case 6: { //SIPI
struct guest_info *core = dest_apic->core;
- uint64_t rip = icr->vec << 12; // vector encodes target address;
-
- PrintDebug("icc_bus: SIPI delivery (0x%x -> rip=0x%p) to core %u\n",
- icr->vec, (void*)rip, core->cpu_id);
// Sanity check
if (core->cpu_mode!=SIPI) {
// Write the RIP, CS, and descriptor
// assume the rest is already good to go
- core->rip=rip & 0xffff;
- core->segments.cs.selector = (rip >> 4) & 0xf000;
+ //
+ // 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
+ //
+ core->rip=0;
+ core->segments.cs.selector = icr->vec<<8;
core->segments.cs.limit= 0xffff;
- core->segments.cs.base = rip & 0xf0000;
+ core->segments.cs.base = icr->vec<<12;
+ PrintDebug("icc_bus: SIPI delivery (0x%x -> 0x%x:0x0) to core %u\n",
+ icr->vec, core->segments.cs.selector, core->cpu_id);
// Maybe need to adjust the APIC?
// We transition the target core to SIPI state
static int icc_bus_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
PrintDebug("icc_bus: Creating ICC_BUS\n");
- char * name = v3_cfg_val(cfg, "name");
+ char * dev_id = v3_cfg_val(cfg, "ID");
struct icc_bus_state * icc_bus = (struct icc_bus_state *)V3_Malloc(sizeof(struct icc_bus_state));
memset(icc_bus, 0, sizeof(struct icc_bus_state));
- struct vm_device * dev = v3_allocate_device(name, &dev_ops, icc_bus);
+ struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, icc_bus);
if (v3_attach_device(vm, dev) == -1) {
- PrintError("icc_bus: Could not attach device %s\n", name);
+ PrintError("icc_bus: Could not attach device %s\n", dev_id);
return -1;
}