Explorar el Código

[i386] Add dump_regs() debug call

Use as "call dump_regs" from any real-mode code within .text16.
Should preserve all registers and flags.
tags/v0.9.5
Michael Brown hace 16 años
padre
commit
e3c5507178
Se han modificado 1 ficheros con 23 adiciones y 0 borrados
  1. 23
    0
      src/arch/i386/core/dumpregs.c

+ 23
- 0
src/arch/i386/core/dumpregs.c Ver fichero

@@ -0,0 +1,23 @@
1
+#include <stdio.h>
2
+#include <realmode.h>
3
+
4
+void __cdecl _dump_regs ( struct i386_all_regs *ix86 ) {
5
+
6
+	__asm__ __volatile__ (
7
+		TEXT16_CODE ( ".globl dump_regs\n\t"
8
+			      "\ndump_regs:\n\t"
9
+			      "pushl $_dump_regs\n\t"
10
+			      "pushw %%cs\n\t"
11
+			      "call prot_call\n\t"
12
+			      "addr32 leal 4(%%esp), %%esp\n\t"
13
+			      "ret\n\t" ) : : );
14
+
15
+	printf ( "EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx\n"
16
+		 "ESI=%08lx EDI=%08lx EBP=%08lx ESP=%08lx\n"
17
+		 "CS=%04x SS=%04x DS=%04x ES=%04x FS=%04x GS=%04x\n",
18
+		 ix86->regs.eax, ix86->regs.ebx, ix86->regs.ecx,
19
+		 ix86->regs.edx, ix86->regs.esi, ix86->regs.edi,
20
+		 ix86->regs.ebp, ix86->regs.esp,
21
+		 ix86->segs.cs, ix86->segs.ss, ix86->segs.ds,
22
+		 ix86->segs.es, ix86->segs.fs, ix86->segs.gs );
23
+}

Loading…
Cancelar
Guardar