From 955bc5e6abde5005a51963830a002a222e39206d Mon Sep 17 00:00:00 2001 From: comex Date: Thu, 16 Jul 2015 18:07:23 -0400 Subject: baton fix --- lib/darwin/inject-asm-raw.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib/darwin') diff --git a/lib/darwin/inject-asm-raw.c b/lib/darwin/inject-asm-raw.c index 767562c..ddbffb0 100644 --- a/lib/darwin/inject-asm-raw.c +++ b/lib/darwin/inject-asm-raw.c @@ -55,9 +55,16 @@ static int bsd_thread_func(void *arg) { manual_semaphore_wait_trap(baton->sem_port); #ifndef __i386__ /* since we're munmapping our own code, this must be optimized into a jump - * (taill call elimination) */ + * (tail call elimination) */ + enum { page_size = +#ifdef __arm64__ + 0x4000 +#else + 0x1000 +#endif + }; unsigned long ptr = (unsigned long) baton & ~(_PAGE_SIZE - 1); - return baton->munmap((void *) ptr, 0x2000); + return baton->munmap((void *) ptr, 2 * page_size); #else /* i386 can't normally eliminate tail calls in caller-cleanup calling * conventions, unless the number of arguments is the same, so use a nasty -- cgit v1.2.3