Index: xen-3.1-testing/tools/firmware/vmxassist/vm86.c =================================================================== --- xen-3.1-testing.orig/tools/firmware/vmxassist/vm86.c +++ xen-3.1-testing/tools/firmware/vmxassist/vm86.c @@ -40,7 +40,7 @@ enum vm86_mode mode = 0; static struct regs saved_rm_regs; #ifdef DEBUG -int traceset = 0; +int traceset = 0xffffffff; char *states[] = { "", @@ -164,6 +164,35 @@ address(struct regs *regs, unsigned seg, return 0; } +void +panic_eip(struct regs *regs, char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + vprintf(fmt, ap); + printf("\n"); + va_end(ap); +#ifdef DEBUG + if (regs->eflags & EFLAGS_VM) { + unsigned int range = 20; + unsigned int eip = address(regs, regs->cs, regs->eip); + unsigned int start = (eip < range) ? 0 : eip - range; + unsigned int stop = (eip > 0x100000 - range) ? 0x100000 : eip + range; + int size = (stop - start); + unsigned int i; + unsigned char data[size]; + + printf("Dumping %x..%x eip=%x\n", start, stop, eip); + for (i = start; i < stop; ++i) + data[i-start] = *(unsigned char *) i; + hexdump(data, size); + } +#else + regs = regs; +#endif + halt(); +} + #ifdef DEBUG void trace(struct regs *regs, int adjust, char *fmt, ...) @@ -1636,7 +1665,7 @@ emulate(struct regs *regs) /* detect the case where we are not making progress */ if (nemul == 0 && prev_eip == regs->eip) { flteip = address(regs, MASK16(regs->cs), regs->eip); - panic("Unknown opcode at %04x:%04x=0x%x", + panic_eip(regs, "Unknown opcode at %04x:%04x=0x%x", MASK16(regs->cs), regs->eip, flteip); } else prev_eip = regs->eip; @@ -1662,7 +1691,7 @@ trap(int trapno, int errno, struct regs if (mode == VM86_REAL) return; if (mode != VM86_REAL_TO_PROTECTED) - panic("not in real-to-protected mode"); + panic_eip(regs, "not in real-to-protected mode"); emulate(regs); return; } @@ -1672,7 +1701,7 @@ trap(int trapno, int errno, struct regs if (regs->eflags & EFLAGS_VM) { /* emulate any 8086 instructions */ if (mode == VM86_PROTECTED) - panic("unexpected protected mode"); + panic_eip(regs, "unexpected protected mode"); emulate(regs); return; } Index: xen-3.1-testing/tools/firmware/rombios/rombios.c =================================================================== --- xen-3.1-testing.orig/tools/firmware/rombios/rombios.c +++ xen-3.1-testing/tools/firmware/rombios/rombios.c @@ -131,18 +131,18 @@ // // BCC Bug: find a generic way to handle the bug of #asm after an "if" (fixed in 0.16.7) -#define DEBUG_ROMBIOS 0 +#define DEBUG_ROMBIOS 1 -#define DEBUG_ATA 0 -#define DEBUG_INT13_HD 0 -#define DEBUG_INT13_CD 0 -#define DEBUG_INT13_ET 0 -#define DEBUG_INT13_FL 0 -#define DEBUG_INT15 0 -#define DEBUG_INT16 0 -#define DEBUG_INT1A 0 -#define DEBUG_INT74 0 -#define DEBUG_APM 0 +#define DEBUG_ATA 1 +#define DEBUG_INT13_HD 1 +#define DEBUG_INT13_CD 1 +#define DEBUG_INT13_ET 1 +#define DEBUG_INT13_FL 1 +#define DEBUG_INT15 1 +#define DEBUG_INT16 1 +#define DEBUG_INT1A 1 +#define DEBUG_INT74 1 +#define DEBUG_APM 1 #define BX_CPU 3 #define BX_USE_PS2_MOUSE 1