mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03: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:
parent
df9fe8fa7b
commit
a4a389156d
Notes:
sideshowbarker
2024-07-19 01:22:53 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/a4a389156db
@ -857,14 +857,12 @@ FlatPtr Emulator::allocate_vm(size_t size, size_t alignment)
|
||||
|
||||
FlatPtr final_address;
|
||||
|
||||
if (alignment) {
|
||||
if (!alignment)
|
||||
alignment = PAGE_SIZE;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
next_address = final_address + size;
|
||||
next_address = round_up_to_power_of_two(final_address + size, PAGE_SIZE);
|
||||
return final_address;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user