Skip to content

Commit c33136e

Browse files
committed
amd64: Remove unused access/dirty flag updates
Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
1 parent 76d1174 commit c33136e

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

  • src/hyperlight_common/src/arch/amd64

src/hyperlight_common/src/arch/amd64/vmem.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ const PAGE_NX: u64 = 1 << 63;
5959
/// This masks out the lower 12 flag bits AND the upper bits including NX (bit 63)
6060
const PTE_ADDR_MASK: u64 = 0x000F_FFFF_FFFF_F000;
6161
const PAGE_USER_ACCESS_DISABLED: u64 = 0 << 2; // U/S bit not set - supervisor mode only (no code runs in user mode for now)
62-
const PAGE_DIRTY_CLEAR: u64 = 0 << 6; // D - dirty bit cleared (set by CPU when written)
63-
const PAGE_ACCESSED_CLEAR: u64 = 0 << 5; // A - accessed bit cleared (set by CPU when accessed)
62+
const PAGE_DIRTY_SET: u64 = 1 << 6; // D - dirty bit
63+
const PAGE_ACCESSED_SET: u64 = 1 << 5; // A - accessed bit
6464
const PAGE_CACHE_ENABLED: u64 = 0 << 4; // PCD - page cache disable bit not set (caching enabled)
6565
const PAGE_WRITE_BACK: u64 = 0 << 3; // PWT - page write-through bit not set (write-back caching)
6666
const PAGE_PAT_WB: u64 = 0 << 7; // PAT - page attribute table index bit (0 for write-back memory when PCD=0, PWT=0)
@@ -107,7 +107,7 @@ fn bits<const HIGH_BIT: u8, const LOW_BIT: u8>(x: u64) -> u64 {
107107
#[allow(clippy::precedence)]
108108
fn pte_for_table<Op: TableOps>(table_addr: Op::TableAddr) -> u64 {
109109
Op::to_phys(table_addr) |
110-
PAGE_ACCESSED_CLEAR | // accessed bit cleared (will be set by CPU when page is accessed - but we dont use the access bit for anything at present)
110+
PAGE_ACCESSED_SET | // prevent the CPU writing to the access flag
111111
PAGE_CACHE_ENABLED | // leave caching enabled
112112
PAGE_WRITE_BACK | // use write-back caching
113113
PAGE_USER_ACCESS_DISABLED |// dont allow user access (no code runs in user mode for now)
@@ -435,8 +435,8 @@ unsafe fn map_page<
435435
(mapping.phys_base + (r.vmin - mapping.virt_base)) |
436436
page_nx_flag(bm.executable) | // NX - no execute unless allowed
437437
PAGE_PAT_WB | // PAT index bit for write-back memory
438-
PAGE_DIRTY_CLEAR | // dirty bit (set by CPU when written)
439-
PAGE_ACCESSED_CLEAR | // accessed bit cleared (will be set by CPU when page is accessed - but we dont use the access bit for anything at present)
438+
PAGE_DIRTY_SET | // prevent the CPU writing to the dirty bit
439+
PAGE_ACCESSED_SET | // prevent the CPU writing to the access flag
440440
PAGE_CACHE_ENABLED | // leave caching enabled
441441
PAGE_WRITE_BACK | // use write-back caching
442442
PAGE_USER_ACCESS_DISABLED | // dont allow user access (no code runs in user mode for now)
@@ -448,8 +448,8 @@ unsafe fn map_page<
448448
page_nx_flag(cm.executable) | // NX - no execute unless allowed
449449
PAGE_AVL_COW |
450450
PAGE_PAT_WB | // PAT index bit for write-back memory
451-
PAGE_DIRTY_CLEAR | // dirty bit (set by CPU when written)
452-
PAGE_ACCESSED_CLEAR | // accessed bit cleared (will be set by CPU when page is accessed - but we dont use the access bit for anything at present)
451+
PAGE_DIRTY_SET | // prevent the CPU writing to the dirty bit
452+
PAGE_ACCESSED_SET | // prevent the CPU writing to the access flag
453453
PAGE_CACHE_ENABLED | // leave caching enabled
454454
PAGE_WRITE_BACK | // use write-back caching
455455
PAGE_USER_ACCESS_DISABLED | // dont allow user access (no code runs in user mode for now)

0 commit comments

Comments
 (0)