/[qemu]/qemu/vl.c
ViewVC logotype

Diff of /qemu/vl.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by bellard, Mon Jun 30 13:06:39 2003 UTC revision 1.8 by bellard, Mon Jun 30 23:36:21 2003 UTC
# Line 536  void cmos_init(void) Line 536  void cmos_init(void)
536  /***********************************************************/  /***********************************************************/
537  /* 8259 pic emulation */  /* 8259 pic emulation */
538    
539    //#define DEBUG_PIC
540    
541  typedef struct PicState {  typedef struct PicState {
542      uint8_t last_irr; /* edge detection */      uint8_t last_irr; /* edge detection */
543      uint8_t irr; /* interrupt request register */      uint8_t irr; /* interrupt request register */
# Line 630  static void pic_update_irq(void) Line 632  static void pic_update_irq(void)
632  int64_t irq_time[16];  int64_t irq_time[16];
633  int64_t cpu_get_ticks(void);  int64_t cpu_get_ticks(void);
634  #endif  #endif
635    #ifdef DEBUG_PIC
636    int irq_level[16];
637    #endif
638    
639  void pic_set_irq(int irq, int level)  void pic_set_irq(int irq, int level)
640  {  {
641    #ifdef DEBUG_PIC
642        if (level != irq_level[irq]) {
643            printf("pic_set_irq: irq=%d level=%d\n", irq, level);
644            irq_level[irq] = level;
645        }
646    #endif
647  #ifdef DEBUG_IRQ_LATENCY  #ifdef DEBUG_IRQ_LATENCY
648      if (level) {      if (level) {
649          irq_time[irq] = cpu_get_ticks();          irq_time[irq] = cpu_get_ticks();
# Line 651  int cpu_x86_get_pic_interrupt(CPUX86Stat Line 662  int cpu_x86_get_pic_interrupt(CPUX86Stat
662  #ifdef DEBUG_IRQ_LATENCY  #ifdef DEBUG_IRQ_LATENCY
663      printf("IRQ%d latency=%Ld\n", irq, cpu_get_ticks() - irq_time[irq]);      printf("IRQ%d latency=%Ld\n", irq, cpu_get_ticks() - irq_time[irq]);
664  #endif  #endif
665    #ifdef DEBUG_PIC
666        printf("pic_interrupt: irq=%d\n", irq);
667    #endif
668    
669      if (irq >= 8) {      if (irq >= 8) {
670          irq2 = irq & 7;          irq2 = irq & 7;
# Line 671  void pic_ioport_write(CPUX86State *env, Line 685  void pic_ioport_write(CPUX86State *env,
685      PicState *s;      PicState *s;
686      int priority;      int priority;
687    
688    #ifdef DEBUG_PIC
689        printf("pic_write: addr=0x%02x val=0x%02x\n", addr, val);
690    #endif
691      s = &pics[addr >> 7];      s = &pics[addr >> 7];
692      addr &= 1;      addr &= 1;
693      if (addr == 0) {      if (addr == 0) {
# Line 743  void pic_ioport_write(CPUX86State *env, Line 760  void pic_ioport_write(CPUX86State *env,
760      }      }
761  }  }
762    
763  uint32_t pic_ioport_read(CPUX86State *env, uint32_t addr)  uint32_t pic_ioport_read(CPUX86State *env, uint32_t addr1)
764  {  {
765      PicState *s;      PicState *s;
766        unsigned int addr;
767        int ret;
768    
769        addr = addr1;
770      s = &pics[addr >> 7];      s = &pics[addr >> 7];
771      addr &= 1;      addr &= 1;
772      if (addr == 0) {      if (addr == 0) {
773          if (s->read_reg_select)          if (s->read_reg_select)
774              return s->isr;              ret = s->isr;
775          else          else
776              return s->irr;              ret = s->irr;
777      } else {      } else {
778          return s->imr;          ret = s->imr;
779      }      }
780    #ifdef DEBUG_PIC
781        printf("pic_read: addr=0x%02x val=0x%02x\n", addr1, ret);
782    #endif
783        return ret;
784  }  }
785    
786  void pic_init(void)  void pic_init(void)
# Line 2634  int main(int argc, char **argv) Line 2659  int main(int argc, char **argv)
2659          help();          help();
2660    
2661      /* init debug */      /* init debug */
2662        setvbuf(stdout, NULL, _IOLBF, 0);
2663      if (loglevel) {      if (loglevel) {
2664          logfile = fopen(DEBUG_LOGFILE, "w");          logfile = fopen(DEBUG_LOGFILE, "w");
2665          if (!logfile) {          if (!logfile) {

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26