about summary refs log tree commit diff
path: root/stdlib/tst-setcontext.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-04-06 21:58:34 +0000
committerUlrich Drepper <drepper@redhat.com>2001-04-06 21:58:34 +0000
commit1a51bde7717d8f0458b682576029576225cf874f (patch)
tree3fd6670fdd151f6b463039b2121caaee06496bf3 /stdlib/tst-setcontext.c
parent99ee59707bafccd24e6dd38190cb3501ffa5c70a (diff)
downloadglibc-1a51bde7717d8f0458b682576029576225cf874f.tar.gz
glibc-1a51bde7717d8f0458b682576029576225cf874f.tar.xz
glibc-1a51bde7717d8f0458b682576029576225cf874f.zip
Update.
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.
Diffstat (limited to 'stdlib/tst-setcontext.c')
-rw-r--r--stdlib/tst-setcontext.c13
1 files changed, 12 insertions, 1 deletions
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)