Commit cec6843e87fe29d8419fd5a9ed9912729c068656
1 parent
e5097dc8
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
Showing
4 changed files
with
39 additions
and
61 deletions
target-i386/helper.c
... | ... | @@ -3138,13 +3138,13 @@ void helper_rdmsr(void) |
3138 | 3138 | } |
3139 | 3139 | #endif |
3140 | 3140 | |
3141 | -uint32_t helper_lsl(uint32_t selector) | |
3141 | +target_ulong helper_lsl(target_ulong selector1) | |
3142 | 3142 | { |
3143 | 3143 | unsigned int limit; |
3144 | - uint32_t e1, e2, eflags; | |
3144 | + uint32_t e1, e2, eflags, selector; | |
3145 | 3145 | int rpl, dpl, cpl, type; |
3146 | 3146 | |
3147 | - selector &= 0xffff; | |
3147 | + selector = selector1 & 0xffff; | |
3148 | 3148 | eflags = cc_table[CC_OP].compute_all(); |
3149 | 3149 | if (load_segment(&e1, &e2, selector) != 0) |
3150 | 3150 | goto fail; |
... | ... | @@ -3181,12 +3181,12 @@ uint32_t helper_lsl(uint32_t selector) |
3181 | 3181 | return limit; |
3182 | 3182 | } |
3183 | 3183 | |
3184 | -uint32_t helper_lar(uint32_t selector) | |
3184 | +target_ulong helper_lar(target_ulong selector1) | |
3185 | 3185 | { |
3186 | - uint32_t e1, e2, eflags; | |
3186 | + uint32_t e1, e2, eflags, selector; | |
3187 | 3187 | int rpl, dpl, cpl, type; |
3188 | 3188 | |
3189 | - selector &= 0xffff; | |
3189 | + selector = selector1 & 0xffff; | |
3190 | 3190 | eflags = cc_table[CC_OP].compute_all(); |
3191 | 3191 | if ((selector & 0xfffc) == 0) |
3192 | 3192 | goto fail; |
... | ... | @@ -3227,12 +3227,12 @@ uint32_t helper_lar(uint32_t selector) |
3227 | 3227 | return e2 & 0x00f0ff00; |
3228 | 3228 | } |
3229 | 3229 | |
3230 | -void helper_verr(uint32_t selector) | |
3230 | +void helper_verr(target_ulong selector1) | |
3231 | 3231 | { |
3232 | - uint32_t e1, e2, eflags; | |
3232 | + uint32_t e1, e2, eflags, selector; | |
3233 | 3233 | int rpl, dpl, cpl; |
3234 | 3234 | |
3235 | - selector &= 0xffff; | |
3235 | + selector = selector1 & 0xffff; | |
3236 | 3236 | eflags = cc_table[CC_OP].compute_all(); |
3237 | 3237 | if ((selector & 0xfffc) == 0) |
3238 | 3238 | goto fail; |
... | ... | @@ -3260,12 +3260,12 @@ void helper_verr(uint32_t selector) |
3260 | 3260 | CC_SRC = eflags | CC_Z; |
3261 | 3261 | } |
3262 | 3262 | |
3263 | -void helper_verw(uint32_t selector) | |
3263 | +void helper_verw(target_ulong selector1) | |
3264 | 3264 | { |
3265 | - uint32_t e1, e2, eflags; | |
3265 | + uint32_t e1, e2, eflags, selector; | |
3266 | 3266 | int rpl, dpl, cpl; |
3267 | 3267 | |
3268 | - selector &= 0xffff; | |
3268 | + selector = selector1 & 0xffff; | |
3269 | 3269 | eflags = cc_table[CC_OP].compute_all(); |
3270 | 3270 | if ((selector & 0xfffc) == 0) |
3271 | 3271 | goto fail; | ... | ... |
target-i386/helper.h
... | ... | @@ -23,10 +23,10 @@ void helper_aas(void); |
23 | 23 | void helper_daa(void); |
24 | 24 | void helper_das(void); |
25 | 25 | |
26 | -uint32_t helper_lsl(uint32_t selector); | |
27 | -uint32_t helper_lar(uint32_t selector); | |
28 | -void helper_verr(uint32_t selector); | |
29 | -void helper_verw(uint32_t selector); | |
26 | +target_ulong helper_lsl(target_ulong selector1); | |
27 | +target_ulong helper_lar(target_ulong selector1); | |
28 | +void helper_verr(target_ulong selector1); | |
29 | +void helper_verw(target_ulong selector1); | |
30 | 30 | void helper_lldt(int selector); |
31 | 31 | void helper_ltr(int selector); |
32 | 32 | void helper_load_seg(int seg_reg, int selector); | ... | ... |
target-i386/op.c
... | ... | @@ -167,34 +167,6 @@ void OPPROTO op_movl_T0_seg(void) |
167 | 167 | T0 = env->segs[PARAM1].selector; |
168 | 168 | } |
169 | 169 | |
170 | -void OPPROTO op_lsl(void) | |
171 | -{ | |
172 | - uint32_t val; | |
173 | - val = helper_lsl(T0); | |
174 | - if (CC_SRC & CC_Z) | |
175 | - T1 = val; | |
176 | - FORCE_RET(); | |
177 | -} | |
178 | - | |
179 | -void OPPROTO op_lar(void) | |
180 | -{ | |
181 | - uint32_t val; | |
182 | - val = helper_lar(T0); | |
183 | - if (CC_SRC & CC_Z) | |
184 | - T1 = val; | |
185 | - FORCE_RET(); | |
186 | -} | |
187 | - | |
188 | -void OPPROTO op_verr(void) | |
189 | -{ | |
190 | - helper_verr(T0); | |
191 | -} | |
192 | - | |
193 | -void OPPROTO op_verw(void) | |
194 | -{ | |
195 | - helper_verw(T0); | |
196 | -} | |
197 | - | |
198 | 170 | void OPPROTO op_arpl(void) |
199 | 171 | { |
200 | 172 | if ((T0 & 3) < (T1 & 3)) { | ... | ... |
target-i386/translate.c
... | ... | @@ -6333,9 +6333,9 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) |
6333 | 6333 | if (s->cc_op != CC_OP_DYNAMIC) |
6334 | 6334 | gen_op_set_cc_op(s->cc_op); |
6335 | 6335 | if (op == 4) |
6336 | - gen_op_verr(); | |
6336 | + tcg_gen_helper_0_1(helper_verr, cpu_T[0]); | |
6337 | 6337 | else |
6338 | - gen_op_verw(); | |
6338 | + tcg_gen_helper_0_1(helper_verw, cpu_T[0]); | |
6339 | 6339 | s->cc_op = CC_OP_EFLAGS; |
6340 | 6340 | break; |
6341 | 6341 | default: |
... | ... | @@ -6606,21 +6606,27 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) |
6606 | 6606 | break; |
6607 | 6607 | case 0x102: /* lar */ |
6608 | 6608 | case 0x103: /* lsl */ |
6609 | - if (!s->pe || s->vm86) | |
6610 | - goto illegal_op; | |
6611 | - ot = dflag ? OT_LONG : OT_WORD; | |
6612 | - modrm = ldub_code(s->pc++); | |
6613 | - reg = ((modrm >> 3) & 7) | rex_r; | |
6614 | - gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0); | |
6615 | - gen_op_mov_TN_reg(ot, 1, reg); | |
6616 | - if (s->cc_op != CC_OP_DYNAMIC) | |
6617 | - gen_op_set_cc_op(s->cc_op); | |
6618 | - if (b == 0x102) | |
6619 | - gen_op_lar(); | |
6620 | - else | |
6621 | - gen_op_lsl(); | |
6622 | - s->cc_op = CC_OP_EFLAGS; | |
6623 | - gen_op_mov_reg_T1(ot, reg); | |
6609 | + { | |
6610 | + int label1; | |
6611 | + if (!s->pe || s->vm86) | |
6612 | + goto illegal_op; | |
6613 | + ot = dflag ? OT_LONG : OT_WORD; | |
6614 | + modrm = ldub_code(s->pc++); | |
6615 | + reg = ((modrm >> 3) & 7) | rex_r; | |
6616 | + gen_ldst_modrm(s, modrm, OT_WORD, OR_TMP0, 0); | |
6617 | + if (s->cc_op != CC_OP_DYNAMIC) | |
6618 | + gen_op_set_cc_op(s->cc_op); | |
6619 | + if (b == 0x102) | |
6620 | + tcg_gen_helper_1_1(helper_lar, cpu_T[0], cpu_T[0]); | |
6621 | + else | |
6622 | + tcg_gen_helper_1_1(helper_lsl, cpu_T[0], cpu_T[0]); | |
6623 | + tcg_gen_andi_tl(cpu_tmp0, cpu_cc_src, CC_Z); | |
6624 | + label1 = gen_new_label(); | |
6625 | + tcg_gen_brcond_tl(TCG_COND_EQ, cpu_tmp0, tcg_const_tl(0), label1); | |
6626 | + gen_op_mov_reg_T0(ot, reg); | |
6627 | + gen_set_label(label1); | |
6628 | + s->cc_op = CC_OP_EFLAGS; | |
6629 | + } | |
6624 | 6630 | break; |
6625 | 6631 | case 0x118: |
6626 | 6632 | modrm = ldub_code(s->pc++); | ... | ... |