getsrcs "multihop" = [ "multihop_chan.c" ]
getsrcs _ = []
+ -- configure default morecore pagesize based on Config.hs
morecore_pagesize "x86_64" = case Config.morecore_pagesize of
"large" -> "LARGE_PAGE_SIZE"
"huge" -> "HUGE_PAGE_SIZE"
_ -> "BASE_PAGE_SIZE"
morecore_pagesize _ = "BASE_PAGE_SIZE"
- morecore_vregion_flags "x86_64" = case Config.morecore_pagesize of
- "large" -> "VREGION_FLAGS_LARGE"
- "huge" -> "VREGION_FLAGS_HUGE"
- _ -> ""
- morecore_vregion_flags "x86_32" = case Config.morecore_pagesize of
- "large" -> "VREGION_FLAGS_LARGE"
- _ -> ""
- morecore_vregion_flags _ = ""
-
-- sources specific to the architecture family
archfam_srcs "x86_32" = [ "arch/x86_32/debug.c" ,
("mem", ["rpcclient"]),
("octopus", ["rpcclient"]),
("spawn", ["rpcclient"])],
- addCFlags = [ "-DMORECORE_PAGESIZE="++(morecore_pagesize arch),
- "-DMORECORE_VREGION_FLAGS="++(morecore_vregion_flags arch)
- ],
+ addCFlags = [ "-DMORECORE_PAGESIZE="++(morecore_pagesize arch) ],
addIncludes = [ "include", "include" ./. arch_dir ],
addGeneratedDependencies = [ "/include/asmoffsets.h" ]
}
// in the base cn.
err = morecore_init(BASE_PAGE_SIZE);
} else {
- err = morecore_init(MORECORE_PAGESIZE);
+ // grab pagesize config from argv if available
+ size_t morecore_pagesize = MORECORE_PAGESIZE;
+ int i = 1;
+ bool found = false;
+ for (; i < params->argc; i++) {
+ if (!found) {
+ if (!strncmp(params->argv[i], "morecore=", 9)) {
+ morecore_pagesize = atoi(params->argv[i]+9);
+ // check for valid page size
+ switch (morecore_pagesize) {
+#ifdef __x86_64__
+ case HUGE_PAGE_SIZE:
+#endif
+ case BASE_PAGE_SIZE:
+ case LARGE_PAGE_SIZE:
+ break;
+ default:
+ morecore_pagesize = MORECORE_PAGESIZE;
+ }
+ found = true;
+ }
+ } else {
+ // found so move all other args one to the front
+ params->argv[i-1] = params->argv[i];
+ }
+ }
+ if (found) {
+ params->argc -= 1;
+ }
+
+ err = morecore_init(morecore_pagesize);
}
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_MORECORE_INIT);
thread_mutex_init(&state->mutex);
+ // setup flags that match the alignment
+ vregion_flags_t morecore_flags = VREGION_FLAGS_READ_WRITE;
+#if __x86_64__
+ morecore_flags |= (alignment == HUGE_PAGE_SIZE ? VREGION_FLAGS_HUGE : 0);
+#endif
+ morecore_flags |= (alignment == LARGE_PAGE_SIZE ? VREGION_FLAGS_LARGE : 0);
+
err = vspace_mmu_aware_init_aligned(&state->mmu_state, HEAP_REGION,
- alignment, VREGION_FLAGS_READ_WRITE | MORECORE_VREGION_FLAGS);
+ alignment, morecore_flags);
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_VSPACE_MMU_AWARE_INIT);
}