linux-user/riscv: 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-07-28 22:06:12 -10:00
parent 592f36d13d
commit a56cf00bc0
2 changed files with 5 additions and 12 deletions

View file

@ -849,12 +849,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
#define VDSO_HEADER "vdso-64.c.inc"
#endif
static inline void init_thread(struct target_pt_regs *regs,
struct image_info *infop)
{
regs->sepc = infop->entry;
regs->sp = infop->start_stack;
}
#define HAVE_INIT_MAIN_THREAD
#define ELF_EXEC_PAGESIZE 4096

View file

@ -94,14 +94,12 @@ void cpu_loop(CPURISCVState *env)
}
}
void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
void init_main_thread(CPUState *cs, struct image_info *info)
{
CPUState *cpu = env_cpu(env);
TaskState *ts = get_task_state(cpu);
struct image_info *info = ts->info;
CPUArchState *env = cpu_env(cs);
env->pc = regs->sepc;
env->gpr[xSP] = regs->sp;
env->pc = info->entry;
env->gpr[xSP] = info->start_stack;
env->elf_flags = info->elf_flags;
if ((env->misa_ext & RVE) && !(env->elf_flags & EF_RISCV_RVE)) {