Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Implemented (but not yet tested) time interface changes for consistency
[palacios.git] / palacios / include / palacios / vmm_time.h
1 /*
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.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
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.
13  *
14  * Author: Jack Lange <jarusl@cs.northwestern.edu>
15  *
16  * This is free software.  You are permitted to use,
17  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
18  */
19
20 #ifndef __VMM_TIME_H
21 #define __VMM_TIME_H
22
23 #ifdef __V3VEE__
24
25 #include <palacios/vmm_types.h>
26 #include <palacios/vmm_list.h>
27
28 struct guest_info;
29
30 struct vm_time {
31     uint32_t cpu_freq; // in kHZ
32
33     // Last time (in guest time) the timers were updated
34     uint64_t last_update;
35     
36     // Cache value to help calculate the guest_tsc
37     uint64_t pause_time;
38
39     // Offset of guest time from host time.
40     sint64_t host_offset;
41
42     // Installed Timers 
43     uint_t num_timers;
44     struct list_head timers;
45 };
46
47
48
49
50 struct vm_timer_ops {
51     void (*update_timer)(struct guest_info * info, ullong_t cpu_cycles, ullong_t cpu_freq, void * priv_data);
52     void (*advance_timer)(struct guest_info * info, void * private_data);
53 };
54
55 struct vm_timer {
56     void * private_data;
57     struct vm_timer_ops * ops;
58
59     struct list_head timer_link;
60 };
61
62
63
64
65 int v3_add_timer(struct guest_info * info, struct vm_timer_ops * ops, void * private_data);
66 int v3_remove_timer(struct guest_info * info, struct vm_timer * timer);
67 void v3_update_timers(struct guest_info * info);
68
69
70 void v3_init_time(struct guest_info * info);
71 int v3_start_time(struct guest_info * info);
72 int v3_pause_time(struct guest_info * info);
73 int v3_resume_time(struct guest_info * info);
74 uint64_t v3_get_host_time(struct guest_info * info);
75 uint64_t v3_get_guest_time(struct guest_info * info);
76 #endif // !__V3VEE__
77
78 #endif