ia64/xen-unstable

view xen/include/public/xen.h @ 19836:d9890e67d2b7

tools: add SHAREDIR to buildmakevars2file

c/s 19818 dropped SHAREDIR from xen/util/path.py, which broke the "xm
new" command. This patch adds SHAREDIR back to the new
buildmakevars2file-closure function.

Signed-off-by: Ryan O'Connor <rjo@cs.ubc.ca>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 25 13:05:10 2009 +0100 (2009-06-25)
parents 2f9e1348aa98
children
line source
1 /******************************************************************************
2 * xen.h
3 *
4 * Guest OS interface to Xen.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 * Copyright (c) 2004, K A Fraser
25 */
27 #ifndef __XEN_PUBLIC_XEN_H__
28 #define __XEN_PUBLIC_XEN_H__
30 #include "xen-compat.h"
32 #if defined(__i386__) || defined(__x86_64__)
33 #include "arch-x86/xen.h"
34 #elif defined(__ia64__)
35 #include "arch-ia64.h"
36 #else
37 #error "Unsupported architecture"
38 #endif
40 #ifndef __ASSEMBLY__
41 /* Guest handles for primitive C types. */
42 DEFINE_XEN_GUEST_HANDLE(char);
43 __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char);
44 DEFINE_XEN_GUEST_HANDLE(int);
45 __DEFINE_XEN_GUEST_HANDLE(uint, unsigned int);
46 DEFINE_XEN_GUEST_HANDLE(long);
47 __DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long);
48 DEFINE_XEN_GUEST_HANDLE(void);
50 DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
51 #endif
53 /*
54 * HYPERCALLS
55 */
57 #define __HYPERVISOR_set_trap_table 0
58 #define __HYPERVISOR_mmu_update 1
59 #define __HYPERVISOR_set_gdt 2
60 #define __HYPERVISOR_stack_switch 3
61 #define __HYPERVISOR_set_callbacks 4
62 #define __HYPERVISOR_fpu_taskswitch 5
63 #define __HYPERVISOR_sched_op_compat 6 /* compat since 0x00030101 */
64 #define __HYPERVISOR_platform_op 7
65 #define __HYPERVISOR_set_debugreg 8
66 #define __HYPERVISOR_get_debugreg 9
67 #define __HYPERVISOR_update_descriptor 10
68 #define __HYPERVISOR_memory_op 12
69 #define __HYPERVISOR_multicall 13
70 #define __HYPERVISOR_update_va_mapping 14
71 #define __HYPERVISOR_set_timer_op 15
72 #define __HYPERVISOR_event_channel_op_compat 16 /* compat since 0x00030202 */
73 #define __HYPERVISOR_xen_version 17
74 #define __HYPERVISOR_console_io 18
75 #define __HYPERVISOR_physdev_op_compat 19 /* compat since 0x00030202 */
76 #define __HYPERVISOR_grant_table_op 20
77 #define __HYPERVISOR_vm_assist 21
78 #define __HYPERVISOR_update_va_mapping_otherdomain 22
79 #define __HYPERVISOR_iret 23 /* x86 only */
80 #define __HYPERVISOR_vcpu_op 24
81 #define __HYPERVISOR_set_segment_base 25 /* x86/64 only */
82 #define __HYPERVISOR_mmuext_op 26
83 #define __HYPERVISOR_xsm_op 27
84 #define __HYPERVISOR_nmi_op 28
85 #define __HYPERVISOR_sched_op 29
86 #define __HYPERVISOR_callback_op 30
87 #define __HYPERVISOR_xenoprof_op 31
88 #define __HYPERVISOR_event_channel_op 32
89 #define __HYPERVISOR_physdev_op 33
90 #define __HYPERVISOR_hvm_op 34
91 #define __HYPERVISOR_sysctl 35
92 #define __HYPERVISOR_domctl 36
93 #define __HYPERVISOR_kexec_op 37
94 #define __HYPERVISOR_tmem_op 38
96 /* Architecture-specific hypercall definitions. */
97 #define __HYPERVISOR_arch_0 48
98 #define __HYPERVISOR_arch_1 49
99 #define __HYPERVISOR_arch_2 50
100 #define __HYPERVISOR_arch_3 51
101 #define __HYPERVISOR_arch_4 52
102 #define __HYPERVISOR_arch_5 53
103 #define __HYPERVISOR_arch_6 54
104 #define __HYPERVISOR_arch_7 55
106 /*
107 * HYPERCALL COMPATIBILITY.
108 */
110 /* New sched_op hypercall introduced in 0x00030101. */
111 #if __XEN_INTERFACE_VERSION__ < 0x00030101
112 #undef __HYPERVISOR_sched_op
113 #define __HYPERVISOR_sched_op __HYPERVISOR_sched_op_compat
114 #endif
116 /* New event-channel and physdev hypercalls introduced in 0x00030202. */
117 #if __XEN_INTERFACE_VERSION__ < 0x00030202
118 #undef __HYPERVISOR_event_channel_op
119 #define __HYPERVISOR_event_channel_op __HYPERVISOR_event_channel_op_compat
120 #undef __HYPERVISOR_physdev_op
121 #define __HYPERVISOR_physdev_op __HYPERVISOR_physdev_op_compat
122 #endif
124 /* New platform_op hypercall introduced in 0x00030204. */
125 #if __XEN_INTERFACE_VERSION__ < 0x00030204
126 #define __HYPERVISOR_dom0_op __HYPERVISOR_platform_op
127 #endif
129 /*
130 * VIRTUAL INTERRUPTS
131 *
132 * Virtual interrupts that a guest OS may receive from Xen.
133 *
134 * In the side comments, 'V.' denotes a per-VCPU VIRQ while 'G.' denotes a
135 * global VIRQ. The former can be bound once per VCPU and cannot be re-bound.
136 * The latter can be allocated only once per guest: they must initially be
137 * allocated to VCPU0 but can subsequently be re-bound.
138 */
139 #define VIRQ_TIMER 0 /* V. Timebase update, and/or requested timeout. */
140 #define VIRQ_DEBUG 1 /* V. Request guest to dump debug info. */
141 #define VIRQ_CONSOLE 2 /* G. (DOM0) Bytes received on emergency console. */
142 #define VIRQ_DOM_EXC 3 /* G. (DOM0) Exceptional event for some domain. */
143 #define VIRQ_TBUF 4 /* G. (DOM0) Trace buffer has records available. */
144 #define VIRQ_DEBUGGER 6 /* G. (DOM0) A domain has paused for debugging. */
145 #define VIRQ_XENOPROF 7 /* V. XenOprofile interrupt: new sample available */
146 #define VIRQ_CON_RING 8 /* G. (DOM0) Bytes received on console */
148 /* Architecture-specific VIRQ definitions. */
149 #define VIRQ_ARCH_0 16
150 #define VIRQ_ARCH_1 17
151 #define VIRQ_ARCH_2 18
152 #define VIRQ_ARCH_3 19
153 #define VIRQ_ARCH_4 20
154 #define VIRQ_ARCH_5 21
155 #define VIRQ_ARCH_6 22
156 #define VIRQ_ARCH_7 23
158 #define NR_VIRQS 24
160 /*
161 * MMU-UPDATE REQUESTS
162 *
163 * HYPERVISOR_mmu_update() accepts a list of (ptr, val) pairs.
164 * A foreigndom (FD) can be specified (or DOMID_SELF for none).
165 * Where the FD has some effect, it is described below.
166 * ptr[1:0] specifies the appropriate MMU_* command.
167 *
168 * ptr[1:0] == MMU_NORMAL_PT_UPDATE:
169 * Updates an entry in a page table. If updating an L1 table, and the new
170 * table entry is valid/present, the mapped frame must belong to the FD, if
171 * an FD has been specified. If attempting to map an I/O page then the
172 * caller assumes the privilege of the FD.
173 * FD == DOMID_IO: Permit /only/ I/O mappings, at the priv level of the caller.
174 * FD == DOMID_XEN: Map restricted areas of Xen's heap space.
175 * ptr[:2] -- Machine address of the page-table entry to modify.
176 * val -- Value to write.
177 *
178 * ptr[1:0] == MMU_MACHPHYS_UPDATE:
179 * Updates an entry in the machine->pseudo-physical mapping table.
180 * ptr[:2] -- Machine address within the frame whose mapping to modify.
181 * The frame must belong to the FD, if one is specified.
182 * val -- Value to write into the mapping entry.
183 *
184 * ptr[1:0] == MMU_PT_UPDATE_PRESERVE_AD:
185 * As MMU_NORMAL_PT_UPDATE above, but A/D bits currently in the PTE are ORed
186 * with those in @val.
187 */
188 #define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */
189 #define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */
190 #define MMU_PT_UPDATE_PRESERVE_AD 2 /* atomically: *ptr = val | (*ptr&(A|D)) */
192 /*
193 * MMU EXTENDED OPERATIONS
194 *
195 * HYPERVISOR_mmuext_op() accepts a list of mmuext_op structures.
196 * A foreigndom (FD) can be specified (or DOMID_SELF for none).
197 * Where the FD has some effect, it is described below.
198 *
199 * cmd: MMUEXT_(UN)PIN_*_TABLE
200 * mfn: Machine frame number to be (un)pinned as a p.t. page.
201 * The frame must belong to the FD, if one is specified.
202 *
203 * cmd: MMUEXT_NEW_BASEPTR
204 * mfn: Machine frame number of new page-table base to install in MMU.
205 *
206 * cmd: MMUEXT_NEW_USER_BASEPTR [x86/64 only]
207 * mfn: Machine frame number of new page-table base to install in MMU
208 * when in user space.
209 *
210 * cmd: MMUEXT_TLB_FLUSH_LOCAL
211 * No additional arguments. Flushes local TLB.
212 *
213 * cmd: MMUEXT_INVLPG_LOCAL
214 * linear_addr: Linear address to be flushed from the local TLB.
215 *
216 * cmd: MMUEXT_TLB_FLUSH_MULTI
217 * vcpumask: Pointer to bitmap of VCPUs to be flushed.
218 *
219 * cmd: MMUEXT_INVLPG_MULTI
220 * linear_addr: Linear address to be flushed.
221 * vcpumask: Pointer to bitmap of VCPUs to be flushed.
222 *
223 * cmd: MMUEXT_TLB_FLUSH_ALL
224 * No additional arguments. Flushes all VCPUs' TLBs.
225 *
226 * cmd: MMUEXT_INVLPG_ALL
227 * linear_addr: Linear address to be flushed from all VCPUs' TLBs.
228 *
229 * cmd: MMUEXT_FLUSH_CACHE
230 * No additional arguments. Writes back and flushes cache contents.
231 *
232 * cmd: MMUEXT_SET_LDT
233 * linear_addr: Linear address of LDT base (NB. must be page-aligned).
234 * nr_ents: Number of entries in LDT.
235 *
236 * cmd: MMUEXT_CLEAR_PAGE
237 * mfn: Machine frame number to be cleared.
238 *
239 * cmd: MMUEXT_COPY_PAGE
240 * mfn: Machine frame number of the destination page.
241 * src_mfn: Machine frame number of the source page.
242 */
243 #define MMUEXT_PIN_L1_TABLE 0
244 #define MMUEXT_PIN_L2_TABLE 1
245 #define MMUEXT_PIN_L3_TABLE 2
246 #define MMUEXT_PIN_L4_TABLE 3
247 #define MMUEXT_UNPIN_TABLE 4
248 #define MMUEXT_NEW_BASEPTR 5
249 #define MMUEXT_TLB_FLUSH_LOCAL 6
250 #define MMUEXT_INVLPG_LOCAL 7
251 #define MMUEXT_TLB_FLUSH_MULTI 8
252 #define MMUEXT_INVLPG_MULTI 9
253 #define MMUEXT_TLB_FLUSH_ALL 10
254 #define MMUEXT_INVLPG_ALL 11
255 #define MMUEXT_FLUSH_CACHE 12
256 #define MMUEXT_SET_LDT 13
257 #define MMUEXT_NEW_USER_BASEPTR 15
258 #define MMUEXT_CLEAR_PAGE 16
259 #define MMUEXT_COPY_PAGE 17
261 #ifndef __ASSEMBLY__
262 struct mmuext_op {
263 unsigned int cmd;
264 union {
265 /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR
266 * CLEAR_PAGE, COPY_PAGE */
267 xen_pfn_t mfn;
268 /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */
269 unsigned long linear_addr;
270 } arg1;
271 union {
272 /* SET_LDT */
273 unsigned int nr_ents;
274 /* TLB_FLUSH_MULTI, INVLPG_MULTI */
275 #if __XEN_INTERFACE_VERSION__ >= 0x00030205
276 XEN_GUEST_HANDLE(const_void) vcpumask;
277 #else
278 const void *vcpumask;
279 #endif
280 /* COPY_PAGE */
281 xen_pfn_t src_mfn;
282 } arg2;
283 };
284 typedef struct mmuext_op mmuext_op_t;
285 DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);
286 #endif
288 /* These are passed as 'flags' to update_va_mapping. They can be ORed. */
289 /* When specifying UVMF_MULTI, also OR in a pointer to a CPU bitmap. */
290 /* UVMF_LOCAL is merely UVMF_MULTI with a NULL bitmap pointer. */
291 #define UVMF_NONE (0UL<<0) /* No flushing at all. */
292 #define UVMF_TLB_FLUSH (1UL<<0) /* Flush entire TLB(s). */
293 #define UVMF_INVLPG (2UL<<0) /* Flush only one entry. */
294 #define UVMF_FLUSHTYPE_MASK (3UL<<0)
295 #define UVMF_MULTI (0UL<<2) /* Flush subset of TLBs. */
296 #define UVMF_LOCAL (0UL<<2) /* Flush local TLB. */
297 #define UVMF_ALL (1UL<<2) /* Flush all TLBs. */
299 /*
300 * Commands to HYPERVISOR_console_io().
301 */
302 #define CONSOLEIO_write 0
303 #define CONSOLEIO_read 1
305 /*
306 * Commands to HYPERVISOR_vm_assist().
307 */
308 #define VMASST_CMD_enable 0
309 #define VMASST_CMD_disable 1
311 /* x86/32 guests: simulate full 4GB segment limits. */
312 #define VMASST_TYPE_4gb_segments 0
314 /* x86/32 guests: trap (vector 15) whenever above vmassist is used. */
315 #define VMASST_TYPE_4gb_segments_notify 1
317 /*
318 * x86 guests: support writes to bottom-level PTEs.
319 * NB1. Page-directory entries cannot be written.
320 * NB2. Guest must continue to remove all writable mappings of PTEs.
321 */
322 #define VMASST_TYPE_writable_pagetables 2
324 /* x86/PAE guests: support PDPTs above 4GB. */
325 #define VMASST_TYPE_pae_extended_cr3 3
327 #define MAX_VMASST_TYPE 3
329 #ifndef __ASSEMBLY__
331 typedef uint16_t domid_t;
333 /* Domain ids >= DOMID_FIRST_RESERVED cannot be used for ordinary domains. */
334 #define DOMID_FIRST_RESERVED (0x7FF0U)
336 /* DOMID_SELF is used in certain contexts to refer to oneself. */
337 #define DOMID_SELF (0x7FF0U)
339 /*
340 * DOMID_IO is used to restrict page-table updates to mapping I/O memory.
341 * Although no Foreign Domain need be specified to map I/O pages, DOMID_IO
342 * is useful to ensure that no mappings to the OS's own heap are accidentally
343 * installed. (e.g., in Linux this could cause havoc as reference counts
344 * aren't adjusted on the I/O-mapping code path).
345 * This only makes sense in MMUEXT_SET_FOREIGNDOM, but in that context can
346 * be specified by any calling domain.
347 */
348 #define DOMID_IO (0x7FF1U)
350 /*
351 * DOMID_XEN is used to allow privileged domains to map restricted parts of
352 * Xen's heap space (e.g., the machine_to_phys table).
353 * This only makes sense in MMUEXT_SET_FOREIGNDOM, and is only permitted if
354 * the caller is privileged.
355 */
356 #define DOMID_XEN (0x7FF2U)
358 /* DOMID_INVALID is used to identity invalid domid */
359 #define DOMID_INVALID (0x7FFFU)
361 /*
362 * Send an array of these to HYPERVISOR_mmu_update().
363 * NB. The fields are natural pointer/address size for this architecture.
364 */
365 struct mmu_update {
366 uint64_t ptr; /* Machine address of PTE. */
367 uint64_t val; /* New contents of PTE. */
368 };
369 typedef struct mmu_update mmu_update_t;
370 DEFINE_XEN_GUEST_HANDLE(mmu_update_t);
372 /*
373 * Send an array of these to HYPERVISOR_multicall().
374 * NB. The fields are natural register size for this architecture.
375 */
376 struct multicall_entry {
377 unsigned long op, result;
378 unsigned long args[6];
379 };
380 typedef struct multicall_entry multicall_entry_t;
381 DEFINE_XEN_GUEST_HANDLE(multicall_entry_t);
383 /*
384 * Event channel endpoints per domain:
385 * 1024 if a long is 32 bits; 4096 if a long is 64 bits.
386 */
387 #define NR_EVENT_CHANNELS (sizeof(unsigned long) * sizeof(unsigned long) * 64)
389 struct vcpu_time_info {
390 /*
391 * Updates to the following values are preceded and followed by an
392 * increment of 'version'. The guest can therefore detect updates by
393 * looking for changes to 'version'. If the least-significant bit of
394 * the version number is set then an update is in progress and the guest
395 * must wait to read a consistent set of values.
396 * The correct way to interact with the version number is similar to
397 * Linux's seqlock: see the implementations of read_seqbegin/read_seqretry.
398 */
399 uint32_t version;
400 uint32_t pad0;
401 uint64_t tsc_timestamp; /* TSC at last update of time vals. */
402 uint64_t system_time; /* Time, in nanosecs, since boot. */
403 /*
404 * Current system time:
405 * system_time +
406 * ((((tsc - tsc_timestamp) << tsc_shift) * tsc_to_system_mul) >> 32)
407 * CPU frequency (Hz):
408 * ((10^9 << 32) / tsc_to_system_mul) >> tsc_shift
409 */
410 uint32_t tsc_to_system_mul;
411 int8_t tsc_shift;
412 int8_t pad1[3];
413 }; /* 32 bytes */
414 typedef struct vcpu_time_info vcpu_time_info_t;
416 struct vcpu_info {
417 /*
418 * 'evtchn_upcall_pending' is written non-zero by Xen to indicate
419 * a pending notification for a particular VCPU. It is then cleared
420 * by the guest OS /before/ checking for pending work, thus avoiding
421 * a set-and-check race. Note that the mask is only accessed by Xen
422 * on the CPU that is currently hosting the VCPU. This means that the
423 * pending and mask flags can be updated by the guest without special
424 * synchronisation (i.e., no need for the x86 LOCK prefix).
425 * This may seem suboptimal because if the pending flag is set by
426 * a different CPU then an IPI may be scheduled even when the mask
427 * is set. However, note:
428 * 1. The task of 'interrupt holdoff' is covered by the per-event-
429 * channel mask bits. A 'noisy' event that is continually being
430 * triggered can be masked at source at this very precise
431 * granularity.
432 * 2. The main purpose of the per-VCPU mask is therefore to restrict
433 * reentrant execution: whether for concurrency control, or to
434 * prevent unbounded stack usage. Whatever the purpose, we expect
435 * that the mask will be asserted only for short periods at a time,
436 * and so the likelihood of a 'spurious' IPI is suitably small.
437 * The mask is read before making an event upcall to the guest: a
438 * non-zero mask therefore guarantees that the VCPU will not receive
439 * an upcall activation. The mask is cleared when the VCPU requests
440 * to block: this avoids wakeup-waiting races.
441 */
442 uint8_t evtchn_upcall_pending;
443 uint8_t evtchn_upcall_mask;
444 unsigned long evtchn_pending_sel;
445 struct arch_vcpu_info arch;
446 struct vcpu_time_info time;
447 }; /* 64 bytes (x86) */
448 #ifndef __XEN__
449 typedef struct vcpu_info vcpu_info_t;
450 #endif
452 /*
453 * Xen/kernel shared data -- pointer provided in start_info.
454 *
455 * This structure is defined to be both smaller than a page, and the
456 * only data on the shared page, but may vary in actual size even within
457 * compatible Xen versions; guests should not rely on the size
458 * of this structure remaining constant.
459 */
460 struct shared_info {
461 struct vcpu_info vcpu_info[XEN_LEGACY_MAX_VCPUS];
463 /*
464 * A domain can create "event channels" on which it can send and receive
465 * asynchronous event notifications. There are three classes of event that
466 * are delivered by this mechanism:
467 * 1. Bi-directional inter- and intra-domain connections. Domains must
468 * arrange out-of-band to set up a connection (usually by allocating
469 * an unbound 'listener' port and avertising that via a storage service
470 * such as xenstore).
471 * 2. Physical interrupts. A domain with suitable hardware-access
472 * privileges can bind an event-channel port to a physical interrupt
473 * source.
474 * 3. Virtual interrupts ('events'). A domain can bind an event-channel
475 * port to a virtual interrupt source, such as the virtual-timer
476 * device or the emergency console.
477 *
478 * Event channels are addressed by a "port index". Each channel is
479 * associated with two bits of information:
480 * 1. PENDING -- notifies the domain that there is a pending notification
481 * to be processed. This bit is cleared by the guest.
482 * 2. MASK -- if this bit is clear then a 0->1 transition of PENDING
483 * will cause an asynchronous upcall to be scheduled. This bit is only
484 * updated by the guest. It is read-only within Xen. If a channel
485 * becomes pending while the channel is masked then the 'edge' is lost
486 * (i.e., when the channel is unmasked, the guest must manually handle
487 * pending notifications as no upcall will be scheduled by Xen).
488 *
489 * To expedite scanning of pending notifications, any 0->1 pending
490 * transition on an unmasked channel causes a corresponding bit in a
491 * per-vcpu selector word to be set. Each bit in the selector covers a
492 * 'C long' in the PENDING bitfield array.
493 */
494 unsigned long evtchn_pending[sizeof(unsigned long) * 8];
495 unsigned long evtchn_mask[sizeof(unsigned long) * 8];
497 /*
498 * Wallclock time: updated only by control software. Guests should base
499 * their gettimeofday() syscall on this wallclock-base value.
500 */
501 uint32_t wc_version; /* Version counter: see vcpu_time_info_t. */
502 uint32_t wc_sec; /* Secs 00:00:00 UTC, Jan 1, 1970. */
503 uint32_t wc_nsec; /* Nsecs 00:00:00 UTC, Jan 1, 1970. */
505 struct arch_shared_info arch;
507 };
508 #ifndef __XEN__
509 typedef struct shared_info shared_info_t;
510 #endif
512 /*
513 * Start-of-day memory layout:
514 * 1. The domain is started within contiguous virtual-memory region.
515 * 2. The contiguous region ends on an aligned 4MB boundary.
516 * 3. This the order of bootstrap elements in the initial virtual region:
517 * a. relocated kernel image
518 * b. initial ram disk [mod_start, mod_len]
519 * c. list of allocated page frames [mfn_list, nr_pages]
520 * (unless relocated due to XEN_ELFNOTE_INIT_P2M)
521 * d. start_info_t structure [register ESI (x86)]
522 * e. bootstrap page tables [pt_base, CR3 (x86)]
523 * f. bootstrap stack [register ESP (x86)]
524 * 4. Bootstrap elements are packed together, but each is 4kB-aligned.
525 * 5. The initial ram disk may be omitted.
526 * 6. The list of page frames forms a contiguous 'pseudo-physical' memory
527 * layout for the domain. In particular, the bootstrap virtual-memory
528 * region is a 1:1 mapping to the first section of the pseudo-physical map.
529 * 7. All bootstrap elements are mapped read-writable for the guest OS. The
530 * only exception is the bootstrap page table, which is mapped read-only.
531 * 8. There is guaranteed to be at least 512kB padding after the final
532 * bootstrap element. If necessary, the bootstrap virtual region is
533 * extended by an extra 4MB to ensure this.
534 */
536 #define MAX_GUEST_CMDLINE 1024
537 struct start_info {
538 /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME. */
539 char magic[32]; /* "xen-<version>-<platform>". */
540 unsigned long nr_pages; /* Total pages allocated to this domain. */
541 unsigned long shared_info; /* MACHINE address of shared info struct. */
542 uint32_t flags; /* SIF_xxx flags. */
543 xen_pfn_t store_mfn; /* MACHINE page number of shared page. */
544 uint32_t store_evtchn; /* Event channel for store communication. */
545 union {
546 struct {
547 xen_pfn_t mfn; /* MACHINE page number of console page. */
548 uint32_t evtchn; /* Event channel for console page. */
549 } domU;
550 struct {
551 uint32_t info_off; /* Offset of console_info struct. */
552 uint32_t info_size; /* Size of console_info struct from start.*/
553 } dom0;
554 } console;
555 /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME). */
556 unsigned long pt_base; /* VIRTUAL address of page directory. */
557 unsigned long nr_pt_frames; /* Number of bootstrap p.t. frames. */
558 unsigned long mfn_list; /* VIRTUAL address of page-frame list. */
559 unsigned long mod_start; /* VIRTUAL address of pre-loaded module. */
560 unsigned long mod_len; /* Size (bytes) of pre-loaded module. */
561 int8_t cmd_line[MAX_GUEST_CMDLINE];
562 /* The pfn range here covers both page table and p->m table frames. */
563 unsigned long first_p2m_pfn;/* 1st pfn forming initial P->M table. */
564 unsigned long nr_p2m_frames;/* # of pfns forming initial P->M table. */
565 };
566 typedef struct start_info start_info_t;
568 /* New console union for dom0 introduced in 0x00030203. */
569 #if __XEN_INTERFACE_VERSION__ < 0x00030203
570 #define console_mfn console.domU.mfn
571 #define console_evtchn console.domU.evtchn
572 #endif
574 /* These flags are passed in the 'flags' field of start_info_t. */
575 #define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */
576 #define SIF_INITDOMAIN (1<<1) /* Is this the initial control domain? */
577 #define SIF_PM_MASK (0xFF<<8) /* reserve 1 byte for xen-pm options */
579 typedef struct dom0_vga_console_info {
580 uint8_t video_type; /* DOM0_VGA_CONSOLE_??? */
581 #define XEN_VGATYPE_TEXT_MODE_3 0x03
582 #define XEN_VGATYPE_VESA_LFB 0x23
584 union {
585 struct {
586 /* Font height, in pixels. */
587 uint16_t font_height;
588 /* Cursor location (column, row). */
589 uint16_t cursor_x, cursor_y;
590 /* Number of rows and columns (dimensions in characters). */
591 uint16_t rows, columns;
592 } text_mode_3;
594 struct {
595 /* Width and height, in pixels. */
596 uint16_t width, height;
597 /* Bytes per scan line. */
598 uint16_t bytes_per_line;
599 /* Bits per pixel. */
600 uint16_t bits_per_pixel;
601 /* LFB physical address, and size (in units of 64kB). */
602 uint32_t lfb_base;
603 uint32_t lfb_size;
604 /* RGB mask offsets and sizes, as defined by VBE 1.2+ */
605 uint8_t red_pos, red_size;
606 uint8_t green_pos, green_size;
607 uint8_t blue_pos, blue_size;
608 uint8_t rsvd_pos, rsvd_size;
609 #if __XEN_INTERFACE_VERSION__ >= 0x00030206
610 /* VESA capabilities (offset 0xa, VESA command 0x4f00). */
611 uint32_t gbl_caps;
612 /* Mode attributes (offset 0x0, VESA command 0x4f01). */
613 uint16_t mode_attrs;
614 #endif
615 } vesa_lfb;
616 } u;
617 } dom0_vga_console_info_t;
618 #define xen_vga_console_info dom0_vga_console_info
619 #define xen_vga_console_info_t dom0_vga_console_info_t
621 typedef uint8_t xen_domain_handle_t[16];
623 /* Turn a plain number into a C unsigned long constant. */
624 #define __mk_unsigned_long(x) x ## UL
625 #define mk_unsigned_long(x) __mk_unsigned_long(x)
627 __DEFINE_XEN_GUEST_HANDLE(uint8, uint8_t);
628 __DEFINE_XEN_GUEST_HANDLE(uint16, uint16_t);
629 __DEFINE_XEN_GUEST_HANDLE(uint32, uint32_t);
630 __DEFINE_XEN_GUEST_HANDLE(uint64, uint64_t);
632 #else /* __ASSEMBLY__ */
634 /* In assembly code we cannot use C numeric constant suffixes. */
635 #define mk_unsigned_long(x) x
637 #endif /* !__ASSEMBLY__ */
639 /* Default definitions for macros used by domctl/sysctl. */
640 #if defined(__XEN__) || defined(__XEN_TOOLS__)
641 #ifndef uint64_aligned_t
642 #define uint64_aligned_t uint64_t
643 #endif
644 #ifndef XEN_GUEST_HANDLE_64
645 #define XEN_GUEST_HANDLE_64(name) XEN_GUEST_HANDLE(name)
646 #endif
647 #endif
649 #endif /* __XEN_PUBLIC_XEN_H__ */
651 /*
652 * Local variables:
653 * mode: C
654 * c-set-style: "BSD"
655 * c-basic-offset: 4
656 * tab-width: 4
657 * indent-tabs-mode: nil
658 * End:
659 */