debuggers.hg

view xen/include/hypervisor-ifs/dom0_ops.h @ 2673:0174982516f6

bitkeeper revision 1.1159.1.229 (416d3ad1BpCS1RVPjkX14HUpsanlGw)

Shadow pagetable walkthrough.
author kaf24@freefall.cl.cam.ac.uk
date Wed Oct 13 14:25:21 2004 +0000 (2004-10-13)
parents c7b0154dff73
children 7eb0f01df59a d92269f82bbe
line source
1 /******************************************************************************
2 * dom0_ops.h
3 *
4 * Process command requests from domain-0 guest OS.
5 *
6 * Copyright (c) 2002-2003, B Dragovic
7 * Copyright (c) 2002-2004, K Fraser
8 */
11 #ifndef __DOM0_OPS_H__
12 #define __DOM0_OPS_H__
14 #include "hypervisor-if.h"
15 #include "sched_ctl.h"
17 /*
18 * Make sure you increment the interface version whenever you modify this file!
19 * This makes sure that old versions of dom0 tools will stop working in a
20 * well-defined way (rather than crashing the machine, for instance).
21 */
22 #define DOM0_INTERFACE_VERSION 0xAAAA0016
24 #define MAX_DOMAIN_NAME 16
26 /************************************************************************/
28 #define DOM0_GETMEMLIST 2
29 typedef struct {
30 /* IN variables. */
31 domid_t domain; /* 0 */
32 u16 __pad0;
33 u32 __pad1;
34 memory_t max_pfns; /* 8 */
35 MEMORY_PADDING;
36 void *buffer; /* 16 */
37 MEMORY_PADDING;
38 /* OUT variables. */
39 memory_t num_pfns; /* 24 */
40 MEMORY_PADDING;
41 } PACKED dom0_getmemlist_t; /* 32 bytes */
43 #define DOM0_SCHEDCTL 6
44 /* struct sched_ctl_cmd is from sched-ctl.h */
45 typedef struct sched_ctl_cmd dom0_schedctl_t;
47 #define DOM0_ADJUSTDOM 7
48 /* struct sched_adjdom_cmd is from sched-ctl.h */
49 typedef struct sched_adjdom_cmd dom0_adjustdom_t;
51 #define DOM0_CREATEDOMAIN 8
52 typedef struct {
53 /* IN parameters. */
54 memory_t memory_kb; /* 0 */
55 MEMORY_PADDING;
56 u8 name[MAX_DOMAIN_NAME]; /* 8 */
57 u32 cpu; /* 24 */
58 u32 __pad0; /* 28 */
59 /* IN/OUT parameters. */
60 /* If 0, domain is allocated. If non-zero use it unless in use. */
61 domid_t domain; /* 32 */
62 u16 __pad1;
63 /* OUT parameters. */
64 } PACKED dom0_createdomain_t; /* 36 bytes */
66 #define DOM0_DESTROYDOMAIN 9
67 typedef struct {
68 /* IN variables. */
69 domid_t domain; /* 0 */
70 u16 __pad;
71 } PACKED dom0_destroydomain_t; /* 4 bytes */
73 #define DOM0_PAUSEDOMAIN 10
74 typedef struct {
75 /* IN parameters. */
76 domid_t domain; /* 0 */
77 u16 __pad;
78 } PACKED dom0_pausedomain_t; /* 4 bytes */
80 #define DOM0_UNPAUSEDOMAIN 11
81 typedef struct {
82 /* IN parameters. */
83 domid_t domain; /* 0 */
84 u16 __pad;
85 } PACKED dom0_unpausedomain_t; /* 4 bytes */
87 #define DOM0_GETDOMAININFO 12
88 typedef struct {
89 /* IN variables. */
90 domid_t domain; /* 0 */ /* NB. IN/OUT variable. */
91 u16 __pad;
92 /* OUT variables. */
93 #define DOMFLAGS_DYING (1<<0) /* Domain is scheduled to die. */
94 #define DOMFLAGS_CRASHED (1<<1) /* Crashed domain; frozen for postmortem. */
95 #define DOMFLAGS_SHUTDOWN (1<<2) /* The guest OS has shut itself down. */
96 #define DOMFLAGS_PAUSED (1<<3) /* Currently paused by control software. */
97 #define DOMFLAGS_BLOCKED (1<<4) /* Currently blocked pending an event. */
98 #define DOMFLAGS_RUNNING (1<<5) /* Domain is currently running. */
99 #define DOMFLAGS_CPUMASK 255 /* CPU to which this domain is bound. */
100 #define DOMFLAGS_CPUSHIFT 8
101 #define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code. */
102 #define DOMFLAGS_SHUTDOWNSHIFT 16
103 u32 flags; /* 4 */
104 u8 name[MAX_DOMAIN_NAME]; /* 8 */
105 full_execution_context_t *ctxt; /* 24 */ /* NB. IN/OUT variable. */
106 MEMORY_PADDING;
107 memory_t tot_pages; /* 32 */
108 MEMORY_PADDING;
109 memory_t max_pages; /* 40 */
110 MEMORY_PADDING;
111 memory_t shared_info_frame; /* 48: MFN of shared_info struct */
112 MEMORY_PADDING;
113 u64 cpu_time; /* 56 */
114 } PACKED dom0_getdomaininfo_t; /* 64 bytes */
116 #define DOM0_BUILDDOMAIN 13
117 typedef struct {
118 /* IN variables. */
119 domid_t domain; /* 0 */
120 u16 __pad0; /* 2 */
121 u32 __pad1; /* 4 */
122 /* IN/OUT parameters */
123 full_execution_context_t *ctxt; /* 8 */
124 MEMORY_PADDING;
125 } PACKED dom0_builddomain_t; /* 16 bytes */
127 #define DOM0_IOPL 14
128 typedef struct {
129 domid_t domain; /* 0 */
130 u16 __pad;
131 u32 iopl; /* 4 */
132 } PACKED dom0_iopl_t; /* 8 bytes */
134 #define DOM0_MSR 15
135 typedef struct {
136 /* IN variables. */
137 u32 write; /* 0 */
138 u32 cpu_mask; /* 4 */
139 u32 msr; /* 8 */
140 u32 in1; /* 12 */
141 u32 in2; /* 16 */
142 /* OUT variables. */
143 u32 out1; /* 20 */
144 u32 out2; /* 24 */
145 } PACKED dom0_msr_t; /* 28 bytes */
147 #define DOM0_DEBUG 16
148 typedef struct {
149 /* IN variables. */
150 domid_t domain; /* 0 */
151 u8 opcode; /* 2 */
152 u8 __pad;
153 u32 in1; /* 4 */
154 u32 in2; /* 8 */
155 u32 in3; /* 12 */
156 u32 in4; /* 16 */
157 /* OUT variables. */
158 u32 status; /* 20 */
159 u32 out1; /* 24 */
160 u32 out2; /* 28 */
161 } PACKED dom0_debug_t; /* 32 bytes */
163 /*
164 * Set clock such that it would read <secs,usecs> after 00:00:00 UTC,
165 * 1 January, 1970 if the current system time was <system_time>.
166 */
167 #define DOM0_SETTIME 17
168 typedef struct {
169 /* IN variables. */
170 u32 secs; /* 0 */
171 u32 usecs; /* 4 */
172 u64 system_time; /* 8 */
173 } PACKED dom0_settime_t; /* 16 bytes */
175 #define DOM0_GETPAGEFRAMEINFO 18
176 #define NOTAB 0 /* normal page */
177 #define L1TAB (1<<28)
178 #define L2TAB (2<<28)
179 #define L3TAB (3<<28)
180 #define L4TAB (4<<28)
181 #define LPINTAB (1<<31)
182 #define XTAB (0xf<<28) /* invalid page */
183 #define LTAB_MASK XTAB
184 #define LTABTYPE_MASK (0x7<<28)
186 typedef struct {
187 /* IN variables. */
188 memory_t pfn; /* 0: Machine page frame number to query. */
189 MEMORY_PADDING;
190 domid_t domain; /* 8: To which domain does the frame belong? */
191 u16 __pad;
192 /* OUT variables. */
193 /* Is the page PINNED to a type? */
194 u32 type; /* 12: see above type defs */
195 } PACKED dom0_getpageframeinfo_t; /* 16 bytes */
197 /*
198 * Read console content from Xen buffer ring.
199 */
200 #define DOM0_READCONSOLE 19
201 typedef struct {
202 memory_t str; /* 0 */
203 MEMORY_PADDING;
204 u32 count; /* 8 */
205 u32 cmd; /* 12 */
206 } PACKED dom0_readconsole_t; /* 16 bytes */
208 /*
209 * Pin Domain to a particular CPU (use -1 to unpin)
210 */
211 #define DOM0_PINCPUDOMAIN 20
212 typedef struct {
213 /* IN variables. */
214 domid_t domain; /* 0 */
215 u16 __pad;
216 s32 cpu; /* 4: -1 implies unpin */
217 } PACKED dom0_pincpudomain_t; /* 8 bytes */
219 /* Get trace buffers machine base address */
220 #define DOM0_GETTBUFS 21
221 typedef struct {
222 /* OUT variables */
223 memory_t mach_addr; /* 0: location of the trace buffers */
224 MEMORY_PADDING;
225 u32 size; /* 8: size of each trace buffer, in bytes */
226 } PACKED dom0_gettbufs_t; /* 12 bytes */
228 /*
229 * Get physical information about the host machine
230 */
231 #define DOM0_PHYSINFO 22
232 typedef struct {
233 u32 ht_per_core; /* 0 */
234 u32 cores; /* 4 */
235 u32 cpu_khz; /* 8 */
236 u32 __pad; /* 12 */
237 memory_t total_pages; /* 16 */
238 MEMORY_PADDING;
239 memory_t free_pages; /* 24 */
240 MEMORY_PADDING;
241 } PACKED dom0_physinfo_t; /* 32 bytes */
243 /*
244 * Allow a domain access to a physical PCI device
245 */
246 #define DOM0_PCIDEV_ACCESS 23
247 typedef struct {
248 /* IN variables. */
249 domid_t domain; /* 0 */
250 u16 __pad;
251 u32 bus; /* 4 */
252 u32 dev; /* 8 */
253 u32 func; /* 12 */
254 u32 enable; /* 16 */
255 } PACKED dom0_pcidev_access_t; /* 20 bytes */
257 /*
258 * Get the ID of the current scheduler.
259 */
260 #define DOM0_SCHED_ID 24
261 typedef struct {
262 /* OUT variable */
263 u32 sched_id; /* 0 */
264 } PACKED dom0_sched_id_t; /* 4 bytes */
266 /*
267 * Control shadow pagetables operation
268 */
269 #define DOM0_SHADOW_CONTROL 25
271 #define DOM0_SHADOW_CONTROL_OP_OFF 0
272 #define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST 1
273 #define DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY 2
274 #define DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE 3
275 #define DOM0_SHADOW_CONTROL_OP_FLUSH 10 /* table ops */
276 #define DOM0_SHADOW_CONTROL_OP_CLEAN 11
277 #define DOM0_SHADOW_CONTROL_OP_PEEK 12
279 typedef struct dom0_shadow_control
280 {
281 u32 fault_count;
282 u32 dirty_count;
283 u32 dirty_net_count;
284 u32 dirty_block_count;
285 } dom0_shadow_control_stats_t;
287 typedef struct {
288 /* IN variables. */
289 domid_t domain; /* 0 */
290 u16 __pad;
291 u32 op; /* 4 */
292 unsigned long *dirty_bitmap; /* 8: pointer to locked buffer */
293 MEMORY_PADDING;
294 /* IN/OUT variables. */
295 memory_t pages; /* 16: size of buffer, updated with actual size */
296 MEMORY_PADDING;
297 /* OUT variables. */
298 dom0_shadow_control_stats_t stats;
299 } PACKED dom0_shadow_control_t;
302 #define DOM0_SETDOMAINNAME 26
303 typedef struct {
304 /* IN variables. */
305 domid_t domain; /* 0 */
306 u16 __pad;
307 u8 name[MAX_DOMAIN_NAME]; /* 4 */
308 } PACKED dom0_setdomainname_t; /* 20 bytes */
310 #define DOM0_SETDOMAININITIALMEM 27
311 typedef struct {
312 /* IN variables. */
313 domid_t domain; /* 0 */
314 u16 __pad0;
315 u32 __pad1;
316 memory_t initial_memkb; /* 8 */
317 MEMORY_PADDING;
318 } PACKED dom0_setdomaininitialmem_t; /* 16 bytes */
320 #define DOM0_SETDOMAINMAXMEM 28
321 typedef struct {
322 /* IN variables. */
323 domid_t domain; /* 0 */
324 u16 __pad0;
325 u32 __pad1;
326 memory_t max_memkb; /* 8 */
327 MEMORY_PADDING;
328 } PACKED dom0_setdomainmaxmem_t; /* 16 bytes */
330 #define DOM0_GETPAGEFRAMEINFO2 29 /* batched interface */
331 typedef struct {
332 /* IN variables. */
333 domid_t domain; /* 0 */
334 u16 __pad0;
335 u32 __pad1;
336 memory_t num; /* 8 */
337 MEMORY_PADDING;
338 /* IN/OUT variables. */
339 unsigned long *array; /* 16 */
340 MEMORY_PADDING;
341 } PACKED dom0_getpageframeinfo2_t; /* 24 bytes */
343 #define DOM0_SETDOMAINVMASSIST 30
344 typedef struct {
345 /* IN variables. */
346 domid_t domain; /* 0 */
347 u16 __pad0;
348 u32 cmd; /* 4: vm_assist cmd */
349 u32 type; /* 8: vm_assist cmd */
350 } PACKED dom0_setdomainvmassist_t; /* 12 bytes */
352 typedef struct {
353 u32 cmd; /* 0 */
354 u32 interface_version; /* 4 */ /* DOM0_INTERFACE_VERSION */
355 union { /* 8 */
356 u32 dummy[18]; /* 72 bytes */
357 dom0_createdomain_t createdomain;
358 dom0_pausedomain_t pausedomain;
359 dom0_unpausedomain_t unpausedomain;
360 dom0_destroydomain_t destroydomain;
361 dom0_getmemlist_t getmemlist;
362 dom0_schedctl_t schedctl;
363 dom0_adjustdom_t adjustdom;
364 dom0_builddomain_t builddomain;
365 dom0_getdomaininfo_t getdomaininfo;
366 dom0_getpageframeinfo_t getpageframeinfo;
367 dom0_iopl_t iopl;
368 dom0_msr_t msr;
369 dom0_debug_t debug;
370 dom0_settime_t settime;
371 dom0_readconsole_t readconsole;
372 dom0_pincpudomain_t pincpudomain;
373 dom0_gettbufs_t gettbufs;
374 dom0_physinfo_t physinfo;
375 dom0_pcidev_access_t pcidev_access;
376 dom0_sched_id_t sched_id;
377 dom0_shadow_control_t shadow_control;
378 dom0_setdomainname_t setdomainname;
379 dom0_setdomaininitialmem_t setdomaininitialmem;
380 dom0_setdomainmaxmem_t setdomainmaxmem;
381 dom0_getpageframeinfo2_t getpageframeinfo2;
382 dom0_setdomainvmassist_t setdomainvmassist;
383 } PACKED u;
384 } PACKED dom0_op_t; /* 80 bytes */
386 #endif /* __DOM0_OPS_H__ */