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, OR1K] Don't save parameter registers in setjmp/longjmp


Dear all,

this patch removes the save/restore of the parameter registers r3-r8 in setjmp/longjmp as they are not preserved across function calls.

Bye,
Stefan

commit 108edf9d3e03d25405e5337ab61fdebb3ddd9da2
Author: Stefan Wallentowitz <stefan.wallentowitz@tum.de>
Date:   Thu Dec 11 16:03:36 2014 +0100

    OR1K: Don't save parameter registers
    
    The parameter registers are not preserved across function calls
    
    newlib/Changelog:
          * libc/machine/or1k/setjmp.S: Remove save/restore of r3-r8

diff --git a/newlib/libc/machine/or1k/setjmp.S b/newlib/libc/machine/or1k/setjmp.S
index 2fbf15d..13ccf8a 100644
--- a/newlib/libc/machine/or1k/setjmp.S
+++ b/newlib/libc/machine/or1k/setjmp.S
@@ -31,12 +31,7 @@ setjmp:
 
 	l.sw	4(r3), r1
 	l.sw	8(r3), r2
-	l.sw	12(r3), r3
-	l.sw	16(r3), r4
-	l.sw	20(r3), r5
-	l.sw	24(r3), r6
-	l.sw	28(r3), r7
-	l.sw	32(r3), r8
+	/* Skip r3-r8 as they are not preserved across function calls */
 	l.sw	36(r3), r9
 	/* Skip r10 as it's preserved to be used by TLS */ 
 	/* Skip r11, setjmp always set it to 0 */
@@ -77,12 +72,7 @@ longjmp:
 
 	l.lwz	r1, 4(r3)
 	l.lwz	r2, 8(r3)
-	/* Skip r3 as it contains the current buffer address */
-	l.lwz	r4, 16(r3)
-	l.lwz	r5, 20(r3)
-	l.lwz	r6, 24(r3)
-	l.lwz	r7, 28(r3)
-	l.lwz	r8, 32(r3)
+	/* Skip r3-r8 as they are not preserved across function calls */
 	l.lwz	r9, 36(r3)
 	/* Skip r11 as it's always set by longjmp */
 	l.lwz	r14, 52(r3)
@@ -94,7 +84,6 @@ longjmp:
 	l.lwz	r26, 100(r3)
 	l.lwz	r28, 108(r3)
 	l.lwz	r30, 116(r3)
-	l.lwz	r3, 12(r3)
 
 	l.jr	r9
 	l.nop

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


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