File: fix_solaris_sparc_header.patch

package info (click to toggle)
python-greenlet 0.3.1-2.5
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 392 kB
  • sloc: ansic: 1,506; python: 666; makefile: 14
file content (52 lines) | stat: -rw-r--r-- 2,150 bytes parent folder | download
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
Author: Floris Bruynooghe <flub@devork.be>
Origin: https://github.com/python-greenlet/greenlet/commit/29d50b1aac84500163e48268355f3aa88b707539
Subject: Fix the sparc/solaris header
    
This header used a relic from the original stackless sources which
referred to a structure which does not exist in greenlet.  Furthermore
it seems to have never worked with gcc > 4.0.0 as a dynamicly loaded
library as it clobbered gcc's PIC register (%l7).

--- a/platform/switch_sparc_sun_gcc.h
+++ b/platform/switch_sparc_sun_gcc.h
@@ -42,20 +42,10 @@ slp_switch(void)
         SLP_SAVE_STATE(stackref, stsizediff);
 
         /* Increment stack and frame pointer by stsizediff */
-
-        /* Sparc special: at first load new return address.
-           This cannot be done later, because the stack
-           might be overwritten again just after SLP_RESTORE_STATE
-           has finished. BTW: All other registers (l0-l7 and i0-i5)
-           might be clobbered too. 
-         */
         __asm__ volatile (
-        "ld [%0+60], %%i7\n\t"
-        "add %1, %%sp, %%sp\n\t"
-        "add %1, %%fp, %%fp"
-        : : "r" (_cst->stack), "r" (stsizediff)
-        : "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7",
-          "%i0", "%i1", "%i2", "%i3", "%i4", "%i5");
+            "add %0, %%sp, %%sp\n\t"
+            "add %0, %%fp, %%fp"
+            : : "r" (stsizediff));
 
         SLP_RESTORE_STATE();
 
@@ -63,10 +53,12 @@ slp_switch(void)
          * The LORD rained down burning sulfur on Sodom and Gomorra ...
          */
 
-        /* Sparc special: Must make it *very* clear to the CPU that
-           it shouldn't look back into the register windows
-         */
-        __asm__ volatile ( "ta %0" : : "i" (ST_CLEAN_WINDOWS));
+        /* No need to restore any registers from the stack nor clear them: the
+         * frame pointer has just been set and the return value register is
+         * also being set by the return statement below.  After returning a
+         * restore instruction is given and the frame below us will load all
+         * it's registers using a fill_trap if required. */
+
         return 0;
     } 
 }