summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-06-30 23:36:21 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-06-30 23:36:21 +0000
commitb118d61e556a1f5cebc991e368af7292ffa1d8f3 (patch)
tree341aa575d3d040ee0fb568be3e1cf64cef93cb8c
parent2f62b397b5603f39deb9bdb170206e4e9e525139 (diff)
downloadqemu-b118d61e556a1f5cebc991e368af7292ffa1d8f3.tar.gz
added PIC debug
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@302 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--vl.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/vl.c b/vl.c
index 23a4b59791..53f475a89e 100644
--- a/vl.c
+++ b/vl.c
@@ -536,6 +536,8 @@ void cmos_init(void)
/***********************************************************/
/* 8259 pic emulation */
+//#define DEBUG_PIC
+
typedef struct PicState {
uint8_t last_irr; /* edge detection */
uint8_t irr; /* interrupt request register */
@@ -630,9 +632,18 @@ static void pic_update_irq(void)
int64_t irq_time[16];
int64_t cpu_get_ticks(void);
#endif
+#ifdef DEBUG_PIC
+int irq_level[16];
+#endif
void pic_set_irq(int irq, int level)
{
+#ifdef DEBUG_PIC
+ if (level != irq_level[irq]) {
+ printf("pic_set_irq: irq=%d level=%d\n", irq, level);
+ irq_level[irq] = level;
+ }
+#endif
#ifdef DEBUG_IRQ_LATENCY
if (level) {
irq_time[irq] = cpu_get_ticks();
@@ -651,6 +662,9 @@ int cpu_x86_get_pic_interrupt(CPUX86State *env)
#ifdef DEBUG_IRQ_LATENCY
printf("IRQ%d latency=%Ld\n", irq, cpu_get_ticks() - irq_time[irq]);
#endif
+#ifdef DEBUG_PIC
+ printf("pic_interrupt: irq=%d\n", irq);
+#endif
if (irq >= 8) {
irq2 = irq & 7;
@@ -671,6 +685,9 @@ void pic_ioport_write(CPUX86State *env, uint32_t addr, uint32_t val)
PicState *s;
int priority;
+#ifdef DEBUG_PIC
+ printf("pic_write: addr=0x%02x val=0x%02x\n", addr, val);
+#endif
s = &pics[addr >> 7];
addr &= 1;
if (addr == 0) {
@@ -743,19 +760,27 @@ void pic_ioport_write(CPUX86State *env, uint32_t addr, uint32_t val)
}
}
-uint32_t pic_ioport_read(CPUX86State *env, uint32_t addr)
+uint32_t pic_ioport_read(CPUX86State *env, uint32_t addr1)
{
PicState *s;
+ unsigned int addr;
+ int ret;
+
+ addr = addr1;
s = &pics[addr >> 7];
addr &= 1;
if (addr == 0) {
if (s->read_reg_select)
- return s->isr;
+ ret = s->isr;
else
- return s->irr;
+ ret = s->irr;
} else {
- return s->imr;
+ ret = s->imr;
}
+#ifdef DEBUG_PIC
+ printf("pic_read: addr=0x%02x val=0x%02x\n", addr1, ret);
+#endif
+ return ret;
}
void pic_init(void)
@@ -2634,6 +2659,7 @@ int main(int argc, char **argv)
help();
/* init debug */
+ setvbuf(stdout, NULL, _IOLBF, 0);
if (loglevel) {
logfile = fopen(DEBUG_LOGFILE, "w");
if (!logfile) {