aboutsummaryrefslogtreecommitdiffstats
path: root/community/ocaml/fix-mcontext-fields.patch
blob: 23b4875d21f20b613256c36bd74542660164e62d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
diff -Nru a/runtime/signals_osdep.h b/runtime/signals_osdep.h
--- a/runtime/signals_osdep.h   2019-06-14 08:21:51.000000000 -0300
+++ b/runtime/signals_osdep.h   2019-07-16 14:21:56.751434439 -0300
@@ -297,11 +297,19 @@
      sigact.sa_flags = 0
 
   typedef unsigned long context_reg;
-  #define CONTEXT_PC (context->regs->nip)
-  #define CONTEXT_EXCEPTION_POINTER (context->regs->gpr[29])
-  #define CONTEXT_YOUNG_LIMIT (context->regs->gpr[30])
-  #define CONTEXT_YOUNG_PTR (context->regs->gpr[31])
-  #define CONTEXT_SP (context->regs->gpr[1])
+  #ifdef __powerpc64__
+    #define CONTEXT_PC (context->gp_regs[32])
+    #define CONTEXT_EXCEPTION_POINTER (context->gp_regs[29])
+    #define CONTEXT_YOUNG_LIMIT (context->gp_regs[30])
+    #define CONTEXT_YOUNG_PTR (context->gp_regs[31])
+    #define CONTEXT_SP (context->gp_regs[1])
+  #else
+    #define CONTEXT_PC (context->regs->nip)
+    #define CONTEXT_EXCEPTION_POINTER (context->regs->gpr[29])
+    #define CONTEXT_YOUNG_LIMIT (context->regs->gpr[30])
+    #define CONTEXT_YOUNG_PTR (context->regs->gpr[31])
+    #define CONTEXT_SP (context->regs->gpr[1])
+  #endif
 
 /****************** PowerPC, NetBSD */