From 673c27ae77ba384b360bf54a030066c3a7629729 Mon Sep 17 00:00:00 2001 From: Michael Starzinger Date: Sat, 19 Sep 2009 23:59:03 +0200 Subject: [PATCH] * src/vm/jit/trap.cpp (trap_init): Disabled mmapping of first page by default. * src/vm/options.c: Added -XX:+AlwaysMmapFirstPage to enable it again. * src/vm/options.h: Likewise. --- src/vm/jit/trap.cpp | 22 ++++++++-------------- src/vm/options.c | 7 +++++++ src/vm/options.h | 1 + 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/vm/jit/trap.cpp b/src/vm/jit/trap.cpp index f43b1e7d0..6d9340c18 100644 --- a/src/vm/jit/trap.cpp +++ b/src/vm/jit/trap.cpp @@ -1,6 +1,6 @@ /* src/vm/jit/trap.cpp - hardware traps - Copyright (C) 2008 + Copyright (C) 2008, 2009 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO Copyright (C) 2009 Theobroma Systems Ltd. @@ -66,21 +66,15 @@ extern "C" { */ void trap_init(void) { -#if !(defined(__ARM__) && defined(__LINUX__)) - /* On arm-linux the first memory page can't be mmap'ed, as it - contains the exception vectors. */ - - int pagesize; - - /* mmap a memory page at address 0x0, so our hardware-exceptions - work. */ + TRACESUBSYSTEMINITIALIZATION("trap_init"); - pagesize = os::getpagesize(); + /* If requested we mmap a memory page at address 0x0, + so our hardware-exceptions work. */ - (void) os::mmap_anonymous(NULL, pagesize, PROT_NONE, MAP_PRIVATE | MAP_FIXED); -#endif - - TRACESUBSYSTEMINITIALIZATION("trap_init"); + if (opt_AlwaysMmapFirstPage) { + int pagesize = os::getpagesize(); + (void) os::mmap_anonymous(NULL, pagesize, PROT_NONE, MAP_PRIVATE | MAP_FIXED); + } #if !defined(TRAP_INSTRUCTION_IS_LOAD) # error TRAP_INSTRUCTION_IS_LOAD is not defined in your md-trap.h diff --git a/src/vm/options.c b/src/vm/options.c index dc73d2ff1..5a6f5c29f 100644 --- a/src/vm/options.c +++ b/src/vm/options.c @@ -157,6 +157,7 @@ int opt_ThreadStackSize = 0; /* Debugging options which can be turned off. */ bool opt_AlwaysEmitLongBranches = false; +bool opt_AlwaysMmapFirstPage = false; int opt_CompileAll = 0; char* opt_CompileMethod = NULL; char* opt_CompileSignature = NULL; @@ -234,6 +235,7 @@ enum { /* Debugging options which can be turned off. */ OPT_AlwaysEmitLongBranches, + OPT_AlwaysMmapFirstPage, OPT_CompileAll, OPT_CompileMethod, OPT_CompileSignature, @@ -294,6 +296,7 @@ option_t options_XX[] = { /* Debugging options which can be turned off. */ { "AlwaysEmitLongBranches", OPT_AlwaysEmitLongBranches, OPT_TYPE_BOOLEAN, "Always emit long-branches." }, + { "AlwaysMmapFirstPage", OPT_AlwaysMmapFirstPage, OPT_TYPE_BOOLEAN, "Always mmap memory page at address 0x0." }, { "CompileAll", OPT_CompileAll, OPT_TYPE_BOOLEAN, "compile all methods, no execution" }, { "CompileMethod", OPT_CompileMethod, OPT_TYPE_VALUE, "compile only a specific method" }, { "CompileSignature", OPT_CompileSignature, OPT_TYPE_VALUE, "specify signature for a specific method" }, @@ -636,6 +639,10 @@ void options_xx(JavaVMInitArgs *vm_args) opt_AlwaysEmitLongBranches = enable; break; + case OPT_AlwaysMmapFirstPage: + opt_AlwaysMmapFirstPage = enable; + break; + case OPT_CompileAll: opt_CompileAll = enable; opt_run = false; diff --git a/src/vm/options.h b/src/vm/options.h index 9a232a024..0aa9ed3d8 100644 --- a/src/vm/options.h +++ b/src/vm/options.h @@ -179,6 +179,7 @@ extern int opt_ThreadStackSize; /* Debugging options which can be turned off. */ extern bool opt_AlwaysEmitLongBranches; +extern bool opt_AlwaysMmapFirstPage; extern int opt_CompileAll; extern char* opt_CompileMethod; extern char* opt_CompileSignature; -- 2.25.1