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.


Have unregistered hypercalls fail to guest
[palacios.git] / palacios / include / gears / guard_mods.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) 2012, Kyle C. Hale <kh@u.northwestern.edu> 
11  * Copyright (c) 2012, The V3VEE Project <http://www.v3vee.org> 
12  * All rights reserved.
13  *
14  * Author: Kyle C. Hale <kh@u.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 __GUARD_MODS_H__
21 #define __GUARD_MODS_H__
22
23
24 #ifdef __V3VEE__
25
26 #define HCALL_INSTR_LEN 3
27 #define MAX_BORDER_NESTING 128
28
29 enum v3_mod_state {
30     INIT,
31     PRIV,
32     NO_PRIV,
33 };
34
35 /* these need to be updated when
36  * load address is received */
37 struct v3_entry_point {
38     char * name;
39     addr_t addr;
40     uint8_t is_ret; /* indicates that this is a return point */
41
42     struct v3_gm * gm;
43     struct list_head er_node;
44 };
45
46
47 struct v3_gm {
48     char * name;
49     char * content_hash;
50     ulong_t stack_hash;
51     uint_t num_entries;
52     uint_t hcall_offset;
53     uint_t text_size;
54     addr_t load_addr;           /* this is a GVA */
55     ullong_t id;
56     struct v3_entry_point * entry_points;
57     enum v3_mod_state state;
58     struct list_head priv_list; /* list of privileges associated with this GM */
59     struct list_head mod_node;
60     struct list_head er_list;
61     void * private_data;
62     int callback_nesting;  
63     int kernel_nesting;
64     addr_t r11_stack_kernel[MAX_BORDER_NESTING];
65     addr_t r11_stack_callback[MAX_BORDER_NESTING];
66     addr_t entry_rsp;
67     addr_t exit_rsp;
68
69 };
70
71 #define V3_GUARD_INIT_HCALL  0x6000
72 #define V3_BIN_CALL_HCALL    0x6001
73 #define V3_BOUT_RET_HCALL    0x6002
74 #define V3_BOUT_CALL_HCALL   0x6003
75 #define V3_BIN_RET_HCALL     0x6004
76
77 struct v3_guarded_mods {
78     struct list_head mod_list;
79     struct hashtable * mod_id_table;
80     struct hashtable * mod_name_table;
81     struct hashtable * er_hash;   /* hash for quick lookups on valid entries/returns */
82 };
83
84
85 #endif /* __V3VEE__ */
86
87 unsigned long long
88 v3_register_gm  (void *  vm, 
89                  char *  name,
90                  char *  hash,
91                  unsigned int hc_off,
92                  unsigned int size,
93                  unsigned int nentries,
94                  unsigned int nprivs,
95                  char ** priv_array,
96                  void * private_data, 
97                  void * entry_points);
98
99
100 #endif /* __GUARD_MODS_H__ */
101