# HG changeset patch # User Paul Boddie # Date 1679183295 -3600 # Node ID 6bccfdae3fe57f9f9f7a90385f8aaf0da28c9cd8 # Parent 9c9e342f58f8a51e885ad0e8c79610de7fbed5ea Added missing include statements and introduced an explicit verbose mode. diff -r 9c9e342f58f8 -r 6bccfdae3fe5 libexec/rm/region_mapper.cc --- a/libexec/rm/region_mapper.cc Sun Mar 19 00:46:24 2023 +0100 +++ b/libexec/rm/region_mapper.cc Sun Mar 19 00:48:15 2023 +0100 @@ -22,6 +22,9 @@ #include #include +#include +#include + #include #include #include @@ -38,12 +41,15 @@ int main(int argc, char *argv[]) { + int debug = (argc > 1) && !strcmp(argv[1], "-v"); + /* Initialise pager regions from region descriptions obtained via the auxiliary data. */ l4re_aux_t *l4re_aux = exec_get_l4re_aux(argc, argv); - printf("aux = {%s, %lx, %lx, %lx}\n", l4re_aux->binary, l4re_aux->kip_ds, l4re_aux->dbg_lvl, l4re_aux->ldr_flags); + if (debug) + printf("aux = {%s, %lx, %lx, %lx}\n", l4re_aux->binary, l4re_aux->kip_ds, l4re_aux->dbg_lvl, l4re_aux->ldr_flags); /* Skip past the auxiliary structure itself. */ @@ -57,16 +63,21 @@ for (; region && (region->ds != L4_INVALID_CAP); region++) { - printf("Adding region: {%lx, %llx, %lx, %lx}\n", region->start, region->start + region->size, region->flags, region->ds); + if (debug) + printf("Adding region: {%lx, %llx, %lx, %lx}\n", region->start, region->start + region->size, region->flags, region->ds); + MappedRegion r(region->start, region->start + region->size, region->flags, region->ds); exec_pager.add(r); } /* Start the pager. */ - printf("Initialising pager...\n"); - printf("Pager capability: %lx\n", l4re_env_get_cap(ENV_INTERNAL_PAGER_NAME)); - printf("Main thread: %lx\n", l4re_env()->main_thread); + if (debug) + { + printf("Initialising pager...\n"); + printf("Pager capability: %lx\n", l4re_env_get_cap(ENV_INTERNAL_PAGER_NAME)); + printf("Main thread: %lx\n", l4re_env()->main_thread); + } /* Initialise the server, enabling notifications. */