Subject: Re: fork1 and new stack
To: None <email@example.com, firstname.lastname@example.org>
From: None <email@example.com>
Date: 04/25/2002 20:30:15
| I'm trying to get IRIX sproc() emulation going on. sproc() spawns a new
| lightweight process. I plan to emulate this with a call to fork1() with
| the FORK_SHAREDVM.
| On IRIX, the child has a stack at offset 0x0400000 from the parent
| stack. If try to call fork1() with stack (SP - 0x0400000) and stacksize
| (vm_maxssize - vm_minssize), the child just does a SIGSEGV on a stack
| Any idea why?=20
Uh, did you by any chance forget to allocate VM in that range?
| More input: sproc() takes an entry argument with the address of the
| function where the child should start. I emulated this by setting the
| child's PC saved on trapframe to entry. But I doublt that this can cause
| the problem.
That's icky. And highly machine dependent. OTOH, this is IRIX....
You might look into using setregs() which is what execve() does.