On Tuesday 16 February 2010 12:36:15 Alexander Graf wrote: > On 16.02.2010, at 19:31, Rob Landley wrote: > > Let's see, one of the lines I #ifdefed out (line 535-ish of linux- > > user/elfload.c) is: > > > > get_user_ual(_regs->gpr[3], pos); > > > > Rummage, rummage... get_user_ual() is a wrapper for get_user() which is a > > wrapper for __get_user() which assigns to its first argument. So yeah, > > that's setting _regs->gpr[3] to a nonzero value. > > Well I was wondering on the order of execution. If main() already sets the > GPRs to 0 it should be 0. I assume the elf reading code comes after that? > If so, your patch looks correct.
The main() code memsets all the registers to zero when the array is allocated, then passes the register array as the first argument to the target-specific init_thread(), which can initialize them to other values. So yeah, main() calls the elf reading code after the memset. Rob -- Latency is more important than throughput. It's that simple. - Linus Torvalds