summaryrefslogtreecommitdiff
path: root/lang/ocaml/files/patch-runtime_power.S
blob: 0155af6a4e1ca994fa36d8ae0ea3f91795cc33ec (plain) (blame)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
--- runtime/power.S.orig	2019-08-05 17:32:44 UTC
+++ runtime/power.S
@@ -13,11 +13,11 @@
 /*                                                                        */
 /**************************************************************************/
 
-#if defined(MODEL_ppc64le)
+#if _CALL_ELF == 2
         .abiversion 2
 #endif
 
-#if defined(MODEL_ppc64) || defined(MODEL_ppc64le)
+#if _CALL_ELF == 1 || _CALL_ELF == 2
 #define EITHER(a,b) b
 #else
 #define EITHER(a,b) a
@@ -42,7 +42,7 @@
 #define CALLBACK_LINK_SIZE 16
 #define CALLBACK_LINK_OFFSET 0
 #endif
-#if defined(MODEL_ppc64)
+#if _CALL_ELF == 1
 #define RESERVED_STACK 48
 #define PARAM_SAVE_AREA (8*8)
 #define LR_SAVE 16
@@ -54,7 +54,7 @@
 #define CALLBACK_LINK_SIZE 32
 #define CALLBACK_LINK_OFFSET 48
 #endif
-#if defined(MODEL_ppc64le)
+#if _CALL_ELF == 2
 #define RESERVED_STACK 32
 #define PARAM_SAVE_AREA 0
 #define LR_SAVE 16
@@ -82,7 +82,7 @@
 
 #endif
 
-#if defined(MODEL_ppc64)
+#if _CALL_ELF == 1
 #define FUNCTION(name) \
   .section ".opd","aw"; \
   .align 3; \
@@ -98,7 +98,7 @@
 
 #endif
 
-#if defined(MODEL_ppc64le)
+#if _CALL_ELF == 2
 #define FUNCTION(name) \
   .section ".text"; \
   .globl name; \
@@ -136,7 +136,7 @@
 
 #endif
 
-#if defined(MODEL_ppc64) || defined(MODEL_ppc64le)
+#if _CALL_ELF == 1 || _CALL_ELF == 2
 
 #define LSYMB(glob) .L##glob
 
@@ -157,7 +157,7 @@
 
 #endif
 
-#if defined(MODEL_ppc64)
+#if _CALL_ELF == 1
         .section ".opd","aw"
 #else
         .section ".text"
@@ -244,7 +244,7 @@ FUNCTION(caml_call_gc)
         stfdu   31, 8(11)
     /* Call the GC */
         bl      caml_garbage_collection
-#if defined(MODEL_ppc64) || defined(MODEL_ppc64le)
+#if _CALL_ELF == 1 || _CALL_ELF == 2
         nop
 #endif
     /* Reload new allocation pointer and allocation limit */
@@ -338,14 +338,14 @@ FUNCTION(caml_c_call)
 #if defined(MODEL_ppc)
         mtctr   28
         bctrl
-#elif defined(MODEL_ppc64)
+#elif _CALL_ELF == 1
         ld      0, 0(28)
         mr      26, 2   /* save current TOC in a callee-save register */
         mtctr   0
         ld      2, 8(28)
         bctrl
         mr      2, 26   /* restore current TOC */
-#elif defined(MODEL_ppc64le)
+#elif _CALL_ELF == 2
         mtctr   28
         mr      12, 28
         mr      26, 2   /* save current TOC in a callee-save register */
@@ -388,7 +388,7 @@ FUNCTION(caml_raise_exn)
         addi    1, 1, -(PARAM_SAVE_AREA + RESERVED_STACK)
                                 /* reserve stack space for C call */
         bl      caml_stash_backtrace
-#if defined(MODEL_ppc64) || defined(MODEL_ppc64le)
+#if _CALL_ELF == 1 || _CALL_ELF == 2
         nop
 #endif
         mr      3, 28           /* restore exn bucket */
@@ -424,7 +424,7 @@ FUNCTION(caml_raise_exception)
         addi    1, 1, -(PARAM_SAVE_AREA + RESERVED_STACK)
                                          /* reserve stack space for C call */
         bl      caml_stash_backtrace
-#if defined(MODEL_ppc64) || defined(MODEL_ppc64le)
+#if _CALL_ELF == 1 || _CALL_ELF == 2
         nop
 #endif
         mr      3, 28           /* restore exn bucket */
@@ -514,14 +514,14 @@ FUNCTION(caml_start_program)
 #if defined(MODEL_ppc)
         mtctr   12
 .L105:  bctrl
-#elif defined(MODEL_ppc64)
+#elif _CALL_ELF == 1
         ld      0, 0(12)
         mtctr   0
         std     2, TOC_SAVE(1)
         ld      2, 8(12)
 .L105:  bctrl
         ld      2, TOC_SAVE(1)
-#elif defined(MODEL_ppc64le)
+#elif _CALL_ELF == 2
         mtctr   12
         std     2, TOC_SAVE(1)
 .L105:  bctrl
@@ -634,7 +634,7 @@ ENDFUNCTION(caml_callback3_exn)
         b       .L102
 ENDFUNCTION(caml_callback3_exn)
 
-#if defined(MODEL_ppc64)
+#if _CALL_ELF == 1
         .section ".opd","aw"
 #else
         .section ".text"
@@ -656,7 +656,7 @@ caml_system__frametable:
 
 /* TOC entries */
 
-#if defined(MODEL_ppc64) || defined(MODEL_ppc64le)
+#if _CALL_ELF == 1 || _CALL_ELF == 2
 
         .section ".toc", "aw"