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