linux-user/sparc: 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 2eaaf04ad7
commit 7b9efb7aae
2 changed files with 9 additions and 19 deletions
+2 -10
View File
@@ -438,16 +438,8 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
# define ELF_ARCH EM_SPARCV9
#endif
static inline void init_thread(struct target_pt_regs *regs,
struct image_info *infop)
{
/* Note that target_cpu_copy_regs does not read psr/tstate. */
regs->pc = infop->entry;
regs->npc = regs->pc + 4;
regs->y = 0;
regs->u_regs[14] = (infop->start_stack - 16 * sizeof(abi_ulong)
- TARGET_STACK_BIAS);
}
#define HAVE_INIT_MAIN_THREAD
#endif /* TARGET_SPARC */
#ifdef TARGET_PPC
+7 -9
View File
@@ -357,14 +357,12 @@ void cpu_loop (CPUSPARCState *env)
}
}
void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
void init_main_thread(CPUState *cs, struct image_info *info)
{
int i;
env->pc = regs->pc;
env->npc = regs->npc;
env->y = regs->y;
for(i = 0; i < 8; i++)
env->gregs[i] = regs->u_regs[i];
for(i = 0; i < 8; i++)
env->regwptr[i] = regs->u_regs[i + 8];
CPUArchState *env = cpu_env(cs);
env->pc = info->entry;
env->npc = env->pc + 4;
env->regwptr[WREG_SP] = (info->start_stack - 16 * sizeof(abi_ulong)
- TARGET_STACK_BIAS);
}