| version 1.4, 2004/01/23 14:33:26 | version 1.6, 2004/01/27 15:56:57 | 
| Line 73  exception(int num, int error_code) | Line 73  exception(int num, int error_code) | 
 | __ASSERT((unsigned int)num < EXCEPTION_NUM); | __ASSERT((unsigned int)num < EXCEPTION_NUM); | 
 |  |  | 
 | VERBOSE(("exception: %s, error_code = %x at %04x:%08x", exception_str[num], error_code, CPU_CS, CPU_PREV_EIP)); | VERBOSE(("exception: %s, error_code = %x at %04x:%08x", exception_str[num], error_code, CPU_CS, CPU_PREV_EIP)); | 
 |  | VERBOSE(("exception:------------------------------------------------")); | 
 |  | VERBOSE(("%s", cpu_reg2str())); | 
 |  | VERBOSE(("exception:------------------------------------------------")); | 
 |  |  | 
 | CPU_STAT_NERROR++; | CPU_STAT_NERROR++; | 
 | if ((CPU_STAT_NERROR >= 3) | if ((CPU_STAT_NERROR >= 3) | 
| Line 132  exception(int num, int error_code) | Line 135  exception(int num, int error_code) | 
 | break; | break; | 
 | } | } | 
 |  |  | 
 | #if defined(DEBUG) |  | 
 | if (num == PF_EXCEPTION) { |  | 
 | VERBOSE(("exception: CPU_CR2 = %08x", CPU_CR2)); |  | 
 | } |  | 
 | #endif |  | 
 |  |  | 
 | if (CPU_STAT_NERROR >= 2) { | if (CPU_STAT_NERROR >= 2) { | 
 | if (dftable[exctype[CPU_STAT_PREV_EXCEPTION]][exctype[num]]) { | if (dftable[exctype[CPU_STAT_PREV_EXCEPTION]][exctype[num]]) { | 
 | num = DF_EXCEPTION; | num = DF_EXCEPTION; | 
| Line 146  exception(int num, int error_code) | Line 143  exception(int num, int error_code) | 
 | CPU_STAT_PREV_EXCEPTION = num; | CPU_STAT_PREV_EXCEPTION = num; | 
 |  |  | 
 | INTERRUPT(num, FALSE, errorp, error_code); | INTERRUPT(num, FALSE, errorp, error_code); | 
 | CPU_STAT_NERROR = 0; |  | 
 | siglongjmp(exec_1step_jmpbuf, 1); | siglongjmp(exec_1step_jmpbuf, 1); | 
 | } | } | 
 |  |  | 
| Line 356  static void | Line 352  static void | 
 | interrupt_intr_or_trap(descriptor_t *gdp, int softintp, int errorp, int error_code) | interrupt_intr_or_trap(descriptor_t *gdp, int softintp, int errorp, int error_code) | 
 | { | { | 
 | selector_t intr_sel, ss_sel; | selector_t intr_sel, ss_sel; | 
 |  | DWORD old_flags = REAL_EFLAGREG; | 
 | DWORD flags = REAL_EFLAGREG; | DWORD flags = REAL_EFLAGREG; | 
 | DWORD mask = 0; | DWORD mask = 0; | 
 | DWORD stacksize; | DWORD stacksize; | 
| Line 364  interrupt_intr_or_trap(descriptor_t *gdp | Line 361  interrupt_intr_or_trap(descriptor_t *gdp | 
 | WORD old_cs, old_ss, new_ss; | WORD old_cs, old_ss, new_ss; | 
 | int rv; | int rv; | 
 |  |  | 
 |  | VERBOSE(("interrupt: old EIP = %04x:%08x, ESP = %04x:%08x", CPU_CS, CPU_PREV_EIP, CPU_SS, CPU_ESP)); | 
 |  |  | 
 |  | new_ip = gdp->u.gate.offset; | 
 |  | old_ss = CPU_SS; | 
 |  | old_cs = CPU_CS; | 
 |  | old_ip = CPU_EIP; | 
 |  | old_sp = CPU_ESP; | 
 |  |  | 
 | switch (gdp->type) { | switch (gdp->type) { | 
 | case CPU_SYSDESC_TYPE_INTR_16: | case CPU_SYSDESC_TYPE_INTR_16: | 
 |  | old_ip &= 0xffff; | 
 |  | old_sp &= 0xffff; | 
 |  | /*FALLTHROUGH*/ | 
 | case CPU_SYSDESC_TYPE_INTR_32: | case CPU_SYSDESC_TYPE_INTR_32: | 
 | VERBOSE(("interrupt: INTERRUPT-GATE")); | VERBOSE(("interrupt: INTERRUPT-GATE")); | 
 | flags &= ~I_FLAG; | flags &= ~I_FLAG; | 
| Line 373  interrupt_intr_or_trap(descriptor_t *gdp | Line 381  interrupt_intr_or_trap(descriptor_t *gdp | 
 | break; | break; | 
 |  |  | 
 | case CPU_SYSDESC_TYPE_TRAP_16: | case CPU_SYSDESC_TYPE_TRAP_16: | 
 |  | old_ip &= 0xffff; | 
 |  | old_sp &= 0xffff; | 
 |  | /*FALLTHROUGH*/ | 
 | case CPU_SYSDESC_TYPE_TRAP_32: | case CPU_SYSDESC_TYPE_TRAP_32: | 
 | VERBOSE(("interrupt: TRAP-GATE")); | VERBOSE(("interrupt: TRAP-GATE")); | 
 | break; | break; | 
 | } | } | 
 |  |  | 
 | flags &= ~(T_FLAG|RF_FLAG|NT_FLAG|VM_FLAG); | flags &= ~(T_FLAG|RF_FLAG|NT_FLAG|VM_FLAG); | 
 | mask |= T_FLAG|RF_FLAG|NT_FLAG|VM_FLAG; | mask |= T_FLAG|RF_FLAG|NT_FLAG|VM_FLAG; | 
 |  |  | 
 | new_ip = gdp->u.gate.offset; |  | 
 | old_ss = CPU_SS; |  | 
 | old_cs = CPU_CS; |  | 
 | old_ip = CPU_EIP; |  | 
 | old_sp = CPU_ESP; |  | 
 | switch (gdp->type) { |  | 
 | case CPU_SYSDESC_TYPE_INTR_16: |  | 
 | case CPU_SYSDESC_TYPE_TRAP_16: |  | 
 | old_ip &= 0xffff; |  | 
 | old_sp &= 0xffff; |  | 
 | break; |  | 
 | } |  | 
 | VERBOSE(("interrupt: old EIP = %04x:%08x, old ESP = %04x:%08x", old_cs, old_ip, old_ss, old_sp)); |  | 
 |  |  | 
 | rv = parse_selector(&intr_sel, gdp->u.gate.selector); | rv = parse_selector(&intr_sel, gdp->u.gate.selector); | 
 | if (rv < 0) { | if (rv < 0) { | 
 | VERBOSE(("interrupt: parse_selector (selector = %04x, rv = %d)", gdp->u.gate.selector, rv)); | VERBOSE(("interrupt: parse_selector (selector = %04x, rv = %d)", gdp->u.gate.selector, rv)); | 
| Line 492  interrupt_intr_or_trap(descriptor_t *gdp | Line 488  interrupt_intr_or_trap(descriptor_t *gdp | 
 | EXCEPTION(GP_EXCEPTION, 0); | EXCEPTION(GP_EXCEPTION, 0); | 
 | } | } | 
 |  |  | 
| load_ss(new_ss, &ss_sel.desc, intr_sel.desc.dpl); | load_ss(ss_sel.selector, &ss_sel.desc, intr_sel.desc.dpl); | 
| if (CPU_STAT_SS32) { | CPU_ESP = new_sp; | 
| CPU_ESP = new_sp; |  | 
| } else { |  | 
| CPU_SP = new_sp; |  | 
| } |  | 
 |  |  | 
 | load_cs(intr_sel.selector, &intr_sel.desc, intr_sel.desc.dpl); | load_cs(intr_sel.selector, &intr_sel.desc, intr_sel.desc.dpl); | 
 | SET_EIP(new_ip); | SET_EIP(new_ip); | 
| Line 529  interrupt_intr_or_trap(descriptor_t *gdp | Line 521  interrupt_intr_or_trap(descriptor_t *gdp | 
 | case CPU_SYSDESC_TYPE_TRAP_32: | case CPU_SYSDESC_TYPE_TRAP_32: | 
 | PUSH0_32(old_ss); | PUSH0_32(old_ss); | 
 | PUSH0_32(old_sp); | PUSH0_32(old_sp); | 
| PUSH0_32(REAL_EFLAGREG); | PUSH0_32(old_flags); | 
 | PUSH0_32(old_cs); | PUSH0_32(old_cs); | 
 | PUSH0_32(old_ip); | PUSH0_32(old_ip); | 
 | if (errorp) { | if (errorp) { | 
| Line 541  interrupt_intr_or_trap(descriptor_t *gdp | Line 533  interrupt_intr_or_trap(descriptor_t *gdp | 
 | case CPU_SYSDESC_TYPE_TRAP_16: | case CPU_SYSDESC_TYPE_TRAP_16: | 
 | PUSH0_16(old_ss); | PUSH0_16(old_ss); | 
 | PUSH0_16(old_sp); | PUSH0_16(old_sp); | 
| PUSH0_16(REAL_FLAGREG); | PUSH0_16(old_flags); | 
 | PUSH0_16(old_cs); | PUSH0_16(old_cs); | 
 | PUSH0_16(old_ip); | PUSH0_16(old_ip); | 
 | if (errorp) { | if (errorp) { |