Commit 78c34e98cd8fad091f480e31c36c5c533d9f77eb
1 parent
2792c4f2
added LAR/LSL - fixed INT3 and INTO EIP computation
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@149 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
22 additions
and
2 deletions
translate-i386.c
... | ... | @@ -3249,7 +3249,7 @@ long disas_insn(DisasContext *s, uint8_t *pc_start) |
3249 | 3249 | case 0x90: /* nop */ |
3250 | 3250 | break; |
3251 | 3251 | case 0xcc: /* int3 */ |
3252 | - gen_exception(s, EXCP03_INT3, pc_start - s->cs_base); | |
3252 | + gen_exception(s, EXCP03_INT3, s->pc - s->cs_base); | |
3253 | 3253 | break; |
3254 | 3254 | case 0xcd: /* int N */ |
3255 | 3255 | val = ldub(s->pc++); |
... | ... | @@ -3261,7 +3261,7 @@ long disas_insn(DisasContext *s, uint8_t *pc_start) |
3261 | 3261 | case 0xce: /* into */ |
3262 | 3262 | if (s->cc_op != CC_OP_DYNAMIC) |
3263 | 3263 | gen_op_set_cc_op(s->cc_op); |
3264 | - gen_op_into(); | |
3264 | + gen_op_into(s->pc - s->cs_base); | |
3265 | 3265 | break; |
3266 | 3266 | case 0xfa: /* cli */ |
3267 | 3267 | if (!s->vm86) { |
... | ... | @@ -3343,6 +3343,24 @@ long disas_insn(DisasContext *s, uint8_t *pc_start) |
3343 | 3343 | /* XXX: if cpl == 0, then should do something else */ |
3344 | 3344 | gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); |
3345 | 3345 | break; |
3346 | + case 0x102: /* lar */ | |
3347 | + case 0x103: /* lsl */ | |
3348 | + if (s->vm86) | |
3349 | + goto illegal_op; | |
3350 | + ot = dflag ? OT_LONG : OT_WORD; | |
3351 | + modrm = ldub(s->pc++); | |
3352 | + reg = (modrm >> 3) & 7; | |
3353 | + gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0); | |
3354 | + gen_op_mov_TN_reg[ot][1][reg](); | |
3355 | + if (s->cc_op != CC_OP_DYNAMIC) | |
3356 | + gen_op_set_cc_op(s->cc_op); | |
3357 | + if (b == 0x102) | |
3358 | + gen_op_lar(); | |
3359 | + else | |
3360 | + gen_op_lsl(); | |
3361 | + s->cc_op = CC_OP_EFLAGS; | |
3362 | + gen_op_mov_reg_T1[ot][reg](); | |
3363 | + break; | |
3346 | 3364 | default: |
3347 | 3365 | goto illegal_op; |
3348 | 3366 | } |
... | ... | @@ -3579,6 +3597,8 @@ static uint16_t opc_write_flags[NB_OPS] = { |
3579 | 3597 | [INDEX_op_cmpxchgl_T0_T1_EAX_cc] = CC_OSZAPC, |
3580 | 3598 | |
3581 | 3599 | [INDEX_op_cmpxchg8b] = CC_Z, |
3600 | + [INDEX_op_lar] = CC_Z, | |
3601 | + [INDEX_op_lsl] = CC_Z, | |
3582 | 3602 | }; |
3583 | 3603 | |
3584 | 3604 | /* simpler form of an operation if no flags need to be generated */ | ... | ... |