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.


integrated new configuration system
[palacios.git] / palacios / include / palacios / vmm_sym_iface.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
21 #ifndef __VMM_SYM_IFACE_H__
22 #define __VMM_SYM_IFACE_H__
23
24 #ifdef __V3VEE__
25
26
27
28 struct v3_sym_interface {
29     uint64_t magic;
30
31     union {
32         uint32_t feature_flags;
33         struct {
34             uint_t pci_map_valid            : 1;
35             uint32_t sym_call_enabled       : 1;
36         } __attribute__((packed));
37     } __attribute__((packed));
38
39     union { 
40         uint32_t state_flags;
41         struct {
42             uint32_t sym_call_active        : 1;
43         } __attribute__((packed));
44     } __attribute__((packed));
45
46     uint64_t current_proc;
47     uint64_t proc_list;
48     
49     uint8_t pci_pt_map[(4 * 256) / 8]; // we're hardcoding this: (4 busses, 256 max devs)
50
51 } __attribute__((packed));
52
53
54
55 #include <palacios/vm_guest.h>
56
57
58 struct v3_sym_context {
59     struct v3_gprs vm_regs;
60     struct v3_segment cs;
61     struct v3_segment ss;
62     uint64_t gs_base;
63     uint64_t fs_base;
64     uint64_t rip;
65     uint64_t flags;
66     uint8_t cpl;
67 };
68
69
70 struct v3_sym_state {
71     
72     struct v3_sym_interface * sym_page;
73     addr_t sym_page_pa;
74
75     uint64_t guest_pg_addr;
76
77     struct {
78         uint_t active                  : 1; // activated when symbiotic page MSR is written
79         uint_t sym_call_active         : 1;
80         uint_t sym_call_returned       : 1;
81         uint_t sym_call_error          : 1;
82     } __attribute__((packed));
83
84     struct v3_sym_context old_ctx;
85
86     int sym_call_errno;    
87
88     uint64_t sym_call_rip;
89     uint64_t sym_call_cs;
90     uint64_t sym_call_rsp;
91     uint64_t sym_call_gs;
92     uint64_t sym_call_fs;
93 };
94
95
96
97
98
99
100
101 int v3_init_sym_iface(struct guest_info * info);
102
103
104 typedef uint64_t sym_arg_t;
105
106 #define v3_sym_call0(info, call_num)            \
107     v3_sym_call(info, call_num, 0, 0, 0, 0, 0)
108 #define v3_sym_call1(info, call_num, arg1)              \
109     v3_sym_call(info, call_num, arg1, 0, 0, 0, 0)
110 #define v3_sym_call2(info, call_num, arg1, arg2)        \
111     v3_sym_call(info, call_num, arg1, arg2, 0, 0, 0)
112 #define v3_sym_call3(info, call_num, arg1, arg2, arg3)  \
113     v3_sym_call(info, call_num, arg1, arg2, arg3, 0, 0)
114 #define v3_sym_call4(info, call_num, arg1, arg2, arg3, arg4)    \
115     v3_sym_call(info, call_num, arg1, arg2, arg3, arg4, 0)
116 #define v3_sym_call5(info, call_num, arg1, arg2, arg3, arg4, arg5)      \
117     v3_sym_call(info, call_num, arg1, arg2, arg3, arg4, arg5)
118
119
120
121
122 int v3_sym_map_pci_passthrough(struct guest_info * info, uint_t bus, uint_t dev, uint_t fn);
123 int v3_sym_unmap_pci_passthrough(struct guest_info * info, uint_t bus, uint_t dev, uint_t fn);
124
125
126 /* Symcall numbers */
127 #define SYMCALL_TEST 1
128 #define SYMCALL_MEM_LOOKUP 10
129 /* ** */
130
131 int v3_sym_call(struct guest_info * info, 
132                 uint64_t call_num, sym_arg_t * arg0, 
133                 sym_arg_t * arg1, sym_arg_t * arg2,
134                 sym_arg_t * arg3, sym_arg_t * arg4);
135
136
137 #endif
138
139 #endif