mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
target-s390: Convert SRST
Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
parent
aa31bf6031
commit
4600c994d9
4 changed files with 45 additions and 32 deletions
|
@ -13,7 +13,7 @@ DEF_HELPER_3(divs32, s64, env, s64, s64)
|
||||||
DEF_HELPER_3(divu32, i64, env, i64, i64)
|
DEF_HELPER_3(divu32, i64, env, i64, i64)
|
||||||
DEF_HELPER_3(divs64, s64, env, s64, s64)
|
DEF_HELPER_3(divs64, s64, env, s64, s64)
|
||||||
DEF_HELPER_4(divu64, i64, env, i64, i64, i64)
|
DEF_HELPER_4(divu64, i64, env, i64, i64, i64)
|
||||||
DEF_HELPER_4(srst, i32, env, i32, i32, i32)
|
DEF_HELPER_4(srst, i64, env, i64, i64, i64)
|
||||||
DEF_HELPER_4(clst, i64, env, i64, i64, i64)
|
DEF_HELPER_4(clst, i64, env, i64, i64, i64)
|
||||||
DEF_HELPER_4(mvpg, void, env, i64, i64, i64)
|
DEF_HELPER_4(mvpg, void, env, i64, i64, i64)
|
||||||
DEF_HELPER_4(mvst, i64, env, i64, i64, i64)
|
DEF_HELPER_4(mvst, i64, env, i64, i64, i64)
|
||||||
|
|
|
@ -471,6 +471,9 @@
|
||||||
C(0xeb1d, RLL, RSY_a, Z, r3_o, sh32, new, r1_32, rll32, 0)
|
C(0xeb1d, RLL, RSY_a, Z, r3_o, sh32, new, r1_32, rll32, 0)
|
||||||
C(0xeb1c, RLLG, RSY_a, Z, r3_o, sh64, r1, 0, rll64, 0)
|
C(0xeb1c, RLLG, RSY_a, Z, r3_o, sh64, r1, 0, rll64, 0)
|
||||||
|
|
||||||
|
/* SEARCH STRING */
|
||||||
|
C(0xb25e, SRST, RRE, Z, r1_o, r2_o, 0, 0, srst, 0)
|
||||||
|
|
||||||
/* SET ACCESS */
|
/* SET ACCESS */
|
||||||
C(0xb24e, SAR, RRE, Z, 0, r2_o, 0, 0, sar, 0)
|
C(0xb24e, SAR, RRE, Z, 0, r2_o, 0, 0, sar, 0)
|
||||||
/* SET FPC */
|
/* SET FPC */
|
||||||
|
|
|
@ -331,25 +331,38 @@ static inline uint64_t get_address_31fix(CPUS390XState *env, int reg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* search string (c is byte to search, r2 is string, r1 end of string) */
|
/* search string (c is byte to search, r2 is string, r1 end of string) */
|
||||||
uint32_t HELPER(srst)(CPUS390XState *env, uint32_t c, uint32_t r1, uint32_t r2)
|
uint64_t HELPER(srst)(CPUS390XState *env, uint64_t r0, uint64_t end,
|
||||||
|
uint64_t str)
|
||||||
{
|
{
|
||||||
uint64_t i;
|
uint32_t len;
|
||||||
uint32_t cc = 2;
|
uint8_t v, c = r0;
|
||||||
uint64_t str = get_address_31fix(env, r2);
|
|
||||||
uint64_t end = get_address_31fix(env, r1);
|
|
||||||
|
|
||||||
HELPER_LOG("%s: c %d *r1 0x%" PRIx64 " *r2 0x%" PRIx64 "\n", __func__,
|
str = fix_address(env, str);
|
||||||
c, env->regs[r1], env->regs[r2]);
|
end = fix_address(env, end);
|
||||||
|
|
||||||
for (i = str; i != end; i++) {
|
/* Assume for now that R2 is unmodified. */
|
||||||
if (cpu_ldub_data(env, i) == c) {
|
env->retxl = str;
|
||||||
env->regs[r1] = i;
|
|
||||||
cc = 1;
|
/* Lest we fail to service interrupts in a timely manner, limit the
|
||||||
break;
|
amount of work we're willing to do. For now, lets cap at 8k. */
|
||||||
|
for (len = 0; len < 0x2000; ++len) {
|
||||||
|
if (str + len == end) {
|
||||||
|
/* Character not found. R1 & R2 are unmodified. */
|
||||||
|
env->cc_op = 2;
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
v = cpu_ldub_data(env, str + len);
|
||||||
|
if (v == c) {
|
||||||
|
/* Character found. Set R1 to the location; R2 is unmodified. */
|
||||||
|
env->cc_op = 1;
|
||||||
|
return str + len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cc;
|
/* CPU-determined bytes processed. Advance R2 to next byte to process. */
|
||||||
|
env->retxl = str + len;
|
||||||
|
env->cc_op = 3;
|
||||||
|
return end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* unsigned string compare (c is string terminator) */
|
/* unsigned string compare (c is string terminator) */
|
||||||
|
|
|
@ -1021,12 +1021,11 @@ static void free_compare(DisasCompare *c)
|
||||||
static void disas_b2(CPUS390XState *env, DisasContext *s, int op,
|
static void disas_b2(CPUS390XState *env, DisasContext *s, int op,
|
||||||
uint32_t insn)
|
uint32_t insn)
|
||||||
{
|
{
|
||||||
TCGv_i64 tmp, tmp2, tmp3;
|
|
||||||
TCGv_i32 tmp32_1, tmp32_2, tmp32_3;
|
|
||||||
int r1, r2;
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
|
TCGv_i64 tmp, tmp2, tmp3;
|
||||||
|
TCGv_i32 tmp32_1, tmp32_2;
|
||||||
|
int r1, r2;
|
||||||
int r3, d2, b2;
|
int r3, d2, b2;
|
||||||
#endif
|
|
||||||
|
|
||||||
r1 = (insn >> 4) & 0xf;
|
r1 = (insn >> 4) & 0xf;
|
||||||
r2 = insn & 0xf;
|
r2 = insn & 0xf;
|
||||||
|
@ -1034,19 +1033,6 @@ static void disas_b2(CPUS390XState *env, DisasContext *s, int op,
|
||||||
LOG_DISAS("disas_b2: op 0x%x r1 %d r2 %d\n", op, r1, r2);
|
LOG_DISAS("disas_b2: op 0x%x r1 %d r2 %d\n", op, r1, r2);
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case 0x5e: /* SRST R1,R2 [RRE] */
|
|
||||||
tmp32_1 = load_reg32(0);
|
|
||||||
tmp32_2 = tcg_const_i32(r1);
|
|
||||||
tmp32_3 = tcg_const_i32(r2);
|
|
||||||
potential_page_fault(s);
|
|
||||||
gen_helper_srst(cc_op, cpu_env, tmp32_1, tmp32_2, tmp32_3);
|
|
||||||
set_cc_static(s);
|
|
||||||
tcg_temp_free_i32(tmp32_1);
|
|
||||||
tcg_temp_free_i32(tmp32_2);
|
|
||||||
tcg_temp_free_i32(tmp32_3);
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
|
||||||
case 0x02: /* STIDP D2(B2) [S] */
|
case 0x02: /* STIDP D2(B2) [S] */
|
||||||
/* Store CPU ID */
|
/* Store CPU ID */
|
||||||
check_privileged(s);
|
check_privileged(s);
|
||||||
|
@ -1314,12 +1300,14 @@ static void disas_b2(CPUS390XState *env, DisasContext *s, int op,
|
||||||
tcg_temp_free_i32(tmp32_1);
|
tcg_temp_free_i32(tmp32_1);
|
||||||
tcg_temp_free_i64(tmp);
|
tcg_temp_free_i64(tmp);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
|
#endif
|
||||||
LOG_DISAS("illegal b2 operation 0x%x\n", op);
|
LOG_DISAS("illegal b2 operation 0x%x\n", op);
|
||||||
gen_illegal_opcode(s);
|
gen_illegal_opcode(s);
|
||||||
|
#ifndef CONFIG_USER_ONLY
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disas_s390_insn(CPUS390XState *env, DisasContext *s)
|
static void disas_s390_insn(CPUS390XState *env, DisasContext *s)
|
||||||
|
@ -3136,6 +3124,15 @@ static ExitStatus op_stmh(DisasContext *s, DisasOps *o)
|
||||||
return NO_EXIT;
|
return NO_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ExitStatus op_srst(DisasContext *s, DisasOps *o)
|
||||||
|
{
|
||||||
|
potential_page_fault(s);
|
||||||
|
gen_helper_srst(o->in1, cpu_env, regs[0], o->in1, o->in2);
|
||||||
|
set_cc_static(s);
|
||||||
|
return_low128(o->in2);
|
||||||
|
return NO_EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
static ExitStatus op_sub(DisasContext *s, DisasOps *o)
|
static ExitStatus op_sub(DisasContext *s, DisasOps *o)
|
||||||
{
|
{
|
||||||
tcg_gen_sub_i64(o->out, o->in1, o->in2);
|
tcg_gen_sub_i64(o->out, o->in1, o->in2);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue