mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
target/xtensa: add linux-user support
Import list of syscalls from the kernel source. Conditionalize code/data that is only used with softmmu. Implement exception handlers. Implement signal hander (only the core registers for now, no coprocessors or TIE). Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
parent
bf9c3a5a96
commit
ba7651fba5
22 changed files with 1705 additions and 44 deletions
|
@ -1341,6 +1341,64 @@ static inline void init_thread(struct target_pt_regs *regs,
|
|||
|
||||
#endif /* TARGET_HPPA */
|
||||
|
||||
#ifdef TARGET_XTENSA
|
||||
|
||||
#define ELF_START_MMAP 0x20000000
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
/* See linux kernel: arch/xtensa/include/asm/elf.h. */
|
||||
#define ELF_NREG 128
|
||||
typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
|
||||
|
||||
enum {
|
||||
TARGET_REG_PC,
|
||||
TARGET_REG_PS,
|
||||
TARGET_REG_LBEG,
|
||||
TARGET_REG_LEND,
|
||||
TARGET_REG_LCOUNT,
|
||||
TARGET_REG_SAR,
|
||||
TARGET_REG_WINDOWSTART,
|
||||
TARGET_REG_WINDOWBASE,
|
||||
TARGET_REG_THREADPTR,
|
||||
TARGET_REG_AR0 = 64,
|
||||
};
|
||||
|
||||
static void elf_core_copy_regs(target_elf_gregset_t *regs,
|
||||
const CPUXtensaState *env)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
(*regs)[TARGET_REG_PC] = tswapreg(env->pc);
|
||||
(*regs)[TARGET_REG_PS] = tswapreg(env->sregs[PS] & ~PS_EXCM);
|
||||
(*regs)[TARGET_REG_LBEG] = tswapreg(env->sregs[LBEG]);
|
||||
(*regs)[TARGET_REG_LEND] = tswapreg(env->sregs[LEND]);
|
||||
(*regs)[TARGET_REG_LCOUNT] = tswapreg(env->sregs[LCOUNT]);
|
||||
(*regs)[TARGET_REG_SAR] = tswapreg(env->sregs[SAR]);
|
||||
(*regs)[TARGET_REG_WINDOWSTART] = tswapreg(env->sregs[WINDOW_START]);
|
||||
(*regs)[TARGET_REG_WINDOWBASE] = tswapreg(env->sregs[WINDOW_BASE]);
|
||||
(*regs)[TARGET_REG_THREADPTR] = tswapreg(env->uregs[THREADPTR]);
|
||||
xtensa_sync_phys_from_window((CPUXtensaState *)env);
|
||||
for (i = 0; i < env->config->nareg; ++i) {
|
||||
(*regs)[TARGET_REG_AR0 + i] = tswapreg(env->phys_regs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#define USE_ELF_CORE_DUMP
|
||||
#define ELF_EXEC_PAGESIZE 4096
|
||||
|
||||
#endif /* TARGET_XTENSA */
|
||||
|
||||
#ifndef ELF_PLATFORM
|
||||
#define ELF_PLATFORM (NULL)
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue