mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
nios2: Add usermode binaries emulation
Add missing bits for qemu-user required for emulating Altera Nios2 userspace binaries. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Chris Wulff <crwulff@gmail.com> Cc: Jeff Da Silva <jdasilva@altera.com> Cc: Ley Foon Tan <lftan@altera.com> Cc: Sandra Loosemore <sandra@codesourcery.com> Cc: Yves Vandervennet <yvanderv@altera.com> Reviewed-by: Alexander Graf <agraf@suse.de> Message-Id: <20170118220146.489-4-marex@denx.de> Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
parent
3f0c342309
commit
a0a839b65b
11 changed files with 1148 additions and 7 deletions
|
|
@ -967,6 +967,63 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUMBState *env
|
|||
|
||||
#endif /* TARGET_MICROBLAZE */
|
||||
|
||||
#ifdef TARGET_NIOS2
|
||||
|
||||
#define ELF_START_MMAP 0x80000000
|
||||
|
||||
#define elf_check_arch(x) ((x) == EM_ALTERA_NIOS2)
|
||||
|
||||
#define ELF_CLASS ELFCLASS32
|
||||
#define ELF_ARCH EM_ALTERA_NIOS2
|
||||
|
||||
static void init_thread(struct target_pt_regs *regs, struct image_info *infop)
|
||||
{
|
||||
regs->ea = infop->entry;
|
||||
regs->sp = infop->start_stack;
|
||||
regs->estatus = 0x3;
|
||||
}
|
||||
|
||||
#define ELF_EXEC_PAGESIZE 4096
|
||||
|
||||
#define USE_ELF_CORE_DUMP
|
||||
#define ELF_NREG 49
|
||||
typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
|
||||
|
||||
/* See linux kernel: arch/mips/kernel/process.c:elf_dump_regs. */
|
||||
static void elf_core_copy_regs(target_elf_gregset_t *regs,
|
||||
const CPUNios2State *env)
|
||||
{
|
||||
int i;
|
||||
|
||||
(*regs)[0] = -1;
|
||||
for (i = 1; i < 8; i++) /* r0-r7 */
|
||||
(*regs)[i] = tswapreg(env->regs[i + 7]);
|
||||
|
||||
for (i = 8; i < 16; i++) /* r8-r15 */
|
||||
(*regs)[i] = tswapreg(env->regs[i - 8]);
|
||||
|
||||
for (i = 16; i < 24; i++) /* r16-r23 */
|
||||
(*regs)[i] = tswapreg(env->regs[i + 7]);
|
||||
(*regs)[24] = -1; /* R_ET */
|
||||
(*regs)[25] = -1; /* R_BT */
|
||||
(*regs)[26] = tswapreg(env->regs[R_GP]);
|
||||
(*regs)[27] = tswapreg(env->regs[R_SP]);
|
||||
(*regs)[28] = tswapreg(env->regs[R_FP]);
|
||||
(*regs)[29] = tswapreg(env->regs[R_EA]);
|
||||
(*regs)[30] = -1; /* R_SSTATUS */
|
||||
(*regs)[31] = tswapreg(env->regs[R_RA]);
|
||||
|
||||
(*regs)[32] = tswapreg(env->regs[R_PC]);
|
||||
|
||||
(*regs)[33] = -1; /* R_STATUS */
|
||||
(*regs)[34] = tswapreg(env->regs[CR_ESTATUS]);
|
||||
|
||||
for (i = 35; i < 49; i++) /* ... */
|
||||
(*regs)[i] = -1;
|
||||
}
|
||||
|
||||
#endif /* TARGET_NIOS2 */
|
||||
|
||||
#ifdef TARGET_OPENRISC
|
||||
|
||||
#define ELF_START_MMAP 0x08000000
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue