diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2008-06-12 22:59:43 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2008-06-12 22:59:43 -0400 |
commit | 15c1f2207f4d406bb56032cef5920f474f32de88 (patch) | |
tree | 26094bfcb85b116a5786e574ba353bd8e541f84e | |
parent | 2e3eeebc33bcf780912f3b10fb23f82d4f9afb22 (diff) | |
download | seabios-hppa-15c1f2207f4d406bb56032cef5920f474f32de88.zip seabios-hppa-15c1f2207f4d406bb56032cef5920f474f32de88.tar.gz seabios-hppa-15c1f2207f4d406bb56032cef5920f474f32de88.tar.bz2 |
Support config driven debugging of each irq handler.
This allows one to easily enable verbose output from handlers.
-rw-r--r-- | src/boot.c | 4 | ||||
-rw-r--r-- | src/clock.c | 8 | ||||
-rw-r--r-- | src/config.h | 26 | ||||
-rw-r--r-- | src/disk.c | 6 | ||||
-rw-r--r-- | src/floppy.c | 2 | ||||
-rw-r--r-- | src/kbd.c | 4 | ||||
-rw-r--r-- | src/mouse.c | 4 | ||||
-rw-r--r-- | src/serial.c | 4 | ||||
-rw-r--r-- | src/system.c | 14 | ||||
-rw-r--r-- | src/util.h | 12 |
10 files changed, 57 insertions, 27 deletions
@@ -200,7 +200,7 @@ do_boot(u16 seq_nr) void VISIBLE16 handle_18() { - debug_enter(NULL); + debug_enter(NULL, DEBUG_HDL_18); u16 seq = GET_EBDA(ipl.sequence) + 1; do_boot(seq); } @@ -209,6 +209,6 @@ handle_18() void VISIBLE16 handle_19() { - debug_enter(NULL); + debug_enter(NULL, DEBUG_HDL_19); do_boot(0); } diff --git a/src/clock.c b/src/clock.c index aef1be8..5bf4642 100644 --- a/src/clock.c +++ b/src/clock.c @@ -276,7 +276,7 @@ handle_1aXX(struct bregs *regs) void VISIBLE16 handle_1a(struct bregs *regs) { - //debug_enter(regs); + debug_enter(regs, DEBUG_HDL_1a); switch (regs->ah) { case 0x00: handle_1a00(regs); break; case 0x01: handle_1a01(regs); break; @@ -295,14 +295,14 @@ handle_1a(struct bregs *regs) void VISIBLE16 handle_1c() { - //debug_enter(regs); + debug_isr(DEBUG_ISR_1c); } // INT 08h System Timer ISR Entry Point void VISIBLE16 handle_08() { - //debug_isr(); + debug_isr(DEBUG_ISR_08); irq_enable(); floppy_tick(); @@ -448,7 +448,7 @@ handle_1583(struct bregs *regs) void VISIBLE16 handle_70() { - //debug_isr(); + debug_isr(DEBUG_ISR_70); // Check which modes are enabled and have occurred. u8 registerB = inb_cmos(CMOS_STATUS_B); diff --git a/src/config.h b/src/config.h index 1f2a6b5..3f5782f 100644 --- a/src/config.h +++ b/src/config.h @@ -69,4 +69,30 @@ // Start of fixed addresses in 0xf0000 segment. #define BUILD_START_FIXED 0xe050 +// Debugging levels. If non-zero and CONFIG_DEBUG_LEVEL is greater +// than the specified value, then the corresponding irq handler will +// report every enter event. +#define DEBUG_HDL_05 1 +#define DEBUG_HDL_10 1 +#define DEBUG_HDL_11 1 +#define DEBUG_HDL_12 1 +#define DEBUG_HDL_15 9 +#define DEBUG_ISR_nmi 1 +#define DEBUG_ISR_75 1 +#define DEBUG_HDL_16 9 +#define DEBUG_ISR_09 9 +#define DEBUG_HDL_18 1 +#define DEBUG_HDL_19 1 +#define DEBUG_HDL_1a 9 +#define DEBUG_ISR_1c 9 +#define DEBUG_ISR_08 9 +#define DEBUG_ISR_70 9 +#define DEBUG_HDL_40 1 +#define DEBUG_HDL_13 9 +#define DEBUG_ISR_76 9 +#define DEBUG_HDL_14 1 +#define DEBUG_HDL_17 1 +#define DEBUG_ISR_74 9 +#define DEBUG_ISR_0e 9 + #endif // config.h @@ -644,7 +644,7 @@ handle_legacy_disk(struct bregs *regs, u8 drive) void VISIBLE16 handle_40(struct bregs *regs) { - debug_enter(regs); + debug_enter(regs, DEBUG_HDL_40); handle_legacy_disk(regs, regs->dl); } @@ -652,7 +652,7 @@ handle_40(struct bregs *regs) void VISIBLE16 handle_13(struct bregs *regs) { - //debug_enter(regs); + debug_enter(regs, DEBUG_HDL_13); u8 drive = regs->dl; if (CONFIG_CDROM_EMU) { @@ -676,7 +676,7 @@ handle_13(struct bregs *regs) void VISIBLE16 handle_76() { - //debug_isr(); + debug_isr(DEBUG_ISR_76); SET_BDA(disk_interrupt_flag, 0xff); eoi_both_pics(); } diff --git a/src/floppy.c b/src/floppy.c index 1f1c2c5..e0b46c2 100644 --- a/src/floppy.c +++ b/src/floppy.c @@ -744,7 +744,7 @@ floppy_13(struct bregs *regs, u8 drive) void VISIBLE16 handle_0e() { - //debug_isr(); + debug_isr(DEBUG_ISR_0e); if ((inb(PORT_FD_STATUS) & 0xc0) != 0xc0) { outb(0x08, PORT_FD_DATA); // sense interrupt status while ((inb(PORT_FD_STATUS) & 0xc0) != 0xc0) @@ -390,7 +390,7 @@ set_leds() void VISIBLE16 handle_16(struct bregs *regs) { - //debug_enter(regs); + debug_enter(regs, DEBUG_HDL_16); set_leds(); @@ -700,7 +700,7 @@ process_key(u8 scancode) void VISIBLE16 handle_09() { - //debug_isr(); + debug_isr(DEBUG_ISR_09); // disable keyboard outb(0xad, PORT_PS2_STATUS); diff --git a/src/mouse.c b/src/mouse.c index 6c21499..23e17de 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -6,7 +6,7 @@ // This file may be distributed under the terms of the GNU GPLv3 license. #include "biosvar.h" // struct bregs -#include "util.h" // debug_enter +#include "util.h" // debug_isr #define DEBUGF1(fmt, args...) bprintf(0, fmt , ##args) #define DEBUGF(fmt, args...) @@ -415,7 +415,7 @@ int74_function() void VISIBLE16 handle_74() { - //debug_isr(); + debug_isr(DEBUG_ISR_74); irq_enable(); int74_function(); diff --git a/src/serial.c b/src/serial.c index 5f5afce..6c38086 100644 --- a/src/serial.c +++ b/src/serial.c @@ -149,7 +149,7 @@ handle_14XX(struct bregs *regs) void VISIBLE16 handle_14(struct bregs *regs) { - debug_enter(regs); + debug_enter(regs, DEBUG_HDL_14); irq_enable(); @@ -278,7 +278,7 @@ handle_17XX(struct bregs *regs) void VISIBLE16 handle_17(struct bregs *regs) { - debug_enter(regs); + debug_enter(regs, DEBUG_HDL_17); irq_enable(); diff --git a/src/system.c b/src/system.c index f3909c1..0941565 100644 --- a/src/system.c +++ b/src/system.c @@ -310,7 +310,7 @@ handle_15XX(struct bregs *regs) void VISIBLE16 handle_15(struct bregs *regs) { - //debug_enter(regs); + debug_enter(regs, DEBUG_HDL_15); switch (regs->ah) { case 0x24: handle_1524(regs); break; case 0x4f: handle_154f(regs); break; @@ -334,7 +334,7 @@ handle_15(struct bregs *regs) void VISIBLE16 handle_12(struct bregs *regs) { - debug_enter(regs); + debug_enter(regs, DEBUG_HDL_12); regs->ax = GET_BDA(mem_size_kb); } @@ -342,7 +342,7 @@ handle_12(struct bregs *regs) void VISIBLE16 handle_11(struct bregs *regs) { - debug_enter(regs); + debug_enter(regs, DEBUG_HDL_11); regs->ax = GET_BDA(equipment_list_flags); } @@ -350,21 +350,21 @@ handle_11(struct bregs *regs) void VISIBLE16 handle_05(struct bregs *regs) { - debug_enter(regs); + debug_enter(regs, DEBUG_HDL_05); } // INT 10h Video Support Service Entry Point void VISIBLE16 handle_10(struct bregs *regs) { - debug_enter(regs); + debug_enter(regs, DEBUG_HDL_10); // dont do anything, since the VGA BIOS handles int10h requests } void VISIBLE16 handle_nmi() { - debug_isr(); + debug_isr(DEBUG_ISR_nmi); BX_PANIC("NMI Handler called\n"); } @@ -372,7 +372,7 @@ handle_nmi() void VISIBLE16 handle_75() { - debug_isr(); + debug_isr(DEBUG_ISR_75); // clear irq13 outb(0, PORT_MATH_CLEAR); @@ -120,12 +120,16 @@ void __debug_enter(const char *fname, struct bregs *regs); void __debug_fail(const char *fname, struct bregs *regs); void __debug_stub(const char *fname, struct bregs *regs); void __debug_isr(const char *fname); -#define debug_enter(regs) \ - __debug_enter(__func__, regs) +#define debug_enter(regs, lvl) do { \ + if ((lvl) && (lvl) <= CONFIG_DEBUG_LEVEL) \ + __debug_enter(__func__, regs); \ + } while (0) +#define debug_isr(lvl) do { \ + if ((lvl) && (lvl) <= CONFIG_DEBUG_LEVEL) \ + __debug_isr(__func__); \ + } while (0) #define debug_stub(regs) \ __debug_stub(__func__, regs) -#define debug_isr(regs) \ - __debug_isr(__func__) // Frequently used return codes #define RET_EUNSUPPORTED 0x86 |