mirror of https://github.com/xqemu/xqemu.git
i8259: improve debugging
Add a DPRINTF macro. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
03ae77d6d2
commit
8ac02ff882
23
hw/i8259.c
23
hw/i8259.c
|
@ -30,6 +30,13 @@
|
||||||
/* debug PIC */
|
/* debug PIC */
|
||||||
//#define DEBUG_PIC
|
//#define DEBUG_PIC
|
||||||
|
|
||||||
|
#ifdef DEBUG_PIC
|
||||||
|
#define DPRINTF(fmt, ...) \
|
||||||
|
do { printf("pic: " fmt , ## __VA_ARGS__); } while (0)
|
||||||
|
#else
|
||||||
|
#define DPRINTF(fmt, ...)
|
||||||
|
#endif
|
||||||
|
|
||||||
//#define DEBUG_IRQ_LATENCY
|
//#define DEBUG_IRQ_LATENCY
|
||||||
//#define DEBUG_IRQ_COUNT
|
//#define DEBUG_IRQ_COUNT
|
||||||
|
|
||||||
|
@ -185,9 +192,7 @@ static void i8259_set_irq(void *opaque, int irq, int level)
|
||||||
|
|
||||||
#if defined(DEBUG_PIC) || defined(DEBUG_IRQ_COUNT)
|
#if defined(DEBUG_PIC) || defined(DEBUG_IRQ_COUNT)
|
||||||
if (level != irq_level[irq]) {
|
if (level != irq_level[irq]) {
|
||||||
#if defined(DEBUG_PIC)
|
DPRINTF("i8259_set_irq: irq=%d level=%d\n", irq, level);
|
||||||
printf("i8259_set_irq: irq=%d level=%d\n", irq, level);
|
|
||||||
#endif
|
|
||||||
irq_level[irq] = level;
|
irq_level[irq] = level;
|
||||||
#ifdef DEBUG_IRQ_COUNT
|
#ifdef DEBUG_IRQ_COUNT
|
||||||
if (level == 1)
|
if (level == 1)
|
||||||
|
@ -253,9 +258,7 @@ int pic_read_irq(PicState2 *s)
|
||||||
(double)(qemu_get_clock(vm_clock) -
|
(double)(qemu_get_clock(vm_clock) -
|
||||||
irq_time[irq]) * 1000000.0 / get_ticks_per_sec());
|
irq_time[irq]) * 1000000.0 / get_ticks_per_sec());
|
||||||
#endif
|
#endif
|
||||||
#if defined(DEBUG_PIC)
|
DPRINTF("pic_interrupt: irq=%d\n", irq);
|
||||||
printf("pic_interrupt: irq=%d\n", irq);
|
|
||||||
#endif
|
|
||||||
return intno;
|
return intno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,9 +289,7 @@ static void pic_ioport_write(void *opaque, uint32_t addr, uint32_t val)
|
||||||
PicState *s = opaque;
|
PicState *s = opaque;
|
||||||
int priority, cmd, irq;
|
int priority, cmd, irq;
|
||||||
|
|
||||||
#ifdef DEBUG_PIC
|
DPRINTF("write: addr=0x%02x val=0x%02x\n", addr, val);
|
||||||
printf("pic_write: addr=0x%02x val=0x%02x\n", addr, val);
|
|
||||||
#endif
|
|
||||||
addr &= 1;
|
addr &= 1;
|
||||||
if (addr == 0) {
|
if (addr == 0) {
|
||||||
if (val & 0x10) {
|
if (val & 0x10) {
|
||||||
|
@ -416,9 +417,7 @@ static uint32_t pic_ioport_read(void *opaque, uint32_t addr1)
|
||||||
ret = s->imr;
|
ret = s->imr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_PIC
|
DPRINTF("read: addr=0x%02x val=0x%02x\n", addr1, ret);
|
||||||
printf("pic_read: addr=0x%02x val=0x%02x\n", addr1, ret);
|
|
||||||
#endif
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue