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>
# 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
}
}
-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);
}