Skip to content

Commit

Permalink
mapping benchmarks: improved style
Browse files Browse the repository at this point in the history
Signed-off-by: Alwin Joshy <[email protected]>
  • Loading branch information
alwin-joshy committed Dec 13, 2023
1 parent f7e547d commit fcdd02c
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions apps/page_mapping/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@
#define START_ADDR 0x60000000
#define NUM_ARGS 3

#if defined(CONFIG_ARCH_X86_64)
#define DEFAULT_DEPTH 64
#elif defined(CONFIG_ARCH_AARCH64)
#define DEFAULT_DEPTH 64
#else
#define DEFAULT_DEPTH 32
#endif
#define DEFAULT_DEPTH seL4_WordBits

#define PAGE_PER_TABLE BIT(seL4_PageTableBits - seL4_WordSizeBits)
#define untyped_retype_root(a,b,c,e)\
Expand Down Expand Up @@ -52,7 +46,9 @@ static void inline prepare_page_table(seL4_Word addr, int npage, seL4_CPtr untyp

err = seL4_ARCH_PageTable_Map(pt, SEL4UTILS_PD_SLOT, addr,
seL4_ARCH_Default_VMAttributes);
#if defined(CONFIG_ARCH_X86_64)
#if defined(CONFIG_ARCH_IA32)
assert(err == 0);
#elif defined(CONFIG_ARCH_X86_64)
if (err) {
seL4_CPtr pd = *free_slot;
err = untyped_retype_root(untyped, seL4_X86_PageDirectoryObject,
Expand All @@ -77,7 +73,6 @@ static void inline prepare_page_table(seL4_Word addr, int npage, seL4_CPtr untyp
err = seL4_ARCH_PageTable_Map(pt, SEL4UTILS_PD_SLOT, addr,
seL4_ARCH_Default_VMAttributes);
}

assert(err == 0);
#elif defined(CONFIG_ARCH_AARCH64)
while (err != seL4_DeleteFirst) {
Expand Down Expand Up @@ -215,18 +210,18 @@ bench_proc(int argc UNUSED, char *argv[])

/* Cleaning up the page table structures */
for (int i = pt_ptr_start; i < page_ptr_start; i++) {
#ifdef CONFIG_ARCH_X86_64
#if defined(CONFIG_ARCH_X86_64)
err = seL4_X86_PDPT_Unmap(i);
if (err) {
err = seL4_X86_PageDirectory_Unmap(i);
if (err) {
err = seL4_ARCH_PageTable_Unmap(i);
ZF_LOGF_IFERR(err, "ummap page table\n");
ZF_LOGF_IFERR(err, "ummap page table failed\n");
}
}
#else
#elif defined(CONFIG_ARCH_AARCH64) || defined(CONFIG_ARCH_IA32)
seL4_ARCH_PageTable_Unmap(i);
ZF_LOGF_IFERR(err, "ummap page table\n");
ZF_LOGF_IFERR(err, "ummap page table failed\n");
#endif
}

Expand Down

0 comments on commit fcdd02c

Please sign in to comment.