1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00
Update.
2004-09-02  Steven Munroe  <sjmunroe@us.ibm.com>

	[BZ #357]
	* stdlib/tst-setcontext.c (test_stack): Added test for stack clobber.
	(main): Call test_stack.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
	(__getcontext): Push stack frame then save parms in local frame.
	Improve instruction scheduling.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
	(__swapcontext): Likewise.
This commit is contained in:
Ulrich Drepper
2004-09-02 18:59:24 +00:00
parent 86aca5ac58
commit 73f7c32c47
28 changed files with 643 additions and 96 deletions

View File

@@ -72,6 +72,55 @@ f2 (void)
was_in_f2 = 1;
}
void
test_stack(volatile int a, volatile int b,
volatile int c, volatile int d)
{
volatile int e = 5;
volatile int f = 6;
ucontext_t uc;
/* Test for cases where getcontext is clobbering the callers
stack, including parameters. */
getcontext(&uc);
if (a != 1)
{
printf ("%s: getcontext clobbers parm a\n", __FUNCTION__);
exit (1);
}
if (b != 2)
{
printf ("%s: getcontext clobbers parm b\n", __FUNCTION__);
exit (1);
}
if (c != 3)
{
printf ("%s: getcontext clobbers parm c\n", __FUNCTION__);
exit (1);
}
if (d != 4)
{
printf ("%s: getcontext clobbers parm d\n", __FUNCTION__);
exit (1);
}
if (e != 5)
{
printf ("%s: getcontext clobbers varible e\n", __FUNCTION__);
exit (1);
}
if (f != 6)
{
printf ("%s: getcontext clobbers variable f\n", __FUNCTION__);
exit (1);
}
}
volatile int global;
int
@@ -88,6 +137,8 @@ main (void)
printf ("%s: getcontext: %m\n", __FUNCTION__);
exit (1);
}
test_stack (1, 2, 3, 4);
/* Play some tricks with this context. */
if (++global == 1)