Rename variable AT (which is the register's name) to SCPREG.

Fix some SCP references in register loads to use SCPREG instead.
Load SCPREG->sc_pc into $24 and jump to it, restoring $at in the delay slot.
This still leaves $24 clobbered.
This commit is contained in:
Roland McGrath 1994-07-29 16:39:58 +00:00
parent 3844669a62
commit 6adee8d53b

View File

@ -16,6 +16,8 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
register int sp asm ("$29"), fp asm ("$30");
#include <hurd.h>
#include <hurd/signal.h>
#include <hurd/threadvar.h>
@ -49,12 +51,13 @@ __sigreturn (const struct sigcontext *scp)
/* Restore registers. */
#define restore_gpr(n) \
asm volatile ("lw $" #n ",%0" : : "m"(at->sc_gpr[(n)]))
asm volatile ("lw $" #n ",%0" : : "m" (scpreg->sc_gpr[n]))
asm volatile (".set noreorder; .set noat;");
{
register const struct sigcontext *at asm ("$1") = scp;
register const struct sigcontext *const scpreg asm ("$1") = scp;
/* Load the general-purpose registers from the sigcontext. */
restore_gpr (2);
restore_gpr (3);
restore_gpr (4);
@ -79,12 +82,22 @@ __sigreturn (const struct sigcontext *scp)
restore_gpr (23);
restore_gpr (24);
restore_gpr (25);
/* Registers 26-27 are kernel-only. */
restore_gpr (28);
asm volatile ("lw $29,%0" : : "m"(scp->sc_sp));
asm volatile ("lw $30,%0" : : "m"(scp->sc_fp));
asm volatile ("lw $31,%0" : : "m"(scp->sc_pc));
asm volatile ("j $31");
restore_gpr(1);
/* Now the special-purpose registers. */
sp = scpreg->sc_sp; /* Stack pointer. */
fp = scpreg->sc_fp; /* Frame pointer. */
restore_gpr (31); /* Return address. */
/* Now jump to the saved PC. */
asm volatile ("lw $24, %0\n" /* Load saved PC into temporary $t8. */
"j $24\n" /* Jump to the saved PC value. */
"lw $1, %1\n" /* Restore $at in delay slot. */
: :
"m" (scpreg->sc_pc),
"m" (scpreg->sc_r1) /* $at */
: "$24"); /* XXX clobbers $24 (aka $t8)!! */
asm volatile (".set reorder; .set at;");
}