s390 patch queue 2012-09-10
Hi Blue / Aurelien,
This is my current patch queue for s390. Please pull.
It contains:
- tcg fix for s390 hosts
- convert s390 target to be areg0 free
Alex
The following changes since commit 0c267217ca9985e6d118ec8368bebd382db7a099:
Jan Kiszka (1):
musicpal: Fix flash mapping
are available in the git repository at:
git://repo.or.cz/qemu/agraf.git s390-for-upstream
Aurelien Jarno (1):
tcg/s390: fix ld/st with CONFIG_TCG_PASS_AREG0
Blue Swirl (11):
target-s390x: fix style
target-s390x: split FPU ops
target-s390x: split condition code helpers
target-s390x: split integer helpers
target-s390x: split memory access helpers
target-s390x: rename op_helper.c to misc_helper.c
target-s390x: avoid AREG0 for FPU helpers
target-s390x: avoid AREG0 for integer helpers
target-s390x: avoid AREG0 for condition code helpers
target-s390x: avoid AREG0 for misc helpers
target-s390x: switch to AREG0 free modeconfigure | 2 +- target-s390x/Makefile.objs | 5 +- target-s390x/cc_helper.c | 550 ++++++++ target-s390x/cpu.h | 9 + target-s390x/fpu_helper.c | 843 ++++++++++++ target-s390x/helper.c | 102 +- target-s390x/helper.h | 250 ++-- target-s390x/int_helper.c | 201 +++ target-s390x/mem_helper.c | 1203 ++++++++++++++++++ target-s390x/misc_helper.c | 430 +++++++ target-s390x/op_helper.c | 3019 -------------------------------------------- target-s390x/translate.c | 233 ++-- tcg/s390/tcg-target.c | 14 +- 13 files changed, 3537 insertions(+), 3324 deletions(-) create mode 100644 target-s390x/cc_helper.c create mode 100644 target-s390x/fpu_helper.c create mode 100644 target-s390x/int_helper.c create mode 100644 target-s390x/mem_helper.c create mode 100644 target-s390x/misc_helper.c delete mode 100644 target-s390x/op_helper.c
PATCH 1/12 target-s390x: fix style
From: Blue Swirl <[email protected]>
Before splitting op_helper.c and helper.c in the next patches, fix style issues. No functional changes.
Replace also GCC specific __FUNCTION__ with
standard __func__.
Don't init static variable (cpu_s390x_init:inited) with 0.
--- target-s390x/helper.c | 96 +++++----- target-s390x/op_helper.c | 438 ++++++++++++++++++++++++++-------------------- 2 files changed, 297 insertions(+), 237 deletions(-)
target-s390x/helper.c +49 -47
@@ -74,7 +74,7 @@ S390CPU *cpu_s390x_init(const char *cpu_model) {S390CPU *cpu;CPUS390XState *env; -static int inited =0 ; +static int inited; cpu =S390_CPU (object_new (TYPE_S390_CPU )); env = &cpu->env;
@@ -91,25 +91,27 @@ S390CPU *cpu_s390x_init(const char *cpu_model)#if defined(CONFIG_USER_ONLY ) -void do_interrupt (CPUS390XState *env) +void do_interrupt (CPUS390XState *env) { env->exception_index =-1 ; } -int cpu_s390x_handle_mmu_fault (CPUS390XState *env,target_ulong address,int rw, -int mmu_idx) +int cpu_s390x_handle_mmu_fault (CPUS390XState *env,target_ulong address, +int rw,int mmu_idx) { -/* fprintf(stderr,"%s: address 0x%lx rw %d mmu_idx %d\n", -__FUNCTION__, address, rw, mmu_idx); */ +/* fprintf(stderr, "%s: address 0x%lx rw %d mmu_idx %d\n", +__func__, address, rw, mmu_idx); */ env->exception_index =EXCP_ADDR ; - env->__excp_addr = address;/* FIXME: find out how this works on a real machine */ +/* FIXME: find out how this works on a real machine */ + env->__excp_addr = address;return 1 ; }#else /* !CONFIG_USER_ONLY */ /* Ensure to exit the TB after this call! */ -static void trigger_pgm_exception (CPUS390XState *env,uint32_t code,uint32_t ilc) +static void trigger_pgm_exception (CPUS390XState *env,uint32_t code, +uint32_t ilc) { env->exception_index =EXCP_PGM ; env->int_pgm_code = code;
@@ -138,19 +140,20 @@ static int trans_bits(CPUS390XState *env, uint64_t mode)return bits; } -static void trigger_prot_fault (CPUS390XState *env,target_ulong vaddr,uint64_t mode) +static void trigger_prot_fault (CPUS390XState *env,target_ulong vaddr, +uint64_t mode) {int ilc =ILC_LATER_INC_2 ;int bits =trans_bits (env, mode) |4 ; -DPRINTF ("%s: vaddr=%016" PRIx64" bits=%d\n" , __FUNCTION__, vaddr, bits); +DPRINTF ("%s: vaddr=%016" PRIx64" bits=%d\n" , __func__, vaddr, bits);stq_phys (env->psa + offsetof(LowCore , trans_exc_code), vaddr | bits);trigger_pgm_exception (env,PGM_PROTECTION , ilc); } -static void trigger_page_fault (CPUS390XState *env,target_ulong vaddr,uint32_t type, -uint64_t asc,int rw) +static void trigger_page_fault (CPUS390XState *env,target_ulong vaddr, +uint32_t type,uint64_t asc,int rw) {int ilc =ILC_LATER ;int bits =trans_bits (env, asc);
@@ -160,26 +163,26 @@ static void trigger_page_fault(CPUS390XState *env, target_ulong vaddr, uint32_t ilc =2 ; } -DPRINTF ("%s: vaddr=%016" PRIx64" bits=%d\n" , __FUNCTION__, vaddr, bits); +DPRINTF ("%s: vaddr=%016" PRIx64" bits=%d\n" , __func__, vaddr, bits);stq_phys (env->psa + offsetof(LowCore , trans_exc_code), vaddr | bits);trigger_pgm_exception (env, type, ilc); } -static int mmu_translate_asce (CPUS390XState *env,target_ulong vaddr,uint64_t asc, -uint64_t asce,int level,target_ulong *raddr, -int *flags,int rw) +static int mmu_translate_asce (CPUS390XState *env,target_ulong vaddr, +uint64_t asc,uint64_t asce,int level, +target_ulong *raddr,int *flags,int rw) {uint64_t offs =0 ;uint64_t origin;uint64_t new_asce; -PTE_DPRINTF ("%s: 0x%" PRIx64"\n" , __FUNCTION__, asce); +PTE_DPRINTF ("%s: 0x%" PRIx64"\n" , __func__, asce);if (((level != _ASCE_TYPE_SEGMENT) && (asce & _REGION_ENTRY_INV)) || ((level == _ASCE_TYPE_SEGMENT) && (asce & _SEGMENT_ENTRY_INV))) {/* XXX different regions have different faults */ -DPRINTF ("%s: invalid region\n" , __FUNCTION__); +DPRINTF ("%s: invalid region\n" , __func__);trigger_page_fault (env, vaddr,PGM_SEGMENT_TRANS , asc, rw);return -1 ; }
@@ -222,7 +225,7 @@ static int mmu_translate_asce(CPUS390XState *env, target_ulong vaddr, uint64_t a new_asce =ldq_phys (origin + offs);PTE_DPRINTF ("%s: 0x%" PRIx64" + 0x%" PRIx64" => 0x%016" PRIx64"\n" , - __FUNCTION__, origin, offs, new_asce); + __func__, origin, offs, new_asce);if (level != _ASCE_TYPE_SEGMENT) {/* yet another region */
@@ -232,7 +235,7 @@ static int mmu_translate_asce(CPUS390XState *env, target_ulong vaddr, uint64_t a/* PTE */ if (new_asce & _PAGE_INVALID) { -DPRINTF ("%s: PTE=0x%" PRIx64" invalid\n" , __FUNCTION__, new_asce); +DPRINTF ("%s: PTE=0x%" PRIx64" invalid\n" , __func__, new_asce);trigger_page_fault (env, vaddr,PGM_PAGE_TRANS , asc, rw);return -1 ; }
@@ -243,13 +246,14 @@ static int mmu_translate_asce(CPUS390XState *env, target_ulong vaddr, uint64_t a *raddr = new_asce & _ASCE_ORIGIN; -PTE_DPRINTF ("%s: PTE=0x%" PRIx64"\n" , __FUNCTION__, new_asce); +PTE_DPRINTF ("%s: PTE=0x%" PRIx64"\n" , __func__, new_asce);return 0 ; } -static int mmu_translate_asc (CPUS390XState *env,target_ulong vaddr,uint64_t asc, -target_ulong *raddr,int *flags,int rw) +static int mmu_translate_asc (CPUS390XState *env,target_ulong vaddr, +uint64_t asc,target_ulong *raddr,int *flags, +int rw) {uint64_t asce =0 ;int level, new_level;
@@ -257,15 +261,15 @@ static int mmu_translate_asc(CPUS390XState *env, target_ulong vaddr, uint64_t asswitch (asc) {case PSW_ASC_PRIMARY : -PTE_DPRINTF ("%s: asc=primary\n" , __FUNCTION__); +PTE_DPRINTF ("%s: asc=primary\n" , __func__); asce = env->cregs[1 ];break ;case PSW_ASC_SECONDARY : -PTE_DPRINTF ("%s: asc=secondary\n" , __FUNCTION__); +PTE_DPRINTF ("%s: asc=secondary\n" , __func__); asce = env->cregs[7 ];break ;case PSW_ASC_HOME : -PTE_DPRINTF ("%s: asc=home\n" , __FUNCTION__); +PTE_DPRINTF ("%s: asc=home\n" , __func__); asce = env->cregs[13 ];break ; }
@@ -276,8 +280,7 @@ static int mmu_translate_asc(CPUS390XState *env, target_ulong vaddr, uint64_t ascase _ASCE_TYPE_REGION2:if (vaddr &0xffe0000000000000ULL ) {DPRINTF ("%s: vaddr doesn't fit 0x%16" PRIx64 -" 0xffe0000000000000ULL\n" , __FUNCTION__, - vaddr); +" 0xffe0000000000000ULL\n" , __func__, vaddr);trigger_page_fault (env, vaddr,PGM_TRANS_SPEC , asc, rw);return -1 ; }
@@ -285,8 +288,7 @@ static int mmu_translate_asc(CPUS390XState *env, target_ulong vaddr, uint64_t ascase _ASCE_TYPE_REGION3:if (vaddr &0xfffffc0000000000ULL ) {DPRINTF ("%s: vaddr doesn't fit 0x%16" PRIx64 -" 0xfffffc0000000000ULL\n" , __FUNCTION__, - vaddr); +" 0xfffffc0000000000ULL\n" , __func__, vaddr);trigger_page_fault (env, vaddr,PGM_TRANS_SPEC , asc, rw);return -1 ; }
@@ -294,8 +296,7 @@ static int mmu_translate_asc(CPUS390XState *env, target_ulong vaddr, uint64_t ascase _ASCE_TYPE_SEGMENT:if (vaddr &0xffffffff80000000ULL ) {DPRINTF ("%s: vaddr doesn't fit 0x%16" PRIx64 -" 0xffffffff80000000ULL\n" , __FUNCTION__, - vaddr); +" 0xffffffff80000000ULL\n" , __func__, vaddr);trigger_page_fault (env, vaddr,PGM_TRANS_SPEC , asc, rw);return -1 ; }
@@ -358,7 +359,7 @@ int mmu_translate(CPUS390XState *env, target_ulong vaddr, int rw, uint64_t asc,break ; } -out: + out:/* Convert real address -> absolute address */ if (*raddr <0x2000 ) { *raddr = *raddr + env->psa;
@@ -378,18 +379,18 @@ out:return r; } -int cpu_s390x_handle_mmu_fault (CPUS390XState *env,target_ulong _vaddr,int rw, -int mmu_idx) +int cpu_s390x_handle_mmu_fault (CPUS390XState *env,target_ulong orig_vaddr, +int rw,int mmu_idx) {uint64_t asc = env->psw.mask &PSW_MASK_ASC ;target_ulong vaddr, raddr;int prot;DPRINTF ("%s: address 0x%" PRIx64" rw %d mmu_idx %d\n" , - __FUNCTION__, _vaddr, rw, mmu_idx); + __func__, _vaddr, rw, mmu_idx); - _vaddr &=TARGET_PAGE_MASK ; - vaddr = _vaddr; + orig_vaddr &=TARGET_PAGE_MASK ; + vaddr = orig_vaddr;/* 31-Bit mode */ if (!(env->psw.mask &PSW_MASK_64 )) {
@@ -403,22 +404,23 @@ int cpu_s390x_handle_mmu_fault (CPUS390XState *env, target_ulong _vaddr, int rw,/* check out of RAM access */ if (raddr > (ram_size + virtio_size)) { -DPRINTF ("%s: aaddr %" PRIx64" > ram_size %" PRIx64"\n" , __FUNCTION__, +DPRINTF ("%s: aaddr %" PRIx64" > ram_size %" PRIx64"\n" , __func__, (uint64_t )aaddr, (uint64_t )ram_size);trigger_pgm_exception (env,PGM_ADDRESSING ,ILC_LATER );return 1 ; } -DPRINTF ("%s: set tlb %" PRIx64" -> %" PRIx64" (%x)\n" , __FUNCTION__, +DPRINTF ("%s: set tlb %" PRIx64" -> %" PRIx64" (%x)\n" , __func__, (uint64_t )vaddr, (uint64_t )raddr, prot); -tlb_set_page (env, _vaddr, raddr, prot, +tlb_set_page (env, orig_vaddr, raddr, prot, mmu_idx,TARGET_PAGE_SIZE );return 0 ; } -target_phys_addr_t cpu_get_phys_page_debug (CPUS390XState *env,target_ulong vaddr) +target_phys_addr_t cpu_get_phys_page_debug (CPUS390XState *env, +target_ulong vaddr) {target_ulong raddr;int prot =PAGE_READ |PAGE_WRITE |PAGE_EXEC ;
@@ -509,7 +511,7 @@ static void do_program_interrupt(CPUS390XState *env)break ; } -qemu_log ("%s: code=0x%x ilc=%d\n" , __FUNCTION__, env->int_pgm_code, ilc); +qemu_log ("%s: code=0x%x ilc=%d\n" , __func__, env->int_pgm_code, ilc); lowcore =cpu_physical_memory_map (env->psa, &len,1 );
@@ -522,7 +524,7 @@ static void do_program_interrupt(CPUS390XState *env)cpu_physical_memory_unmap (lowcore, len,1 , len); -DPRINTF ("%s: %x %x %" PRIx64" %" PRIx64"\n" , __FUNCTION__, +DPRINTF ("%s: %x %x %" PRIx64" %" PRIx64"\n" , __func__, env->int_pgm_code, ilc, env->psw.mask, env->psw.addr);
@@ -565,15 +567,15 @@ static void do_ext_interrupt(CPUS390XState *env) env->pending_int &= ~INTERRUPT_EXT ; } -DPRINTF ("%s: %" PRIx64" %" PRIx64"\n" , __FUNCTION__, +DPRINTF ("%s: %" PRIx64" %" PRIx64"\n" , __func__, env->psw.mask, env->psw.addr);load_psw (env, mask, addr); } -void do_interrupt (CPUS390XState *env) +void do_interrupt (CPUS390XState *env) { -qemu_log ("%s: %d at pc=%" PRIx64"\n" , __FUNCTION__, env->exception_index, +qemu_log ("%s: %d at pc=%" PRIx64"\n" , __func__, env->exception_index, env->psw.addr);s390_add_running_cpu (env);
target-s390x/op_helper.c +248 -190
1,184 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 2/12 target-s390x: split FPU ops
In reply to Alexander GrafFrom: Blue Swirl <[email protected]>
Move floating point instructions to fpu_helper.c.
While exporting some condition code helpers, avoid duplicate identifier conflict with translate.c.
Remove unused set_cc_nz_f64() in translate.c.
--- target-s390x/Makefile.objs | 2 + target-s390x/cpu.h | 6 + target-s390x/fpu_helper.c | 836 ++++++++++++++++++++++++++++++++++++++++++++ target-s390x/op_helper.c | 802 ------------------------------------------ target-s390x/translate.c | 11 +- 5 files changed, 847 insertions(+), 810 deletions(-) create mode 100644 target-s390x/fpu_helper.c
target-s390x/Makefile.objs +2 -0
@@ -1,5 +1,7 @@ obj-y += translate.o op_helper.o helper.o cpu.o interrupt.o +obj-y += fpu_helper.o obj-$(CONFIG_SOFTMMU) += machine.o obj-$(CONFIG_KVM) += kvm.o $(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) +$(obj)/fpu_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
target-s390x/cpu.h +6 -0
@@ -999,4 +999,10 @@ static inline void cpu_pc_from_tb(CPUS390XState *env, TranslationBlock* tb) env->psw.addr = tb->pc; } +/* fpu_helper.c */ +uint32_t set_cc_f32 (float32 v1,float32 v2); +uint32_t set_cc_f64 (float64 v1,float64 v2); +uint32_t set_cc_nz_f32 (float32 v); +uint32_t set_cc_nz_f64 (float64 v); +#endif
target-s390x/fpu_helper.c new file +836 -0
836 lines not on this page · raw message
target-s390x/op_helper.c +0 -802
814 lines not on this page · raw message
target-s390x/translate.c +3 -8
@@ -667,16 +667,11 @@ static void set_cc_cmp_f32_i64(DisasContext *s, TCGv_i32 v1, TCGv_i64 v2) s->cc_op =CC_OP_LTGT_F32 ; } -static void set_cc_nz_f32 (DisasContext *s,TCGv_i32 v1) +static void gen_set_cc_nz_f32 (DisasContext *s,TCGv_i32 v1) {gen_op_update1_cc_i32 (s,CC_OP_NZ_F32 , v1); } -static inline void set_cc_nz_f64 (DisasContext *s,TCGv_i64 v1) -{ -gen_op_update1_cc_i64 (s,CC_OP_NZ_F64 , v1); -} -/* CC value is in env->cc_op */ static inline void set_cc_static (DisasContext *s) {
@@ -2235,7 +2230,7 @@ static void disas_ed(DisasContext *s, int op, int r1, int x2, int b2, int d2,tcg_temp_free_i32 (tmp32); tmp32 =load_freg32 (r1); -set_cc_nz_f32 (s, tmp32); +gen_set_cc_nz_f32 (s, tmp32);tcg_temp_free_i32 (tmp32);break ;case 0xb :/* SEB R1,D2(X2,B2) [RXE] */
@@ -2248,7 +2243,7 @@ static void disas_ed(DisasContext *s, int op, int r1, int x2, int b2, int d2,tcg_temp_free_i32 (tmp32); tmp32 =load_freg32 (r1); -set_cc_nz_f32 (s, tmp32); +gen_set_cc_nz_f32 (s, tmp32);tcg_temp_free_i32 (tmp32);break ;case 0xd :/* DEB R1,D2(X2,B2) [RXE] */
Signature · 1 line
1.6.0.2
PATCH 3/12 target-s390x: split condition code helpers
In reply to Alexander GrafFrom: Blue Swirl <[email protected]>
Move condition code helpers to cc_helper.c.
--- target-s390x/Makefile.objs | 3 +- target-s390x/cc_helper.c | 551 ++++++++++++++++++++++++++++++++++++++++++++ target-s390x/cpu.h | 3 + target-s390x/op_helper.c | 522 +----------------------------------------- 4 files changed, 557 insertions(+), 522 deletions(-) create mode 100644 target-s390x/cc_helper.c
target-s390x/Makefile.objs +2 -1
@@ -1,7 +1,8 @@ obj-y += translate.o op_helper.o helper.o cpu.o interrupt.o -obj-y += fpu_helper.o +obj-y += fpu_helper.o cc_helper.o obj-$(CONFIG_SOFTMMU) += machine.o obj-$(CONFIG_KVM) += kvm.o $(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/fpu_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) +$(obj)/cc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
target-s390x/cc_helper.c new file +551 -0
551 lines not on this page · raw message
target-s390x/cpu.h +3 -0
@@ -1005,4 +1005,7 @@ uint32_t set_cc_f64(float64 v1, float64 v2);uint32_t set_cc_nz_f32 (float32 v);uint32_t set_cc_nz_f64 (float64 v); +/* op_helper.c */ +void program_interrupt (CPUS390XState *env,uint32_t code,int ilc); +#endif
target-s390x/op_helper.c +1 -521
546 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 4/12 target-s390x: split integer helpers
In reply to Alexander GrafFrom: Blue Swirl <[email protected]>
Move integer helpers to int_helper.c.
--- target-s390x/Makefile.objs | 3 +- target-s390x/int_helper.c | 201 ++++++++++++++++++++++++++++++++++++++++++++ target-s390x/op_helper.c | 170 ------------------------------------- 3 files changed, 203 insertions(+), 171 deletions(-) create mode 100644 target-s390x/int_helper.c
target-s390x/Makefile.objs +2 -1
@@ -1,8 +1,9 @@ obj-y += translate.o op_helper.o helper.o cpu.o interrupt.o -obj-y += fpu_helper.o cc_helper.o +obj-y += int_helper.o fpu_helper.o cc_helper.o obj-$(CONFIG_SOFTMMU) += machine.o obj-$(CONFIG_KVM) += kvm.o $(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) +$(obj)/int_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/fpu_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/cc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
target-s390x/int_helper.c new file +201 -0
201 lines not on this page · raw message
target-s390x/op_helper.c +0 -170
194 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 5/12 target-s390x: split memory access helpers
In reply to Alexander GrafFrom: Blue Swirl <[email protected]>
Move memory access helpers to mem_helper.c.
--- target-s390x/Makefile.objs | 3 +- target-s390x/mem_helper.c | 1190 ++++++++++++++++++++++++++++++++++++++++++++ target-s390x/op_helper.c | 1159 +------------------------------------------ 3 files changed, 1193 insertions(+), 1159 deletions(-) create mode 100644 target-s390x/mem_helper.c
target-s390x/Makefile.objs +2 -1
@@ -1,5 +1,5 @@ obj-y += translate.o op_helper.o helper.o cpu.o interrupt.o -obj-y += int_helper.o fpu_helper.o cc_helper.o +obj-y += int_helper.o fpu_helper.o cc_helper.o mem_helper.o obj-$(CONFIG_SOFTMMU) += machine.o obj-$(CONFIG_KVM) += kvm.o
@@ -7,3 +7,4 @@ $(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/int_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/fpu_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/cc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) +$(obj)/mem_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
target-s390x/mem_helper.c new file +1190 -0
1,190 lines not on this page · raw message
target-s390x/op_helper.c +1 -1158
1,182 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 6/12 target-s390x: rename op_helper.c to misc_helper.c
In reply to Alexander GrafFrom: Blue Swirl <[email protected]>
Now op_helper.c contains miscellaneous helpers, rename it to misc_helper.c.
---
target-s390x/Makefile.objs | 6 +++---
target-s390x/cpu.h | 2 +-
target-s390x/{op_helper.c => misc_helper.c} | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
rename target-s390x/{op_helper.c => misc_helper.c} (99%)target-s390x/Makefile.objs +3 -3
@@ -1,10 +1,10 @@ -obj-y += translate.o op_helper.o helper.o cpu.o interrupt.o -obj-y += int_helper.o fpu_helper.o cc_helper.o mem_helper.o +obj-y += translate.o helper.o cpu.o interrupt.o +obj-y += int_helper.o fpu_helper.o cc_helper.o mem_helper.o misc_helper.o obj-$(CONFIG_SOFTMMU) += machine.o obj-$(CONFIG_KVM) += kvm.o -$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/int_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/fpu_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/cc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/mem_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) +$(obj)/misc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
target-s390x/cpu.h +1 -1
@@ -1005,7 +1005,7 @@ uint32_t set_cc_f64(float64 v1, float64 v2);uint32_t set_cc_nz_f32 (float32 v);uint32_t set_cc_nz_f64 (float64 v); -/* op_helper.c */ +/* misc_helper.c */ void program_interrupt (CPUS390XState *env,uint32_t code,int ilc);#endif
target-s390x/misc_helper.c renamed from target-s390x/op_helper.c +1 -1
@@ -1,5 +1,5 @@/* -* S/390 helper routines +* S/390 misc helper routines * * Copyright (c) 2009 Ulrich Hecht * Copyright (c) 2009 Alexander Graf
Signature · 1 line
1.6.0.2
PATCH 7/12 target-s390x: avoid AREG0 for FPU helpers
In reply to Alexander GrafFrom: Blue Swirl <[email protected]>
Make FPU helpers take a parameter for CPUState instead of relying on global env.
Introduce temporary wrappers for FPU load and store ops.
--- target-s390x/Makefile.objs | 1 - target-s390x/cc_helper.c | 4 +- target-s390x/cpu.h | 14 +++- target-s390x/fpu_helper.c | 184 +++++++++++++++++++++++--------------------- target-s390x/helper.h | 126 +++++++++++++++--------------- target-s390x/mem_helper.c | 49 ++++++++++++ target-s390x/translate.c | 70 ++++++++-------- 7 files changed, 257 insertions(+), 191 deletions(-)
target-s390x/Makefile.objs +0 -1
@@ -4,7 +4,6 @@ obj-$(CONFIG_SOFTMMU) += machine.o obj-$(CONFIG_KVM) += kvm.o $(obj)/int_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) -$(obj)/fpu_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/cc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/mem_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/misc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
target-s390x/cc_helper.c +2 -2
@@ -473,10 +473,10 @@ static inline uint32_t do_calc_cc(CPUS390XState *env, uint32_t cc_op,break ;case CC_OP_LTGT_F32 : - r =set_cc_f32 (src, dst); + r =set_cc_f32 (env, src, dst);break ;case CC_OP_LTGT_F64 : - r =set_cc_f64 (src, dst); + r =set_cc_f64 (env, src, dst);break ;case CC_OP_NZ_F32 : r =set_cc_nz_f32 (dst);
target-s390x/cpu.h +12 -2
@@ -1000,12 +1000,22 @@ static inline void cpu_pc_from_tb(CPUS390XState *env, TranslationBlock* tb) }/* fpu_helper.c */ -uint32_t set_cc_f32 (float32 v1,float32 v2); -uint32_t set_cc_f64 (float64 v1,float64 v2); +uint32_t set_cc_f32 (CPUS390XState *env,float32 v1,float32 v2); +uint32_t set_cc_f64 (CPUS390XState *env,float64 v1,float64 v2);uint32_t set_cc_nz_f32 (float32 v);uint32_t set_cc_nz_f64 (float64 v);/* misc_helper.c */ void program_interrupt (CPUS390XState *env,uint32_t code,int ilc); +/* temporary wrappers */ +uint32_t cpu_ldub_data (CPUS390XState *env,target_ulong ptr); +uint32_t cpu_lduw_data (CPUS390XState *env,target_ulong ptr); +uint32_t cpu_ldl_data (CPUS390XState *env,target_ulong ptr); +uint64_t cpu_ldq_data (CPUS390XState *env,target_ulong ptr); + +void cpu_stb_data (CPUS390XState *env,target_ulong ptr,uint32_t data); +void cpu_stw_data (CPUS390XState *env,target_ulong ptr,uint32_t data); +void cpu_stl_data (CPUS390XState *env,target_ulong ptr,uint32_t data); +void cpu_stq_data (CPUS390XState *env,target_ulong ptr,uint64_t data);#endif
target-s390x/fpu_helper.c +96 -88
642 lines not on this page · raw message
target-s390x/helper.h +63 -63
133 lines not on this page · raw message
target-s390x/mem_helper.c +49 -0
52 lines not on this page · raw message
target-s390x/translate.c +35 -35
229 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 8/12 target-s390x: avoid AREG0 for integer helpers
In reply to Alexander GrafFrom: Blue Swirl <[email protected]>
Make integer helpers take a parameter for CPUState instead of relying on global env.
--- target-s390x/Makefile.objs | 1 - target-s390x/helper.h | 10 +++++----- target-s390x/int_helper.c | 12 ++++++------ target-s390x/translate.c | 16 ++++++++-------- 4 files changed, 19 insertions(+), 20 deletions(-)
target-s390x/Makefile.objs +0 -1
@@ -3,7 +3,6 @@ obj-y += int_helper.o fpu_helper.o cc_helper.o mem_helper.o misc_helper.o obj-$(CONFIG_SOFTMMU) += machine.o obj-$(CONFIG_KVM) += kvm.o -$(obj)/int_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/cc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/mem_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/misc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
target-s390x/helper.h +5 -5
@@ -12,8 +12,8 @@ DEF_HELPER_FLAGS_1(set_cc_comp_s64, TCG_CALL_PURE|TCG_CALL_CONST, i32, s64) DEF_HELPER_FLAGS_2(set_cc_icm, TCG_CALL_PURE|TCG_CALL_CONST, i32, i32, i32) DEF_HELPER_3(clm, i32, i32, i32, i64) DEF_HELPER_3(stcm, void, i32, i32, i64) -DEF_HELPER_2(mlg, void, i32, i64) -DEF_HELPER_2(dlg, void, i32, i64) +DEF_HELPER_3(mlg, void, env, i32, i64) +DEF_HELPER_3(dlg, void, env, i32, i64) DEF_HELPER_FLAGS_3(set_cc_add64, TCG_CALL_PURE|TCG_CALL_CONST, i32, s64, s64, s64) DEF_HELPER_FLAGS_3(set_cc_addu64, TCG_CALL_PURE|TCG_CALL_CONST, i32, i64, i64, i64)DEF_HELPER_FLAGS_3 (set_cc_add32,TCG_CALL_PURE |TCG_CALL_CONST , i32, s32, s32, s32)
@@ -43,8 +43,8 @@ DEF_HELPER_3(stam, void, i32, i64, i32) DEF_HELPER_3(lam, void, i32, i64, i32) DEF_HELPER_3(mvcle, i32, i32, i64, i32) DEF_HELPER_3(clcle, i32, i32, i64, i32) -DEF_HELPER_3(slb, i32, i32, i32, i32) -DEF_HELPER_4(slbg, i32, i32, i32, i64, i64) +DEF_HELPER_4(slb, i32, env, i32, i32, i32) +DEF_HELPER_5(slbg, i32, env, i32, i32, i64, i64) DEF_HELPER_3(cefbr, void, env, i32, s32) DEF_HELPER_3(cdfbr, void, env, i32, s32)DEF_HELPER_3 (cxfbr, void, env, i32, s32)
@@ -107,7 +107,7 @@ DEF_HELPER_3(lxdb, void, env, i32, i64) DEF_HELPER_FLAGS_3(tceb, TCG_CALL_PURE, i32, env, i32, i64) DEF_HELPER_FLAGS_3(tcdb, TCG_CALL_PURE, i32, env, i32, i64) DEF_HELPER_FLAGS_3(tcxb, TCG_CALL_PURE, i32, env, i32, i64) -DEF_HELPER_2(flogr, i32, i32, i64) +DEF_HELPER_3(flogr, i32, env, i32, i64) DEF_HELPER_3(sqdbr, void, env, i32, i32) DEF_HELPER_FLAGS_1(cvd, TCG_CALL_PURE|TCG_CALL_CONST, i64, s32)DEF_HELPER_3 (unpk, void, i32, i64, i64)
target-s390x/int_helper.c +6 -6
@@ -19,7 +19,6 @@*/ #include "cpu.h" -#include "dyngen-exec.h" #include "host-utils.h" #include "helper.h"
@@ -31,7 +30,7 @@#endif /* 64/64 -> 128 unsigned multiplication */ -void HELPER (mlg )(uint32_t r1,uint64_t v2) +void HELPER (mlg )(CPUS390XState *env,uint32_t r1,uint64_t v2) {#if HOST_LONG_BITS ==64 && defined(__GNUC__)/* assuming 64-bit hosts have __uint128_t */
@@ -46,7 +45,7 @@ void HELPER(mlg)(uint32_t r1, uint64_t v2) }/* 128 -> 64/64 unsigned division */ -void HELPER (dlg )(uint32_t r1,uint64_t v2) +void HELPER (dlg )(CPUS390XState *env,uint32_t r1,uint64_t v2) {uint64_t divisor = v2;
@@ -129,7 +128,7 @@ uint32_t HELPER(addc_u32)(uint32_t cc, uint32_t v1, uint32_t v2) }/* subtract unsigned v2 from v1 with borrow */ -uint32_t HELPER (slb )(uint32_t cc,uint32_t r1,uint32_t v2) +uint32_t HELPER (slb )(CPUS390XState *env,uint32_t cc,uint32_t r1,uint32_t v2) {uint32_t v1 = env->regs[r1];uint32_t res = v1 + (~v2) + (cc >>1 );
@@ -144,7 +143,8 @@ uint32_t HELPER(slb)(uint32_t cc, uint32_t r1, uint32_t v2) }/* subtract unsigned v2 from v1 with borrow */ -uint32_t HELPER (slbg )(uint32_t cc,uint32_t r1,uint64_t v1,uint64_t v2) +uint32_t HELPER (slbg )(CPUS390XState *env,uint32_t cc,uint32_t r1, +uint64_t v1,uint64_t v2) {uint64_t res = v1 + (~v2) + (cc >>1 );
@@ -158,7 +158,7 @@ uint32_t HELPER(slbg)(uint32_t cc, uint32_t r1, uint64_t v1, uint64_t v2) }/* find leftmost one */ -uint32_t HELPER (flogr )(uint32_t r1,uint64_t v2) +uint32_t HELPER (flogr )(CPUS390XState *env,uint32_t r1,uint64_t v2) {uint64_t res =0 ;uint64_t ov2 = v2;
target-s390x/translate.c +8 -8
@@ -1803,7 +1803,7 @@ static void disas_e3(DisasContext* s, int op, int r1, int x2, int b2, int d2) tmp2 =tcg_temp_new_i64 (); tmp32_1 =tcg_const_i32 (r1);tcg_gen_qemu_ld64 (tmp2, addr,get_mem_index (s)); -gen_helper_mlg (tmp32_1, tmp2); +gen_helper_mlg (cpu_env, tmp32_1, tmp2);tcg_temp_free_i64 (tmp2);tcg_temp_free_i32 (tmp32_1);break ;
@@ -1811,7 +1811,7 @@ static void disas_e3(DisasContext* s, int op, int r1, int x2, int b2, int d2) tmp2 =tcg_temp_new_i64 (); tmp32_1 =tcg_const_i32 (r1);tcg_gen_qemu_ld64 (tmp2, addr,get_mem_index (s)); -gen_helper_dlg (tmp32_1, tmp2); +gen_helper_dlg (cpu_env, tmp32_1, tmp2);tcg_temp_free_i64 (tmp2);tcg_temp_free_i32 (tmp32_1);break ;
@@ -1837,7 +1837,7 @@ static void disas_e3(DisasContext* s, int op, int r1, int x2, int b2, int d2)tcg_gen_qemu_ld64 (tmp2, addr,get_mem_index (s));/* XXX possible optimization point */ gen_op_calc_cc (s); -gen_helper_slbg (cc_op, cc_op, tmp32_1, regs[r1], tmp2); +gen_helper_slbg (cc_op, cpu_env, cc_op, tmp32_1, regs[r1], tmp2);set_cc_static (s);tcg_temp_free_i64 (tmp2);tcg_temp_free_i32 (tmp32_1);
@@ -1917,7 +1917,7 @@ static void disas_e3(DisasContext* s, int op, int r1, int x2, int b2, int d2)tcg_gen_trunc_i64_i32 (tmp32_2, tmp2);/* XXX possible optimization point */ gen_op_calc_cc (s); -gen_helper_slb (cc_op, cc_op, tmp32_1, tmp32_2); +gen_helper_slb (cc_op, cpu_env, cc_op, tmp32_1, tmp32_2);set_cc_static (s);tcg_temp_free_i64 (tmp2);tcg_temp_free_i32 (tmp32_1);
@@ -3535,7 +3535,7 @@ static void disas_b9(DisasContext *s, int op, int r1, int r2)case 0x83 :/* FLOGR R1,R2 [RRE] */ tmp =load_reg (r2); tmp32_1 =tcg_const_i32 (r1); -gen_helper_flogr (cc_op, tmp32_1, tmp); +gen_helper_flogr (cc_op, cpu_env, tmp32_1, tmp);set_cc_static (s);tcg_temp_free_i64 (tmp);tcg_temp_free_i32 (tmp32_1);
@@ -3555,7 +3555,7 @@ static void disas_b9(DisasContext *s, int op, int r1, int r2)case 0x87 :/* DLGR R1,R2 [RRE] */ tmp32_1 =tcg_const_i32 (r1); tmp =load_reg (r2); -gen_helper_dlg (tmp32_1, tmp); +gen_helper_dlg (cpu_env, tmp32_1, tmp);tcg_temp_free_i64 (tmp);tcg_temp_free_i32 (tmp32_1);break ;
@@ -3580,7 +3580,7 @@ static void disas_b9(DisasContext *s, int op, int r1, int r2) tmp2 =load_reg (r2); tmp32_1 =tcg_const_i32 (r1);gen_op_calc_cc (s); -gen_helper_slbg (cc_op, cc_op, tmp32_1, tmp, tmp2); +gen_helper_slbg (cc_op, cpu_env, cc_op, tmp32_1, tmp, tmp2);set_cc_static (s);tcg_temp_free_i64 (tmp);tcg_temp_free_i64 (tmp2);
@@ -3647,7 +3647,7 @@ static void disas_b9(DisasContext *s, int op, int r1, int r2) tmp32_1 =load_reg32 (r2); tmp32_2 =tcg_const_i32 (r1);gen_op_calc_cc (s); -gen_helper_slb (cc_op, cc_op, tmp32_2, tmp32_1); +gen_helper_slb (cc_op, cpu_env, cc_op, tmp32_2, tmp32_1);set_cc_static (s);tcg_temp_free_i32 (tmp32_1);tcg_temp_free_i32 (tmp32_2);
Signature · 1 line
1.6.0.2
PATCH 9/12 target-s390x: avoid AREG0 for condition code helpers
In reply to Alexander GrafFrom: Blue Swirl <[email protected]>
Make condition code helpers take a parameter for CPUState instead of relying on global env.
--- target-s390x/Makefile.objs | 1 - target-s390x/cc_helper.c | 11 +++++------ target-s390x/helper.h | 10 +++++----- target-s390x/translate.c | 16 ++++++++-------- 4 files changed, 18 insertions(+), 20 deletions(-)
target-s390x/Makefile.objs +0 -1
@@ -3,6 +3,5 @@ obj-y += int_helper.o fpu_helper.o cc_helper.o mem_helper.o misc_helper.o obj-$(CONFIG_SOFTMMU) += machine.o obj-$(CONFIG_KVM) += kvm.o -$(obj)/cc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/mem_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) $(obj)/misc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
target-s390x/cc_helper.c +5 -6
@@ -19,7 +19,6 @@*/ #include "cpu.h" -#include "dyngen-exec.h" #include "helper.h" /* #define DEBUG_HELPER */
@@ -500,14 +499,14 @@ uint32_t calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst,return do_calc_cc (env, cc_op, src, dst, vr); } -uint32_t HELPER (calc_cc )(uint32_t cc_op,uint64_t src,uint64_t dst, -uint64_t vr) +uint32_t HELPER (calc_cc )(CPUS390XState *env,uint32_t cc_op,uint64_t src, +uint64_t dst,uint64_t vr) {return do_calc_cc (env, cc_op, src, dst, vr); }/* insert psw mask and condition code into r1 */ -void HELPER (ipm )(uint32_t cc,uint32_t r1) +void HELPER (ipm )(CPUS390XState *env,uint32_t cc,uint32_t r1) {uint64_t r = env->regs[r1];
@@ -519,13 +518,13 @@ void HELPER(ipm)(uint32_t cc, uint32_t r1) }#ifndef CONFIG_USER_ONLY -void HELPER (load_psw )(uint64_t mask,uint64_t addr) +void HELPER (load_psw )(CPUS390XState *env,uint64_t mask,uint64_t addr) {load_psw (env, mask, addr);cpu_loop_exit (env); } -void HELPER (sacf )(uint64_t a1) +void HELPER (sacf )(CPUS390XState *env,uint64_t a1) {HELPER_LOG ("%s: %16" PRIx64"\n" , __func__, a1);
target-s390x/helper.h +5 -5
@@ -36,7 +36,7 @@ DEF_HELPER_FLAGS_1(abs_i64, TCG_CALL_PURE|TCG_CALL_CONST, i64, s64) DEF_HELPER_FLAGS_1(nabs_i64, TCG_CALL_PURE|TCG_CALL_CONST, s64, s64) DEF_HELPER_3(stcmh, void, i32, i64, i32) DEF_HELPER_3(icmh, i32, i32, i64, i32) -DEF_HELPER_2(ipm, void, i32, i32) +DEF_HELPER_3(ipm, void, env, i32, i32) DEF_HELPER_FLAGS_3(addc_u32, TCG_CALL_PURE|TCG_CALL_CONST, i32, i32, i32, i32) DEF_HELPER_FLAGS_3(set_cc_addc_u64, TCG_CALL_PURE|TCG_CALL_CONST, i32, i64, i64, i64)DEF_HELPER_3 (stam, void, i32, i64, i32)
@@ -115,7 +115,7 @@ DEF_HELPER_3(tr, void, i32, i64, i64) DEF_HELPER_2(servc, i32, i32, i64) DEF_HELPER_3(diag, i64, i32, i64, i64) -DEF_HELPER_2(load_psw, void, i64, i64) +DEF_HELPER_3(load_psw, void, env, i64, i64) DEF_HELPER_1(program_interrupt, void, i32) DEF_HELPER_FLAGS_1(stidp, TCG_CALL_CONST, void, i64)DEF_HELPER_FLAGS_1 (spx,TCG_CALL_CONST , void, i64)
@@ -139,14 +139,14 @@ DEF_HELPER_2(csp, i32, i32, i32) DEF_HELPER_3(mvcs, i32, i64, i64, i64) DEF_HELPER_3(mvcp, i32, i64, i64, i64) DEF_HELPER_3(sigp, i32, i64, i32, i64) -DEF_HELPER_1(sacf, void, i64) +DEF_HELPER_2(sacf, void, env, i64) DEF_HELPER_FLAGS_2(ipte, TCG_CALL_CONST, void, i64, i64) DEF_HELPER_FLAGS_0(ptlb, TCG_CALL_CONST, void) DEF_HELPER_2(lra, i32, i64, i32) DEF_HELPER_2(stura, void, i64, i32) DEF_HELPER_2(cksm, void, i32, i32) -DEF_HELPER_FLAGS_4 (calc_cc,TCG_CALL_PURE |TCG_CALL_CONST , - i32, i32, i64, i64, i64) +DEF_HELPER_FLAGS_5 (calc_cc,TCG_CALL_PURE |TCG_CALL_CONST , + i32, env, i32, i64, i64, i64)#include "def-helper.h"
target-s390x/translate.c +8 -8
@@ -722,7 +722,7 @@ static void gen_op_calc_cc(DisasContext *s)case CC_OP_NZ_F32 :case CC_OP_NZ_F64 :/* 1 argument */ -gen_helper_calc_cc (cc_op, local_cc_op, dummy, cc_dst, dummy); +gen_helper_calc_cc (cc_op, cpu_env, local_cc_op, dummy, cc_dst, dummy);break ;case CC_OP_ICM :case CC_OP_LTGT_32 :
@@ -735,7 +735,7 @@ static void gen_op_calc_cc(DisasContext *s)case CC_OP_LTGT_F64 :case CC_OP_SLAG :/* 2 arguments */ -gen_helper_calc_cc (cc_op, local_cc_op, cc_src, cc_dst, dummy); +gen_helper_calc_cc (cc_op, cpu_env, local_cc_op, cc_src, cc_dst, dummy);break ;case CC_OP_ADD_64 :case CC_OP_ADDU_64 :
@@ -746,11 +746,11 @@ static void gen_op_calc_cc(DisasContext *s)case CC_OP_SUB_32 :case CC_OP_SUBU_32 :/* 3 arguments */ -gen_helper_calc_cc (cc_op, local_cc_op, cc_src, cc_dst, cc_vr); +gen_helper_calc_cc (cc_op, cpu_env, local_cc_op, cc_src, cc_dst, cc_vr);break ;case CC_OP_DYNAMIC :/* unknown operation - assume 3 arguments and cc_op in env */ -gen_helper_calc_cc (cc_op, cc_op, cc_src, cc_dst, cc_vr); +gen_helper_calc_cc (cc_op, cpu_env, cc_op, cc_src, cc_dst, cc_vr);break ;default :tcg_abort ();
@@ -2628,7 +2628,7 @@ static void disas_b2(DisasContext *s, int op, uint32_t insn)case 0x22 :/* IPM R1 [RRE] */ tmp32_1 =tcg_const_i32 (r1);gen_op_calc_cc (s); -gen_helper_ipm (cc_op, tmp32_1); +gen_helper_ipm (cpu_env, cc_op, tmp32_1);tcg_temp_free_i32 (tmp32_1);break ;case 0x41 :/* CKSM R1,R2 [RRE] */
@@ -2916,7 +2916,7 @@ static void disas_b2(DisasContext *s, int op, uint32_t insn)decode_rs (s, insn, &r1, &r3, &b2, &d2); tmp =get_address (s,0 , b2, d2);potential_page_fault (s); -gen_helper_sacf (tmp); +gen_helper_sacf (cpu_env, tmp);tcg_temp_free_i64 (tmp);/* addressing mode has changed, so end the block */ s->pc += ilc *2 ;
@@ -2967,7 +2967,7 @@ static void disas_b2(DisasContext *s, int op, uint32_t insn)tcg_gen_qemu_ld64 (tmp2, tmp,get_mem_index (s));tcg_gen_addi_i64 (tmp, tmp,8 );tcg_gen_qemu_ld64 (tmp3, tmp,get_mem_index (s)); -gen_helper_load_psw (tmp2, tmp3); +gen_helper_load_psw (cpu_env, tmp2, tmp3);/* we need to keep cc_op intact */ s->is_jmp =DISAS_JUMP ;tcg_temp_free_i64 (tmp);
@@ -4527,7 +4527,7 @@ static void disas_s390_insn(DisasContext *s)tcg_gen_qemu_ld32u (tmp2, tmp,get_mem_index (s));tcg_gen_addi_i64 (tmp, tmp,4 );tcg_gen_qemu_ld32u (tmp3, tmp,get_mem_index (s)); -gen_helper_load_psw (tmp2, tmp3); +gen_helper_load_psw (cpu_env, tmp2, tmp3);tcg_temp_free_i64 (tmp);tcg_temp_free_i64 (tmp2);tcg_temp_free_i64 (tmp3);
Signature · 1 line
1.6.0.2
PATCH 10/12 target-s390x: avoid AREG0 for misc helpers
In reply to Alexander GrafFrom: Blue Swirl <[email protected]>
Make misc helpers take a parameter for CPUState instead of relying on global env.
--- target-s390x/Makefile.objs | 1 - target-s390x/helper.h | 26 ++++++++++---------- target-s390x/mem_helper.c | 2 +- target-s390x/misc_helper.c | 55 ++++++++++++++++++++++++-------------------- target-s390x/translate.c | 32 ++++++++++++------------ 5 files changed, 60 insertions(+), 56 deletions(-)
target-s390x/Makefile.objs +0 -1
@@ -4,4 +4,3 @@ obj-$(CONFIG_SOFTMMU) += machine.o obj-$(CONFIG_KVM) += kvm.o $(obj)/mem_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) -$(obj)/misc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
target-s390x/helper.h +13 -13
@@ -1,6 +1,6 @@#include "def-helper.h" -DEF_HELPER_1(exception, void, i32) +DEF_HELPER_2(exception, void, env, i32) DEF_HELPER_3(nc, i32, i32, i64, i64) DEF_HELPER_3(oc, i32, i32, i64, i64)DEF_HELPER_3 (xc, i32, i32, i64, i64)
@@ -113,20 +113,20 @@ DEF_HELPER_FLAGS_1(cvd, TCG_CALL_PURE|TCG_CALL_CONST, i64, s32) DEF_HELPER_3(unpk, void, i32, i64, i64) DEF_HELPER_3(tr, void, i32, i64, i64) -DEF_HELPER_2(servc, i32, i32, i64) -DEF_HELPER_3(diag, i64, i32, i64, i64) +DEF_HELPER_3(servc, i32, env, i32, i64) +DEF_HELPER_4(diag, i64, env, i32, i64, i64) DEF_HELPER_3(load_psw, void, env, i64, i64) DEF_HELPER_1(program_interrupt, void, i32) -DEF_HELPER_FLAGS_1(stidp, TCG_CALL_CONST, void, i64) -DEF_HELPER_FLAGS_1(spx, TCG_CALL_CONST, void, i64) +DEF_HELPER_FLAGS_2(stidp, TCG_CALL_CONST, void, env, i64) +DEF_HELPER_FLAGS_2(spx, TCG_CALL_CONST, void, env, i64) DEF_HELPER_FLAGS_1(sck, TCG_CALL_CONST, i32, i64) -DEF_HELPER_1(stck, i32, i64) -DEF_HELPER_1(stcke, i32, i64) -DEF_HELPER_FLAGS_1(sckc, TCG_CALL_CONST, void, i64) -DEF_HELPER_FLAGS_1(stckc, TCG_CALL_CONST, void, i64) -DEF_HELPER_FLAGS_1(spt, TCG_CALL_CONST, void, i64) -DEF_HELPER_FLAGS_1(stpt, TCG_CALL_CONST, void, i64) -DEF_HELPER_3(stsi, i32, i64, i32, i32) +DEF_HELPER_2(stck, i32, env, i64) +DEF_HELPER_2(stcke, i32, env, i64) +DEF_HELPER_FLAGS_2(sckc, TCG_CALL_CONST, void, env, i64) +DEF_HELPER_FLAGS_2(stckc, TCG_CALL_CONST, void, env, i64) +DEF_HELPER_FLAGS_2(spt, TCG_CALL_CONST, void, env, i64) +DEF_HELPER_FLAGS_2(stpt, TCG_CALL_CONST, void, env, i64) +DEF_HELPER_4(stsi, i32, env, i64, i32, i32) DEF_HELPER_3(lctl, void, i32, i64, i32) DEF_HELPER_3(lctlg, void, i32, i64, i32)DEF_HELPER_3 (stctl, void, i32, i64, i32)
@@ -138,7 +138,7 @@ DEF_HELPER_FLAGS_2(rrbe, TCG_CALL_CONST, i32, i32, i64) DEF_HELPER_2(csp, i32, i32, i32) DEF_HELPER_3(mvcs, i32, i64, i64, i64) DEF_HELPER_3(mvcp, i32, i64, i64, i64) -DEF_HELPER_3(sigp, i32, i64, i32, i64) +DEF_HELPER_4(sigp, i32, env, i64, i32, i64) DEF_HELPER_2(sacf, void, env, i64) DEF_HELPER_FLAGS_2(ipte, TCG_CALL_CONST, void, i64, i64)DEF_HELPER_FLAGS_0 (ptlb,TCG_CALL_CONST , void)
target-s390x/mem_helper.c +1 -1
@@ -595,7 +595,7 @@ uint32_t HELPER(ex)(uint32_t cc, uint64_t v1, uint64_t addr, uint64_t ret) env->psw.addr = ret -4 ; env->int_svc_code = (insn | v1) &0xff ; env->int_svc_ilc =4 ; -helper_exception (EXCP_SVC ); +helper_exception (env,EXCP_SVC ); }else if ((insn &0xff00 ) ==0xbf00 ) {uint32_t insn2, r1, r3, b2, d2;
target-s390x/misc_helper.c +30 -25
150 lines not on this page · raw message
target-s390x/translate.c +16 -16
@@ -312,7 +312,7 @@ static inline void gen_debug(DisasContext *s)TCGv_i32 tmp =tcg_const_i32 (EXCP_DEBUG );update_psw_addr (s);gen_op_calc_cc (s); -gen_helper_exception (tmp); +gen_helper_exception (cpu_env, tmp);tcg_temp_free_i32 (tmp); s->is_jmp =DISAS_EXCP ; }
@@ -324,7 +324,7 @@ static void gen_illegal_opcode(DisasContext *s, int ilc)TCGv_i32 tmp =tcg_const_i32 (EXCP_SPEC );update_psw_addr (s);gen_op_calc_cc (s); -gen_helper_exception (tmp); +gen_helper_exception (cpu_env, tmp);tcg_temp_free_i32 (tmp); s->is_jmp =DISAS_EXCP ; }
@@ -377,7 +377,7 @@ static void gen_program_exception(DisasContext *s, int ilc, int code)/* trigger exception */ tmp =tcg_const_i32 (EXCP_PGM ); -gen_helper_exception (tmp); +gen_helper_exception (cpu_env, tmp);tcg_temp_free_i32 (tmp);/* end TB here */
@@ -2712,7 +2712,7 @@ static void disas_b2(DisasContext *s, int op, uint32_t insn)decode_rs (s, insn, &r1, &r3, &b2, &d2); tmp =get_address (s,0 , b2, d2);potential_page_fault (s); -gen_helper_stidp (tmp); +gen_helper_stidp (cpu_env, tmp);tcg_temp_free_i64 (tmp);break ;case 0x04 :/* SCK D2(B2) [S] */
@@ -2730,7 +2730,7 @@ static void disas_b2(DisasContext *s, int op, uint32_t insn)decode_rs (s, insn, &r1, &r3, &b2, &d2); tmp =get_address (s,0 , b2, d2);potential_page_fault (s); -gen_helper_stck (cc_op, tmp); +gen_helper_stck (cc_op, cpu_env, tmp);set_cc_static (s);tcg_temp_free_i64 (tmp);break ;
@@ -2740,7 +2740,7 @@ static void disas_b2(DisasContext *s, int op, uint32_t insn)decode_rs (s, insn, &r1, &r3, &b2, &d2); tmp =get_address (s,0 , b2, d2);potential_page_fault (s); -gen_helper_sckc (tmp); +gen_helper_sckc (cpu_env, tmp);tcg_temp_free_i64 (tmp);break ;case 0x07 :/* STCKC D2(B2) [S] */
@@ -2749,7 +2749,7 @@ static void disas_b2(DisasContext *s, int op, uint32_t insn)decode_rs (s, insn, &r1, &r3, &b2, &d2); tmp =get_address (s,0 , b2, d2);potential_page_fault (s); -gen_helper_stckc (tmp); +gen_helper_stckc (cpu_env, tmp);tcg_temp_free_i64 (tmp);break ;case 0x08 :/* SPT D2(B2) [S] */
@@ -2758,7 +2758,7 @@ static void disas_b2(DisasContext *s, int op, uint32_t insn)decode_rs (s, insn, &r1, &r3, &b2, &d2); tmp =get_address (s,0 , b2, d2);potential_page_fault (s); -gen_helper_spt (tmp); +gen_helper_spt (cpu_env, tmp);tcg_temp_free_i64 (tmp);break ;case 0x09 :/* STPT D2(B2) [S] */
@@ -2767,7 +2767,7 @@ static void disas_b2(DisasContext *s, int op, uint32_t insn)decode_rs (s, insn, &r1, &r3, &b2, &d2); tmp =get_address (s,0 , b2, d2);potential_page_fault (s); -gen_helper_stpt (tmp); +gen_helper_stpt (cpu_env, tmp);tcg_temp_free_i64 (tmp);break ;case 0x0a :/* SPKA D2(B2) [S] */
@@ -2793,7 +2793,7 @@ static void disas_b2(DisasContext *s, int op, uint32_t insn)decode_rs (s, insn, &r1, &r3, &b2, &d2); tmp =get_address (s,0 , b2, d2);potential_page_fault (s); -gen_helper_spx (tmp); +gen_helper_spx (cpu_env, tmp);tcg_temp_free_i64 (tmp);break ;case 0x11 :/* STPX D2(B2) [S] */
@@ -2906,7 +2906,7 @@ static void disas_b2(DisasContext *s, int op, uint32_t insn)decode_rs (s, insn, &r1, &r3, &b2, &d2); tmp =get_address (s,0 , b2, d2);potential_page_fault (s); -gen_helper_stcke (cc_op, tmp); +gen_helper_stcke (cc_op, cpu_env, tmp);set_cc_static (s);tcg_temp_free_i64 (tmp);break ;
@@ -2930,7 +2930,7 @@ static void disas_b2(DisasContext *s, int op, uint32_t insn) tmp32_1 =load_reg32 (0 ); tmp32_2 =load_reg32 (1 );potential_page_fault (s); -gen_helper_stsi (cc_op, tmp, tmp32_1, tmp32_2); +gen_helper_stsi (cc_op, cpu_env, tmp, tmp32_1, tmp32_2);set_cc_static (s);tcg_temp_free_i64 (tmp);tcg_temp_free_i32 (tmp32_1);
@@ -2980,7 +2980,7 @@ static void disas_b2(DisasContext *s, int op, uint32_t insn)potential_page_fault (s); tmp32_1 =load_reg32 (r2); tmp =load_reg (r1); -gen_helper_servc (cc_op, tmp32_1, tmp); +gen_helper_servc (cc_op, cpu_env, tmp32_1, tmp);set_cc_static (s);tcg_temp_free_i32 (tmp32_1);tcg_temp_free_i64 (tmp);
@@ -3926,7 +3926,7 @@ static void disas_s390_insn(DisasContext *s) tmp32_3 =tcg_const_i32 (EXCP_SVC );tcg_gen_st_i32 (tmp32_1, cpu_env, offsetof(CPUS390XState , int_svc_code));tcg_gen_st_i32 (tmp32_2, cpu_env, offsetof(CPUS390XState , int_svc_ilc)); -gen_helper_exception (tmp32_3); +gen_helper_exception (cpu_env, tmp32_3); s->is_jmp =DISAS_EXCP ;tcg_temp_free_i32 (tmp32_1);tcg_temp_free_i32 (tmp32_2);
@@ -4543,7 +4543,7 @@ static void disas_s390_insn(DisasContext *s) tmp32_1 =tcg_const_i32 (insn &0xfff ); tmp2 =load_reg (2 ); tmp3 =load_reg (1 ); -gen_helper_diag (tmp2, tmp32_1, tmp2, tmp3); +gen_helper_diag (tmp2, cpu_env, tmp32_1, tmp2, tmp3);store_reg (2 , tmp2);tcg_temp_free_i32 (tmp32_1);tcg_temp_free_i64 (tmp2);
@@ -4777,7 +4777,7 @@ static void disas_s390_insn(DisasContext *s) tmp2 =load_reg (r3); tmp32_1 =tcg_const_i32 (r1);potential_page_fault (s); -gen_helper_sigp (cc_op, tmp, tmp32_1, tmp2); +gen_helper_sigp (cc_op, cpu_env, tmp, tmp32_1, tmp2);set_cc_static (s);tcg_temp_free_i64 (tmp);tcg_temp_free_i64 (tmp2);
Signature · 1 line
1.6.0.2
PATCH 11/12 target-s390x: switch to AREG0 free mode
In reply to Alexander GrafFrom: Blue Swirl <[email protected]>
Add an explicit CPUState parameter instead of relying on AREG0.
Remove temporary wrappers and switch to AREG0 free mode.
--- configure | 2 +- target-s390x/Makefile.objs | 2 - target-s390x/cpu.h | 10 -- target-s390x/fpu_helper.c | 3 +- target-s390x/helper.c | 6 +- target-s390x/helper.h | 78 +++++----- target-s390x/mem_helper.c | 338 ++++++++++++++++++++------------------------ target-s390x/misc_helper.c | 3 - target-s390x/translate.c | 88 ++++++------ 9 files changed, 239 insertions(+), 291 deletions(-)
configure +1 -1
@@ -3829,7 +3829,7 @@ symlink "$source_path/Makefile.target" "$target_dir/Makefile" case "$target_arch2" in - alpha | i386 | or32 | sparc* | x86_64 | xtensa* | ppc*) + alpha | i386 | or32 | s390x | sparc* | x86_64 | xtensa* | ppc*) echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak ;; esac
target-s390x/Makefile.objs +0 -2
@@ -2,5 +2,3 @@ obj-y += translate.o helper.o cpu.o interrupt.o obj-y += int_helper.o fpu_helper.o cc_helper.o mem_helper.o misc_helper.o obj-$(CONFIG_SOFTMMU) += machine.o obj-$(CONFIG_KVM) += kvm.o - -$(obj)/mem_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
target-s390x/cpu.h +0 -10
@@ -1008,14 +1008,4 @@ uint32_t set_cc_nz_f64(float64 v);/* misc_helper.c */ void program_interrupt (CPUS390XState *env,uint32_t code,int ilc); -/* temporary wrappers */ -uint32_t cpu_ldub_data (CPUS390XState *env,target_ulong ptr); -uint32_t cpu_lduw_data (CPUS390XState *env,target_ulong ptr); -uint32_t cpu_ldl_data (CPUS390XState *env,target_ulong ptr); -uint64_t cpu_ldq_data (CPUS390XState *env,target_ulong ptr); - -void cpu_stb_data (CPUS390XState *env,target_ulong ptr,uint32_t data); -void cpu_stw_data (CPUS390XState *env,target_ulong ptr,uint32_t data); -void cpu_stl_data (CPUS390XState *env,target_ulong ptr,uint32_t data); -void cpu_stq_data (CPUS390XState *env,target_ulong ptr,uint64_t data);#endif
target-s390x/fpu_helper.c +1 -2
@@ -21,8 +21,7 @@#include "cpu.h" #include "helper.h" -/* temporarily disabled due to wrapper use */ -#if 0 && !defined(CONFIG_USER_ONLY ) +#if !defined(CONFIG_USER_ONLY )#include "softmmu_exec.h" #endif
target-s390x/helper.c +3 -3
@@ -499,14 +499,14 @@ static void do_program_interrupt(CPUS390XState *env)switch (ilc) {case ILC_LATER : - ilc =get_ilc (ldub_code (env->psw.addr)); + ilc =get_ilc (cpu_ldub_code (env, env->psw.addr));break ;case ILC_LATER_INC : - ilc =get_ilc (ldub_code (env->psw.addr)); + ilc =get_ilc (cpu_ldub_code (env, env->psw.addr)); env->psw.addr += ilc *2 ;break ;case ILC_LATER_INC_2 : - ilc =get_ilc (ldub_code (env->psw.addr)) *2 ; + ilc =get_ilc (cpu_ldub_code (env, env->psw.addr)) *2 ; env->psw.addr += ilc;break ; }
target-s390x/helper.h +39 -39
115 lines not on this page · raw message
target-s390x/mem_helper.c +151 -187
900 lines not on this page · raw message
target-s390x/misc_helper.c +0 -3
@@ -31,10 +31,7 @@#endif #if !defined(CONFIG_USER_ONLY ) -/* temporarily disabled due to wrapper use */ -#if 0 #include "softmmu_exec.h" -#endif #include "sysemu.h" #endif
target-s390x/translate.c +44 -44
332 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 12/12 tcg/s390: fix ld/st with CONFIG_TCG_PASS_AREG0
In reply to Alexander GrafFrom: Aurelien Jarno <[email protected]>
The load/store slow path has been broken in e141ab52d:
- We need to move 4 registers for store functions and 3 registers for load functions and not the reverse.
- According to the s390x calling convention the arguments of a function should be zero extended. This means that the register shift should be done with TCG_TYPE_I64 to ensure the higher word is correctly zero extended when needed.
I am aware that CONFIG_TCG_PASS_AREG0 is being removed and thus that this patch can be improved, but doing so means it can also be applied to the 1.1 and 1.2 stable branches.
--- tcg/s390/tcg-target.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
tcg/s390/tcg-target.c +7 -7
@@ -1509,11 +1509,13 @@ static void tcg_prepare_qemu_ldst(TCGContext* s, TCGReg data_reg,tcg_out_movi (s,TCG_TYPE_I32 ,TCG_REG_R4 , mem_index);#ifdef CONFIG_TCG_PASS_AREG0 /* XXX/FIXME: suboptimal */ -tcg_out_mov (s,TCG_TYPE_I32 , tcg_target_call_iarg_regs[2 ], +tcg_out_mov (s,TCG_TYPE_I64 , tcg_target_call_iarg_regs[3 ], + tcg_target_call_iarg_regs[2 ]); +tcg_out_mov (s,TCG_TYPE_I64 , tcg_target_call_iarg_regs[2 ], tcg_target_call_iarg_regs[1 ]); -tcg_out_mov (s,TCG_TYPE_TL , tcg_target_call_iarg_regs[1 ], +tcg_out_mov (s,TCG_TYPE_I64 , tcg_target_call_iarg_regs[1 ], tcg_target_call_iarg_regs[0 ]); -tcg_out_mov (s,TCG_TYPE_PTR , tcg_target_call_iarg_regs[0 ], +tcg_out_mov (s,TCG_TYPE_I64 , tcg_target_call_iarg_regs[0 ],TCG_AREG0 );#endif tgen_calli (s, (tcg_target_ulong )qemu_st_helpers[s_bits]);
@@ -1521,13 +1523,11 @@ static void tcg_prepare_qemu_ldst(TCGContext* s, TCGReg data_reg,tcg_out_movi (s,TCG_TYPE_I32 , arg1, mem_index);#ifdef CONFIG_TCG_PASS_AREG0 /* XXX/FIXME: suboptimal */ -tcg_out_mov (s,TCG_TYPE_I32 , tcg_target_call_iarg_regs[3 ], - tcg_target_call_iarg_regs[2 ]);tcg_out_mov (s,TCG_TYPE_I64 , tcg_target_call_iarg_regs[2 ], tcg_target_call_iarg_regs[1 ]); -tcg_out_mov (s,TCG_TYPE_TL , tcg_target_call_iarg_regs[1 ], +tcg_out_mov (s,TCG_TYPE_I64 , tcg_target_call_iarg_regs[1 ], tcg_target_call_iarg_regs[0 ]); -tcg_out_mov (s,TCG_TYPE_PTR , tcg_target_call_iarg_regs[0 ], +tcg_out_mov (s,TCG_TYPE_I64 , tcg_target_call_iarg_regs[0 ],TCG_AREG0 );#endif tgen_calli (s, (tcg_target_ulong )qemu_ld_helpers[s_bits]);
Signature · 1 line
1.6.0.2
Quoted 48 lines · Alexander Graf
Hi Blue / Aurelien,
This is my current patch queue for s390. Please pull.
It contains:
- tcg fix for s390 hosts
- convert s390 target to be areg0 freeAlex
The following changes since commit
0c267217ca9985e6d118ec8368bebd382db7a099:
Jan Kiszka (1):
musicpal: Fix flash mappingare available in the git repository at:
git://repo.or.cz/qemu/agraf.gits390-for-upstreamAurelien Jarno (1):
tcg/s390: fix ld/st withCONFIG_TCG_PASS_AREG0Blue Swirl (11):
target-s390x: fix style target-s390x: split FPU ops target-s390x: split condition code helpers target-s390x: split integer helpers target-s390x: split memory access helpers target-s390x: rename op_helper.c to misc_helper.c target-s390x: avoid AREG0 for FPU helpers target-s390x: avoid AREG0 for integer helpers target-s390x: avoid AREG0 for condition code helpers target-s390x: avoid AREG0 for misc helpers target-s390x: switch to AREG0 free modeconfigure | 2 +- target-s390x/Makefile.objs | 5 +- target-s390x/cc_helper.c | 550 ++++++++ target-s390x/cpu.h | 9 + target-s390x/fpu_helper.c | 843 ++++++++++++ target-s390x/helper.c | 102 +- target-s390x/helper.h | 250 ++-- target-s390x/int_helper.c | 201 +++ target-s390x/mem_helper.c | 1203 ++++++++++++++++++ target-s390x/misc_helper.c | 430 +++++++ target-s390x/op_helper.c | 3019 -------------------------------------------- target-s390x/translate.c | 233 ++--
Quoted 9 lines
tcg/s390/tcg-target.c | 14 +- 13 files changed, 3537 insertions(+), 3324 deletions(-) create mode 100644 target-s390x/cc_helper.c create mode 100644 target-s390x/fpu_helper.c create mode 100644 target-s390x/int_helper.c create mode 100644 target-s390x/mem_helper.c create mode 100644 target-s390x/misc_helper.c delete mode 100644 target-s390x/op_helper.c
Thanks, pulled.
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net