mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-18 23:52:14 -06:00
linux-user/sparc: Clean up init_thread
Share code between sparc32 and sparc64, removing a bit of pointless difference wrt psr/tstate. Use sizeof(abi_ulong) for allocating initial register window. Use TARGET_STACK_BIAS. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210426025334.1168495-7-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
eb215f40c2
commit
089a2256ee
1 changed files with 5 additions and 28 deletions
|
@ -676,48 +676,25 @@ static uint32_t get_elf_hwcap2(void)
|
||||||
|
|
||||||
#define ELF_CLASS ELFCLASS64
|
#define ELF_CLASS ELFCLASS64
|
||||||
#define ELF_ARCH EM_SPARCV9
|
#define ELF_ARCH EM_SPARCV9
|
||||||
|
|
||||||
#define STACK_BIAS 2047
|
|
||||||
|
|
||||||
static inline void init_thread(struct target_pt_regs *regs,
|
|
||||||
struct image_info *infop)
|
|
||||||
{
|
|
||||||
#ifndef TARGET_ABI32
|
|
||||||
regs->tstate = 0;
|
|
||||||
#endif
|
|
||||||
regs->pc = infop->entry;
|
|
||||||
regs->npc = regs->pc + 4;
|
|
||||||
regs->y = 0;
|
|
||||||
#ifdef TARGET_ABI32
|
|
||||||
regs->u_regs[14] = infop->start_stack - 16 * 4;
|
|
||||||
#else
|
|
||||||
if (personality(infop->personality) == PER_LINUX32)
|
|
||||||
regs->u_regs[14] = infop->start_stack - 16 * 4;
|
|
||||||
else
|
|
||||||
regs->u_regs[14] = infop->start_stack - 16 * 8 - STACK_BIAS;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define ELF_START_MMAP 0x80000000
|
#define ELF_START_MMAP 0x80000000
|
||||||
#define ELF_HWCAP (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | HWCAP_SPARC_SWAP \
|
#define ELF_HWCAP (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | HWCAP_SPARC_SWAP \
|
||||||
| HWCAP_SPARC_MULDIV)
|
| HWCAP_SPARC_MULDIV)
|
||||||
|
|
||||||
#define ELF_CLASS ELFCLASS32
|
#define ELF_CLASS ELFCLASS32
|
||||||
#define ELF_ARCH EM_SPARC
|
#define ELF_ARCH EM_SPARC
|
||||||
|
#endif /* TARGET_SPARC64 */
|
||||||
|
|
||||||
static inline void init_thread(struct target_pt_regs *regs,
|
static inline void init_thread(struct target_pt_regs *regs,
|
||||||
struct image_info *infop)
|
struct image_info *infop)
|
||||||
{
|
{
|
||||||
regs->psr = 0;
|
/* Note that target_cpu_copy_regs does not read psr/tstate. */
|
||||||
regs->pc = infop->entry;
|
regs->pc = infop->entry;
|
||||||
regs->npc = regs->pc + 4;
|
regs->npc = regs->pc + 4;
|
||||||
regs->y = 0;
|
regs->y = 0;
|
||||||
regs->u_regs[14] = infop->start_stack - 16 * 4;
|
regs->u_regs[14] = (infop->start_stack - 16 * sizeof(abi_ulong)
|
||||||
|
- TARGET_STACK_BIAS);
|
||||||
}
|
}
|
||||||
|
#endif /* TARGET_SPARC */
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TARGET_PPC
|
#ifdef TARGET_PPC
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue