mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-24 00:24:38 +00:00
UserspaceEmulator: Make sure the (crappy) VM allocator is page-aligned
We don't want the next_address pointer losing its alignment somehow. This whole thing should be replaced at some point, since UE hosted programs won't be able to run forever with this allocation strategy.
This commit is contained in:
@@ -857,14 +857,12 @@ FlatPtr Emulator::allocate_vm(size_t size, size_t alignment)
|
||||
|
||||
FlatPtr final_address;
|
||||
|
||||
if (alignment) {
|
||||
// FIXME: What if alignment is not a power of 2?
|
||||
final_address = round_up_to_power_of_two(next_address, alignment);
|
||||
} else {
|
||||
final_address = next_address;
|
||||
}
|
||||
if (!alignment)
|
||||
alignment = PAGE_SIZE;
|
||||
|
||||
next_address = final_address + size;
|
||||
// FIXME: What if alignment is not a power of 2?
|
||||
final_address = round_up_to_power_of_two(next_address, alignment);
|
||||
next_address = round_up_to_power_of_two(final_address + size, PAGE_SIZE);
|
||||
return final_address;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user