linux-user/s390x: Create init_main_thread

Merge init_thread and target_cpu_copy_regs.
There's no point going through a target_pt_regs intermediate.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson
2025-08-28 06:39:25 +10:00
parent 6b523112ba
commit 592f36d13d
2 changed files with 9 additions and 15 deletions
+1 -8
View File
@@ -798,14 +798,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUM68KState *e
#define ELF_DATA ELFDATA2MSB
#define ELF_ARCH EM_S390
static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop)
{
regs->psw.addr = infop->entry;
regs->psw.mask = PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT | \
PSW_MASK_MCHECK | PSW_MASK_PSTATE | PSW_MASK_64 | \
PSW_MASK_32;
regs->gprs[15] = infop->start_stack;
}
#define HAVE_INIT_MAIN_THREAD
/* See linux kernel: arch/s390/include/uapi/asm/ptrace.h (s390_regs). */
#define ELF_NREG 27
+8 -7
View File
@@ -180,12 +180,13 @@ void cpu_loop(CPUS390XState *env)
}
}
void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
void init_main_thread(CPUState *cs, struct image_info *info)
{
int i;
for (i = 0; i < 16; i++) {
env->regs[i] = regs->gprs[i];
}
env->psw.mask = regs->psw.mask;
env->psw.addr = regs->psw.addr;
CPUArchState *env = cpu_env(cs);
env->psw.addr = info->entry;
env->psw.mask = PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT |
PSW_MASK_MCHECK | PSW_MASK_PSTATE | PSW_MASK_64 |
PSW_MASK_32;
env->regs[15] = info->start_stack;
}