Mucho buggering about jmp_with_stack and its kin. Jeez. Now the
amd64 version is broken again. Writing code with undocumented
assumptions should be a firable offense. At the very least.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3402 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/stage1.c b/coregrind/stage1.c
index 2c10edb..6ab8c93 100644
--- a/coregrind/stage1.c
+++ b/coregrind/stage1.c
@@ -255,6 +255,7 @@
return 1;
}
+
static void main2(void)
{
int err, padfile;
@@ -262,7 +263,7 @@
extern char _end;
int *esp;
char buf[strlen(valgrind_lib) + sizeof(stage2) + 16];
-
+ printf("& local = %p\n", &esp);
info.exe_end = PGROUNDDN(init_sp);
#ifdef HAVE_PIE
info.exe_base = ROUNDDN(info.exe_end - 0x02000000, 0x10000000);
@@ -300,9 +301,16 @@
foreach_map(prmap, /*dummy*/NULL);
}
- jmp_with_stack((void (*)(void))info.init_eip, (Addr)esp);
+ jump_and_switch_stacks(
+ (Addr) esp, /* stack */
+ (Addr) info.init_eip /* where to */
+ );
+
+ /*NOTREACHED*/
+ assert(0);
}
+
int main(int argc, char** argv)
{
struct rlimit rlim;
@@ -328,7 +336,13 @@
setrlimit(RLIMIT_AS, &rlim);
/* move onto another stack so we can play with the main one */
- jmp_with_stack(main2, (Addr)stack + sizeof(stack));
+ jump_and_switch_stacks(
+ (Addr)stack + sizeof(stack), /* stack */
+ main2 /* where to */
+ );
+
+ /*NOTREACHED*/
+ assert(0);
}
/*--------------------------------------------------------------------*/