};
-int v3_init_mem_map(struct guest_info * info);
-void v3_delete_mem_map(struct guest_info * info);
+int v3_init_mem_map(struct v3_vm_info * vm);
+void v3_delete_mem_map(struct v3_vm_info * vm);
struct vm_timer_ops {
void (*update_time)(struct guest_info * info, ullong_t cpu_cycles, ullong_t cpu_freq, void * priv_data);
- void (*advance_timer)(struct guest_info * info);
+ void (*advance_timer)(struct guest_info * info, void * private_data);
};
struct vm_timer {
}
+static void pit_advance_time(struct guest_info * core, void * private_data) {
+
+ v3_raise_irq(core->vm_info, 0);
+}
+
+
/* This should call out to handle_SQR_WAVE_write, etc...
*/
static struct vm_timer_ops timer_ops = {
.update_time = pit_update_time,
+ .advance_timer = pit_advance_time,
};
v3_init_intr_routers(vm);
// Initialize the memory map
- if (v3_init_mem_map(&(vm->cores[0])) == -1) {
+ if (v3_init_mem_map(vm) == -1) {
PrintError("Could not initialize shadow map\n");
return -1;
}
cores_cfg = v3_cfg_subtree(cfg_data->cfg, "cores");
+ if (!cores_cfg) {
+ PrintError("Could not find core configuration (new config format required)\n");
+ return NULL;
+ }
+
num_cores = atoi(v3_cfg_val(cores_cfg, "count"));
+ if (num_cores == 0) {
+ PrintError("No cores specified in configuration\n");
+ return NULL;
+ }
+
V3_Print("Configuring %d cores\n", num_cores);
vm = allocate_guest(num_cores);
intr_state->irq_started = 0;
intr_state->irq_vector = 0;
+ v3_lock_init(&(intr_state->irq_lock));
+
INIT_LIST_HEAD(&(intr_state->controller_list));
}
}
-int v3_init_shadow_map(struct v3_vm_info * vm) {
+int v3_init_mem_map(struct v3_vm_info * vm) {
struct v3_mem_map * map = &(vm->mem_map);
addr_t mem_pages = vm->mem_size >> 12;
//info->time_state.pending_cycles = 0;
}
+
+void v3_advance_time(struct guest_info * core) {
+ struct vm_timer * tmp_timer;
+
+
+ list_for_each_entry(tmp_timer, &(core->time_state.timers), timer_link) {
+ tmp_timer->ops->advance_timer(core, tmp_timer->private_data);
+ }
+
+
+
+}