mirror of https://github.com/xemu-project/xemu.git
linux-user: add support for xtensa FDPIC
Define xtensa-specific info_is_fdpic and fill in FDPIC-specific registers in the xtensa version of init_thread. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Message-Id: <20230205061230.544451-1-jcmvbkbc@gmail.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
9c1da8b5ee
commit
d2796be69d
|
@ -1619,6 +1619,7 @@ typedef struct elf64_shdr {
|
||||||
#define ELFOSABI_MODESTO 11 /* Novell Modesto. */
|
#define ELFOSABI_MODESTO 11 /* Novell Modesto. */
|
||||||
#define ELFOSABI_OPENBSD 12 /* OpenBSD. */
|
#define ELFOSABI_OPENBSD 12 /* OpenBSD. */
|
||||||
#define ELFOSABI_ARM_FDPIC 65 /* ARM FDPIC */
|
#define ELFOSABI_ARM_FDPIC 65 /* ARM FDPIC */
|
||||||
|
#define ELFOSABI_XTENSA_FDPIC 65 /* Xtensa FDPIC */
|
||||||
#define ELFOSABI_ARM 97 /* ARM */
|
#define ELFOSABI_ARM 97 /* ARM */
|
||||||
#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
|
#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
|
||||||
|
|
||||||
|
|
|
@ -1748,6 +1748,15 @@ static inline void init_thread(struct target_pt_regs *regs,
|
||||||
regs->windowstart = 1;
|
regs->windowstart = 1;
|
||||||
regs->areg[1] = infop->start_stack;
|
regs->areg[1] = infop->start_stack;
|
||||||
regs->pc = infop->entry;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See linux kernel: arch/xtensa/include/asm/elf.h. */
|
/* See linux kernel: arch/xtensa/include/asm/elf.h. */
|
||||||
|
@ -2207,11 +2216,16 @@ static void zero_bss(abi_ulong elf_bss, abi_ulong last_bss, int prot)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TARGET_ARM
|
#if defined(TARGET_ARM)
|
||||||
static int elf_is_fdpic(struct elfhdr *exec)
|
static int elf_is_fdpic(struct elfhdr *exec)
|
||||||
{
|
{
|
||||||
return exec->e_ident[EI_OSABI] == ELFOSABI_ARM_FDPIC;
|
return exec->e_ident[EI_OSABI] == ELFOSABI_ARM_FDPIC;
|
||||||
}
|
}
|
||||||
|
#elif defined(TARGET_XTENSA)
|
||||||
|
static int elf_is_fdpic(struct elfhdr *exec)
|
||||||
|
{
|
||||||
|
return exec->e_ident[EI_OSABI] == ELFOSABI_XTENSA_FDPIC;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
/* Default implementation, always false. */
|
/* Default implementation, always false. */
|
||||||
static int elf_is_fdpic(struct elfhdr *exec)
|
static int elf_is_fdpic(struct elfhdr *exec)
|
||||||
|
|
Loading…
Reference in New Issue