Use asms instead of global register vars to restore FP regs.

Fix typo in REI invocation.
This commit is contained in:
Roland McGrath 1994-12-12 06:41:03 +00:00
parent 079f003a7c
commit 94cd6ef1f8
1 changed files with 38 additions and 66 deletions

View File

@ -17,43 +17,13 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
/* Declare global register variables before any code. */
register double f0 asm ("$f0");
register double f1 asm ("$f1");
register double f2 asm ("$f2");
register double f3 asm ("$f3");
register double f4 asm ("$f4");
register double f5 asm ("$f5");
register double f6 asm ("$f6");
register double f7 asm ("$f7");
register double f8 asm ("$f8");
register double f9 asm ("$f9");
register double f10 asm ("$f10");
register double f11 asm ("$f11");
register double f12 asm ("$f12");
register double f13 asm ("$f13");
register double f14 asm ("$f14");
register double f15 asm ("$f15");
register double f16 asm ("$f16");
register double f17 asm ("$f17");
register double f18 asm ("$f18");
register double f19 asm ("$f19");
register double f20 asm ("$f20");
register double f21 asm ("$f21");
register double f22 asm ("$f22");
register double f23 asm ("$f23");
register double f24 asm ("$f24");
register double f25 asm ("$f25");
register double f26 asm ("$f26");
register double f27 asm ("$f27");
register double f28 asm ("$f28");
register double f29 asm ("$f29");
register double f30 asm ("$f30");;
#include <hurd.h> #include <hurd.h>
#include <hurd/signal.h> #include <hurd/signal.h>
#include <hurd/threadvar.h> #include <hurd/threadvar.h>
#include <hurd/msg.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <mach/machine/alpha_instruction.h>
int int
__sigreturn (struct sigcontext *scp) __sigreturn (struct sigcontext *scp)
@ -119,37 +89,39 @@ __sigreturn (struct sigcontext *scp)
asm volatile ("mt_fpcr %0" : : "f" (scp->sc_fpcsr)); asm volatile ("mt_fpcr %0" : : "f" (scp->sc_fpcsr));
/* Restore floating-point registers. */ /* Restore floating-point registers. */
f0 = scp->sc_fpregs[0]; #define restore_fpr(n) \
f1 = scp->sc_fpregs[1]; asm volatile ("ldt $f" #n ",%0" : : "m" (scp->sc_fpregs[n]))
f2 = scp->sc_fpregs[2]; restore_fpr (0);
f3 = scp->sc_fpregs[3]; restore_fpr (1);
f4 = scp->sc_fpregs[4]; restore_fpr (2);
f5 = scp->sc_fpregs[5]; restore_fpr (3);
f6 = scp->sc_fpregs[6]; restore_fpr (4);
f7 = scp->sc_fpregs[7]; restore_fpr (5);
f8 = scp->sc_fpregs[8]; restore_fpr (6);
f9 = scp->sc_fpregs[9]; restore_fpr (7);
f10 = scp->sc_fpregs[10]; restore_fpr (8);
f11 = scp->sc_fpregs[11]; restore_fpr (9);
f12 = scp->sc_fpregs[12]; restore_fpr (10);
f13 = scp->sc_fpregs[13]; restore_fpr (11);
f14 = scp->sc_fpregs[14]; restore_fpr (12);
f15 = scp->sc_fpregs[15]; restore_fpr (13);
f16 = scp->sc_fpregs[16]; restore_fpr (14);
f17 = scp->sc_fpregs[17]; restore_fpr (15);
f18 = scp->sc_fpregs[18]; restore_fpr (16);
f19 = scp->sc_fpregs[19]; restore_fpr (17);
f20 = scp->sc_fpregs[20]; restore_fpr (18);
f21 = scp->sc_fpregs[21]; restore_fpr (19);
f22 = scp->sc_fpregs[22]; restore_fpr (20);
f23 = scp->sc_fpregs[23]; restore_fpr (21);
f24 = scp->sc_fpregs[24]; restore_fpr (22);
f25 = scp->sc_fpregs[25]; restore_fpr (23);
f26 = scp->sc_fpregs[26]; restore_fpr (24);
f27 = scp->sc_fpregs[27]; restore_fpr (25);
f28 = scp->sc_fpregs[28]; restore_fpr (26);
f29 = scp->sc_fpregs[29]; restore_fpr (27);
f30 = scp->sc_fpregs[30]; restore_fpr (28);
restore_fpr (29);
restore_fpr (30);
} }
/* Load all the registers from the sigcontext. */ /* Load all the registers from the sigcontext. */
@ -165,7 +137,7 @@ __sigreturn (struct sigcontext *scp)
registers and PSW it will to restore, onto the user's stack and let registers and PSW it will to restore, onto the user's stack and let
it pop them from there. */ it pop them from there. */
register const struct sigcontext *const scpreg asm ("$2") = scp; register const struct sigcontext *const scpreg asm ("$2") = scp;
register integer_t *usp asm ("$3") = scpreg->sc_regs[30]; register integer_t *usp asm ("$3") = (integer_t *) scpreg->sc_regs[30];
register integer_t usp_align asm ("$4"); register integer_t usp_align asm ("$4");
/* Push an 8-word "trap frame" onto the user stack for `rei': /* Push an 8-word "trap frame" onto the user stack for `rei':
@ -226,7 +198,7 @@ __sigreturn (struct sigcontext *scp)
/* Switch the stack pointer to the trap frame set up on /* Switch the stack pointer to the trap frame set up on
the user stack and do the magical `rei' PAL call. */ the user stack and do the magical `rei' PAL call. */
asm volatile ("mov %0, $30\n" asm volatile ("mov %0, $30\n"
"call_pal %0" "call_pal %1"
: : "r" (rei_frame), "i" (op_rei)); : : "r" (rei_frame), "i" (op_rei));
/* Firewall. */ /* Firewall. */
asm volatile ("call_pal %0" : : "i" (op_halt)); asm volatile ("call_pal %0" : : "i" (op_halt));