-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/06/10 12:48, Andrew Dennison wrote:
[...]
> It does work, we ran without the MMU for a while without issue. I've
> also booted the arm and i386 ports both with and without the mmu and
> everything started up ok.

Okay, in which case it's obviously me.

> ...fundamentally the
> structure guarantees only the child or parent is running at any one
> time and the setjump / longjump restores the context. The calls into
> the proc and exec servers also do a lot of the heavy lifting behind
> the scenes. The proc server may actually copy and restore the stack if
> my memory serves me correctly.

What I'm seeing is:

 - vfork is called with stack (SP-n)
 - vfork launches new thread, which gets stack (SP) (i.e. the same as
the parent's original stack pointer)
 - new thread runs a stub routine which longjmps to (SP-n)
 - vfork resumes, in the child thread
 - vfork crashes on return

It's crashing --- I think --- because the stub routine's own stack usage
is overwriting vfork()'s caller's stack, since n is quite small. If my
analysis is correct it ought to be easily fixable by telling the stub
not to overwrite the stack. This may not affect ARM because ARM's got
more registers and doesn't use the stack as much as the H8300S, but I
would have expected ia32 to show it up.

If the proc server is fiddling with the child thread state behind the
scenes then this is obviously not necessarily the case, so I'll go and
look into that --- ta.

thread_create looks like it physically copies the parent thread's kernel
stack, so duplicating the parent thread's default user mode registers
for the child to (including the same stack pointer!). This appears to me
to be rather dubious...

- -- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ }
│ --- Conway's Game Of Life, in one line of APL
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwH11IACgkQf9E0noFvlzi5VACfRKRYV7a3s0Fcii+peCE8jZsg
ST0AoL6GtmTgDW/ZdvO2nYOM3Ho6ggGw
=Aqae
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Prex-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/prex-devel

Reply via email to