break;
}
- // Write the RIP, CS, and descriptor
- // assume the rest is already good to go
- //
- // vector VV -> rip at 0
- // CS = VV00
- // This means we start executing at linear address VV000
- //
- // So the selector needs to be VV00
- // and the base needs to be VV000
- //
- dst_core->rip = 0;
- dst_core->segments.cs.selector = vector << 8;
- dst_core->segments.cs.limit = 0xffff;
- dst_core->segments.cs.base = vector << 12;
+ v3_reset_vm_core(dst_core, vector);
PrintDebug(" SIPI delivery (0x%x -> 0x%x:0x0) to core %u\n",
vector, dst_core->segments.cs.selector, dst_core->vcpu_id);
break;
}
+
+ case APIC_EXTINT_DELIVERY: // EXTINT
+ /* Two possible things to do here:
+ * 1. Ignore the IPI and assume the 8259a (PIC) will handle it
+ * 2. Add 32 to the vector and inject it...
+ * We probably just want to do 1 here, and assume the raise_irq() will hit the 8259a.
+ */
+ return 0;
+
case APIC_SMI_DELIVERY:
case APIC_RES1_DELIVERY: // reserved
case APIC_NMI_DELIVERY:
- case APIC_EXTINT_DELIVERY: // ExtInt
default:
PrintError("IPI %d delivery is unsupported\n", del_mode);
return -1;
*val_ptr = *(((uint8_t *)&val) + byte_addr);
} else if ((length == 2) &&
- ((reg_addr & 0x3) == 0x3)) {
+ ((reg_addr & 0x3) != 0x3)) {
uint_t byte_addr = reg_addr & 0x3;
uint16_t * val_ptr = (uint16_t *)dst;
*val_ptr = *(((uint16_t *)&val) + byte_addr);
apic->tmr_cur_cnt = op_val;
break;
case TMR_DIV_CFG_OFFSET:
+ PrintDebug("apic %u: core %u: setting tmr_div_cfg to 0x%x\n",
+ apic->lapic_id.val, core->vcpu_id, op_val);
apic->tmr_div_cfg.val = op_val;
break;
}
if (apic->tmr_vec_tbl.tmr_mode == APIC_TMR_PERIODIC) {
+ static unsigned int nexits = 0;
+ static unsigned int missed_ints = 0;
+
+ nexits++;
+ missed_ints += tmr_ticks / apic->tmr_init_cnt;
+
+ if ((missed_ints > 0) && (nexits >= 5000)) {
+ V3_Print("apic %u: core %u: missed %u timer interrupts total in last %u exits.\n",
+ apic->lapic_id.val, core->vcpu_id, missed_ints, nexits);
+ missed_ints = 0;
+ nexits = 0;
+ }
+
tmr_ticks = tmr_ticks % apic->tmr_init_cnt;
apic->tmr_cur_cnt = apic->tmr_init_cnt - tmr_ticks;
}