On x86-64, we can't 'call' with a 64-bit relative offset. JIT code is often located far away from Jato's native functions, so no 32-bit RIP-relative offset is suitable to encode a 'call'. Therefore, we ask mmap() to map jit_text lower.
Signed-off-by: Eduard - Gabriel Munteanu <eduard.munte...@linux360.ro> --- arch/x86/include/arch/text.h | 6 ++++++ jit/text.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/arch/text.h b/arch/x86/include/arch/text.h index 016d5f3..cc3ee21 100644 --- a/arch/x86/include/arch/text.h +++ b/arch/x86/include/arch/text.h @@ -7,4 +7,10 @@ */ #define TEXT_ALIGNMENT 16 +#ifdef CONFIG_X86_64 +# define TEXT_MAP_FLAGS MAP_32BIT +#else +# define TEXT_MAP_FLAGS 0 +#endif + #endif /* JATO_X86_TEXT_H */ diff --git a/jit/text.c b/jit/text.c index c8d47e2..7c5aec8 100644 --- a/jit/text.c +++ b/jit/text.c @@ -45,7 +45,9 @@ static void *jit_text; void jit_text_init(void) { - jit_text = mmap(NULL, MAX_TEXT_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); + jit_text = mmap(NULL, MAX_TEXT_SIZE, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE | MAP_ANONYMOUS | TEXT_MAP_FLAGS, -1, 0); if (jit_text == MAP_FAILED) die("mmap"); } -- 1.6.0.6 ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/blackberry _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel