浏览代码

[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 8 年前
父节点
当前提交
83c8f2e8e3
共有 2 个文件被更改,包括 28 次插入0 次删除
  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 查看文件

@@ -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 查看文件

@@ -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
+}

正在加载...
取消
保存