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.


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