mirror of
git://sourceware.org/git/glibc.git
synced 2024-12-27 04:41:02 +08:00
(__longjmp): Restore SP and FP last and
in a single asm as they may be used to access other stored registers.
This commit is contained in:
parent
0abafb2042
commit
a9a575e676
@ -45,16 +45,10 @@ __longjmp (env, val_arg)
|
|||||||
asm volatile ("l.d $f28, %0" : : "m" (env[0].__fpregs[4]));
|
asm volatile ("l.d $f28, %0" : : "m" (env[0].__fpregs[4]));
|
||||||
asm volatile ("l.d $f30, %0" : : "m" (env[0].__fpregs[5]));
|
asm volatile ("l.d $f30, %0" : : "m" (env[0].__fpregs[5]));
|
||||||
|
|
||||||
/* Restore the stack pointer. */
|
|
||||||
asm volatile ("lw $29, %0" : : "m" (env[0].__sp));
|
|
||||||
|
|
||||||
/* Get and reconstruct the floating point csr. */
|
/* Get and reconstruct the floating point csr. */
|
||||||
asm volatile ("lw $2, %0" : : "m" (env[0].__fpc_csr));
|
asm volatile ("lw $2, %0" : : "m" (env[0].__fpc_csr));
|
||||||
asm volatile ("ctc1 $2, $31");
|
asm volatile ("ctc1 $2, $31");
|
||||||
|
|
||||||
/* Get the FP. */
|
|
||||||
asm volatile ("lw $30, %0" : : "m" (env[0].__fp));
|
|
||||||
|
|
||||||
/* Get the GP. */
|
/* Get the GP. */
|
||||||
asm volatile ("lw $gp, %0" : : "m" (env[0].__gp));
|
asm volatile ("lw $gp, %0" : : "m" (env[0].__gp));
|
||||||
|
|
||||||
@ -71,6 +65,12 @@ __longjmp (env, val_arg)
|
|||||||
/* Get the PC. */
|
/* Get the PC. */
|
||||||
asm volatile ("lw $25, %0" : : "m" (env[0].__pc));
|
asm volatile ("lw $25, %0" : : "m" (env[0].__pc));
|
||||||
|
|
||||||
|
/* Restore the stack pointer and the FP. They have to be restored
|
||||||
|
last and in a single asm as gcc, depending on options used, may
|
||||||
|
use either of them to access env. */
|
||||||
|
asm volatile ("lw $29, %0\n\t"
|
||||||
|
"lw $30, %1\n\t" : : "m" (env[0].__sp), "m" (env[0].__fp));
|
||||||
|
|
||||||
/* Give setjmp 1 if given a 0, or what they gave us if non-zero. */
|
/* Give setjmp 1 if given a 0, or what they gave us if non-zero. */
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
asm volatile ("li $2, 1");
|
asm volatile ("li $2, 1");
|
||||||
|
@ -47,16 +47,10 @@ __longjmp (env, val_arg)
|
|||||||
asm volatile ("l.d $f30, %0" : : "m" (env[0].__fpregs[6]));
|
asm volatile ("l.d $f30, %0" : : "m" (env[0].__fpregs[6]));
|
||||||
asm volatile ("l.d $f31, %0" : : "m" (env[0].__fpregs[7]));
|
asm volatile ("l.d $f31, %0" : : "m" (env[0].__fpregs[7]));
|
||||||
|
|
||||||
/* Restore the stack pointer. */
|
|
||||||
asm volatile ("ld $29, %0" : : "m" (env[0].__sp));
|
|
||||||
|
|
||||||
/* Get and reconstruct the floating point csr. */
|
/* Get and reconstruct the floating point csr. */
|
||||||
asm volatile ("lw $2, %0" : : "m" (env[0].__fpc_csr));
|
asm volatile ("lw $2, %0" : : "m" (env[0].__fpc_csr));
|
||||||
asm volatile ("ctc1 $2, $31");
|
asm volatile ("ctc1 $2, $31");
|
||||||
|
|
||||||
/* Get the FP. */
|
|
||||||
asm volatile ("ld $30, %0" : : "m" (env[0].__fp));
|
|
||||||
|
|
||||||
/* Get the GP. */
|
/* Get the GP. */
|
||||||
asm volatile ("ld $gp, %0" : : "m" (env[0].__gp));
|
asm volatile ("ld $gp, %0" : : "m" (env[0].__gp));
|
||||||
|
|
||||||
@ -73,6 +67,13 @@ __longjmp (env, val_arg)
|
|||||||
/* Get the PC. */
|
/* Get the PC. */
|
||||||
asm volatile ("ld $31, %0" : : "m" (env[0].__pc));
|
asm volatile ("ld $31, %0" : : "m" (env[0].__pc));
|
||||||
|
|
||||||
|
|
||||||
|
/* Restore the stack pointer and the FP. They have to be restored
|
||||||
|
last and in a single asm as gcc, depending on options used, may
|
||||||
|
use either of them to access env. */
|
||||||
|
asm volatile ("ld $29, %0\n\t"
|
||||||
|
"ld $30, %1\n\t" : : "m" (env[0].__sp), "m" (env[0].__fp));
|
||||||
|
|
||||||
/* Give setjmp 1 if given a 0, or what they gave us if non-zero. */
|
/* Give setjmp 1 if given a 0, or what they gave us if non-zero. */
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
asm volatile ("dli $2, 1");
|
asm volatile ("dli $2, 1");
|
||||||
|
Loading…
Reference in New Issue
Block a user