X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_time.c;h=7cf7853cd4ff97a10a2e6c1ba9b82e9e1f8e3d88;hb=1c000bda0560742ad6be011722fa226771b656ff;hp=5b3bfe72e58ec9bd895c96e1220c85b380fb508d;hpb=5257ce9721525328a025a443ac086e34e0dc6441;p=palacios.git diff --git a/palacios/src/palacios/vmm_time.c b/palacios/src/palacios/vmm_time.c index 5b3bfe7..7cf7853 100644 --- a/palacios/src/palacios/vmm_time.c +++ b/palacios/src/palacios/vmm_time.c @@ -84,6 +84,16 @@ static int handle_cpufreq_hcall(struct guest_info * info, uint_t hcall_id, void return 0; } +static int handle_rdhtsc_hcall(struct guest_info * info, uint_t hcall_id, void * priv_data) { + struct vm_core_time * time_state = &(info->time_state); + + info->vm_regs.rbx = v3_get_host_time(time_state); + + // PrintDebug("Guest request host TSC: return %ld\n", (long)info->vm_regs.rbx); + + return 0; +} + int v3_start_time(struct guest_info * info) { @@ -393,6 +403,9 @@ int v3_init_time_vm(struct v3_vm_info * vm) { PrintDebug("Registering TIME_CPUFREQ hypercall.\n"); ret = v3_register_hypercall(vm, TIME_CPUFREQ_HCALL, handle_cpufreq_hcall, NULL); + PrintDebug("Registering TIME_RDHTSC hypercall.\n"); + ret = v3_register_hypercall(vm, TIME_RDHTSC_HCALL, + handle_rdhtsc_hcall, NULL); handle_time_configuration(vm, v3_cfg_subtree(cfg_tree, "time"));