aboutsummaryrefslogtreecommitdiffstats
path: root/community/ocaml/fix-mcontext-fields.patch
blob: e47f348b23c462da2cb88252e606d96c8f13bf02 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
diff -Nru a/asmrun/signals_osdep.h b/asmrun/signals_osdep.h
--- a/asmrun/signals_osdep.h   2016-11-04 16:08:24.000000000 +0000
+++ b/asmrun/signals_osdep.h   2017-05-13 03:16:28.749615533 +0000
@@ -314,11 +314,11 @@
      sigact.sa_flags = 0
 
   typedef unsigned long context_reg;
-  #define CONTEXT_PC (context->sregs->regs.psw.addr)
-  #define CONTEXT_EXCEPTION_POINTER (context->sregs->regs.gprs[13])
-  #define CONTEXT_YOUNG_LIMIT (context->sregs->regs.gprs[10])
-  #define CONTEXT_YOUNG_PTR (context->sregs->regs.gprs[11])
-  #define CONTEXT_SP (context->sregs->regs.gprs[15])
+  #define CONTEXT_PC (context->sregs->psw.addr)
+  #define CONTEXT_EXCEPTION_POINTER (context->sregs->gregs[13])
+  #define CONTEXT_YOUNG_LIMIT (context->sregs->gregs[10])
+  #define CONTEXT_YOUNG_PTR (context->sregs->gregs[11])
+  #define CONTEXT_SP (context->sregs->gregs[15])
 
 /****************** PowerPC, BSD */
 
diff -Nru a/asmrun/signals_osdep.h b/asmrun/signals_osdep.h
--- a/asmrun/signals_osdep.h    2017-05-13 03:19:52.863954544 +0000
+++ b/asmrun/signals_osdep.h    2017-05-13 04:10:48.417194351 +0000
@@ -297,11 +297,20 @@
      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
 
 /****************** s390x, ELF (Linux) */
 #elif defined(TARGET_s390x) && defined(SYS_elf)