|
|
| version 1.1, 2004/03/07 01:23:14 | version 1.9, 2004/03/30 07:12:02 |
|---|---|
| Line 6 | Line 6 |
| #include "iocore.h" | #include "iocore.h" |
| #include "debugsub.h" | #include "debugsub.h" |
| void debugwriteseg(const char *fname, const descriptor_t *sd, | |
| UINT32 addr, UINT32 size); | |
| void debugpageptr(UINT32 addr); | |
| #if defined(MACOS) | #if defined(MACOS) |
| #define CRLITERAL "\r" | #define CRLITERAL "\r" |
| Line 107 static char work[256]; | Line 111 static char work[256]; |
| return(work); | return(work); |
| } | } |
| static void writeseg(const char *fname, UINT32 addr, UINT limit) { | void debugwriteseg(const char *fname, const descriptor_t *sd, |
| UINT32 addr, UINT32 size) { | |
| FILEH fh; | FILEH fh; |
| UINT size; | |
| BYTE buf[0x1000]; | BYTE buf[0x1000]; |
| UINT32 limit; | |
| limit = sd->u.seg.limit; | |
| if (limit <= addr) { | |
| return; | |
| } | |
| size = min(limit - addr, size - 1) + 1; | |
| fh = file_create_c(fname); | fh = file_create_c(fname); |
| if (fh == FILEH_INVALID) { | if (fh == FILEH_INVALID) { |
| return; | return; |
| } | } |
| limit = min(limit, 0xffff); | addr += sd->u.seg.segbase; |
| limit++; | while(size) { |
| while(limit) { | limit = min(size, sizeof(buf)); |
| size = min(limit, sizeof(buf)); | MEML_READ(addr, buf, limit); |
| MEML_READ(addr, buf, size); | file_write(fh, buf, limit); |
| file_write(fh, buf, size); | addr += limit; |
| addr += size; | size -= limit; |
| limit -= size; | |
| } | } |
| file_close(fh); | file_close(fh); |
| } | } |
| Line 135 static int filenum = 0; | Line 144 static int filenum = 0; |
| FILEH fh; | FILEH fh; |
| char work[512]; | char work[512]; |
| const char *p; | const char *p; |
| descriptor_t *sd; | |
| SPRINTF(work, file_i386reg, filenum); | SPRINTF(work, file_i386reg, filenum); |
| fh = file_create_c(work); | fh = file_create_c(work); |
| Line 145 const char *p; | Line 153 const char *p; |
| SPRINTF(work, str_picstat, | SPRINTF(work, str_picstat, |
| pic.pi[0].imr, pic.pi[0].irr, pic.pi[0].isr, | pic.pi[0].imr, pic.pi[0].irr, pic.pi[0].isr, |
| pic.pi[1].imr, pic.pi[1].irr, pic.pi[1].isr, | pic.pi[1].imr, pic.pi[1].irr, pic.pi[1].isr, |
| mouseif.portc, sysport.c); | mouseif.upd8255.portc, sysport.c); |
| file_write(fh, work, strlen(work)); | file_write(fh, work, strlen(work)); |
| file_close(fh); | file_close(fh); |
| } | } |
| SPRINTF(work, file_i386cs, filenum); | SPRINTF(work, file_i386cs, filenum); |
| sd = &CPU_STAT_SREG(CPU_CS_INDEX); | debugwriteseg(work, &CPU_STAT_SREG(CPU_CS_INDEX), CPU_EIP & 0xffff0000, 0x10000); |
| writeseg(work, sd->u.seg.segbase, sd->u.seg.limit); | |
| SPRINTF(work, file_i386ds, filenum); | SPRINTF(work, file_i386ds, filenum); |
| sd = &CPU_STAT_SREG(CPU_DS_INDEX); | debugwriteseg(work, &CPU_STAT_SREG(CPU_DS_INDEX), 0, 0x10000); |
| writeseg(work, sd->u.seg.segbase, sd->u.seg.limit); | |
| SPRINTF(work, file_i386es, filenum); | SPRINTF(work, file_i386es, filenum); |
| sd = &CPU_STAT_SREG(CPU_ES_INDEX); | debugwriteseg(work, &CPU_STAT_SREG(CPU_ES_INDEX), 0, 0x10000); |
| writeseg(work, sd->u.seg.segbase, sd->u.seg.limit); | |
| SPRINTF(work, file_i386ss, filenum); | SPRINTF(work, file_i386ss, filenum); |
| sd = &CPU_STAT_SREG(CPU_SS_INDEX); | debugwriteseg(work, &CPU_STAT_SREG(CPU_SS_INDEX), CPU_ESP & 0xffff0000, 0x10000); |
| writeseg(work, sd->u.seg.segbase, sd->u.seg.limit); | |
| filenum++; | filenum++; |
| iptrace_out(); | |
| } | } |
| void debugsub_memorydump(void) { | void debugsub_memorydump(void) { |
| Line 181 void debugsub_memorydump(void) { | Line 187 void debugsub_memorydump(void) { |
| } | } |
| } | } |
| void debugsub_memorydumpall(void) { | |
| FILEH fh; | |
| fh = file_create_c(file_memorybin); | |
| if (fh != FILEH_INVALID) { | |
| file_write(fh, mem, 0x110000); | |
| if (CPU_EXTMEMSIZE > 0x10000) { | |
| file_write(fh, CPU_EXTMEM + 0x10000, CPU_EXTMEMSIZE - 0x10000); | |
| } | |
| file_close(fh); | |
| } | |
| } | |
| #if 1 // ²¶ÍѥǥХ° | |
| void debugpageptr(UINT32 addr) { | |
| FILEH fh; | |
| char buf[256]; | |
| UINT32 pde; | |
| UINT32 pte; | |
| UINT i; | |
| UINT32 a; | |
| fh = file_create("page.txt"); | |
| SPRINTF(buf, "CR3=%.8x\r\n", CPU_CR3); | |
| file_write(fh, buf, strlen(buf)); | |
| for (i=0; i<1024; i++) { | |
| a = CPU_STAT_PDE_BASE + (i * 4); | |
| pde = cpu_memoryread_d(a); | |
| SPRINTF(buf, "%.8x=>%.8x [%.8x]\r\n", (i << 22), pde, a); | |
| file_write(fh, buf, strlen(buf)); | |
| } | |
| addr >>= 22; | |
| pde = cpu_memoryread_d(CPU_STAT_PDE_BASE + (addr * 4)); | |
| for (i=0; i<1024; i++) { | |
| a = (pde & CPU_PDE_BASEADDR_MASK) + (i * 4); | |
| pte = cpu_memoryread_d(a); | |
| SPRINTF(buf, "%.8x=>%.8x [%.8x]\r\n", (addr << 22) + (i << 12), pte, a); | |
| file_write(fh, buf, strlen(buf)); | |
| } | |
| file_close(fh); | |
| } | |
| #endif |