From 1a51bde7717d8f0458b682576029576225cf874f Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 6 Apr 2001 21:58:34 +0000 Subject: Update. 2001-04-06 David Mosberger * 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. --- stdlib/tst-setcontext.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'stdlib') diff --git a/stdlib/tst-setcontext.c b/stdlib/tst-setcontext.c index 6ee1b514a6..ed53f9e288 100644 --- a/stdlib/tst-setcontext.c +++ b/stdlib/tst-setcontext.c @@ -26,6 +26,8 @@ static ucontext_t ctx[3]; static int was_in_f1; static int was_in_f2; +static char st2[8192]; + static void f1 (long a0, long a1, long a2, long a3) { @@ -49,7 +51,17 @@ f1 (long a0, long a1, long a2, long a3) static void f2 (void) { + char on_stack[1]; + 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) { printf ("%s: swapcontext: %m\n", __FUNCTION__); @@ -63,7 +75,6 @@ int main (void) { char st1[8192]; - char st2[8192]; puts ("making contexts"); if (getcontext (&ctx[1]) != 0) -- cgit 1.4.1