mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-11 17:00:37 +00: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
1 changed files with 2 additions and 2 deletions
|
@ -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 a new issue