diff options
author | Michael Brown <mcb30@ipxe.org> | 2016-01-12 08:27:59 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2016-01-12 08:27:59 +0000 |
commit | 83c8f2e8e352e676d9951dda58b74e587101c0b4 (patch) | |
tree | c34d2a8689d19c8b4fa1790d8ef5e09e740fc758 /src | |
parent | 7d48affec200bc1d74f42813eca0c31d548d1167 (diff) | |
download | ipxe-83c8f2e8e352e676d9951dda58b74e587101c0b4.tar.gz |
[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>
Diffstat (limited to 'src')
-rw-r--r-- | src/arch/i386/include/biosint.h | 1 | ||||
-rw-r--r-- | src/arch/i386/interface/pcbios/biosint.c | 27 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/arch/i386/include/biosint.h b/src/arch/i386/include/biosint.h index 67d6a3811..f47116f70 100644 --- a/src/arch/i386/include/biosint.h +++ b/src/arch/i386/include/biosint.h @@ -29,5 +29,6 @@ extern void hook_bios_interrupt ( unsigned int interrupt, unsigned int handler, extern int unhook_bios_interrupt ( unsigned int interrupt, unsigned int handler, struct segoff *chain_vector ); +extern void check_bios_interrupts ( void ); #endif /* BIOSINT_H */ diff --git a/src/arch/i386/interface/pcbios/biosint.c b/src/arch/i386/interface/pcbios/biosint.c index 3b8e80438..667e9ed81 100644 --- a/src/arch/i386/interface/pcbios/biosint.c +++ b/src/arch/i386/interface/pcbios/biosint.c @@ -90,3 +90,30 @@ int unhook_bios_interrupt ( unsigned int interrupt, unsigned int handler, hooked_bios_interrupts--; return 0; } + +/** + * Dump changes to interrupt vector table (for debugging) + * + */ +void check_bios_interrupts ( void ) { + static struct segoff vectors[256]; + static uint8_t initialised; + struct segoff vector; + unsigned int i; + + /* Print any changed interrupt vectors */ + for ( i = 0; i < ( sizeof ( vectors ) / sizeof ( vectors[0] ) ); i++ ) { + copy_from_real ( &vector, 0, ( i * sizeof ( vector ) ), + sizeof ( vector ) ); + if ( memcmp ( &vector, &vectors[i], sizeof ( vector ) ) == 0 ) + continue; + if ( initialised ) { + dbg_printf ( "INT %02x changed %04x:%04x => " + "%04x:%04x\n", i, vectors[i].segment, + vectors[i].offset, vector.segment, + vector.offset ); + } + memcpy ( &vectors[i], &vector, sizeof ( vectors[i] ) ); + } + initialised = 1; +} |