Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Cleanup and sanity-checking of OOB accesses and pointer-to-local issues (Coverity...
[palacios.git] / palacios / src / devices / 8259a.c
index c10d1ef..25d6fa1 100644 (file)
@@ -162,7 +162,7 @@ struct pic_internal {
     struct {
        int (*ack)(struct guest_info * core, uint32_t irq, void * private_data);
        void * private_data;
-    } irq_ack_cbs[15];
+    } irq_ack_cbs[16];
 
 
     void * router_handle;
@@ -318,7 +318,9 @@ static int pic_lower_intr(struct v3_vm_info * vm, void * private_data, struct v3
 static int pic_intr_pending_from_master(struct guest_info * info, void * private_data) {
     struct pic_internal * state = (struct pic_internal*)private_data;
 
-    return state->master_irr & (~(state->master_imr));
+    return state->master_irr        // interrupt pending in the master's irr
+       & (~(state->master_imr))    // and is not masked in the master 
+       & (~(state->master_icw3));  // and the pin is not hooked to slave
 }
 
 static int pic_intr_pending_from_slave(struct guest_info * info, void * private_data) {
@@ -593,7 +595,7 @@ static int write_master_port1(struct guest_info * core, ushort_t port, void * sr
         if (IS_OCW2(cw)) {
             // handle the EOI here
             struct ocw2 * cw2 =  (struct ocw2*)&cw;
-           int eoi_irq;
+           int eoi_irq=-1;
 
             PrintDebug(core->vm_info, core, "8259 PIC: Master: Handling OCW2 = %x (wr_Master1)\n", cw);
 
@@ -748,7 +750,7 @@ static int write_slave_port1(struct guest_info * core, ushort_t port, void * src
        state->slave_state = ICW2;
     } else if (state->slave_state == READY) {
        if (IS_OCW2(cw)) {
-           int eoi_irq;
+           int eoi_irq = -1;
            // handle the EOI here
            struct ocw2 * cw2 =  (struct ocw2 *)&cw;