aboutsummaryrefslogtreecommitdiffstats
path: root/community/py3-greenlet/ppc64le_clobbering.patch
blob: bb76ac85198ecbb8bd1d55b3865c2337d560d079 (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
diff --git a/platform/switch_ppc64_linux.h b/platform/switch_ppc64_linux.h
index 88e6847..feb60d4 100644
--- a/platform/switch_ppc64_linux.h
+++ b/platform/switch_ppc64_linux.h
@@ -66,7 +66,6 @@
 
 #define REGS_TO_SAVE "r14", "r15", "r16", "r17", "r18", "r19", "r20",  \
        "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29",  \
-       "r31",                                                    \
        "fr14", "fr15", "fr16", "fr17", "fr18", "fr19", "fr20", "fr21", \
        "fr22", "fr23", "fr24", "fr25", "fr26", "fr27", "fr28", "fr29", \
        "fr30", "fr31", \
@@ -80,21 +79,25 @@ slp_switch(void)
     register long *stackref, stsizediff;
     void * toc;
     void * r30;
+    void * r31;
     __asm__ volatile ("" : : : REGS_TO_SAVE);
     __asm__ volatile ("std 2, %0" : "=m" (toc));
     __asm__ volatile ("std 30, %0" : "=m" (r30));
+    __asm__ volatile ("std 31, %0" : "=m" (r31));
     __asm__ ("mr %0, 1" : "=r" (stackref) : );
     {
         SLP_SAVE_STATE(stackref, stsizediff);
         __asm__ volatile (
             "mr 11, %0\n"
             "add 1, 1, 11\n"
+            "add 31, 31, 11\n"
             : /* no outputs */
             : "r" (stsizediff)
             : "11"
             );
         SLP_RESTORE_STATE();
     }
+    __asm__ volatile ("ld 31, %0" : : "m" (r31));
     __asm__ volatile ("ld 30, %0" : : "m" (r30));
     __asm__ volatile ("ld 2, %0" : : "m" (toc));
     __asm__ volatile ("" : : : REGS_TO_SAVE);