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.


updated IO and MSRs to allow hooking/unhooking dynamic at runtime
[palacios.git] / palacios / include / palacios / vmm_io.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_IO_H
21 #define __VMM_IO_H
22
23
24 #ifdef __V3VEE__
25
26 #include <palacios/vmm_types.h>
27 #include <palacios/vmm_util.h>
28 #include <palacios/vmm_rbtree.h>
29
30
31
32
33 struct guest_info;
34
35 void v3_init_io_map(struct guest_info * info);
36
37
38
39
40 /* External API */
41 int v3_hook_io_port(struct guest_info * info, uint_t port, 
42                     int (*read)(uint16_t port, void * dst, uint_t length, void * priv_data),
43                     int (*write)(uint16_t port, void * src, uint_t length, void * priv_data), 
44                     void * priv_data);
45
46 int v3_unhook_io_port(struct guest_info * info, uint_t port);
47
48
49
50
51
52 struct v3_io_hook {
53     uint16_t port;
54
55     // Reads data into the IO port (IN, INS)
56     int (*read)(uint16_t port, void * dst, uint_t length, void * priv_data);
57
58     // Writes data from the IO port (OUT, OUTS)
59     int (*write)(uint16_t port, void * src, uint_t length, void * priv_data);
60
61
62
63     void * priv_data;
64   
65     struct rb_node tree_node;
66
67 };
68
69 struct v3_io_map {
70     struct rb_root map;
71
72     int (*update_map)(struct guest_info * info, uint16_t port, int hook_read, int hook_write);
73
74     void * arch_data;
75 };
76
77 struct v3_io_hook * v3_get_io_hook(struct guest_info * info, uint_t port);
78
79
80 void v3_print_io_map(struct guest_info * info);
81
82
83
84
85 void v3_outb(uint16_t port, uint8_t value);
86 uint8_t v3_inb(uint16_t port);
87
88 void v3_outw(uint16_t port, uint16_t value);
89 uint16_t v3_inw(uint16_t port);
90
91 void v3_outdw(uint16_t port, uint_t value);
92 uint_t v3_indw(uint16_t port);
93
94
95
96 #endif // !__V3VEE__
97
98
99
100
101
102 #endif