From a098bc2338bfa40bf99f19809dc6cac7509127b3 Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 9 Aug 2016 02:54:10 +0200 Subject: [PATCH] Enabled logging of all CPU exceptions. --- src/386_dynarec.c | 2 +- src/x86_ops_i686.h | 16 ++++++++-------- src/x86seg.c | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/386_dynarec.c b/src/386_dynarec.c index dee4f27a6..122d4a493 100644 --- a/src/386_dynarec.c +++ b/src/386_dynarec.c @@ -270,7 +270,7 @@ void x86_int_sw(int num) void x86illegal() { uint16_t addr; -// pclog("x86 illegal %04X %08X %04X:%08X %02X\n",msw,cr0,CS,pc,opcode); + pclog("x86 illegal %04X %08X %04X:%08X %02X\n",msw,cr0,CS,cpu_state.pc,opcode); // if (output) // { diff --git a/src/x86_ops_i686.h b/src/x86_ops_i686.h index ddc529a54..6e98d85e6 100644 --- a/src/x86_ops_i686.h +++ b/src/x86_ops_i686.h @@ -1,7 +1,7 @@ -static int internal_illegal() +static int internal_illegal(char *s) { cpu_state.pc = oldpc; - x86gpf(NULL, 0); + x86gpf(s, 0); return 1; } @@ -32,8 +32,8 @@ static int opSYSENTER(uint32_t fetchdat) pclog("SYSENTER called\n"); - if (!(cr0 & 1)) return internal_illegal(); - if (!(cs_msr & 0xFFFC)) return internal_illegal(); + if (!(cr0 & 1)) return internal_illegal("SYSENTER: CPU not in protected mode"); + if (!(cs_msr & 0xFFFC)) return internal_illegal("SYSENTER: CS MSR not zero"); pclog("SYSENTER started:\n"); pclog("CS (%04X): base=%08X, limit=%08X, access=%02X, seg=%04X, limit_low=%08X, limit_high=%08X, checked=%i\n", CS, _cs.base, _cs.limit, _cs.access, _cs.seg, _cs.limit_low, _cs.limit_high, _cs.checked); @@ -85,11 +85,11 @@ static int opSYSEXIT(uint32_t fetchdat) pclog("SYSEXIT called\n"); - if (!(cs_msr & 0xFFFC)) return internal_illegal(); - if (!(cr0 & 1)) return internal_illegal(); - if (CS & 3) return internal_illegal(); + if (!(cs_msr & 0xFFFC)) return internal_illegal("SYSEXIT: CS MSR not zero"); + if (!(cr0 & 1)) return internal_illegal("SYSEXIT: CPU not in protected mode"); + if (CS & 3) return internal_illegal("SYSEXIT: CPL not 0"); - pclog("SYSEXIT completed:\n"); + pclog("SYSEXIT start:\n"); pclog("CS (%04X): base=%08X, limit=%08X, access=%02X, seg=%04X, limit_low=%08X, limit_high=%08X, checked=%i\n", CS, _cs.base, _cs.limit, _cs.access, _cs.seg, _cs.limit_low, _cs.limit_high, _cs.checked); pclog("SS (%04X): base=%08X, limit=%08X, access=%02X, seg=%04X, limit_low=%08X, limit_high=%08X, checked=%i\n", SS, _ss.base, _ss.limit, _ss.access, _ss.seg, _ss.limit_low, _ss.limit_high, _ss.checked); pclog("Model specific registers: cs_msr=%04X, esp_msr=%08X, eip_msr=%08X\n", cs_msr, esp_msr, eip_msr); diff --git a/src/x86seg.c b/src/x86seg.c index d13824eee..eb2aa079f 100644 --- a/src/x86seg.c +++ b/src/x86seg.c @@ -145,25 +145,25 @@ void x86_doabrt(int x86_abrt) } void x86gpf(char *s, uint16_t error) { - // pclog("GPF %04X : %s\n", error, s); + pclog("GPF %04X : %s\n", error, s); abrt = ABRT_GPF; abrt_error = error; } void x86ss(char *s, uint16_t error) { - // pclog("SS %04X\n", error); + pclog("SS %04X\n", error); abrt = ABRT_SS; abrt_error = error; } void x86ts(char *s, uint16_t error) { - // pclog("TS %04X\n", error); + pclog("TS %04X\n", error); abrt = ABRT_TS; abrt_error = error; } void x86np(char *s, uint16_t error) { - // pclog("NP %04X : %s\n", error, s); + pclog("NP %04X : %s\n", error, s); abrt = ABRT_NP; abrt_error = error; }