2001-04-06  David Mosberger  <davidm@hpl.hp.com>

	* stdlib/tst-setcontext.c: Move st2[] to global scope.
	(f2): Verify that stack pointer is inside st2[].

	* sysdeps/unix/sysv/linux/ia64/getcontext.S: It helps to save r12.
	* sysdeps/unix/sysv/linux/ia64/setcontext.S: It helps to restore r12.
This commit is contained in:
Ulrich Drepper 2001-04-06 21:58:34 +00:00
parent 99ee59707b
commit 1a51bde771
4 changed files with 29 additions and 10 deletions

View File

@ -1,3 +1,11 @@
2001-04-06 David Mosberger <davidm@hpl.hp.com>
* stdlib/tst-setcontext.c: Move st2[] to global scope.
(f2): Verify that stack pointer is inside st2[].
* sysdeps/unix/sysv/linux/ia64/getcontext.S: It helps to save r12.
* sysdeps/unix/sysv/linux/ia64/setcontext.S: It helps to restore r12.
2001-04-06 Ulrich Drepper <drepper@redhat.com> 2001-04-06 Ulrich Drepper <drepper@redhat.com>
* timezone/antarctica: Update from tzdata2001b. * timezone/antarctica: Update from tzdata2001b.

View File

@ -26,6 +26,8 @@ static ucontext_t ctx[3];
static int was_in_f1; static int was_in_f1;
static int was_in_f2; static int was_in_f2;
static char st2[8192];
static void static void
f1 (long a0, long a1, long a2, long a3) f1 (long a0, long a1, long a2, long a3)
{ {
@ -49,7 +51,17 @@ f1 (long a0, long a1, long a2, long a3)
static void static void
f2 (void) f2 (void)
{ {
char on_stack[1];
puts ("start f2"); puts ("start f2");
printf ("&on_stack=%p\n", on_stack);
if (on_stack < st2 || on_stack >= st2 + sizeof (st2))
{
printf ("%s: memory stack is not where it belongs!", __FUNCTION__);
exit (1);
}
if (swapcontext (&ctx[2], &ctx[1]) != 0) if (swapcontext (&ctx[2], &ctx[1]) != 0)
{ {
printf ("%s: swapcontext: %m\n", __FUNCTION__); printf ("%s: swapcontext: %m\n", __FUNCTION__);
@ -63,7 +75,6 @@ int
main (void) main (void)
{ {
char st1[8192]; char st1[8192];
char st2[8192];
puts ("making contexts"); puts ("making contexts");
if (getcontext (&ctx[1]) != 0) if (getcontext (&ctx[1]) != 0)

View File

@ -61,12 +61,11 @@ ENTRY(__getcontext)
mov.i rPFS = ar.pfs mov.i rPFS = ar.pfs
;; ;;
.mem.offset 0,0; st8.spill [r2] = r5, 16 .mem.offset 0,0; st8.spill [r2] = r5, 16
.mem.offset 8,0; st8.spill [r3] = r6 .mem.offset 8,0; st8.spill [r3] = r6, 48
add r3 = (SC_FR+3*16-(SC_GR+6*8)), r3 and rTMP = ~0x3, rRSC
;; ;;
st8.spill [r2] = r7, (SC_FR+2*16-(SC_GR+7*8)) st8.spill [r2] = r7, (SC_FR+2*16-(SC_GR+7*8))
nop 0 st8.spill [r3] = sp, (SC_FR+3*16-(SC_GR+12*8))
and rTMP = ~0x3, rRSC
;; ;;
mov.m ar.rsc = rTMP // put RSE into enforced lazy mode mov.m ar.rsc = rTMP // put RSE into enforced lazy mode
mov.m rNAT = ar.unat mov.m rNAT = ar.unat

View File

@ -87,9 +87,12 @@ ENTRY(__setcontext)
ld8.fill r5 = [r3], 16 ld8.fill r5 = [r3], 16
mov b0 = rB0 mov b0 = rB0
;; ;;
ld8.fill r6 = [r2] ld8.fill r6 = [r2], 48
ld8.fill r7 = [r3], (SC_FR+2*16-(SC_GR+7*8)) ld8.fill r7 = [r3], (SC_FR+2*16-(SC_GR+7*8))
adds r2 = (SC_FR+3*16-(SC_GR+6*8)), r2 ;;
ld8.fill sp = [r2], (SC_FR+3*16-(SC_GR+12*8))
mov.m ar.fpsr = rFPSR
mov.i ar.pfs = rPFS
;; ;;
ldf.fill f3 = [r2], 16 ldf.fill f3 = [r2], 16
ldf.fill f2 = [r3], 48 ldf.fill f2 = [r3], 48
@ -132,10 +135,8 @@ ENTRY(__setcontext)
mov pr = rPR, -1 mov pr = rPR, -1
;; ;;
mov.m ar.rsc = rTMP // put RSE into enforced lazy mode mov.m ar.rsc = rTMP // put RSE into enforced lazy mode
mov.m ar.fpsr = rFPSR
mov.i ar.pfs = rPFS
;; ;;
loadrs // drop dirty partition is empty loadrs // drop dirty partition
;; ;;
mov.m ar.bspstore = rBSP mov.m ar.bspstore = rBSP
mov.m ar.unat = rUNAT mov.m ar.unat = rUNAT