S/390 CPU emulation
PATCH 2/13 S/390 CPU emulation
Currently only does userspace with 64-bit addressing, but it's quite good at that.
replaced always_inline with inline
Signed-off-by Ulrich Hecht <[email protected]>
--- cpu-exec.c | 42 + disas.c | 3 + s390-dis.c | 4 +- target-s390x/cpu.h | 131 +++ target-s390x/exec.h | 51 + target-s390x/helper.c | 81 ++ target-s390x/helpers.h | 128 +++ target-s390x/op_helper.c | 1719 ++++++++++++++++++++++++++++++++ target-s390x/translate.c | 2479 ++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 4636 insertions(+), 2 deletions(-) create mode 100644 target-s390x/cpu.h create mode 100644 target-s390x/exec.h create mode 100644 target-s390x/helper.c create mode 100644 target-s390x/helpers.h create mode 100644 target-s390x/op_helper.c create mode 100644 target-s390x/translate.c
cpu-exec.c +42 -0
@@ -249,6 +249,7 @@ int cpu_exec(CPUState *env1)#elif defined(TARGET_MIPS )#elif defined(TARGET_SH4 )#elif defined(TARGET_CRIS ) +#elif defined(TARGET_S390X )/* XXXXX */ #else #error unsupported target CPU
@@ -712,6 +713,7 @@ int cpu_exec(CPUState *env1)#elif defined(TARGET_SH4 )#elif defined(TARGET_ALPHA )#elif defined(TARGET_CRIS ) +#elif defined(TARGET_S390X )/* XXXXX */ #else #error unsupported target CPU
@@ -1234,6 +1236,46 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,return 1 ; } +#elif defined (TARGET_S390X ) +static inline int handle_cpu_signal (unsigned long pc,unsigned long address, +int is_write,sigset_t *old_set, +void *puc) +{ +TranslationBlock *tb; +int ret; + +if (cpu_single_env) + env = cpu_single_env;/* XXX: find a correct solution for multithread */ +#if defined(DEBUG_SIGNAL ) +printf ("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n" , + pc, address, is_write, *(unsigned long *)old_set); +#endif +/* XXX: locking issue */ +if (is_write &&page_unprotect (h2g (address), pc, puc)) { +return 1 ; + } + +/* see if it is an MMU fault */ + ret =cpu_s390x_handle_mmu_fault (env, address, is_write,MMU_USER_IDX ,0 ); +if (ret <0 ) +return 0 ;/* not an MMU fault */ +if (ret ==0 ) +return 1 ;/* the MMU fault was handled without causing real CPU fault */ + +/* now we have a real cpu fault */ + tb =tb_find_pc (pc); +if (tb) { +/* the PC is inside the translated code. It means that we have +a virtual CPU fault */ +cpu_restore_state (tb, env, pc, puc); + } +/* we restore the process signal mask as the sigreturn should +do it (XXX: use sigsetjmp) */ +sigprocmask (SIG_SETMASK , old_set,NULL ); +cpu_loop_exit (); +/* never comes here */ +return 1 ; +}#else #error unsupported target CPU#endif
disas.c +3 -0
@@ -195,6 +195,9 @@ void target_disas(FILE *out, target_ulong code, target_ulong size, int flags)#elif defined(TARGET_CRIS ) disasm_info.mach = bfd_mach_cris_v32; print_insn = print_insn_crisv32; +#elif defined(TARGET_S390X ) + disasm_info.mach = bfd_mach_s390_64; + print_insn = print_insn_s390;#elif defined(TARGET_MICROBLAZE ) disasm_info.mach = bfd_arch_microblaze; print_insn = print_insn_microblaze;
s390-dis.c +2 -2
@@ -191,10 +191,10 @@ init_disasm (struct disassemble_info *info)// switch (info->mach) // { // case bfd_mach_s390_31: - current_arch_mask =1 <<S390_OPCODE_ESA ; +// current_arch_mask = 1 << S390_OPCODE_ESA; // break; // case bfd_mach_s390_64: -// current_arch_mask = 1 << S390_OPCODE_ZARCH; + current_arch_mask =1 <<S390_OPCODE_ZARCH ;// break; // default: // abort ();
target-s390x/cpu.h new file +131 -0
131 lines not on this page · raw message
target-s390x/exec.h new file +51 -0
51 lines not on this page · raw message
target-s390x/helper.c new file +81 -0
81 lines not on this page · raw message
target-s390x/helpers.h new file +128 -0
128 lines not on this page · raw message
target-s390x/op_helper.c new file +1719 -0
1,719 lines not on this page · raw message
target-s390x/translate.c new file +2479 -0
809 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.6.2.1
Part of the diff is not shown here. View the raw message.