diff options
author | Michael Brown | 2008-09-29 00:06:53 +0200 |
---|---|---|
committer | Michael Brown | 2008-09-29 00:06:53 +0200 |
commit | e3c550717864cb60b982389eb845b825bb9574e8 (patch) | |
tree | 33140a95ed3d2847a84c4806d5353d8fe44a2070 | |
parent | [hermon] Allocate only as much memory as is needed for ICM and ICM AUX (diff) | |
download | ipxe-e3c550717864cb60b982389eb845b825bb9574e8.tar.gz ipxe-e3c550717864cb60b982389eb845b825bb9574e8.tar.xz ipxe-e3c550717864cb60b982389eb845b825bb9574e8.zip |
[i386] Add dump_regs() debug call
Use as "call dump_regs" from any real-mode code within .text16.
Should preserve all registers and flags.
-rw-r--r-- | src/arch/i386/core/dumpregs.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/arch/i386/core/dumpregs.c b/src/arch/i386/core/dumpregs.c new file mode 100644 index 00000000..89426d58 --- /dev/null +++ b/src/arch/i386/core/dumpregs.c @@ -0,0 +1,23 @@ +#include <stdio.h> +#include <realmode.h> + +void __cdecl _dump_regs ( struct i386_all_regs *ix86 ) { + + __asm__ __volatile__ ( + TEXT16_CODE ( ".globl dump_regs\n\t" + "\ndump_regs:\n\t" + "pushl $_dump_regs\n\t" + "pushw %%cs\n\t" + "call prot_call\n\t" + "addr32 leal 4(%%esp), %%esp\n\t" + "ret\n\t" ) : : ); + + printf ( "EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx\n" + "ESI=%08lx EDI=%08lx EBP=%08lx ESP=%08lx\n" + "CS=%04x SS=%04x DS=%04x ES=%04x FS=%04x GS=%04x\n", + ix86->regs.eax, ix86->regs.ebx, ix86->regs.ecx, + ix86->regs.edx, ix86->regs.esi, ix86->regs.edi, + ix86->regs.ebp, ix86->regs.esp, + ix86->segs.cs, ix86->segs.ss, ix86->segs.ds, + ix86->segs.es, ix86->segs.fs, ix86->segs.gs ); +} |