From 47026c0785a0cd86c05f8255cc34a85c1cf9eced Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 3 Aug 2000 03:02:41 +0000 Subject: * fork.cc (vfork): Store complete stack frame in vfork_save structure for later recovery. * spawn.cc (spawn_guts): Reorganize slightly to consolidate handling when there is a CreateProcess error. (_spawnve): Only longjmp back to vfork handling when a process has been successfuly started. * winsup.h (vfork_save): Extend to include frame info. Remove obsolete cpplus conditionals. --- winsup/cygwin/fork.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'winsup/cygwin/fork.cc') diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 7eb43b6be..6052bac7f 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -639,6 +639,7 @@ vfork () return fork (); #else vfork_save *vf = get_vfork_val (); + char **esp, **pp; if (vf == NULL) vf = vfork_storage.create (); @@ -646,9 +647,11 @@ vfork () if (!setjmp (vf->j)) { vf->pid = -1; + __asm__ volatile ("movl %%esp,%0": "=r" (vf->vfork_esp):); __asm__ volatile ("movl %%ebp,%0": "=r" (vf->vfork_ebp):); - __asm__ volatile ("movl (%%ebp),%0": "=r" (vf->caller_ebp):); - __asm__ volatile ("movl 4(%%ebp),%0": "=r" (vf->retaddr):); + for (pp = (char **)vf->frame, esp = vf->vfork_esp; + esp <= vf->vfork_ebp + 1; pp++, esp++) + *pp = *esp; return dtable.vfork_child_dup () ? 0 : -1; } @@ -662,8 +665,11 @@ vfork () exit (exitval); } - vf->vfork_ebp[0] = vf->caller_ebp; - vf->vfork_ebp[1] = vf->retaddr; + __asm__ volatile ("movl %%esp,%0": "=r" (esp):); + for (pp = (char **)vf->frame, esp = vf->vfork_esp; + esp <= vf->vfork_ebp + 1; pp++, esp++) + *esp = *pp; + return vf->pid; #endif } -- cgit v1.2.3