Skip to content

Commit

Permalink
Merge pull request #36 from d-we/master
Browse files Browse the repository at this point in the history
Update clear_bit demo to new API
  • Loading branch information
misc0110 authored Feb 6, 2024
2 parents 9800a23 + ad127e1 commit 5c622d1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions demos/clear_bits.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ int main(int argc, char** argv)
memset(addr,0x42,2*1024*1024);

ptedit_entry_t entry = ptedit_resolve(addr, 0);
ptedit_clear_bit(addr, 0, PTEDIT_PAGE_BIT_ACCESSED,PTEDIT_VALID_MASK_PUD|PTEDIT_VALID_MASK_PMD|PTEDIT_VALID_MASK_PTE);
ptedit_pte_clear_bit(addr, 0, PTEDIT_PAGE_BIT_ACCESSED);
entry = ptedit_resolve(addr, 0);
ptedit_print_entry(entry.pte);
ptedit_print_entry(entry.pmd);
ptedit_print_entry(entry.pud);
ptedit_set_bit(addr, 0, PTEDIT_PAGE_BIT_ACCESSED,PTEDIT_VALID_MASK_PUD|PTEDIT_VALID_MASK_PMD|PTEDIT_VALID_MASK_PTE);
ptedit_pte_set_bit(addr, 0, PTEDIT_PAGE_BIT_ACCESSED);
entry = ptedit_resolve(addr, 0);
ptedit_print_entry(entry.pte);
ptedit_print_entry(entry.pmd);
ptedit_print_entry(entry.pud);

//clear accessed bit of pd entry
//set accessed bit of pd entry
size_t address_pfn = ptedit_get_pfn(entry.pd);
ptedit_set_bit(addr, 0, PTEDIT_PAGE_BIT_ACCESSED,PTEDIT_VALID_MASK_PMD);
ptedit_pte_set_bit(addr, 0, PTEDIT_PAGE_BIT_ACCESSED);
munmap(addr,4096);

ptedit_cleanup();
Expand Down

0 comments on commit 5c622d1

Please sign in to comment.