On Wed, 30 Jul 2025 at 01:19, Richard Henderson <richard.hender...@linaro.org> wrote: > > Merge init_thread and target_cpu_copy_regs. > There's no point going through a target_pt_regs intermediate. > Temporarily introduce HAVE_INIT_MAIN_THREAD during conversion. > > Signed-off-by: Richard Henderson <richard.hender...@linaro.org> > --- > linux-user/qemu.h | 1 + > linux-user/elfload.c | 29 ++++++----------------------- > linux-user/i386/cpu_loop.c | 31 ++++++------------------------- > 3 files changed, 13 insertions(+), 48 deletions(-)
> -static inline void init_thread(struct target_pt_regs *regs, > - struct image_info *infop) > -{ > - regs->esp = infop->start_stack; > - regs->eip = infop->entry; > - > - /* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program > - starts %edx contains a pointer to a function which might be > - registered using `atexit'. This provides a mean for the > - dynamic linker to call DT_FINI functions for shared libraries > - that have been loaded before the code runs. > - > - A value of 0 tells we have no such handler. */ This seems like a useful comment to retain -- it's nice to know whether we're zeroing a register as an ABI requirement versus just being tidy. > - regs->edx = 0; > -} > + memset(env->regs, 0, sizeof(env->regs)); Are we not allowed to assume the regs are zero out of reset ? > + env->regs[R_ESP] = info->start_stack; > + env->eip = info->entry; Otherwise Reviewed-by: Peter Maydell <peter.mayd...@linaro.org> thanks -- PMM