diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-05-21 16:25:27 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-05-21 16:25:27 +0000 |
commit | cec6843e87fe29d8419fd5a9ed9912729c068656 (patch) | |
tree | 18655d7ea74f7eae9e230c6a8f0bdcbf4fe302d3 /target-i386 | |
parent | e5097dc8e3beb5cc94d132681db7a2433bdce5a7 (diff) |
converted LSL/LAR/VERW/VERR to TCG - force 16 bit memory access for LSL/LAR
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4513 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-i386')
-rw-r--r-- | target-i386/helper.c | 24 | ||||
-rw-r--r-- | target-i386/helper.h | 8 | ||||
-rw-r--r-- | target-i386/op.c | 28 | ||||
-rw-r--r-- | target-i386/translate.c | 40 |
4 files changed, 39 insertions, 61 deletions
diff --git a/target-i386/helper.c b/target-i386/helper.c index 0891ec9dc1..731d7a328c 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -3138,13 +3138,13 @@ void helper_rdmsr(void) } #endif -uint32_t helper_lsl(uint32_t selector) +target_ulong helper_lsl(target_ulong selector1) { unsigned int limit; - uint32_t e1, e2, eflags; + uint32_t e1, e2, eflags, selector; int rpl, dpl, cpl, type; - selector &= 0xffff; + selector = selector1 & 0xffff; eflags = cc_table[CC_OP].compute_all(); if (load_segment(&e1, &e2, selector) != 0) goto fail; @@ -3181,12 +3181,12 @@ uint32_t helper_lsl(uint32_t selector) return limit; } -uint32_t helper_lar(uint32_t selector) +target_ulong helper_lar(target_ulong selector1) { - uint32_t e1, e2, eflags; + uint32_t e1, e2, eflags, selector; int rpl, dpl, cpl, type; - selector &= 0xffff; + selector = selector1 & 0xffff; eflags = cc_table[CC_OP].compute_all(); if ((selector & 0xfffc) == 0) goto fail; @@ -3227,12 +3227,12 @@ uint32_t helper_lar(uint32_t selector) return e2 & 0x00f0ff00; } -void helper_verr(uint32_t selector) +void helper_verr(target_ulong selector1) { - uint32_t e1, e2, eflags; + uint32_t e1, e2, eflags, selector; int rpl, dpl, cpl; - selector &= 0xffff; + selector = selector1 & 0xffff; eflags = cc_table[CC_OP].compute_all(); if ((selector & 0xfffc) == 0) goto fail; @@ -3260,12 +3260,12 @@ void helper_verr(uint32_t selector) CC_SRC = eflags | CC_Z; } -void helper_verw(uint32_t selector) +void helper_verw(target_ulong selector1) { - uint32_t e1, e2, eflags; + uint32_t e1, e2, eflags, selector; int rpl, dpl, cpl; - selector &= 0xffff; + selector = selector1 & 0xffff; eflags = cc_table[CC_OP].compute_all(); if ((selector & 0xfffc) == 0) goto fail; diff --git a/target-i386/helper.h b/target-i386/helper.h index 76775e15a6..e0ff417b23 100644 --- a/target-i386/helper.h +++ b/target-i386/helper.h @@ -23,10 +23,10 @@ void helper_aas(void); void helper_daa(void); void helper_das(void); -uint32_t helper_lsl(uint32_t selector); -uint32_t helper_lar(uint32_t selector); -void helper_verr(uint32_t selector); -void helper_verw(uint32_t selector); +target_ulong helper_lsl(target_ulong selector1); +target_ulong helper_lar(target_ulong selector1); +void helper_verr(target_ulong selector1); +void helper_verw(target_ulong selector1); void helper_lldt(int selector); void helper_ltr(int selector); void helper_load_seg(int seg_reg, int selector); diff --git a/target-i386/op.c b/target-i386/op.c index a4833010b4..d637423c65 100644 --- a/target-i386/op.c +++ b/target-i386/op.c @@ -167,34 +167,6 @@ void OPPROTO op_movl_T0_seg(void) T0 = env->segs[PARAM1].selector; } -void OPPROTO op_lsl(void) -{ - uint32_t val; - val = helper_lsl(T0); - if (CC_SRC & CC_Z) - T1 = val; - FORCE_RET(); -} - -void OPPROTO op_lar(void) -{ - uint32_t val; - val = helper_lar(T0); - if (CC_SRC & CC_Z) - T1 = val; - FORCE_RET(); -} - -void OPPROTO op_verr(void) -{ - helper_verr(T0); -} - -void OPPROTO op_verw(void) -{ - helper_verw(T0); -} - void OPPROTO op_arpl(void) { if ((T0 & 3) < (T1 & 3)) { diff --git a/target-i386/translate.c b/target-i386/translate.c index 5efebb349d..b2cd4d5f28 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -6333,9 +6333,9 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); if (op == 4) - gen_op_verr(); + tcg_gen_helper_0_1(helper_verr, cpu_T[0]); else - gen_op_verw(); + tcg_gen_helper_0_1(helper_verw, cpu_T[0]); s->cc_op = CC_OP_EFLAGS; break; default: @@ -6606,21 +6606,27 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) break; case 0x102: /* lar */ case 0x103: /* lsl */ - if (!s->pe || s->vm86) - goto illegal_op; - ot = dflag ? OT_LONG : OT_WORD; - modrm = ldub_code(s->pc++); - reg = ((modrm >> 3) & 7) | rex_r; - gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0); - gen_op_mov_TN_reg(ot, 1, reg); - if (s->cc_op != CC_OP_DYNAMIC) - gen_op_set_cc_op(s->cc_op); - if (b == 0x102) - gen_op_lar(); - else - gen_op_lsl(); - s->cc_op = CC_OP_EFLAGS; - gen_op_mov_reg_T1(ot, reg); + { + int label1; + if (!s->pe || s->vm86) + goto illegal_op; + ot = dflag ? OT_LONG : OT_WORD; + modrm = ldub_code(s->pc++); + reg = ((modrm >> 3) & 7) | rex_r; + gen_ldst_modrm(s, modrm, OT_WORD, OR_TMP0, 0); + if (s->cc_op != CC_OP_DYNAMIC) + gen_op_set_cc_op(s->cc_op); + if (b == 0x102) + tcg_gen_helper_1_1(helper_lar, cpu_T[0], cpu_T[0]); + else + tcg_gen_helper_1_1(helper_lsl, cpu_T[0], cpu_T[0]); + tcg_gen_andi_tl(cpu_tmp0, cpu_cc_src, CC_Z); + label1 = gen_new_label(); + tcg_gen_brcond_tl(TCG_COND_EQ, cpu_tmp0, tcg_const_tl(0), label1); + gen_op_mov_reg_T0(ot, reg); + gen_set_label(label1); + s->cc_op = CC_OP_EFLAGS; + } break; case 0x118: modrm = ldub_code(s->pc++); |