Commit 504e56ebdca53bf8e8d379aa994e90a2e3b0d564
1 parent
455b7619
more accurate GPF generation
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@128 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
14 additions
and
7 deletions
op-i386.c
| @@ -616,8 +616,10 @@ void OPPROTO op_jmp_im(void) | @@ -616,8 +616,10 @@ void OPPROTO op_jmp_im(void) | ||
| 616 | 616 | ||
| 617 | void OPPROTO op_int_im(void) | 617 | void OPPROTO op_int_im(void) |
| 618 | { | 618 | { |
| 619 | - EIP = PARAM1; | ||
| 620 | - raise_exception(EXCP0D_GPF); | 619 | + int intno; |
| 620 | + intno = PARAM1; | ||
| 621 | + EIP = PARAM2; | ||
| 622 | + raise_exception_err(EXCP0D_GPF, intno * 8 + 2); | ||
| 621 | } | 623 | } |
| 622 | 624 | ||
| 623 | void OPPROTO op_int3(void) | 625 | void OPPROTO op_int3(void) |
| @@ -633,18 +635,23 @@ void OPPROTO op_into(void) | @@ -633,18 +635,23 @@ void OPPROTO op_into(void) | ||
| 633 | if (eflags & CC_O) { | 635 | if (eflags & CC_O) { |
| 634 | raise_exception(EXCP04_INTO); | 636 | raise_exception(EXCP04_INTO); |
| 635 | } | 637 | } |
| 638 | + FORCE_RET(); | ||
| 636 | } | 639 | } |
| 637 | 640 | ||
| 638 | -/* XXX: add IOPL/CPL tests */ | ||
| 639 | -void OPPROTO op_cli(void) | 641 | +void OPPROTO op_gpf(void) |
| 640 | { | 642 | { |
| 643 | + EIP = PARAM1; | ||
| 641 | raise_exception(EXCP0D_GPF); | 644 | raise_exception(EXCP0D_GPF); |
| 642 | } | 645 | } |
| 643 | 646 | ||
| 644 | -/* XXX: add IOPL/CPL tests */ | 647 | +void OPPROTO op_cli(void) |
| 648 | +{ | ||
| 649 | + env->eflags &= ~IF_MASK; | ||
| 650 | +} | ||
| 651 | + | ||
| 645 | void OPPROTO op_sti(void) | 652 | void OPPROTO op_sti(void) |
| 646 | { | 653 | { |
| 647 | - raise_exception(EXCP0D_GPF); | 654 | + env->eflags |= IF_MASK; |
| 648 | } | 655 | } |
| 649 | 656 | ||
| 650 | /* vm86plus instructions */ | 657 | /* vm86plus instructions */ |
| @@ -1097,7 +1104,7 @@ void load_seg(int seg_reg, int selector) | @@ -1097,7 +1104,7 @@ void load_seg(int seg_reg, int selector) | ||
| 1097 | dt = &env->gdt; | 1104 | dt = &env->gdt; |
| 1098 | index = selector & ~7; | 1105 | index = selector & ~7; |
| 1099 | if ((index + 7) > dt->limit) | 1106 | if ((index + 7) > dt->limit) |
| 1100 | - raise_exception(EXCP0D_GPF); | 1107 | + raise_exception_err(EXCP0D_GPF, selector); |
| 1101 | ptr = dt->base + index; | 1108 | ptr = dt->base + index; |
| 1102 | e1 = ldl(ptr); | 1109 | e1 = ldl(ptr); |
| 1103 | e2 = ldl(ptr + 4); | 1110 | e2 = ldl(ptr + 4); |