diff options
| author | Richard Henderson <richard.henderson@linaro.org> | 2025-07-28 10:17:44 -1000 |
|---|---|---|
| committer | Richard Henderson <richard.henderson@linaro.org> | 2025-08-28 06:39:25 +1000 |
| commit | 8d4020dd025dc37d9003c6a514e758d8c6ef99b9 (patch) | |
| tree | 5cf3a74c260873537726bf314b19c4410d4d9215 /linux-user/elfload.c | |
| parent | 1f2f4c0fbcc527f47e2f9d5708ae7df824bd574f (diff) | |
| download | focaccia-qemu-8d4020dd025dc37d9003c6a514e758d8c6ef99b9.tar.gz focaccia-qemu-8d4020dd025dc37d9003c6a514e758d8c6ef99b9.zip | |
linux-user/i386: Create init_main_thread
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. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'linux-user/elfload.c')
| -rw-r--r-- | linux-user/elfload.c | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 6fce74f45a..89f3972253 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -149,17 +149,12 @@ typedef abi_int target_pid_t; #ifdef TARGET_I386 +#define HAVE_INIT_MAIN_THREAD + #ifdef TARGET_X86_64 #define ELF_CLASS ELFCLASS64 #define ELF_ARCH EM_X86_64 -static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) -{ - regs->rax = 0; - regs->rsp = infop->start_stack; - regs->rip = infop->entry; -} - #define ELF_NREG 27 typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG]; @@ -237,22 +232,6 @@ static bool init_guest_commpage(void) #define EXSTACK_DEFAULT true -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. */ - regs->edx = 0; -} - #define ELF_NREG 17 typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG]; @@ -3621,8 +3600,12 @@ static int elf_core_dump(int signr, const CPUArchState *env) void do_init_main_thread(CPUState *cs, struct image_info *infop) { +#ifdef HAVE_INIT_MAIN_THREAD + init_main_thread(cs, infop); +#else target_pt_regs regs = { }; init_thread(®s, infop); target_cpu_copy_regs(cpu_env(cs), ®s); +#endif } |