Parcourir la source

[i386] Add check_bios_interrupts() debug function

Provide a debug function check_bios_interrupts() to look for changes
to the interrupt vector table.  This can be useful when investigating
the behaviour (including crashes) of external PXE NBPs.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown il y a 8 ans
Parent
révision
83c8f2e8e3
2 fichiers modifiés avec 28 ajouts et 0 suppressions
  1. 1
    0
      src/arch/i386/include/biosint.h
  2. 27
    0
      src/arch/i386/interface/pcbios/biosint.c

+ 1
- 0
src/arch/i386/include/biosint.h Voir le fichier

@@ -29,5 +29,6 @@ extern void hook_bios_interrupt ( unsigned int interrupt, unsigned int handler,
29 29
 extern int unhook_bios_interrupt ( unsigned int interrupt,
30 30
 				   unsigned int handler,
31 31
 				   struct segoff *chain_vector );
32
+extern void check_bios_interrupts ( void );
32 33
 
33 34
 #endif /* BIOSINT_H */

+ 27
- 0
src/arch/i386/interface/pcbios/biosint.c Voir le fichier

@@ -90,3 +90,30 @@ int unhook_bios_interrupt ( unsigned int interrupt, unsigned int handler,
90 90
 	hooked_bios_interrupts--;
91 91
 	return 0;
92 92
 }
93
+
94
+/**
95
+ * Dump changes to interrupt vector table (for debugging)
96
+ *
97
+ */
98
+void check_bios_interrupts ( void ) {
99
+	static struct segoff vectors[256];
100
+	static uint8_t initialised;
101
+	struct segoff vector;
102
+	unsigned int i;
103
+
104
+	/* Print any changed interrupt vectors */
105
+	for ( i = 0; i < ( sizeof ( vectors ) / sizeof ( vectors[0] ) ); i++ ) {
106
+		copy_from_real ( &vector, 0, ( i * sizeof ( vector ) ),
107
+				 sizeof ( vector ) );
108
+		if ( memcmp ( &vector, &vectors[i], sizeof ( vector ) ) == 0 )
109
+			continue;
110
+		if ( initialised ) {
111
+			dbg_printf ( "INT %02x changed %04x:%04x => "
112
+				     "%04x:%04x\n", i, vectors[i].segment,
113
+				     vectors[i].offset, vector.segment,
114
+				     vector.offset );
115
+		}
116
+		memcpy ( &vectors[i], &vector, sizeof ( vectors[i] ) );
117
+	}
118
+	initialised = 1;
119
+}

Chargement…
Annuler
Enregistrer