X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_time.c;h=b169669d4dd54861c6f21e7955ddb015e7b0e44a;hb=f86f45f3cbbd4c85b30a2eee73ff79e2908e1495;hp=319d1585cc50965fce08751df237ef5687ee944a;hpb=123a1ba27ea09c8fa77a1b36ce625b43d7c48b14;p=palacios.releases.git diff --git a/palacios/src/palacios/vmm_time.c b/palacios/src/palacios/vmm_time.c index 319d158..b169669 100644 --- a/palacios/src/palacios/vmm_time.c +++ b/palacios/src/palacios/vmm_time.c @@ -21,6 +21,18 @@ #include #include +static int handle_cpufreq_hcall(struct guest_info * info, uint_t hcall_id, void * priv_data) { + struct vm_time * time_state = &(info->time_state); + + info->vm_regs.rbx = time_state->cpu_freq; + + PrintDebug("Guest request cpu frequency: return %ld\n", (long)info->vm_regs.rbx); + + return 0; +} + + + void v3_init_time(struct guest_info * info) { struct vm_time * time_state = &(info->time_state); @@ -32,6 +44,8 @@ void v3_init_time(struct guest_info * info) { INIT_LIST_HEAD(&(time_state->timers)); time_state->num_timers = 0; + + v3_register_hypercall(info->vm_info, TIME_CPUFREQ_HCALL, handle_cpufreq_hcall, NULL); } @@ -60,16 +74,32 @@ int v3_remove_timer(struct guest_info * info, struct vm_timer * timer) { -void v3_update_time(struct guest_info * info, ullong_t cycles) { +void v3_update_time(struct guest_info * info, uint64_t cycles) { struct vm_timer * tmp_timer; - + + // cycles *= 8; + +// cycles /= 150; + info->time_state.guest_tsc += cycles; list_for_each_entry(tmp_timer, &(info->time_state.timers), timer_link) { - tmp_timer->ops->update_time(cycles, info->time_state.cpu_freq, tmp_timer->private_data); + tmp_timer->ops->update_time(info, cycles, info->time_state.cpu_freq, tmp_timer->private_data); } //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); + } + + + +}