debuggers.hg

view xen/include/public/xen.h @ 20653:5f076dbdab6c

domain builder: multiboot-like module support

This defines how multiple modules can be passed to a domain by packing
them together into a "multiboot module" in a way very similar to the
multiboot standard. An SIF_ flag is added to announce such package.
This also adds a packing implementation to PV-GRUB.

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