mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:27:35 +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
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…
Add table
Add a link
Reference in a new issue