target-s390x: fixes improvements
cover target-s390x: fixes improvements
The two first patches fixes bugs in the target-s390x TCG emulation.
The 4 next patches fix some instruction definition. Given we don't emulate a given CPU model and check the instruction availability, they don't provide any functional change.
The last patches emulate some missing instructions, either from the zArchitecture or from some additional facilities.
With all these patches applied, the GCC testsuite run in a guest fully passes.
Aurelien Jarno (13):
target-s390x: fix exception for invalid operation code
target-s390x: fix CLGIT instruction
target-s390x: rename BRXHLE instruction into BRXLG
target-s390x: change CHRL and CGHRL format to RIL-b
target-s390x: move STORE CLOCK FAST to the correct facility
target-s390x: move SET DFP ROUNDING MODE to the correct facility
target-s390x: implement LOAD FP INTEGER instructions
target-s390x: implement TRANSLATE AND TEST instruction
target-s390x: implement TRANSLATE EXTENDED instruction
target-s390x: implement LPDFR and LNDFR instructions
target-s390x: implement miscellaneous-instruction-extensions facility
target-s390x: implement load-and-trap facility
target-s390x: implement high-word facility
target-s390x/fpu_helper.c | 31 ++++++++ target-s390x/helper.h | 5 ++ target-s390x/insn-data.def | 82 ++++++++++++++++++-- target-s390x/mem_helper.c | 63 ++++++++++++++++ target-s390x/translate.c | 181 ++++++++++++++++++++++++++++++++++++++++++--- 5 files changed, 346 insertions(+), 16 deletions(-)
Signature · 1 line
2.1.4
PATCH 1/13 target-s390x: fix exception for invalid operation code
When an operation code is not recognized (ie invalid instruction) an operation exception should be generated instead of a specification exception. The latter is for valid opcode, with invalid operands or modifiers.
This give a very basic GDB support in the guest, as it uses the invalid opcode 0x0001 to generate a trap.
--- target-s390x/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target-s390x/translate.c +1 -1
@@ -320,7 +320,7 @@ static void gen_program_exception(DisasContext *s, int code)static inline void gen_illegal_opcode (DisasContext *s) { -gen_program_exception (s,PGM_SPECIFICATION ); +gen_program_exception (s,PGM_OPERATION ); }#ifndef CONFIG_USER_ONLY
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 01/13] target-s390x: fix exception for invalid operation code
Quoted 8 lines · Aurelien Jarno
When an operation code is not recognized (ie invalid instruction) an operation exception should be generated instead of a specification exception. The latter is for valid opcode, with invalid operands or modifiers.
This give a very basic GDB support in the guest, as it uses the invalid opcode
0x0001to generate a trap.
Quoted 6 lines
Cc Alexander Graf <[email protected]>Cc Richard Henderson <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>--- target-s390x/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
PATCH 2/13 target-s390x: fix CLGIT instruction
In reply to Aurelien JarnoThe COMPARE LOGICAL IMMEDIATE AND TRAP instruction should compare the numbers as unsigned, as its name implies.
--- target-s390x/insn-data.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target-s390x/insn-data.def +1 -1
@@ -231,7 +231,7 @@ D(0xb973, CLRT, RRF_c, GIE, r1_32u, r2_32u, 0, 0, ct, 0, 1) D(0xb961, CLGRT, RRF_c, GIE, r1_o, r2_o, 0, 0, ct, 0, 1) D(0xec73, CLFIT, RIE_a, GIE, r1_32u, i2_32u, 0, 0, ct, 0, 1) - D(0xec71, CLGIT, RIE_a, GIE, r1_o, i2_32u, 0, 0, ct, 0, 0) + D(0xec71, CLGIT, RIE_a, GIE, r1_o, i2_32u, 0, 0, ct, 0, 1) /* CONVERT TO DECIMAL */ C(0x4e00, CVD, RX_a, Z, r1_o, a2, 0, 0, cvd, 0)
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 02/13] target-s390x: fix CLGIT instruction
Quoted 9 lines · Aurelien Jarno
The COMPARE LOGICAL IMMEDIATE AND TRAP instruction should compare the numbers as unsigned, as its name implies.
Cc Alexander Graf<[email protected]>Cc Richard Henderson<[email protected]>Signed-off-by Aurelien Jarno<[email protected]>--- target-s390x/insn-data.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
PATCH 3/13 target-s390x: rename BRXHLE instruction into BRXLG
In reply to Aurelien JarnoUse the same name than in PoP and binutils.
--- target-s390x/insn-data.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target-s390x/insn-data.def +1 -1
@@ -120,7 +120,7 @@ D(0x8400, BRXH, RSI, Z, 0, 0, 0, 0, bx32, 0, 0) D(0x8500, BRXLE, RSI, Z, 0, 0, 0, 0, bx32, 0, 1) D(0xec44, BRXHG, RIE_e, Z, 0, 0, 0, 0, bx64, 0, 0) - D(0xec45, BRXHLE, RIE_e, Z, 0, 0, 0, 0, bx64, 0, 1) + D(0xec45, BRXLG, RIE_e, Z, 0, 0, 0, 0, bx64, 0, 1) /* CHECKSUM */ C(0xb241, CKSM, RRE, Z, r1_o, ra2, new, r1_32, cksm, 0)
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 03/13] target-s390x: rename BRXHLE instruction into BRXLG
target-s390x/insn-data.def line 126
Quoted 9 lines · Aurelien Jarno
D(0x8400, BRXH, RSI, Z, 0, 0, 0, 0, bx32, 0, 0) D(0x8500, BRXLE, RSI, Z, 0, 0, 0, 0, bx32, 0, 1) D(0xec44, BRXHG, RIE_e, Z, 0, 0, 0, 0, bx64, 0, 0)target-s390x/insn-data.def +1
-1- D(0xec45, BRXHLE, RIE_e, Z, 0, 0, 0, 0, bx64, 0, 1) + D(0xec45, BRXLG, RIE_e, Z, 0, 0, 0, 0, bx64, 0, 1) /* CHECKSUM */ C(0xb241, CKSM, RRE, Z, r1_o, ra2, new, r1_32, cksm, 0)
It seems to have changed names several times.
Indeed, while it's BRXLG in PoO v8, it's been renamed BRXLEG in v10.
r~
Re: [Qemu-devel] [PATCH 03/13] target-s390x: rename BRXHLE instruction into BRXLG
Quoted 7 lines · Richard Henderson
Quoted 6 lines · Aurelien Jarno
D(0x8400, BRXH, RSI, Z, 0, 0, 0, 0, bx32, 0, 0) D(0x8500, BRXLE, RSI, Z, 0, 0, 0, 0, bx32, 0, 1) D(0xec44, BRXHG, RIE_e, Z, 0, 0, 0, 0, bx64, 0, 0)target-s390x/insn-data.def +1
-1- D(0xec45, BRXHLE, RIE_e, Z, 0, 0, 0, 0, bx64, 0, 1) + D(0xec45, BRXLG, RIE_e, Z, 0, 0, 0, 0, bx64, 0, 1)
Quoted 7 lines
Quoted 3 lines
/* CHECKSUM */
C(0xb241, CKSM, RRE, Z, r1_o, ra2, new, r1_32, cksm, 0)It seems to have changed names several times.
Indeed, while it's BRXLG in PoO v8, it's been renamed BRXLEG in v10.
Ok. Then I'll drop this patch in the next version, and I'll try to remember this one next time I review the list of missing instructions.
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://www.aurel32.net
PATCH 4/13 target-s390x: change CHRL and CGHRL format to RIL-b
In reply to Aurelien JarnoChange to match the PoP. In practice both format RIL-a and RIL-b have the same fields. They differ on the way we decode the fields, and it's done correctly in QEMU.
--- target-s390x/insn-data.def | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target-s390x/insn-data.def +2 -2
@@ -159,8 +159,8 @@ C(0xe55c, CHSI, SIL, GIE, m1_32s, i2, 0, 0, 0, cmps64) C(0xe558, CGHSI, SIL, GIE, m1_64, i2, 0, 0, 0, cmps64) /* COMPARE HALFWORD RELATIVE LONG */ - C(0xc605, CHRL, RIL_a, GIE, r1_o, mri2_32s, 0, 0, 0, cmps32) - C(0xc604, CGHRL, RIL_a, GIE, r1_o, mri2_64, 0, 0, 0, cmps64) + C(0xc605, CHRL, RIL_b, GIE, r1_o, mri2_32s, 0, 0, 0, cmps32) + C(0xc604, CGHRL, RIL_b, GIE, r1_o, mri2_64, 0, 0, 0, cmps64) /* COMPARE LOGICAL */ C(0x1500, CLR, RR_a, Z, r1, r2, 0, 0, 0, cmpu32)
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 04/13] target-s390x: change CHRL and CGHRL format to RIL-b
Quoted 10 lines · Aurelien Jarno
Change to match the PoP. In practice both format RIL-a and RIL-b have the same fields. They differ on the way we decode the fields, and it's done correctly in QEMU.
Cc Alexander Graf<[email protected]>Cc Richard Henderson<[email protected]>Signed-off-by Aurelien Jarno<[email protected]>--- target-s390x/insn-data.def | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
r~
PATCH 5/13 target-s390x: move STORE CLOCK FAST to the correct facility
In reply to Aurelien JarnoSTORE CLOCK FAST should be in the SCF facility.
--- target-s390x/insn-data.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target-s390x/insn-data.def +1 -1
@@ -815,7 +815,7 @@ C(0xae00, SIGP, RS_a, Z, r3_o, a2, 0, 0, sigp, 0) /* STORE CLOCK */ C(0xb205, STCK, S, Z, la2, 0, new, m1_64, stck, 0) - C(0xb27c, STCKF, S, Z, la2, 0, new, m1_64, stck, 0) + C(0xb27c, STCKF, S, SCF, la2, 0, new, m1_64, stck, 0) /* STORE CLOCK EXTENDED */ C(0xb278, STCKE, S, Z, 0, a2, 0, 0, stcke, 0) /* STORE CLOCK COMPARATOR */
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 05/13] target-s390x: move STORE CLOCK FAST to the correct facility
Quoted 8 lines · Aurelien Jarno
STORE CLOCK FAST should be in the SCF facility.
Cc Alexander Graf<[email protected]>Cc Richard Henderson<[email protected]>Signed-off-by Aurelien Jarno<[email protected]>--- target-s390x/insn-data.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
PATCH 6/13 target-s390x: move SET DFP ROUNDING MODE to the correct facility
In reply to Aurelien JarnoIt belongs to the DFP rounding facility.
--- target-s390x/insn-data.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target-s390x/insn-data.def +1 -1
@@ -622,7 +622,7 @@ C(0xb299, SRNM, S, Z, 0, 0, 0, 0, srnm, 0) C(0xb2b8, SRNMB, S, FPE, 0, 0, 0, 0, srnm, 0) /* SET DFP ROUNDING MODE */ - C(0xb2b9, SRNMT, S, DFP, 0, 0, 0, 0, srnm, 0) + C(0xb2b9, SRNMT, S, DFPR, 0, 0, 0, 0, srnm, 0) /* SHIFT LEFT SINGLE */ D(0x8b00, SLA, RS_a, Z, r1, sh32, new, r1_32, sla, 0, 31)
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 06/13] target-s390x: move SET DFP ROUNDING MODE to the correct facility
Quoted 8 lines · Aurelien Jarno
It belongs to the DFP rounding facility.
Cc Alexander Graf<[email protected]>Cc Richard Henderson<[email protected]>Signed-off-by Aurelien Jarno<[email protected]>--- target-s390x/insn-data.def | 2 +- 1 file changed, 1 i
r~
PATCH 7/13 target-s390x: implement LOAD FP INTEGER instructions
In reply to Aurelien JarnoThis is needed to pass the gcc.c-torture/execute/ieee/20010114-2.c test in the gcc testsuite.
--- target-s390x/fpu_helper.c | 31 +++++++++++++++++++++++++++++++ target-s390x/helper.h | 3 +++ target-s390x/insn-data.def | 4 ++++ target-s390x/translate.c | 25 +++++++++++++++++++++++++ 4 files changed, 63 insertions(+)
target-s390x/fpu_helper.c +31 -0
@@ -552,6 +552,37 @@ uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t m3)return ret; } +/* round to integer 32-bit */ +uint64_t HELPER (fieb )(CPUS390XState *env,uint64_t f2,uint32_t m3) +{ +int hold =swap_round_mode (env, m3); +float32 ret =float32_round_to_int (f2, &env->fpu_status); +set_float_rounding_mode (hold, &env->fpu_status); +handle_exceptions (env,GETPC ()); +return ret; +} + +/* round to integer 64-bit */ +uint64_t HELPER (fidb )(CPUS390XState *env,uint64_t f2,uint32_t m3) +{ +int hold =swap_round_mode (env, m3); +float64 ret =float64_round_to_int (f2, &env->fpu_status); +set_float_rounding_mode (hold, &env->fpu_status); +handle_exceptions (env,GETPC ()); +return ret; +} + +/* round to integer 128-bit */ +uint64_t HELPER (fixb )(CPUS390XState *env,uint64_t ah,uint64_t al,uint32_t m3) +{ +int hold =swap_round_mode (env, m3); +float128 ret =float128_round_to_int (make_float128 (ah, al), + &env->fpu_status); +set_float_rounding_mode (hold, &env->fpu_status); +handle_exceptions (env,GETPC ()); +return RET128 (ret); +} +/* 32-bit FP multiply and add */ uint64_t HELPER (maeb )(CPUS390XState *env,uint64_t f1,uint64_t f2,uint64_t f3)
target-s390x/helper.h +3 -0
@@ -60,6 +60,9 @@ DEF_HELPER_FLAGS_4(clgxb, TCG_CALL_NO_WG, i64, env, i64, i64, i32) DEF_HELPER_FLAGS_3(clfeb, TCG_CALL_NO_WG, i64, env, i64, i32) DEF_HELPER_FLAGS_3(clfdb, TCG_CALL_NO_WG, i64, env, i64, i32) DEF_HELPER_FLAGS_4(clfxb, TCG_CALL_NO_WG, i64, env, i64, i64, i32) +DEF_HELPER_FLAGS_3(fieb, TCG_CALL_NO_WG, i64, env, i64, i32) +DEF_HELPER_FLAGS_3(fidb, TCG_CALL_NO_WG, i64, env, i64, i32) +DEF_HELPER_FLAGS_4(fixb, TCG_CALL_NO_WG, i64, env, i64, i64, i32) DEF_HELPER_FLAGS_4(maeb, TCG_CALL_NO_WG, i64, env, i64, i64, i64) DEF_HELPER_FLAGS_4(madb, TCG_CALL_NO_WG, i64, env, i64, i64, i64)DEF_HELPER_FLAGS_4 (mseb,TCG_CALL_NO_WG , i64, env, i64, i64, i64)
target-s390x/insn-data.def +4 -0
@@ -479,6 +479,10 @@ C(0xb29d, LFPC, S, Z, 0, m2_32u, 0, 0, sfpc, 0) /* LOAD FPC AND SIGNAL */ C(0xb2bd, LFAS, S, IEEEE_SIM, 0, m2_32u, 0, 0, sfas, 0) +/* LOAD FP INTEGER */ + C(0xb357, FIEBR, RRF_e, Z, 0, e2, new, e1, fieb, 0) + C(0xb35f, FIDBR, RRF_e, Z, 0, f2_o, f1, 0, fidb, 0) + C(0xb347, FIXBR, RRF_e, Z, 0, f2_o, x1, 0, fixb, 0) /* LOAD LENGTHENED */ C(0xb304, LDEBR, RRE, Z, 0, e2, f1, 0, ldeb, 0)
target-s390x/translate.c +25 -0
@@ -2116,6 +2116,31 @@ static ExitStatus op_ex(DisasContext *s, DisasOps *o)return NO_EXIT ; } +static ExitStatus op_fieb (DisasContext *s,DisasOps *o) +{ +TCGv_i32 m3 =tcg_const_i32 (get_field (s->fields, m3)); +gen_helper_fieb (o->out, cpu_env, o->in2, m3); +tcg_temp_free_i32 (m3); +return NO_EXIT ; +} + +static ExitStatus op_fidb (DisasContext *s,DisasOps *o) +{ +TCGv_i32 m3 =tcg_const_i32 (get_field (s->fields, m3)); +gen_helper_fidb (o->out, cpu_env, o->in2, m3); +tcg_temp_free_i32 (m3); +return NO_EXIT ; +} + +static ExitStatus op_fixb (DisasContext *s,DisasOps *o) +{ +TCGv_i32 m3 =tcg_const_i32 (get_field (s->fields, m3)); +gen_helper_fixb (o->out, cpu_env, o->in1, o->in2, m3); +return_low128 (o->out2); +tcg_temp_free_i32 (m3); +return NO_EXIT ; +} +static ExitStatus op_flogr (DisasContext *s,DisasOps *o) {/* We'll use the original input for cc computation, since we get to
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 07/13] target-s390x: implement LOAD FP INTEGER instructions
target-s390x/insn-data.def line 485
Quoted 4 lines · Aurelien Jarno
target-s390x/insn-data.def +4
-0+/* LOAD FP INTEGER */ + C(0xb357, FIEBR, RRF_e, Z, 0, e2, new, e1, fieb, 0) + C(0xb35f, FIDBR, RRF_e, Z, 0, f2_o, f1, 0, fidb, 0) + C(0xb347, FIXBR, RRF_e, Z, 0, f2_o, x1, 0, fixb, 0)
That should be x2_o for FIXBR.
r~
Re: [Qemu-devel] [PATCH 07/13] target-s390x: implement LOAD FP INTEGER instructions
Quoted 7 lines · Richard Henderson
target-s390x/insn-data.def line 485
Quoted 4 lines · Aurelien Jarno
target-s390x/insn-data.def +4
-0+/* LOAD FP INTEGER */ + C(0xb357, FIEBR, RRF_e, Z, 0, e2, new, e1, fieb, 0) + C(0xb35f, FIDBR, RRF_e, Z, 0, f2_o, f1, 0, fidb, 0) + C(0xb347, FIXBR, RRF_e, Z, 0, f2_o, x1, 0, fixb, 0)That should be
x2_ofor FIXBR.
Good catch, thanks!
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://www.aurel32.net
PATCH 8/13 target-s390x: implement TRANSLATE AND TEST instruction
In reply to Aurelien JarnoIt is part of the basic zArchitecture instructions. Allow it to be call from EXECUTE.
--- target-s390x/helper.h | 1 + target-s390x/insn-data.def | 2 ++ target-s390x/mem_helper.c | 24 ++++++++++++++++++++++++ target-s390x/translate.c | 10 ++++++++++ 4 files changed, 37 insertions(+)
target-s390x/helper.h +1 -0
@@ -77,6 +77,7 @@ DEF_HELPER_FLAGS_3(sqxb, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_1(cvd, TCG_CALL_NO_RWG_SE, i64, s32) DEF_HELPER_FLAGS_4(unpk, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(tr, TCG_CALL_NO_WG, void, env, i32, i64, i64) +DEF_HELPER_4(trt, i32, env, i32, i64, i64) DEF_HELPER_4(cksm, i64, env, i64, i64, i64) DEF_HELPER_FLAGS_5(calc_cc, TCG_CALL_NO_RWG_SE, i32, env, i32, i64, i64, i64)DEF_HELPER_FLAGS_2 (sfpc,TCG_CALL_NO_RWG , void, env, i64)
target-s390x/insn-data.def +2 -0
@@ -759,6 +759,8 @@ /* TRANSLATE */ C(0xdc00, TR, SS_a, Z, la1, a2, 0, 0, tr, 0) +/* TRANSLATE AND TEST */ + C(0xdd00, TRT, SS_a, Z, la1, a2, 0, 0, trt, 0) /* UNPACK */ /* Really format SS_b, but we pack both lengths into one argument
target-s390x/mem_helper.c +24 -0
@@ -509,6 +509,9 @@ uint32_t HELPER(ex)(CPUS390XState *env, uint32_t cc, uint64_t v1,case 0xc00 :helper_tr (env, l,get_address (env,0 , b1, d1),get_address (env,0 , b2, d2)); +case 0xd00 : + cc =helper_trt (env, l,get_address (env,0 , b1, d1), +get_address (env,0 , b2, d2));break ;default : goto abort;
@@ -801,6 +804,27 @@ void HELPER(tr)(CPUS390XState *env, uint32_t len, uint64_t array, } } +uint32_t HELPER (trt )(CPUS390XState *env,uint32_t len,uint64_t array, +uint64_t trans) +{ +uint32_t cc =0 ; +int i; + +for (i =0 ; i <= len; i++) { +uint8_t byte =cpu_ldub_data (env, array + i); +uint8_t sbyte =cpu_ldub_data (env, trans + byte); + +if (sbyte !=0 ) { + env->regs[1 ] = array + i; + env->regs[2 ] = (env->regs[2 ] & ~0xff ) | sbyte; + cc = (i == len) ?2 :1 ; +break ; + } + } + +return cc; +} +#if !defined(CONFIG_USER_ONLY )void HELPER (lctlg )(CPUS390XState *env,uint32_t r1,uint64_t a2,uint32_t r3) {
target-s390x/translate.c +10 -0
@@ -3787,6 +3787,16 @@ static ExitStatus op_tr(DisasContext *s, DisasOps *o)return NO_EXIT ; } +static ExitStatus op_trt (DisasContext *s,DisasOps *o) +{ +TCGv_i32 l =tcg_const_i32 (get_field (s->fields, l1)); +potential_page_fault (s); +gen_helper_trt (cc_op, cpu_env, l, o->addr1, o->in2); +tcg_temp_free_i32 (l); +set_cc_static (s); +return NO_EXIT ; +} +static ExitStatus op_unpk (DisasContext *s,DisasOps *o) {TCGv_i32 l =tcg_const_i32 (get_field (s->fields, l1));
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 08/13] target-s390x: implement TRANSLATE AND TEST instruction
Quoted 6 lines · Aurelien Jarno
It is part of the basic zArchitecture instructions. Allow it to be call from EXECUTE.
Cc Alexander Graf<[email protected]>Cc Richard Henderson<[email protected]>Signed-off-by Aurelien Jarno<[email protected]>
Quoted 6 lines
--- target-s390x/helper.h | 1 + target-s390x/insn-data.def | 2 ++ target-s390x/mem_helper.c | 24 ++++++++++++++++++++++++ target-s390x/translate.c | 10 ++++++++++ 4 files changed, 37 insertions(+)
r~
PATCH 9/13 target-s390x: implement TRANSLATE EXTENDED instruction
In reply to Aurelien JarnoIt is part of the basic zArchitecture instructions.
--- target-s390x/helper.h | 1 + target-s390x/insn-data.def | 2 ++ target-s390x/mem_helper.c | 39 +++++++++++++++++++++++++++++++++++++++ target-s390x/translate.c | 12 ++++++++++++ 4 files changed, 54 insertions(+)
target-s390x/helper.h +1 -0
@@ -77,6 +77,7 @@ DEF_HELPER_FLAGS_3(sqxb, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_1(cvd, TCG_CALL_NO_RWG_SE, i64, s32) DEF_HELPER_FLAGS_4(unpk, TCG_CALL_NO_WG, void, env, i32, i64, i64) DEF_HELPER_FLAGS_4(tr, TCG_CALL_NO_WG, void, env, i32, i64, i64) +DEF_HELPER_3(tre, void, env, i32, i32) DEF_HELPER_4(trt, i32, env, i32, i64, i64) DEF_HELPER_4(cksm, i64, env, i64, i64, i64)DEF_HELPER_FLAGS_5 (calc_cc,TCG_CALL_NO_RWG_SE , i32, env, i32, i64, i64, i64)
target-s390x/insn-data.def +2 -0
@@ -761,6 +761,8 @@ C(0xdc00, TR, SS_a, Z, la1, a2, 0, 0, tr, 0) /* TRANSLATE AND TEST */ C(0xdd00, TRT, SS_a, Z, la1, a2, 0, 0, trt, 0) +/* TRANSLATE EXTENDED */ + C(0xb2a5, TRE, RRE, Z, 0, 0, 0, 0, tre, 0) /* UNPACK */ /* Really format SS_b, but we pack both lengths into one argument
target-s390x/mem_helper.c +39 -0
@@ -804,6 +804,45 @@ void HELPER(tr)(CPUS390XState *env, uint32_t len, uint64_t array, } } +void HELPER (tre )(CPUS390XState *env,uint32_t r1,uint32_t r2) +{ +uint8_t end = env->regs[0 ] &0xff ; +uint64_t array = env->regs[r1]; +uint64_t len = env->regs[r1 +1 ]; +uint64_t trans = env->regs[r2]; +uint64_t i; + +if (!(env->psw.mask &PSW_MASK_64 )) { + array &=0x7fffffff ; + len = (uint32_t )len; + } + +/* Lest we fail to service interrupts in a timely manner, limit the +amount of work we're willing to do. For now, let's cap at 8k. */ +if (len >0x2000 ) { + len =0x2000 ; + env->cc_op =3 ; + }else { + env->cc_op =0 ; + } + +for (i =0 ; i < len; i++) { +uint8_t byte, new_byte; + + byte =cpu_ldub_data (env, array + i); + +if (byte == end) { + env->cc_op =1 ; +break ; + } + + new_byte =cpu_ldub_data (env, trans + byte); +cpu_stb_data (env, array + i, new_byte); + } + env->regs[r1] = array + i; + env->regs[r1 +1 ] -= i; +} +uint32_t HELPER (trt )(CPUS390XState *env,uint32_t len,uint64_t array,uint64_t trans) {
target-s390x/translate.c +12 -0
@@ -3787,6 +3787,18 @@ static ExitStatus op_tr(DisasContext *s, DisasOps *o)return NO_EXIT ; } +static ExitStatus op_tre (DisasContext *s,DisasOps *o) +{ +TCGv_i32 r1 =tcg_const_i32 (get_field (s->fields, r1)); +TCGv_i32 r2 =tcg_const_i32 (get_field (s->fields, r2)); +potential_page_fault (s); +gen_helper_tre (cpu_env, r1, r2); +tcg_temp_free_i32 (r1); +tcg_temp_free_i32 (r2); +set_cc_static (s); +return NO_EXIT ; +} +static ExitStatus op_trt (DisasContext *s,DisasOps *o) {TCGv_i32 l =tcg_const_i32 (get_field (s->fields, l1));
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 09/13] target-s390x: implement TRANSLATE EXTENDED instruction
Quoted 2 lines · Aurelien Jarno
target-s390x/insn-data.def +2
-0+/* TRANSLATE EXTENDED */ + C(0xb2a5, TRE, RRE, Z, 0, 0, 0, 0, tre, 0)
...
target-s390x/translate.c static ExitStatus op_tr(DisasContext *s, DisasOps *o) · line 3800
Quoted 11 lines
target-s390x/translate.c +11
-0+static ExitStatus op_tre (DisasContext *s,DisasOps *o) +{ +TCGv_i32 r1 =tcg_const_i32 (get_field (s->fields, r1)); +TCGv_i32 r2 =tcg_const_i32 (get_field (s->fields, r2)); +potential_page_fault (s); +gen_helper_tre (cpu_env, r1, r2); +tcg_temp_free_i32 (r1); +tcg_temp_free_i32 (r2); +set_cc_static (s); +return NO_EXIT ; +}
Missing the specification exception for odd r1.
Easily fixable by using prep_r1_P. You don't necessarily have to do anything else -- merely prepping out+out2 are sufficient.
But why don't we just pass and return (most) of the data to the helper? Like
C(0xb2a5, TRE, RRE, Z, 0, r2, r1_P, 0, tre, 0)
potential_page_fault(s); gen_helper_tre(o->out, cpu_env, o->out, o->out2, o->in2); return_low128(o->out2); set_cc_static(s);
r~
Re: [Qemu-devel] [PATCH 09/13] target-s390x: implement TRANSLATE EXTENDED instruction
Quoted 4 lines · Richard Henderson
Quoted 2 lines · Aurelien Jarno
target-s390x/insn-data.def +2
-0+/* TRANSLATE EXTENDED */ + C(0xb2a5, TRE, RRE, Z, 0, 0, 0, 0, tre, 0)...
Quoted 13 lines
target-s390x/translate.c static ExitStatus op_tr(DisasContext *s, DisasOps *o) · line 3800
Quoted 11 lines
target-s390x/translate.c +11
-0+static ExitStatus op_tre (DisasContext *s,DisasOps *o) +{ +TCGv_i32 r1 =tcg_const_i32 (get_field (s->fields, r1)); +TCGv_i32 r2 =tcg_const_i32 (get_field (s->fields, r2)); +potential_page_fault (s); +gen_helper_tre (cpu_env, r1, r2); +tcg_temp_free_i32 (r1); +tcg_temp_free_i32 (r2); +set_cc_static (s); +return NO_EXIT ; +}Missing the specification exception for odd r1.
Good catch.
Quoted 11 lines
Easily fixable by using
prep_r1_P. You don't necessarily have to do anything else -- merely prepping out+out2 are sufficient.But why don't we just pass and return (most) of the data to the helper? Like
C(0xb2a5, TRE, RRE, Z, 0, r2, r1_P, 0, tre, 0)potential_page_fault(s); gen_helper_tre(o->out, cpu_env, o->out, o->out2, o->in2); return_low128(o->out2); set_cc_static(s);
My point was that we need to pass 4 values (reg0, r1, r1+1 and r2) and return 3 values (r1, r1+1 and cc), so it's probably better to pass all of them the same way. It's the strategy chosen for other similar instructions (e.g mvcl), except for cc.
I'll change that in the next version.
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://www.aurel32.net
Re: [Qemu-devel] [PATCH 09/13] target-s390x: implement TRANSLATE EXTENDED instruction
Quoted 9 lines · Aurelien Jarno
Quoted 8 lines
But why don't we just pass and return (most) of the data to the helper? Like
C(0xb2a5, TRE, RRE, Z, 0, r2, r1_P, 0, tre, 0)potential_page_fault(s); gen_helper_tre(o->out, cpu_env, o->out, o->out2, o->in2); return_low128(o->out2); set_cc_static(s);
Quoted 6 lines
My point was that we need to pass 4 values (reg0, r1, r1+1 and r2) and return 3 values (r1, r1+1 and cc), so it's probably better to pass all of them the same way. It's the strategy chosen for other similar instructions (e.g mvcl), except for cc.
I'll change that in the next version.
The reg0 and cc data is at a fixed location, and are therefore more amenable to passing implicitly.
It's r1, r1+1, and r2 that are in varying locations, and therefore you either have to pass their register number or their contents.
For mvcl, there are 5 return values, so we're pretty much stuck passing register numbers.
r~
PATCH 10/13 target-s390x: implement LPDFR and LNDFR instructions
In reply to Aurelien JarnoThis complete the floating point support sign handling facility.
--- target-s390x/insn-data.def | 2 ++ 1 file changed, 2 insertions(+)
target-s390x/insn-data.def +2 -0
@@ -451,6 +451,7 @@ C(0xb301, LNEBR, RRE, Z, 0, e2, new, e1, nabsf32, f32) C(0xb311, LNDBR, RRE, Z, 0, f2_o, f1, 0, nabsf64, f64) C(0xb341, LNXBR, RRE, Z, 0, x2_o, x1, 0, nabsf128, f128) + C(0xb371, LNDFR, RRE, FPSSH, 0, f2_o, f1, 0, nabsf64, 0) /* LOAD ON CONDITION */ C(0xb9f2, LOCR, RRF_c, LOC, r1, r2, new, r1_32, loc, 0) C(0xb9e2, LOCGR, RRF_c, LOC, r1, r2, r1, 0, loc, 0)
@@ -464,6 +465,7 @@ C(0xb300, LPEBR, RRE, Z, 0, e2, new, e1, absf32, f32) C(0xb310, LPDBR, RRE, Z, 0, f2_o, f1, 0, absf64, f64) C(0xb340, LPXBR, RRE, Z, 0, x2_o, x1, 0, absf128, f128) + C(0xb370, LPDFR, RRE, FPSSH, 0, f2_o, f1, 0, absf64, 0) /* LOAD REVERSED */ C(0xb91f, LRVR, RRE, Z, 0, r2_32u, new, r1_32, rev32, 0) C(0xb90f, LRVGR, RRE, Z, 0, r2_o, r1, 0, rev64, 0)
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 10/13] target-s390x: implement LPDFR and LNDFR instructions
Quoted 8 lines · Aurelien Jarno
This complete the floating point support sign handling facility.
Cc Alexander Graf <[email protected]>Cc Richard Henderson <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>--- target-s390x/insn-data.def | 2 ++ 1 file changed, 2 insertions(+)
r~
PATCH 11/13 target-s390x: implement miscellaneous-instruction-extensions facility
In reply to Aurelien JarnoRISBGN is the same as RISBG, but without setting the condition code. CLT and CLGT are the same as CLRT and CLGRT, but using memory for the second operand.
--- target-s390x/insn-data.def | 3 +++ target-s390x/translate.c | 1 + 2 files changed, 4 insertions(+)
target-s390x/insn-data.def +3 -0
@@ -230,6 +230,8 @@ /* COMPARE LOGICAL AND TRAP */ D(0xb973, CLRT, RRF_c, GIE, r1_32u, r2_32u, 0, 0, ct, 0, 1) D(0xb961, CLGRT, RRF_c, GIE, r1_o, r2_o, 0, 0, ct, 0, 1) + D(0xeb23, CLT, RSY_b, MIE, r1_32u, m2_32u, 0, 0, ct, 0, 1) + D(0xeb2b, CLGT, RSY_b, MIE, r1_o, m2_64, 0, 0, ct, 0, 1) D(0xec73, CLFIT, RIE_a, GIE, r1_32u, i2_32u, 0, 0, ct, 0, 1) D(0xec71, CLGIT, RIE_a, GIE, r1_o, i2_32u, 0, 0, ct, 0, 1)
@@ -604,6 +606,7 @@ /* ROTATE THEN INSERT SELECTED BITS */ C(0xec55, RISBG, RIE_f, GIE, 0, r2, r1, 0, risbg, s64) + C(0xec59, RISBGN, RIE_f, MIE, 0, r2, r1, 0, risbg, 0) C(0xec5d, RISBHG, RIE_f, HW, 0, r2, r1, 0, risbg, 0) C(0xec51, RISBLG, RIE_f, HW, 0, r2, r1, 0, risbg, 0) /* ROTATE_THEN <OP> SELECTED BITS */
target-s390x/translate.c +1 -0
@@ -1119,6 +1119,7 @@ typedef enum DisasFacility {FAC_HFP_MA ,/* HFP multiply-and-add/subtract */ FAC_HW ,/* high-word */ FAC_IEEEE_SIM ,/* IEEE exception sumilation */ +FAC_MIE ,/* miscellaneous-instruction-extensions */ FAC_LOC ,/* load/store on condition */ FAC_LD ,/* long displacement */ FAC_PC, /* population count */
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 11/13] target-s390x: implement miscellaneous-instruction-extensions facility
Quoted 11 lines · Aurelien Jarno
RISBGN is the same as RISBG, but without setting the condition code. CLT and CLGT are the same as CLRT and CLGRT, but using memory for the second operand.
Cc Alexander Graf <[email protected]>Cc Richard Henderson <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>--- target-s390x/insn-data.def | 3 +++ target-s390x/translate.c | 1 + 2 files changed, 4 insertions(+)
r~
PATCH 12/13 target-s390x: implement load-and-trap facility
In reply to Aurelien JarnoAt the same time move the trap code from op_ct into gen_trap and use it for all new functions. The value needs to be stored back to register before the exception, but also before the brcond (as we don't use temp locals). That's why we can't use wout helper.
--- target-s390x/insn-data.def | 10 ++++++ target-s390x/translate.c | 80 ++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 81 insertions(+), 9 deletions(-)
target-s390x/insn-data.def +10 -0
@@ -389,6 +389,9 @@ C(0xb302, LTEBR, RRE, Z, 0, e2, 0, cond_e1e2, mov2, f32) C(0xb312, LTDBR, RRE, Z, 0, f2_o, 0, f1, mov2, f64) C(0xb342, LTXBR, RRE, Z, 0, x2_o, 0, x1, movx, f128) +/* LOAD AND TRAP */ + C(0xe39f, LAT, RXY_a, LAT, 0, m2_32u, r1, 0, lat, 0) + C(0xe385, LGAT, RXY_a, LAT, 0, a2, r1, 0, lgat, 0) /* LOAD BYTE */ C(0xb926, LBR, RRE, EI, 0, r2_8s, 0, r1_32, mov2, 0) C(0xb906, LGBR, RRE, EI, 0, r2_8s, 0, r1, mov2, 0)
@@ -414,9 +417,13 @@ /* LOAD HALFWORD RELATIVE LONG */ C(0xc405, LHRL, RIL_b, GIE, 0, ri2, new, r1_32, ld16s, 0) C(0xc404, LGHRL, RIL_b, GIE, 0, ri2, r1, 0, ld16s, 0) +/* LOAG HIGH AND TRAP */ + C(0xe3c8, LFHAT, RXY_a, LAT, 0, m2_32u, r1, 0, lfhat, 0) /* LOAD LOGICAL */ C(0xb916, LLGFR, RRE, Z, 0, r2_32u, 0, r1, mov2, 0) C(0xe316, LLGF, RXY_a, Z, 0, a2, r1, 0, ld32u, 0) +/* LOAD LOGICAL AND TRAP */ + C(0xe39d, LLGFAT, RXY_a, LAT, 0, a2, r1, 0, llgfat, 0) /* LOAD LOGICAL RELATIVE LONG */ C(0xc40e, LLGFRL, RIL_b, GIE, 0, ri2, r1, 0, ld32u, 0) /* LOAD LOGICAL CHARACTER */
@@ -442,6 +449,9 @@ /* LOAD LOGICAL THIRTY ONE BITS */ C(0xb917, LLGTR, RRE, Z, 0, r2_o, r1, 0, llgt, 0) C(0xe317, LLGT, RXY_a, Z, 0, m2_32u, r1, 0, llgt, 0) +/* LOAD LOGICAL THIRTY ONE BITS AND TRAP */ + C(0xe39c, LLGTAT, RXY_a, LAT, 0, m2_32u, r1, 0, llgtat, 0) + /* LOAD FPR FROM GR */ C(0xb3c1, LDGR, RRE, FPRGR, 0, r2_o, 0, f1, mov2, 0) /* LOAD GR FROM FPR */
target-s390x/translate.c +71 -9
111 lines not on this page · raw message
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 12/13] target-s390x: implement load-and-trap facility
Quoted 5 lines · Aurelien Jarno
At the same time move the trap code from
op_ctintogen_trapand use it for all new functions. The value needs to be stored back to register before the exception, but also before the brcond (as we don't use temp locals). That's why we can't use wout helper.
Quoted 7 lines
Cc Alexander Graf <[email protected]>Cc Richard Henderson <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>--- target-s390x/insn-data.def | 10 ++++++ target-s390x/translate.c | 80 ++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 81 insertions(+), 9 deletions(-)
r~
PATCH 13/13 target-s390x: implement high-word facility
In reply to Aurelien JarnoBesides RISBHG and RISBLG, all high-word instructions are not implemented. Fix that.
--- target-s390x/insn-data.def | 47 ++++++++++++++++++++++++++++++++++++++++++ target-s390x/translate.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+)
target-s390x/insn-data.def +47 -0
@@ -34,6 +34,9 @@ C(0xb34a, AXBR, RRE, Z, 0, x2_o, x1, 0, axb, f128) C(0xed0a, AEB, RXE, Z, e1, m2_32u, new, e1, aeb, f32) C(0xed1a, ADB, RXE, Z, f1_o, m2_64, f1, 0, adb, f64) +/* ADD HIGH */ + C(0xb9c8, AHHHR, RRF_a, HW, r2_sr32, r3_sr32, new, r1_32h, add, adds32) + C(0xb9d8, AHHLR, RRF_a, HW, r2_sr32, r3, new, r1_32h, add, adds32) /* ADD IMMEDIATE */ C(0xc209, AFI, RIL_a, EI, r1, i2, new, r1_32, add, adds32) C(0xeb6a, ASI, SIY, GIE, m1_32s, i2, new, m1_32, add, adds32)
@@ -41,6 +44,8 @@ C(0xc208, AGFI, RIL_a, EI, r1, i2, r1, 0, add, adds64) C(0xeb7a, AGSI, SIY, GIE, m1_64, i2, new, m1_64, add, adds64) C(0xecd9, AGHIK, RIE_d, DO, r3, i2, r1, 0, add, adds64) +/* ADD IMMEDIATE HIGH */ + C(0xcc08, AIH, RIL_a, HW, r1_sr32, i2, new, r1_32h, add, adds32) /* ADD HALFWORD */ C(0x4a00, AH, RX_a, Z, r1, m2_16s, new, r1_32, add, adds32) C(0xe37a, AHY, RXY_a, LD, r1, m2_16s, new, r1_32, add, adds32)
@@ -58,6 +63,9 @@ C(0xb9ea, ALGRK, RRF_a, DO, r2, r3, r1, 0, add, addu64) C(0xe30a, ALG, RXY_a, Z, r1, m2_64, r1, 0, add, addu64) C(0xe31a, ALGF, RXY_a, Z, r1, m2_32u, r1, 0, add, addu64) +/* ADD LOGICAL HIGH */ + C(0xb9ca, ALHHHR, RRF_a, HW, r2_sr32, r3_sr32, new, r1_32h, add, addu32) + C(0xb9da, ALHHLR, RRF_a, HW, r2_sr32, r3, new, r1_32h, add, addu32) /* ADD LOGICAL IMMEDIATE */ C(0xc20b, ALFI, RIL_a, EI, r1, i2_32u, new, r1_32, add, addu32) C(0xc20a, ALGFI, RIL_a, EI, r1, i2_32u, r1, 0, add, addu64)
@@ -66,6 +74,9 @@ C(0xecda, ALHSIK, RIE_d, DO, r3, i2, new, r1_32, add, addu32) C(0xeb7e, ALGSI, SIY, GIE, m1_64, i2, new, m1_64, add, addu64) C(0xecdb, ALGHSIK, RIE_d, DO, r3, i2, r1, 0, add, addu64) +/* ADD LOGICAL WITH SIGNED IMMEDIATE HIGH */ + C(0xcc0a, ALSIH, RIL_a, HW, r1_sr32, i2, new, r1_32h, add, addu32) + C(0xcc0b, ALSIHN, RIL_a, HW, r1_sr32, i2, new, r1_32h, add, 0) /* ADD LOGICAL WITH CARRY */ C(0xb998, ALCR, RRE, Z, r1, r2, new, r1_32, addc, addc32) C(0xb988, ALCGR, RRE, Z, r1, r2, r1, 0, addc, addc64)
@@ -111,6 +122,8 @@ /* BRANCH RELATIVE ON COUNT */ C(0xa706, BRCT, RI_b, Z, 0, 0, 0, 0, bct32, 0) C(0xa707, BRCTG, RI_b, Z, 0, 0, 0, 0, bct64, 0) +/* BRANCH RELATIVE ON COUNT HIGH */ + C(0xcc06, BRCTH, RIL_b, HW, 0, 0, 0, 0, bcth, 0) /* BRANCH ON INDEX */ D(0x8600, BXH, RS_a, Z, 0, a2, 0, 0, bx32, 0, 0) D(0x8700, BXLE, RS_a, Z, 0, a2, 0, 0, bx32, 0, 1)
@@ -161,6 +174,12 @@ /* COMPARE HALFWORD RELATIVE LONG */ C(0xc605, CHRL, RIL_b, GIE, r1_o, mri2_32s, 0, 0, 0, cmps32) C(0xc604, CGHRL, RIL_b, GIE, r1_o, mri2_64, 0, 0, 0, cmps64) +/* COMPARE HIGH */ + C(0xb9cd, CHHR, RRE, HW, r1_sr32, r2_sr32, 0, 0, 0, cmps32) + C(0xb9dd, CHLR, RRE, HW, r1_sr32, r2_o, 0, 0, 0, cmps32) + C(0xe3cd, CHF, RXY_a, HW, r1_sr32, m2_32s, 0, 0, 0, cmps32) +/* COMPARE IMMEDIATE HIGH */ + C(0xcc0d, CIH, RIL_a, HW, r1_sr32, i2, 0, 0, 0, cmps32) /* COMPARE LOGICAL */ C(0x1500, CLR, RR_a, Z, r1, r2, 0, 0, 0, cmpu32)
@@ -171,6 +190,10 @@ C(0xe321, CLG, RXY_a, Z, r1, m2_64, 0, 0, 0, cmpu64) C(0xe331, CLGF, RXY_a, Z, r1, m2_32u, 0, 0, 0, cmpu64) C(0xd500, CLC, SS_a, Z, la1, a2, 0, 0, clc, 0) +/* COMPARE LOGICAL HIGH */ + C(0xb9cf, CLHHR, RRE, HW, r1_sr32, r2_sr32, 0, 0, 0, cmpu32) + C(0xb9df, CLHLR, RRE, HW, r1_sr32, r2_o, 0, 0, 0, cmpu32) + C(0xe3cf, CLHF, RXY_a, HW, r1_sr32, m2_32s, 0, 0, 0, cmpu32) /* COMPARE LOGICAL IMMEDIATE */ C(0xc20f, CLFI, RIL_a, EI, r1, i2, 0, 0, 0, cmpu32) C(0xc20e, CLGFI, RIL_a, EI, r1, i2_32u, 0, 0, 0, cmpu64)
@@ -179,6 +202,8 @@ C(0xe555, CLHHSI, SIL, GIE, m1_16u, i2_16u, 0, 0, 0, cmpu64) C(0xe55d, CLFHSI, SIL, GIE, m1_32u, i2_16u, 0, 0, 0, cmpu64) C(0xe559, CLGHSI, SIL, GIE, m1_64, i2_16u, 0, 0, 0, cmpu64) +/* COMPARE LOGICAL IMMEDIATE HIGH */ + C(0xcc0f, CLIH, RIL_a, HW, r1_sr32, i2, 0, 0, 0, cmpu32) /* COMPARE LOGICAL RELATIVE LONG */ C(0xc60f, CLRL, RIL_b, GIE, r1_o, mri2_32u, 0, 0, 0, cmpu32) C(0xc60a, CLGRL, RIL_b, GIE, r1_o, mri2_64, 0, 0, 0, cmpu64)
@@ -397,6 +422,8 @@ C(0xb906, LGBR, RRE, EI, 0, r2_8s, 0, r1, mov2, 0) C(0xe376, LB, RXY_a, LD, 0, a2, new, r1_32, ld8s, 0) C(0xe377, LGB, RXY_a, LD, 0, a2, r1, 0, ld8s, 0) +/* LOAD BYTE HIGH */ + C(0xe3c0, LBH, RXY_a, HW, 0, a2, new, r1_32h, ld8s, 0) /* LOAD COMPLEMENT */ C(0x1300, LCR, RR_a, Z, 0, r2, new, r1_32, neg, neg32) C(0xb903, LCGR, RRE, Z, 0, r2, r1, 0, neg, neg64)
@@ -411,12 +438,16 @@ C(0x4800, LH, RX_a, Z, 0, a2, new, r1_32, ld16s, 0) C(0xe378, LHY, RXY_a, LD, 0, a2, new, r1_32, ld16s, 0) C(0xe315, LGH, RXY_a, Z, 0, a2, r1, 0, ld16s, 0) +/* LOAD HALFWORD HIGH */ + C(0xe3c4, LHH, RXY_a, HW, 0, a2, new, r1_32h, ld16s, 0) /* LOAD HALFWORD IMMEDIATE */ C(0xa708, LHI, RI_a, Z, 0, i2, 0, r1_32, mov2, 0) C(0xa709, LGHI, RI_a, Z, 0, i2, 0, r1, mov2, 0) /* LOAD HALFWORD RELATIVE LONG */ C(0xc405, LHRL, RIL_b, GIE, 0, ri2, new, r1_32, ld16s, 0) C(0xc404, LGHRL, RIL_b, GIE, 0, ri2, r1, 0, ld16s, 0) +/* LOAD HIGH */ + C(0xe3ca, LFH, RXY_a, HW, 0, a2, new, r1_32h, ld32u, 0) /* LOAG HIGH AND TRAP */ C(0xe3c8, LFHAT, RXY_a, LAT, 0, m2_32u, r1, 0, lfhat, 0) /* LOAD LOGICAL */
@@ -431,11 +462,15 @@ C(0xb984, LLGCR, RRE, EI, 0, r2_8u, 0, r1, mov2, 0) C(0xe394, LLC, RXY_a, EI, 0, a2, new, r1_32, ld8u, 0) C(0xe390, LLGC, RXY_a, Z, 0, a2, r1, 0, ld8u, 0) +/* LOAD LOGICAL CHARACTER HIGH */ + C(0xe3c2, LLCH, RXY_a, HW, 0, a2, new, r1_32h, ld8u, 0) /* LOAD LOGICAL HALFWORD */ C(0xb995, LLHR, RRE, EI, 0, r2_16u, 0, r1_32, mov2, 0) C(0xb985, LLGHR, RRE, EI, 0, r2_16u, 0, r1, mov2, 0) C(0xe395, LLH, RXY_a, EI, 0, a2, new, r1_32, ld16u, 0) C(0xe391, LLGH, RXY_a, Z, 0, a2, r1, 0, ld16u, 0) +/* LOAD LOGICAL HALFWORD HIGH */ + C(0xe3c6, LLHH, RXY_a, HW, 0, a2, new, r1_32h, ld16u, 0) /* LOAD LOGICAL HALFWORD RELATIVE LONG */ C(0xc402, LLHRL, RIL_b, GIE, 0, ri2, new, r1_32, ld16u, 0) C(0xc406, LLGHRL, RIL_b, GIE, 0, ri2, r1, 0, ld16u, 0)
@@ -689,6 +724,8 @@ /* STORE CHARACTER */ C(0x4200, STC, RX_a, Z, r1_o, a2, 0, 0, st8, 0) C(0xe372, STCY, RXY_a, LD, r1_o, a2, 0, 0, st8, 0) +/* STORE CHARACTER HIGH */ + C(0xe3c3, STCH, RXY_a, HW, r1_sr32, a2, 0, 0, st8, 0) /* STORE CHARACTERS UNDER MASK */ D(0xbe00, STCM, RS_b, Z, r1_o, a2, 0, 0, stcm, 0, 0) D(0xeb2d, STCMY, RSY_b, LD, r1_o, a2, 0, 0, stcm, 0, 0)
@@ -696,8 +733,12 @@ /* STORE HALFWORD */ C(0x4000, STH, RX_a, Z, r1_o, a2, 0, 0, st16, 0) C(0xe370, STHY, RXY_a, LD, r1_o, a2, 0, 0, st16, 0) +/* STORE HALFWORD HIGH */ + C(0xe3c7, STHH, RXY_a, HW, r1_sr32, a2, 0, 0, st16, 0) /* STORE HALFWORD RELATIVE LONG */ C(0xc407, STHRL, RIL_b, GIE, r1_o, ri2, 0, 0, st16, 0) +/* STORE HIGH */ + C(0xe3cb, STFH, RXY_a, HW, r1_sr32, a2, 0, 0, st32, 0) /* STORE ON CONDITION */ D(0xebf3, STOC, RSY_b, LOC, 0, 0, 0, 0, soc, 0, 0) D(0xebe3, STOCG, RSY_b, LOC, 0, 0, 0, 0, soc, 0, 1)
@@ -737,6 +778,9 @@ /* SUBTRACT HALFWORD */ C(0x4b00, SH, RX_a, Z, r1, m2_16s, new, r1_32, sub, subs32) C(0xe37b, SHY, RXY_a, LD, r1, m2_16s, new, r1_32, sub, subs32) +/* SUBTRACT HIGH */ + C(0xb9c9, SHHHR, RRF_a, HW, r2_sr32, r3_sr32, new, r1_32h, sub, subs32) + C(0xb9d9, SHHLR, RRF_a, HW, r2_sr32, r3, new, r1_32h, sub, subs32) /* SUBTRACT LOGICAL */ C(0x1f00, SLR, RR_a, Z, r1, r2, new, r1_32, sub, subu32) C(0xb9fb, SLRK, RRF_a, DO, r2, r3, new, r1_32, sub, subu32)
@@ -747,6 +791,9 @@ C(0xb9eb, SLGRK, RRF_a, DO, r2, r3, r1, 0, sub, subu64) C(0xe30b, SLG, RXY_a, Z, r1, m2_64, r1, 0, sub, subu64) C(0xe31b, SLGF, RXY_a, Z, r1, m2_32u, r1, 0, sub, subu64) +/* SUBTRACT LOCICAL HIGH */ + C(0xb9cb, SLHHHR, RRF_a, HW, r2_sr32, r3_sr32, new, r1_32h, sub, subu32) + C(0xb9db, SLHHLR, RRF_a, HW, r2_sr32, r3, new, r1_32h, sub, subu32) /* SUBTRACT LOGICAL IMMEDIATE */ C(0xc205, SLFI, RIL_a, EI, r1, i2_32u, new, r1_32, sub, subu32) C(0xc204, SLGFI, RIL_a, EI, r1, i2_32u, r1, 0, sub, subu64)
target-s390x/translate.c +51 -0
81 lines not on this page · raw message
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 13/13] target-s390x: implement high-word facility
Quoted 10 lines · Aurelien Jarno
Besides RISBHG and RISBLG, all high-word instructions are not implemented. Fix that.
Cc Alexander Graf <[email protected]>Cc Richard Henderson <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>--- target-s390x/insn-data.def | 47 ++++++++++++++++++++++++++++++++++++++++++ target-s390x/translate.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+)
r~