This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/1] Use register g1 instead of g6 in sparc/setjmp.S


The SPARC ABI reserves the use of register g6 to the operating system. RTEMS is of late using g6 to keep track of per CPU data. This conflicts with its use in longjmp. Register g1 (or one of the out registers) is more suited for the temporary storage of data in longjmp.

Best regards,
Daniel

2014-05-15  Daniel Cederman  <cederman@gaisler.com>

    * libc/machine/sparc/setjmp.S (longjmp): Use register g1 instead of g6.
---
 newlib/libc/machine/sparc/setjmp.S |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/newlib/libc/machine/sparc/setjmp.S b/newlib/libc/machine/sparc/setjmp.S
index bd879c4..9cc8469 100644
--- a/newlib/libc/machine/sparc/setjmp.S
+++ b/newlib/libc/machine/sparc/setjmp.S
@@ -124,9 +124,9 @@ ENTRY(_setjmp)
 ENTRY(longjmp)
 ENTRY(_longjmp)
         ta      0x03            /* flush registers */
-        addcc   %o1, %g0, %g6   ! compute v ? v : 1 in a global register
+        addcc   %o1, %g0, %g1   ! compute v ? v : 1 in a global register
         be,a    0f
-        mov     1, %g6
+        mov     1, %g1
 0:
         ld      [%o0], %sp      /* caller's stack pointer */
 
@@ -143,6 +143,6 @@ ENTRY(_longjmp)
         ld      [%o0+8], %fp    /* caller's frame pointer */
         ld      [%o0+12], %o7 
 
-        jmp     %o7 + 8         ! success, return %g6
-        mov     %g6, %o0
+        jmp     %o7 + 8         ! success, return %g1
+        mov     %g1, %o0
 
-- 
1.7.9.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]