mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-26 20:55:35 +03:00
Kernel: Fix page round wrap detection for 64-bit
We were assuming 32-bit pointers, which will not always be the case Also fixed an incorrect comment about wrapping
This commit is contained in:
parent
65566d6868
commit
10728cd421
Notes:
sideshowbarker
2024-07-18 11:23:43 +09:00
Author: https://github.com/Hendiadyoin1 Commit: https://github.com/SerenityOS/serenity/commit/10728cd4213 Pull-request: https://github.com/SerenityOS/serenity/pull/8297
@ -22,13 +22,13 @@ namespace Kernel {
|
||||
|
||||
constexpr bool page_round_up_would_wrap(FlatPtr x)
|
||||
{
|
||||
return x > 0xfffff000u;
|
||||
return x > (explode_byte(0xFF) & ~0xFFF);
|
||||
}
|
||||
|
||||
constexpr FlatPtr page_round_up(FlatPtr x)
|
||||
{
|
||||
FlatPtr rounded = (((FlatPtr)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1));
|
||||
// Rounding up >0xffff0000 wraps back to 0. That's never what we want.
|
||||
// Rounding up >0xfffff000 wraps back to 0. That's never what we want.
|
||||
VERIFY(x == 0 || rounded != 0);
|
||||
return rounded;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user