SHARE
TWEET

Untitled




Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- int main(int argc, char **argv)
- {
- uint64_t pt = alloc_page_frame();
- assert(page_table_query(pt, 0xcafe) == NO_MAPPING);
- page_table_update(pt, 0xcafe, 0xf00d);
- assert(page_table_query(pt, 0xcafe) == 0xf00d);
- page_table_update(pt, 0xcafe, 0xf00a);
- assert(page_table_query(pt, 0xcafe) == 0xf00a);
- page_table_update(pt, 0xcafe, 0xa01);
- assert(page_table_query(pt, 0xcafe) == 0xa01);
- page_table_update(pt, 0xcafe, NO_MAPPING);
- assert(page_table_query(pt, 0xcafe) == NO_MAPPING);
- page_table_update(pt, 0xab, 0xaa);
- page_table_update(pt, 0xab, 0xac);
- assert(page_table_query(pt, 0xab) == 0xac);
- page_table_update(pt, 0xab, 0xaddd);
- assert(page_table_query(pt, 0xab)== 0xaddd);
- assert(page_table_query(pt, 0xcafa) == NO_MAPPING);
- assert(page_table_query(pt, 0x0) == NO_MAPPING);
- page_table_update(pt, 0xcafe, 0xf00a);
- assert(page_table_query(pt, 0xcafe) == 0xf00a);
- page_table_update(pt, 0xcafe, 0xf00b);
- assert(page_table_query(pt, 0xcafe) == 0xf00b);
- uint64_t pt2 = alloc_page_frame();
- assert(page_table_query(pt2, 0xcafe) == NO_MAPPING);
- page_table_update(pt2, 0xcafe, 0xf00c);
- assert(page_table_query(pt2, 0xcafe) == 0xf00c);
- page_table_update(pt2, 0xcafe, NO_MAPPING);
- assert(page_table_query(pt2, 0xcafe) == NO_MAPPING);
- printf("All tests passed\n");
- return 0;
- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.