summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux
diff options
context:
space:
mode:
authorChristian Svensson <blue@cmd.nu>2014-07-18 00:27:58 +0200
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2017-11-25 17:46:25 +0100
commit82cf6e18bc5e98fa203f98534bde1549a9263e4c (patch)
treef1b5f33b9a7f6b1ccd90e945f092dcb5410cdd78 /libc/sysdeps/linux
parent42329aab078bbfd7884c9abadf4617db64be21a2 (diff)
setjmp/longjmp saves only non-call clobbered regs
Previously we saved everything, but we only need to save the registers that are promised to be untouched by the setjmp call.
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r--libc/sysdeps/linux/or1k/__longjmp.S56
-rw-r--r--libc/sysdeps/linux/or1k/bits/setjmp.h4
-rw-r--r--libc/sysdeps/linux/or1k/jmpbuf-offsets.h7
-rw-r--r--libc/sysdeps/linux/or1k/setjmp.S50
4 files changed, 36 insertions, 81 deletions
diff --git a/libc/sysdeps/linux/or1k/__longjmp.S b/libc/sysdeps/linux/or1k/__longjmp.S
index e49455fb1..6d40ab97d 100644
--- a/libc/sysdeps/linux/or1k/__longjmp.S
+++ b/libc/sysdeps/linux/or1k/__longjmp.S
@@ -2,7 +2,7 @@
Based on:
longjmp for PowerPC.
- Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -31,50 +31,30 @@
.type __longjmp,@function;
.align 4;
-__longjmp:
-# l.lwz r11,(JB_SR*4)(r3)
-# l.mtspr r0,r11,SPR_SR
- l.lwz r1,((JB_GPRS+0)*4)(r3)
- l.lwz r2,((JB_GPRS+1)*4)(r3)
- /* pass through "value" to r11, then restore r4, for what it's worth" */
-#if 1
+__longjmp:
+ l.lwz r1,0(r3)
+ l.lwz r2,4(r3)
+
/* if r4 is 0, something wrong, so set it to 1 */
l.sfeqi r4, 0x0
l.bnf 1f /* r4 != 0, longjmp value sensible */
- l.nop
+ l.nop
l.ori r4, r0, 0x1 /* make nonzero */
1:
-#endif
l.addi r11, r4, 0
- l.lwz r4,((JB_GPRS+3)*4)(r3)
- l.lwz r5,((JB_GPRS+4)*4)(r3)
- l.lwz r6,((JB_GPRS+5)*4)(r3)
- l.lwz r7,((JB_GPRS+6)*4)(r3)
- l.lwz r8,((JB_GPRS+7)*4)(r3)
- l.lwz r9,((JB_GPRS+8)*4)(r3)
- l.lwz r10,((JB_GPRS+9)*4)(r3)
- l.lwz r12,((JB_GPRS+11)*4)(r3)
- l.lwz r13,((JB_GPRS+12)*4)(r3)
- l.lwz r14,((JB_GPRS+13)*4)(r3)
- l.lwz r15,((JB_GPRS+14)*4)(r3)
- l.lwz r16,((JB_GPRS+15)*4)(r3)
- l.lwz r17,((JB_GPRS+16)*4)(r3)
- l.lwz r18,((JB_GPRS+17)*4)(r3)
- l.lwz r19,((JB_GPRS+18)*4)(r3)
- l.lwz r20,((JB_GPRS+19)*4)(r3)
- l.lwz r21,((JB_GPRS+20)*4)(r3)
- l.lwz r22,((JB_GPRS+21)*4)(r3)
- l.lwz r23,((JB_GPRS+22)*4)(r3)
- l.lwz r24,((JB_GPRS+23)*4)(r3)
- l.lwz r25,((JB_GPRS+24)*4)(r3)
- l.lwz r26,((JB_GPRS+25)*4)(r3)
- l.lwz r27,((JB_GPRS+26)*4)(r3)
- l.lwz r28,((JB_GPRS+27)*4)(r3)
- l.lwz r29,((JB_GPRS+28)*4)(r3)
- l.lwz r30,((JB_GPRS+29)*4)(r3)
- l.lwz r31,((JB_GPRS+30)*4)(r3)
+ l.lwz r9,8(r3)
+ l.lwz r10,12(r3)
+ l.lwz r14,16(r3)
+ l.lwz r16,20(r3)
+ l.lwz r18,24(r3)
+ l.lwz r20,28(r3)
+ l.lwz r22,32(r3)
+ l.lwz r24,36(r3)
+ l.lwz r26,40(r3)
+ l.lwz r28,44(r3)
+ l.lwz r30,48(r3)
l.jr r9
- l.nop
+ l.nop
.size __longjmp,.-__longjmp
libc_hidden_def(__longjmp)
diff --git a/libc/sysdeps/linux/or1k/bits/setjmp.h b/libc/sysdeps/linux/or1k/bits/setjmp.h
index 4bcdc6a67..355ede699 100644
--- a/libc/sysdeps/linux/or1k/bits/setjmp.h
+++ b/libc/sysdeps/linux/or1k/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -25,7 +25,7 @@
#endif
#ifndef _ASM
-typedef long int __jmp_buf[32];
+typedef long int __jmp_buf[13];
#endif
#endif
diff --git a/libc/sysdeps/linux/or1k/jmpbuf-offsets.h b/libc/sysdeps/linux/or1k/jmpbuf-offsets.h
index 8cd82a104..d9643b186 100644
--- a/libc/sysdeps/linux/or1k/jmpbuf-offsets.h
+++ b/libc/sysdeps/linux/or1k/jmpbuf-offsets.h
@@ -1,8 +1,3 @@
#include <features.h>
-#define JB_SR 0
-#define JB_GPRS 1
-#define JB_SP 1
-#define JB_LR 9
-#define JB_RV 11
-#define JB_SIZE (32*4)
+#define JB_SP 0
diff --git a/libc/sysdeps/linux/or1k/setjmp.S b/libc/sysdeps/linux/or1k/setjmp.S
index 66b4b8536..ccc1141cc 100644
--- a/libc/sysdeps/linux/or1k/setjmp.S
+++ b/libc/sysdeps/linux/or1k/setjmp.S
@@ -2,7 +2,7 @@
Based on:
setjmp for PowerPC.
- Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -57,39 +57,19 @@ __setjmp:
__sigsetjmp:
.Local_sigsetjmp:
-# l.mfspr r11,r0,SPR_SR
-# l.sw (JB_SR*4)(r3),r11
- l.sw ((JB_GPRS+0)*4)(r3),r1
- l.sw ((JB_GPRS+1)*4)(r3),r2
-/* l.sw ((JB_GPRS+2)*4)(r3),r3*/
- l.sw ((JB_GPRS+3)*4)(r3),r4
- l.sw ((JB_GPRS+4)*4)(r3),r5
- l.sw ((JB_GPRS+5)*4)(r3),r6
- l.sw ((JB_GPRS+6)*4)(r3),r7
- l.sw ((JB_GPRS+7)*4)(r3),r8
- l.sw ((JB_GPRS+8)*4)(r3),r9
- l.sw ((JB_GPRS+9)*4)(r3),r10
- l.sw ((JB_GPRS+10)*4)(r3),r11
- l.sw ((JB_GPRS+11)*4)(r3),r12
- l.sw ((JB_GPRS+12)*4)(r3),r13
- l.sw ((JB_GPRS+13)*4)(r3),r14
- l.sw ((JB_GPRS+14)*4)(r3),r15
- l.sw ((JB_GPRS+15)*4)(r3),r16
- l.sw ((JB_GPRS+16)*4)(r3),r17
- l.sw ((JB_GPRS+17)*4)(r3),r18
- l.sw ((JB_GPRS+18)*4)(r3),r19
- l.sw ((JB_GPRS+19)*4)(r3),r20
- l.sw ((JB_GPRS+20)*4)(r3),r21
- l.sw ((JB_GPRS+21)*4)(r3),r22
- l.sw ((JB_GPRS+22)*4)(r3),r23
- l.sw ((JB_GPRS+23)*4)(r3),r24
- l.sw ((JB_GPRS+24)*4)(r3),r25
- l.sw ((JB_GPRS+25)*4)(r3),r26
- l.sw ((JB_GPRS+26)*4)(r3),r27
- l.sw ((JB_GPRS+27)*4)(r3),r28
- l.sw ((JB_GPRS+28)*4)(r3),r29
- l.sw ((JB_GPRS+29)*4)(r3),r30
- l.sw ((JB_GPRS+30)*4)(r3),r31
+ l.sw 0(r3),r1
+ l.sw 4(r3),r2
+ l.sw 8(r3),r9
+ l.sw 12(r3),r10
+ l.sw 16(r3),r14
+ l.sw 20(r3),r16
+ l.sw 24(r3),r18
+ l.sw 28(r3),r20
+ l.sw 32(r3),r22
+ l.sw 36(r3),r24
+ l.sw 40(r3),r26
+ l.sw 44(r3),r28
+ l.sw 48(r3),r30
l.j __sigjmp_save
- l.nop
+ l.nop
.size __sigsetjmp,.-__sigsetjmp