summaryrefslogtreecommitdiff
path: root/gc.h
diff options
context:
space:
mode:
authorBreno Leitao <breno.leitao@gmail.com>2019-12-16 01:05:21 (GMT)
committer卜部昌平 <shyouhei@ruby-lang.org>2019-12-16 01:05:21 (GMT)
commitf47c38245ff6976c5d1fc27a79f239bba00fc333 (patch)
tree3b70e6ee6d8994450a1d2413aaa4b5e60bc8d68e /gc.h
parente8c62836a6292bf2f691de458b24ea50c51b452a (diff)
gc.h: Add SET_MACHINE_STACK_END specific for Powerpc64 (#1767)
Currently we are not able to grab the correct end/top of the stack on powerpc64 due to the fact that it uses the fallback function. The fallback function does not return the correct top of the stack because it adds a new frame and the returned top of the stack contains this frame overhead that could be something around 112 bytes on Powerpc64. This patch simply gets the correct top of the stack pointer, which is always on r1 register according to both ABI v1 and ABI v2 (Little endian). Signed-off-by: Breno Leitao <leitao@debian.org>
Diffstat (limited to 'gc.h')
-rw-r--r--gc.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gc.h b/gc.h
index 7c7f0ef..cf794fa 100644
--- a/gc.h
+++ b/gc.h
@@ -6,6 +6,8 @@
#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movq\t%%rsp, %0" : "=r" (*(p)))
#elif defined(__i386) && defined(__GNUC__)
#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movl\t%%esp, %0" : "=r" (*(p)))
+#elif defined(__powerpc64__) && defined(__GNUC__)
+#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("mr\t%0, %%r1" : "=r" (*(p)))
#else
NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p));
#define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p)