The PAT_HUGE_PAGE is bit 1 << 12, which is usually part of the address field. So we mask it out:
|
const fn physical_address_mask() -> u64 { |
|
0x000f_ffff_ffff_f000 |
|
} |
This mask is used in many places. This means that PAT_HUGE_PAGE will be never returned by flags even if it is set:
|
pub const fn flags(&self) -> PageTableFlags { |
|
PageTableFlags::from_bits_retain(self.entry & !Self::physical_address_mask()) |
|
} |
Another issue is that set_flags/set_addr will blindly OR PAT_HUGE_PAGE in, but this will change the address when applied to a non-huge entry:
|
pub fn set_flags(&mut self, flags: PageTableFlags) { |
|
self.entry = self.addr().as_u64() | flags.bits(); |
|
} |
Given that the PAT_HUGE_PAGE only lives on next (introduced in #548), it's probably a good idea to remove it again before cutting the 0.16 release (see #600). We could replace it with a getter/setter (needs to take is_level_1_table as arg).
The
PAT_HUGE_PAGEis bit1 << 12, which is usually part of the address field. So we mask it out:x86_64/src/structures/paging/page_table.rs
Lines 109 to 111 in 286ea1f
This mask is used in many places. This means that
PAT_HUGE_PAGEwill be never returned byflagseven if it is set:x86_64/src/structures/paging/page_table.rs
Lines 57 to 59 in 286ea1f
Another issue is that
set_flags/set_addrwill blindly ORPAT_HUGE_PAGEin, but this will change the address when applied to a non-huge entry:x86_64/src/structures/paging/page_table.rs
Lines 103 to 105 in 286ea1f
Given that the
PAT_HUGE_PAGEonly lives onnext(introduced in #548), it's probably a good idea to remove it again before cutting the 0.16 release (see #600). We could replace it with a getter/setter (needs to takeis_level_1_tableas arg).