|
|
| version 1.1, 2003/12/08 00:55:31 | version 1.3, 2004/01/14 16:14:49 |
|---|---|
| Line 27 | Line 27 |
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ | */ |
| #include "compiler.h" | |
| #include "cpu.h" | #include "cpu.h" |
| #ifdef USE_FPU | #ifdef USE_FPU |
| #include "instructions/fpu/fpu.h" | #include "instructions/fpu/fpu.h" |
| #endif | #endif |
| #if 0 | |
| extern BOOL is_a20(void); /* in ../cpuio.c */ | extern BOOL is_a20(void); /* in ../cpuio.c */ |
| #endif | |
| static char *cpu_reg2str(void) | char *cpu_reg2str(void) |
| { | { |
| static char buf[512]; | static char buf[512]; |
| Line 45 static char *cpu_reg2str(void) | Line 49 static char *cpu_reg2str(void) |
| "eflag=%08x " | "eflag=%08x " |
| /* ID VIP VIF AC VM RF NT IOPL OF DF IF TF SF ZF AF PF CF */ | /* ID VIP VIF AC VM RF NT IOPL OF DF IF TF SF ZF AF PF CF */ |
| "[ ID=%d VIP=%d VIF=%d AC=%d VM=%d RF=%d NT=%d IOPL=%d%d %s %s %s TF=%d %s %s %s %s %s ]\n" | "[ ID=%d VIP=%d VIF=%d AC=%d VM=%d RF=%d NT=%d IOPL=%d%d %s %s %s TF=%d %s %s %s %s %s ]\n" |
| "gdtr=%08x:%04x idtr=%08x:%04x ldtr=%04x tr=%04x\n" | "gdtr=%08x:%04x idtr=%08x:%04x\n" |
| "ldtr=%04x(%08x:%04x) tr=%04x(%08x:%04x)\n" | |
| "cr0=%08x cr1=%08x cr2=%08x cr3=%08x cr4=%08x mxcsr=%08x\n", | "cr0=%08x cr1=%08x cr2=%08x cr3=%08x cr4=%08x mxcsr=%08x\n", |
| I286_EAX, I286_EBX, I286_ECX, I286_EDX, I286_ESI, I286_EDI, | CPU_EAX, CPU_EBX, CPU_ECX, CPU_EDX, CPU_ESI, CPU_EDI, |
| I286_EIP, I286_ESP, I286_EBP, CPU_PREV_EIP, | CPU_EIP, CPU_ESP, CPU_EBP, CPU_PREV_EIP, |
| I286_CS, I286_SS, I286_DS, I286_ES, I286_FS, I286_GS, | CPU_CS, CPU_SS, CPU_DS, CPU_ES, CPU_FS, CPU_GS, |
| I286_EFLAG, | CPU_EFLAG, |
| (I286_EFLAG & ID_FLAG) != 0, | (CPU_EFLAG & ID_FLAG) != 0, |
| (I286_EFLAG & VIP_FLAG) != 0, | (CPU_EFLAG & VIP_FLAG) != 0, |
| (I286_EFLAG & VIF_FLAG) != 0, | (CPU_EFLAG & VIF_FLAG) != 0, |
| (I286_EFLAG & AC_FLAG) != 0, | (CPU_EFLAG & AC_FLAG) != 0, |
| (I286_EFLAG & VM_FLAG) != 0, | (CPU_EFLAG & VM_FLAG) != 0, |
| (I286_EFLAG & RF_FLAG) != 0, | (CPU_EFLAG & RF_FLAG) != 0, |
| (I286_EFLAG & NT_FLAG) != 0, | (CPU_EFLAG & NT_FLAG) != 0, |
| I286_EFLAG >> 13 & 1, | CPU_EFLAG >> 13 & 1, |
| I286_EFLAG >> 12 & 1, | CPU_EFLAG >> 12 & 1, |
| I286_EFLAG & O_FLAG ? "OV" : "NV", | CPU_EFLAG & O_FLAG ? "OV" : "NV", |
| I286_EFLAG & D_FLAG ? "UP" : "DN", | CPU_EFLAG & D_FLAG ? "UP" : "DN", |
| I286_EFLAG & I_FLAG ? "DI" : "EI", | CPU_EFLAG & I_FLAG ? "DI" : "EI", |
| (I286_EFLAG & T_FLAG) != 0, | (CPU_EFLAG & T_FLAG) != 0, |
| I286_EFLAG & S_FLAG ? "NG" : "PL", | CPU_EFLAG & S_FLAG ? "NG" : "PL", |
| I286_EFLAG & Z_FLAG ? "ZR" : "NZ", | CPU_EFLAG & Z_FLAG ? "ZR" : "NZ", |
| I286_EFLAG & A_FLAG ? "AC" : "NA", | CPU_EFLAG & A_FLAG ? "AC" : "NA", |
| I286_EFLAG & P_FLAG ? "PE" : "PO", | CPU_EFLAG & P_FLAG ? "PE" : "PO", |
| I286_EFLAG & C_FLAG ? "CY" : "NC", | CPU_EFLAG & C_FLAG ? "CY" : "NC", |
| CPU_GDTR_BASE, CPU_GDTR_LIMIT, CPU_IDTR_BASE, CPU_IDTR_LIMIT, CPU_LDTR, CPU_TR, | CPU_GDTR_BASE, CPU_GDTR_LIMIT, CPU_IDTR_BASE, CPU_IDTR_LIMIT, |
| CPU_LDTR, CPU_LDTR_BASE, CPU_LDTR_LIMIT, CPU_TR, CPU_TR_BASE, CPU_TR_LIMIT, | |
| CPU_CR0, CPU_CR1, CPU_CR2, CPU_CR3, CPU_CR4, CPU_MXCSR); | CPU_CR0, CPU_CR1, CPU_CR2, CPU_CR3, CPU_CR4, CPU_MXCSR); |
| return buf; | return buf; |
| } | } |
| #ifdef USE_FPU | #ifdef USE_FPU |
| static char *fpu_reg2str(void) | char *fpu_reg2str(void) |
| { | { |
| static char buf[512]; | static char buf[512]; |
| char tmp[128]; | char tmp[128]; |
| Line 109 static char *fpu_reg2str(void) | Line 115 static char *fpu_reg2str(void) |
| } | } |
| #endif | #endif |
| #if 0 | |
| static char *a20str(void) | static char *a20str(void) |
| { | { |
| static char buf[32]; | static char buf[32]; |
| Line 160 void FASTCALL msgbox_mem(DWORD no) | Line 167 void FASTCALL msgbox_mem(DWORD no) |
| strcat(buf, fpu_reg2str()); | strcat(buf, fpu_reg2str()); |
| strcat(buf, "\n"); | strcat(buf, "\n"); |
| #endif | #endif |
| strcat(buf, mem2str(I286_CS, I286_IP)); | strcat(buf, mem2str(CPU_CS, CPU_IP)); |
| strcat(buf, "\n"); | strcat(buf, "\n"); |
| sprintf(tmp, "no=%08x\n", no); | sprintf(tmp, "no=%08x\n", no); |
| strcat(buf, tmp); | strcat(buf, tmp); |
| Line 182 void put_cpuinfo(void) | Line 189 void put_cpuinfo(void) |
| printf(buf); | printf(buf); |
| } | } |
| #endif |