2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu>
11 * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Jack Lange <jarusl@cs.northwestern.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
25 #include <palacios/vmm_types.h>
26 #include <palacios/vmm_list.h>
27 #include <palacios/vmm_util.h>
32 uint32_t cpu_freq; // in kHZ
34 // Last time (in guest time) the timers were updated
37 // Cache value to help calculate the guest_tsc
40 // Offset of guest time from host time.
45 struct list_head timers;
52 void (*update_timer)(struct guest_info * info, ullong_t cpu_cycles, ullong_t cpu_freq, void * priv_data);
53 void (*advance_timer)(struct guest_info * info, void * private_data);
58 struct vm_timer_ops * ops;
60 struct list_head timer_link;
66 int v3_add_timer(struct guest_info * info, struct vm_timer_ops * ops, void * private_data);
67 int v3_remove_timer(struct guest_info * info, struct vm_timer * timer);
68 void v3_update_timers(struct guest_info * info);
71 void v3_init_time(struct guest_info * info);
72 int v3_start_time(struct guest_info * info);
73 int v3_pause_time(struct guest_info * info);
74 int v3_resume_time(struct guest_info * info);
76 static inline uint64_t v3_get_host_time(struct vm_time *t) {
82 static inline uint64_t v3_get_guest_time(struct vm_time *t) {
83 return v3_get_host_time(t) + t->host_offset;