--- np2/i386c/ia32/exception.c 2012/01/08 11:32:16 1.34 +++ np2/i386c/ia32/exception.c 2012/02/07 09:30:05 1.37 @@ -147,14 +147,7 @@ exception(int num, int error_code) VERBOSE(("exception: ---------------------------------------------------------------- end")); - interrupt(num, INTR_TYPE_EXTINTR, errorp, error_code); -#if defined(IA32_SUPPORT_DEBUG_REGISTER) - if (num != BP_EXCEPTION) { - if (CPU_INST_OP32) { - set_eflags(REAL_EFLAGREG|RF_FLAG, RF_FLAG); - } - } -#endif + interrupt(num, INTR_TYPE_EXCEPTION, errorp, error_code); CPU_STAT_EXCEPTION_COUNTER_CLEAR(); siglongjmp(exec_1step_jmpbuf, 1); } @@ -227,7 +220,7 @@ interrupt(int num, int intrtype, int err UINT16 new_cs; int exc_errcode; - VERBOSE(("interrupt: num = 0x%02x, intrtype = %s, errorp = %s, error_code = %08x", num, intrtype ? "on" : "off", errorp ? "on" : "off", error_code)); + VERBOSE(("interrupt: num = 0x%02x, intrtype = %s, errorp = %s, error_code = %08x", num, (intrtype == INTR_TYPE_EXTINTR) ? "external" : (intrtype == INTR_TYPE_EXCEPTION ? "exception" : "softint"), errorp ? "on" : "off", error_code)); CPU_SET_PREV_ESP(); @@ -309,8 +302,8 @@ interrupt(int num, int intrtype, int err } /* 5.10.1.1. 例外/割り込みハンドラ・プロシージャの保護 */ - if ((intrtype != INTR_TYPE_EXTINTR) && (gsd.dpl < CPU_STAT_CPL)) { - VERBOSE(("interrupt: intrtype(%d) && DPL(%d) < CPL(%d)", intrtype, gsd.dpl, CPU_STAT_CPL)); + if ((intrtype == INTR_TYPE_SOFTINTR) && (gsd.dpl < CPU_STAT_CPL)) { + VERBOSE(("interrupt: intrtype(softint) && DPL(%d) < CPL(%d)", gsd.dpl, CPU_STAT_CPL)); EXCEPTION(GP_EXCEPTION, exc_errcode); } @@ -389,7 +382,12 @@ interrupt_task_gate(const descriptor_t * CPU_SET_PREV_ESP(); if (errorp) { - XPUSH0(error_code); + VERBOSE(("interrupt: push error code (%08x)", error_code)); + if (task_sel.desc.type == CPU_SYSDESC_TYPE_TSS_32) { + PUSH0_32(error_code); + } else { + PUSH0_16(error_code); + } } /* out of range */