linux-user/xtensa: 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:
parent
1aec088719
commit
ceff7f9ae9
2 changed files with 17 additions and 23 deletions
|
|
@ -905,23 +905,7 @@ static bool init_guest_commpage(void)
|
|||
#define ELF_CLASS ELFCLASS32
|
||||
#define ELF_ARCH EM_XTENSA
|
||||
|
||||
static inline void init_thread(struct target_pt_regs *regs,
|
||||
struct image_info *infop)
|
||||
{
|
||||
regs->windowbase = 0;
|
||||
regs->windowstart = 1;
|
||||
regs->areg[1] = infop->start_stack;
|
||||
regs->pc = infop->entry;
|
||||
if (info_is_fdpic(infop)) {
|
||||
regs->areg[4] = infop->loadmap_addr;
|
||||
regs->areg[5] = infop->interpreter_loadmap_addr;
|
||||
if (infop->interpreter_loadmap_addr) {
|
||||
regs->areg[6] = infop->interpreter_pt_dynamic_addr;
|
||||
} else {
|
||||
regs->areg[6] = infop->pt_dynamic_addr;
|
||||
}
|
||||
}
|
||||
}
|
||||
#define HAVE_INIT_MAIN_THREAD
|
||||
|
||||
/* See linux kernel: arch/xtensa/include/asm/elf.h. */
|
||||
#define ELF_NREG 128
|
||||
|
|
|
|||
|
|
@ -238,12 +238,22 @@ void cpu_loop(CPUXtensaState *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->areg[i];
|
||||
CPUArchState *env = cpu_env(cs);
|
||||
|
||||
env->sregs[WINDOW_BASE] = 0;
|
||||
env->sregs[WINDOW_START] = 1;
|
||||
env->regs[1] = info->start_stack;
|
||||
env->pc = info->entry;
|
||||
|
||||
if (info_is_fdpic(info)) {
|
||||
env->regs[4] = info->loadmap_addr;
|
||||
env->regs[5] = info->interpreter_loadmap_addr;
|
||||
if (info->interpreter_loadmap_addr) {
|
||||
env->regs[6] = info->interpreter_pt_dynamic_addr;
|
||||
} else {
|
||||
env->regs[6] = info->pt_dynamic_addr;
|
||||
}
|
||||
}
|
||||
env->sregs[WINDOW_START] = regs->windowstart;
|
||||
env->pc = regs->pc;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue