--------------------------------------------------------------------------
-- Copyright (c) 2007-2010, 2012, ETH Zurich.
+-- Copyright (c) 2014, HP Labs.
-- All rights reserved.
--
-- This file is distributed under the terms in the attached LICENSE file.
--newlib_malloc = "dlmalloc" -- use dlmalloc
newlib_malloc = "oldmalloc"
+-- Configure pagesize for libbarrelfish's morecore implementation
+-- x86_64 accepts "small", "large", and "huge" for 4kB, 2MB and 1GB pages
+-- respectively. x86_32 accepts "small" and "large" for 4kB and 2MB/4MB pages
+-- respectively. All other architectures default to their default page size.
+morecore_pagesize :: String
+morecore_pagesize = "large"
+
-- Use a frame pointer
use_fp :: Bool
use_fp = True
__BEGIN_DECLS
-errval_t morecore_init(void);
+errval_t morecore_init(size_t alignment);
void morecore_use_optimal(void);
errval_t morecore_reinit(void);
--------------------------------------------------------------------------
-- Copyright (c) 2007-2012, ETH Zurich
+-- Copyright (c) 2014, HP Labs.
-- All rights reserved.
--
-- This file is distributed under the terms in the attached LICENSE file.
getsrcs "multihop" = [ "multihop_chan.c" ]
getsrcs _ = []
+ morecore_pagesize "x86_64" = case Config.morecore_pagesize of
+ "large" -> "LARGE_PAGE_SIZE"
+ "huge" -> "HUGE_PAGE_SIZE"
+ _ -> "BASE_PAGE_SIZE"
+ morecore_pagesize "x86_32" = case Config.morecore_pagesize of
+ "large" -> "LARGE_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" ,
"arch/x86_32/dispatch.c" , "arch/x86_32/syscalls.c" ,
("mem", ["rpcclient"]),
("octopus", ["rpcclient"]),
("spawn", ["rpcclient"])],
+ addCFlags = [ "-DMORECORE_PAGESIZE="++(morecore_pagesize arch),
+ "-DMORECORE_VREGION_FLAGS="++(morecore_vregion_flags arch)
+ ],
addIncludes = [ "include", "include" ./. arch_dir ],
addGeneratedDependencies = [ "/include/asmoffsets.h" ]
}
// TODO: the kernel boots us with a deterministic pmap structure: use it
}
- err = morecore_init();
+ if (init_domain) {
+ // we cannot use large pages in the init domains because we are not
+ // connected to the memory server and need to work with the 4k pages
+ // in the base cn.
+ err = morecore_init(BASE_PAGE_SIZE);
+ } else {
+ err = morecore_init(MORECORE_PAGESIZE);
+ }
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_MORECORE_INIT);
}
return get_morecore_state()->header_freep;
}
-errval_t morecore_init(void)
+errval_t morecore_init(size_t alignment)
{
errval_t err;
struct morecore_state *state = get_morecore_state();
thread_mutex_init(&state->mutex);
err = vspace_mmu_aware_init_aligned(&state->mmu_state, HEAP_REGION,
- BASE_PAGE_SIZE, VREGION_FLAGS_READ_WRITE);
+ alignment, VREGION_FLAGS_READ_WRITE | MORECORE_VREGION_FLAGS);
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_VSPACE_MMU_AWARE_INIT);
}