Subject: Re: fork1 and new stack
To: Emmanuel Dreyfus <manu@netbsd.org>
From: Andrey Petrov <petrov@netbsd.org>
List: tech-kern
Date: 04/26/2002 00:39:43
On Fri, Apr 26, 2002 at 08:32:01AM +0200, Emmanuel Dreyfus wrote:
> > > child_stack_addr = (u_long)(tf->f_regs[SP]
> > > - IRIX_SPROC_STACK_OFFSET);
> > > child_stack_size = (u_long)p->p_vmspace->vm_minsaddr
> > > - (u_long)p->p_vmspace->vm_maxsaddr;
> >
> > Aren't they reversed?
>
> I have a debug printf just before this
> vm_minsaddr = 0x7ffff000 vm_maxsaddr = 0x7dfff000
>
> Hence it seems ok.
Yeah, right.
caddr_t vm_maxsaddr; /* user VA at max stack growth */
caddr_t vm_minsaddr; /* user VA at top of stack */
Somewhat misleading but whatever. I doubt that user stack space
needs special allocation. I always thought that that's one of VM's
responsibilities. I think it should be enough just to tell VM
where stack should be and VM will provide anon memory when it
needed(faulted). VM should check process' limits though.
Well, I might be wrong and I haven't looked at uvm code enough yet.
What information SEGV gives you? Your clone started and segv-faulted
right away?
Andrey