Coverage Report

Created: 2017-10-25 09:10

/root/src/xen/xen/include/public/xen.h
Line
Count
Source (jump to first uncovered line)
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
 */
26
27
#ifndef __XEN_PUBLIC_XEN_H__
28
#define __XEN_PUBLIC_XEN_H__
29
30
#include "xen-compat.h"
31
32
#if defined(__i386__) || defined(__x86_64__)
33
#include "arch-x86/xen.h"
34
#elif defined(__arm__) || defined (__aarch64__)
35
#include "arch-arm.h"
36
#else
37
#error "Unsupported architecture"
38
#endif
39
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
#if __XEN_INTERFACE_VERSION__ < 0x00040300
47
DEFINE_XEN_GUEST_HANDLE(long);
48
__DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long);
49
#endif
50
DEFINE_XEN_GUEST_HANDLE(void);
51
52
DEFINE_XEN_GUEST_HANDLE(uint64_t);
53
DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
54
DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
55
56
/* Turn a plain number into a C unsigned (long (long)) constant. */
57
19
#define __xen_mk_uint(x)  x ## U
58
0
#define __xen_mk_ulong(x) x ## UL
59
#ifndef __xen_mk_ullong
60
0
# define __xen_mk_ullong(x) x ## ULL
61
#endif
62
15.0M
#define xen_mk_uint(x)    __xen_mk_uint(x)
63
0
#define xen_mk_ulong(x)   __xen_mk_ulong(x)
64
0
#define xen_mk_ullong(x)  __xen_mk_ullong(x)
65
66
#else
67
68
/* In assembly code we cannot use C numeric constant suffixes. */
69
#define xen_mk_uint(x)   x
70
#define xen_mk_ulong(x)  x
71
#define xen_mk_ullong(x) x
72
73
#endif
74
75
/*
76
 * HYPERCALLS
77
 */
78
79
/* `incontents 100 hcalls List of hypercalls
80
 * ` enum hypercall_num { // __HYPERVISOR_* => HYPERVISOR_*()
81
 */
82
83
0
#define __HYPERVISOR_set_trap_table        0
84
0
#define __HYPERVISOR_mmu_update            1
85
#define __HYPERVISOR_set_gdt               2
86
#define __HYPERVISOR_stack_switch          3
87
#define __HYPERVISOR_set_callbacks         4
88
#define __HYPERVISOR_fpu_taskswitch        5
89
#define __HYPERVISOR_sched_op_compat       6 /* compat since 0x00030101 */
90
0
#define __HYPERVISOR_platform_op           7
91
#define __HYPERVISOR_set_debugreg          8
92
#define __HYPERVISOR_get_debugreg          9
93
#define __HYPERVISOR_update_descriptor    10
94
0
#define __HYPERVISOR_memory_op            12
95
0
#define __HYPERVISOR_multicall            13
96
#define __HYPERVISOR_update_va_mapping    14
97
#define __HYPERVISOR_set_timer_op         15
98
#define __HYPERVISOR_event_channel_op_compat 16 /* compat since 0x00030202 */
99
#define __HYPERVISOR_xen_version          17
100
0
#define __HYPERVISOR_console_io           18
101
#define __HYPERVISOR_physdev_op_compat    19 /* compat since 0x00030202 */
102
0
#define __HYPERVISOR_grant_table_op       20
103
#define __HYPERVISOR_vm_assist            21
104
#define __HYPERVISOR_update_va_mapping_otherdomain 22
105
258
#define __HYPERVISOR_iret                 23 /* x86 only */
106
0
#define __HYPERVISOR_vcpu_op              24
107
#define __HYPERVISOR_set_segment_base     25 /* x86/64 only */
108
0
#define __HYPERVISOR_mmuext_op            26
109
#define __HYPERVISOR_xsm_op               27
110
#define __HYPERVISOR_nmi_op               28
111
0
#define __HYPERVISOR_sched_op             29
112
#define __HYPERVISOR_callback_op          30
113
#define __HYPERVISOR_xenoprof_op          31
114
#define __HYPERVISOR_event_channel_op     32
115
#define __HYPERVISOR_physdev_op           33
116
0
#define __HYPERVISOR_hvm_op               34
117
0
#define __HYPERVISOR_sysctl               35
118
0
#define __HYPERVISOR_domctl               36
119
0
#define __HYPERVISOR_kexec_op             37
120
#define __HYPERVISOR_tmem_op              38
121
#define __HYPERVISOR_xc_reserved_op       39 /* reserved for XenClient */
122
#define __HYPERVISOR_xenpmu_op            40
123
0
#define __HYPERVISOR_dm_op                41
124
125
/* Architecture-specific hypercall definitions. */
126
#define __HYPERVISOR_arch_0               48
127
0
#define __HYPERVISOR_arch_1               49
128
#define __HYPERVISOR_arch_2               50
129
#define __HYPERVISOR_arch_3               51
130
#define __HYPERVISOR_arch_4               52
131
#define __HYPERVISOR_arch_5               53
132
#define __HYPERVISOR_arch_6               54
133
#define __HYPERVISOR_arch_7               55
134
135
/* ` } */
136
137
/*
138
 * HYPERCALL COMPATIBILITY.
139
 */
140
141
/* New sched_op hypercall introduced in 0x00030101. */
142
#if __XEN_INTERFACE_VERSION__ < 0x00030101
143
#undef __HYPERVISOR_sched_op
144
#define __HYPERVISOR_sched_op __HYPERVISOR_sched_op_compat
145
#endif
146
147
/* New event-channel and physdev hypercalls introduced in 0x00030202. */
148
#if __XEN_INTERFACE_VERSION__ < 0x00030202
149
#undef __HYPERVISOR_event_channel_op
150
#define __HYPERVISOR_event_channel_op __HYPERVISOR_event_channel_op_compat
151
#undef __HYPERVISOR_physdev_op
152
#define __HYPERVISOR_physdev_op __HYPERVISOR_physdev_op_compat
153
#endif
154
155
/* New platform_op hypercall introduced in 0x00030204. */
156
#if __XEN_INTERFACE_VERSION__ < 0x00030204
157
#define __HYPERVISOR_dom0_op __HYPERVISOR_platform_op
158
#endif
159
160
/* 
161
 * VIRTUAL INTERRUPTS
162
 * 
163
 * Virtual interrupts that a guest OS may receive from Xen.
164
 * 
165
 * In the side comments, 'V.' denotes a per-VCPU VIRQ while 'G.' denotes a
166
 * global VIRQ. The former can be bound once per VCPU and cannot be re-bound.
167
 * The latter can be allocated only once per guest: they must initially be
168
 * allocated to VCPU0 but can subsequently be re-bound.
169
 */
170
/* ` enum virq { */
171
11.5k
#define VIRQ_TIMER      0  /* V. Timebase update, and/or requested timeout.  */
172
5.76k
#define VIRQ_DEBUG      1  /* V. Request guest to dump debug info.           */
173
0
#define VIRQ_CONSOLE    2  /* G. (DOM0) Bytes received on emergency console. */
174
0
#define VIRQ_DOM_EXC    3  /* G. (DOM0) Exceptional event for some domain.   */
175
0
#define VIRQ_TBUF       4  /* G. (DOM0) Trace buffer has records available.  */
176
0
#define VIRQ_DEBUGGER   6  /* G. (DOM0) A domain has paused for debugging.   */
177
5.76k
#define VIRQ_XENOPROF   7  /* V. XenOprofile interrupt: new sample available */
178
131
#define VIRQ_CON_RING   8  /* G. (DOM0) Bytes received on console            */
179
11
#define VIRQ_PCPU_STATE 9  /* G. (DOM0) PCPU state changed                   */
180
#define VIRQ_MEM_EVENT  10 /* G. (DOM0) A memory event has occured           */
181
#define VIRQ_XC_RESERVED 11 /* G. Reserved for XenClient                     */
182
0
#define VIRQ_ENOMEM     12 /* G. (DOM0) Low on heap memory       */
183
5.76k
#define VIRQ_XENPMU     13 /* V.  PMC interrupt                              */
184
185
/* Architecture-specific VIRQ definitions. */
186
0
#define VIRQ_ARCH_0    16
187
#define VIRQ_ARCH_1    17
188
#define VIRQ_ARCH_2    18
189
#define VIRQ_ARCH_3    19
190
#define VIRQ_ARCH_4    20
191
#define VIRQ_ARCH_5    21
192
#define VIRQ_ARCH_6    22
193
0
#define VIRQ_ARCH_7    23
194
/* ` } */
195
196
0
#define NR_VIRQS       24
197
198
/*
199
 * ` enum neg_errnoval
200
 * ` HYPERVISOR_mmu_update(const struct mmu_update reqs[],
201
 * `                       unsigned count, unsigned *done_out,
202
 * `                       unsigned foreigndom)
203
 * `
204
 * @reqs is an array of mmu_update_t structures ((ptr, val) pairs).
205
 * @count is the length of the above array.
206
 * @pdone is an output parameter indicating number of completed operations
207
 * @foreigndom[15:0]: FD, the expected owner of data pages referenced in this
208
 *                    hypercall invocation. Can be DOMID_SELF.
209
 * @foreigndom[31:16]: PFD, the expected owner of pagetable pages referenced
210
 *                     in this hypercall invocation. The value of this field
211
 *                     (x) encodes the PFD as follows:
212
 *                     x == 0 => PFD == DOMID_SELF
213
 *                     x != 0 => PFD == x - 1
214
 * 
215
 * Sub-commands: ptr[1:0] specifies the appropriate MMU_* command.
216
 * -------------
217
 * ptr[1:0] == MMU_NORMAL_PT_UPDATE:
218
 * Updates an entry in a page table belonging to PFD. If updating an L1 table,
219
 * and the new table entry is valid/present, the mapped frame must belong to
220
 * FD. If attempting to map an I/O page then the caller assumes the privilege
221
 * of the FD.
222
 * FD == DOMID_IO: Permit /only/ I/O mappings, at the priv level of the caller.
223
 * FD == DOMID_XEN: Map restricted areas of Xen's heap space.
224
 * ptr[:2]  -- Machine address of the page-table entry to modify.
225
 * val      -- Value to write.
226
 *
227
 * There also certain implicit requirements when using this hypercall. The
228
 * pages that make up a pagetable must be mapped read-only in the guest.
229
 * This prevents uncontrolled guest updates to the pagetable. Xen strictly
230
 * enforces this, and will disallow any pagetable update which will end up
231
 * mapping pagetable page RW, and will disallow using any writable page as a
232
 * pagetable. In practice it means that when constructing a page table for a
233
 * process, thread, etc, we MUST be very dilligient in following these rules:
234
 *  1). Start with top-level page (PGD or in Xen language: L4). Fill out
235
 *      the entries.
236
 *  2). Keep on going, filling out the upper (PUD or L3), and middle (PMD
237
 *      or L2).
238
 *  3). Start filling out the PTE table (L1) with the PTE entries. Once
239
 *    done, make sure to set each of those entries to RO (so writeable bit
240
 *    is unset). Once that has been completed, set the PMD (L2) for this
241
 *    PTE table as RO.
242
 *  4). When completed with all of the PMD (L2) entries, and all of them have
243
 *    been set to RO, make sure to set RO the PUD (L3). Do the same
244
 *    operation on PGD (L4) pagetable entries that have a PUD (L3) entry.
245
 *  5). Now before you can use those pages (so setting the cr3), you MUST also
246
 *      pin them so that the hypervisor can verify the entries. This is done
247
 *      via the HYPERVISOR_mmuext_op(MMUEXT_PIN_L4_TABLE, guest physical frame
248
 *      number of the PGD (L4)). And this point the HYPERVISOR_mmuext_op(
249
 *      MMUEXT_NEW_BASEPTR, guest physical frame number of the PGD (L4)) can be
250
 *      issued.
251
 * For 32-bit guests, the L4 is not used (as there is less pagetables), so
252
 * instead use L3.
253
 * At this point the pagetables can be modified using the MMU_NORMAL_PT_UPDATE
254
 * hypercall. Also if so desired the OS can also try to write to the PTE
255
 * and be trapped by the hypervisor (as the PTE entry is RO).
256
 *
257
 * To deallocate the pages, the operations are the reverse of the steps
258
 * mentioned above. The argument is MMUEXT_UNPIN_TABLE for all levels and the
259
 * pagetable MUST not be in use (meaning that the cr3 is not set to it).
260
 * 
261
 * ptr[1:0] == MMU_MACHPHYS_UPDATE:
262
 * Updates an entry in the machine->pseudo-physical mapping table.
263
 * ptr[:2]  -- Machine address within the frame whose mapping to modify.
264
 *             The frame must belong to the FD, if one is specified.
265
 * val      -- Value to write into the mapping entry.
266
 * 
267
 * ptr[1:0] == MMU_PT_UPDATE_PRESERVE_AD:
268
 * As MMU_NORMAL_PT_UPDATE above, but A/D bits currently in the PTE are ORed
269
 * with those in @val.
270
 *
271
 * @val is usually the machine frame number along with some attributes.
272
 * The attributes by default follow the architecture defined bits. Meaning that
273
 * if this is a X86_64 machine and four page table layout is used, the layout
274
 * of val is:
275
 *  - 63 if set means No execute (NX)
276
 *  - 46-13 the machine frame number
277
 *  - 12 available for guest
278
 *  - 11 available for guest
279
 *  - 10 available for guest
280
 *  - 9 available for guest
281
 *  - 8 global
282
 *  - 7 PAT (PSE is disabled, must use hypercall to make 4MB or 2MB pages)
283
 *  - 6 dirty
284
 *  - 5 accessed
285
 *  - 4 page cached disabled
286
 *  - 3 page write through
287
 *  - 2 userspace accessible
288
 *  - 1 writeable
289
 *  - 0 present
290
 *
291
 *  The one bits that does not fit with the default layout is the PAGE_PSE
292
 *  also called PAGE_PAT). The MMUEXT_[UN]MARK_SUPER arguments to the
293
 *  HYPERVISOR_mmuext_op serve as mechanism to set a pagetable to be 4MB
294
 *  (or 2MB) instead of using the PAGE_PSE bit.
295
 *
296
 *  The reason that the PAGE_PSE (bit 7) is not being utilized is due to Xen
297
 *  using it as the Page Attribute Table (PAT) bit - for details on it please
298
 *  refer to Intel SDM 10.12. The PAT allows to set the caching attributes of
299
 *  pages instead of using MTRRs.
300
 *
301
 *  The PAT MSR is as follows (it is a 64-bit value, each entry is 8 bits):
302
 *                    PAT4                 PAT0
303
 *  +-----+-----+----+----+----+-----+----+----+
304
 *  | UC  | UC- | WC | WB | UC | UC- | WC | WB |  <= Linux
305
 *  +-----+-----+----+----+----+-----+----+----+
306
 *  | UC  | UC- | WT | WB | UC | UC- | WT | WB |  <= BIOS (default when machine boots)
307
 *  +-----+-----+----+----+----+-----+----+----+
308
 *  | rsv | rsv | WP | WC | UC | UC- | WT | WB |  <= Xen
309
 *  +-----+-----+----+----+----+-----+----+----+
310
 *
311
 *  The lookup of this index table translates to looking up
312
 *  Bit 7, Bit 4, and Bit 3 of val entry:
313
 *
314
 *  PAT/PSE (bit 7) ... PCD (bit 4) .. PWT (bit 3).
315
 *
316
 *  If all bits are off, then we are using PAT0. If bit 3 turned on,
317
 *  then we are using PAT1, if bit 3 and bit 4, then PAT2..
318
 *
319
 *  As you can see, the Linux PAT1 translates to PAT4 under Xen. Which means
320
 *  that if a guest that follows Linux's PAT setup and would like to set Write
321
 *  Combined on pages it MUST use PAT4 entry. Meaning that Bit 7 (PAGE_PAT) is
322
 *  set. For example, under Linux it only uses PAT0, PAT1, and PAT2 for the
323
 *  caching as:
324
 *
325
 *   WB = none (so PAT0)
326
 *   WC = PWT (bit 3 on)
327
 *   UC = PWT | PCD (bit 3 and 4 are on).
328
 *
329
 * To make it work with Xen, it needs to translate the WC bit as so:
330
 *
331
 *  PWT (so bit 3 on) --> PAT (so bit 7 is on) and clear bit 3
332
 *
333
 * And to translate back it would:
334
 *
335
 * PAT (bit 7 on) --> PWT (bit 3 on) and clear bit 7.
336
 */
337
0
#define MMU_NORMAL_PT_UPDATE      0 /* checked '*ptr = val'. ptr is MA.      */
338
0
#define MMU_MACHPHYS_UPDATE       1 /* ptr = MA of frame to modify entry for */
339
0
#define MMU_PT_UPDATE_PRESERVE_AD 2 /* atomically: *ptr = val | (*ptr&(A|D)) */
340
341
/*
342
 * MMU EXTENDED OPERATIONS
343
 *
344
 * ` enum neg_errnoval
345
 * ` HYPERVISOR_mmuext_op(mmuext_op_t uops[],
346
 * `                      unsigned int count,
347
 * `                      unsigned int *pdone,
348
 * `                      unsigned int foreigndom)
349
 */
350
/* HYPERVISOR_mmuext_op() accepts a list of mmuext_op structures.
351
 * A foreigndom (FD) can be specified (or DOMID_SELF for none).
352
 * Where the FD has some effect, it is described below.
353
 *
354
 * cmd: MMUEXT_(UN)PIN_*_TABLE
355
 * mfn: Machine frame number to be (un)pinned as a p.t. page.
356
 *      The frame must belong to the FD, if one is specified.
357
 *
358
 * cmd: MMUEXT_NEW_BASEPTR
359
 * mfn: Machine frame number of new page-table base to install in MMU.
360
 *
361
 * cmd: MMUEXT_NEW_USER_BASEPTR [x86/64 only]
362
 * mfn: Machine frame number of new page-table base to install in MMU
363
 *      when in user space.
364
 *
365
 * cmd: MMUEXT_TLB_FLUSH_LOCAL
366
 * No additional arguments. Flushes local TLB.
367
 *
368
 * cmd: MMUEXT_INVLPG_LOCAL
369
 * linear_addr: Linear address to be flushed from the local TLB.
370
 *
371
 * cmd: MMUEXT_TLB_FLUSH_MULTI
372
 * vcpumask: Pointer to bitmap of VCPUs to be flushed.
373
 *
374
 * cmd: MMUEXT_INVLPG_MULTI
375
 * linear_addr: Linear address to be flushed.
376
 * vcpumask: Pointer to bitmap of VCPUs to be flushed.
377
 *
378
 * cmd: MMUEXT_TLB_FLUSH_ALL
379
 * No additional arguments. Flushes all VCPUs' TLBs.
380
 *
381
 * cmd: MMUEXT_INVLPG_ALL
382
 * linear_addr: Linear address to be flushed from all VCPUs' TLBs.
383
 *
384
 * cmd: MMUEXT_FLUSH_CACHE
385
 * No additional arguments. Writes back and flushes cache contents.
386
 *
387
 * cmd: MMUEXT_FLUSH_CACHE_GLOBAL
388
 * No additional arguments. Writes back and flushes cache contents
389
 * on all CPUs in the system.
390
 *
391
 * cmd: MMUEXT_SET_LDT
392
 * linear_addr: Linear address of LDT base (NB. must be page-aligned).
393
 * nr_ents: Number of entries in LDT.
394
 *
395
 * cmd: MMUEXT_CLEAR_PAGE
396
 * mfn: Machine frame number to be cleared.
397
 *
398
 * cmd: MMUEXT_COPY_PAGE
399
 * mfn: Machine frame number of the destination page.
400
 * src_mfn: Machine frame number of the source page.
401
 *
402
 * cmd: MMUEXT_[UN]MARK_SUPER
403
 * mfn: Machine frame number of head of superpage to be [un]marked.
404
 */
405
/* ` enum mmuext_cmd { */
406
0
#define MMUEXT_PIN_L1_TABLE      0
407
0
#define MMUEXT_PIN_L2_TABLE      1
408
0
#define MMUEXT_PIN_L3_TABLE      2
409
0
#define MMUEXT_PIN_L4_TABLE      3
410
0
#define MMUEXT_UNPIN_TABLE       4
411
0
#define MMUEXT_NEW_BASEPTR       5
412
0
#define MMUEXT_TLB_FLUSH_LOCAL   6
413
0
#define MMUEXT_INVLPG_LOCAL      7
414
0
#define MMUEXT_TLB_FLUSH_MULTI   8
415
0
#define MMUEXT_INVLPG_MULTI      9
416
0
#define MMUEXT_TLB_FLUSH_ALL    10
417
0
#define MMUEXT_INVLPG_ALL       11
418
0
#define MMUEXT_FLUSH_CACHE      12
419
0
#define MMUEXT_SET_LDT          13
420
0
#define MMUEXT_NEW_USER_BASEPTR 15
421
0
#define MMUEXT_CLEAR_PAGE       16
422
0
#define MMUEXT_COPY_PAGE        17
423
0
#define MMUEXT_FLUSH_CACHE_GLOBAL 18
424
0
#define MMUEXT_MARK_SUPER       19
425
0
#define MMUEXT_UNMARK_SUPER     20
426
/* ` } */
427
428
#ifndef __ASSEMBLY__
429
struct mmuext_op {
430
    unsigned int cmd; /* => enum mmuext_cmd */
431
    union {
432
        /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR
433
         * CLEAR_PAGE, COPY_PAGE, [UN]MARK_SUPER */
434
        xen_pfn_t     mfn;
435
        /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */
436
        unsigned long linear_addr;
437
    } arg1;
438
    union {
439
        /* SET_LDT */
440
        unsigned int nr_ents;
441
        /* TLB_FLUSH_MULTI, INVLPG_MULTI */
442
#if __XEN_INTERFACE_VERSION__ >= 0x00030205
443
        XEN_GUEST_HANDLE(const_void) vcpumask;
444
#else
445
        const void *vcpumask;
446
#endif
447
        /* COPY_PAGE */
448
        xen_pfn_t src_mfn;
449
    } arg2;
450
};
451
typedef struct mmuext_op mmuext_op_t;
452
DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);
453
#endif
454
455
/*
456
 * ` enum neg_errnoval
457
 * ` HYPERVISOR_update_va_mapping(unsigned long va, u64 val,
458
 * `                              enum uvm_flags flags)
459
 * `
460
 * ` enum neg_errnoval
461
 * ` HYPERVISOR_update_va_mapping_otherdomain(unsigned long va, u64 val,
462
 * `                                          enum uvm_flags flags,
463
 * `                                          domid_t domid)
464
 * `
465
 * ` @va: The virtual address whose mapping we want to change
466
 * ` @val: The new page table entry, must contain a machine address
467
 * ` @flags: Control TLB flushes
468
 */
469
/* These are passed as 'flags' to update_va_mapping. They can be ORed. */
470
/* When specifying UVMF_MULTI, also OR in a pointer to a CPU bitmap.   */
471
/* UVMF_LOCAL is merely UVMF_MULTI with a NULL bitmap pointer.         */
472
/* ` enum uvm_flags { */
473
#define UVMF_NONE           (xen_mk_ulong(0)<<0) /* No flushing at all.   */
474
0
#define UVMF_TLB_FLUSH      (xen_mk_ulong(1)<<0) /* Flush entire TLB(s).  */
475
0
#define UVMF_INVLPG         (xen_mk_ulong(2)<<0) /* Flush only one entry. */
476
0
#define UVMF_FLUSHTYPE_MASK (xen_mk_ulong(3)<<0)
477
#define UVMF_MULTI          (xen_mk_ulong(0)<<2) /* Flush subset of TLBs. */
478
0
#define UVMF_LOCAL          (xen_mk_ulong(0)<<2) /* Flush local TLB.      */
479
0
#define UVMF_ALL            (xen_mk_ulong(1)<<2) /* Flush all TLBs.       */
480
/* ` } */
481
482
/*
483
 * Commands to HYPERVISOR_console_io().
484
 */
485
237k
#define CONSOLEIO_write         0
486
0
#define CONSOLEIO_read          1
487
488
/*
489
 * Commands to HYPERVISOR_vm_assist().
490
 */
491
0
#define VMASST_CMD_enable                0
492
0
#define VMASST_CMD_disable               1
493
494
/* x86/32 guests: simulate full 4GB segment limits. */
495
0
#define VMASST_TYPE_4gb_segments         0
496
497
/* x86/32 guests: trap (vector 15) whenever above vmassist is used. */
498
0
#define VMASST_TYPE_4gb_segments_notify  1
499
500
/*
501
 * x86 guests: support writes to bottom-level PTEs.
502
 * NB1. Page-directory entries cannot be written.
503
 * NB2. Guest must continue to remove all writable mappings of PTEs.
504
 */
505
0
#define VMASST_TYPE_writable_pagetables  2
506
507
/* x86/PAE guests: support PDPTs above 4GB. */
508
0
#define VMASST_TYPE_pae_extended_cr3     3
509
510
/*
511
 * x86 guests: Sane behaviour for virtual iopl
512
 *  - virtual iopl updated from do_iret() hypercalls.
513
 *  - virtual iopl reported in bounce frames.
514
 *  - guest kernels assumed to be level 0 for the purpose of iopl checks.
515
 */
516
0
#define VMASST_TYPE_architectural_iopl   4
517
518
/*
519
 * All guests: activate update indicator in vcpu_runstate_info
520
 * Enable setting the XEN_RUNSTATE_UPDATE flag in guest memory mapped
521
 * vcpu_runstate_info during updates of the runstate information.
522
 */
523
0
#define VMASST_TYPE_runstate_update_flag 5
524
525
/*
526
 * x86/64 guests: strictly hide M2P from user mode.
527
 * This allows the guest to control respective hypervisor behavior:
528
 * - when not set, L4 tables get created with the respective slot blank,
529
 *   and whenever the L4 table gets used as a kernel one the missing
530
 *   mapping gets inserted,
531
 * - when set, L4 tables get created with the respective slot initialized
532
 *   as before, and whenever the L4 table gets used as a user one the
533
 *   mapping gets zapped.
534
 */
535
0
#define VMASST_TYPE_m2p_strict           32
536
537
#if __XEN_INTERFACE_VERSION__ < 0x00040600
538
#define MAX_VMASST_TYPE                  3
539
#endif
540
541
/* Domain ids >= DOMID_FIRST_RESERVED cannot be used for ordinary domains. */
542
3
#define DOMID_FIRST_RESERVED xen_mk_uint(0x7FF0)
543
544
/* DOMID_SELF is used in certain contexts to refer to oneself. */
545
13
#define DOMID_SELF           xen_mk_uint(0x7FF0)
546
547
/*
548
 * DOMID_IO is used to restrict page-table updates to mapping I/O memory.
549
 * Although no Foreign Domain need be specified to map I/O pages, DOMID_IO
550
 * is useful to ensure that no mappings to the OS's own heap are accidentally
551
 * installed. (e.g., in Linux this could cause havoc as reference counts
552
 * aren't adjusted on the I/O-mapping code path).
553
 * This only makes sense as HYPERVISOR_mmu_update()'s and
554
 * HYPERVISOR_update_va_mapping_otherdomain()'s "foreigndom" argument. For
555
 * HYPERVISOR_mmu_update() context it can be specified by any calling domain,
556
 * otherwise it's only permitted if the caller is privileged.
557
 */
558
1
#define DOMID_IO             xen_mk_uint(0x7FF1)
559
560
/*
561
 * DOMID_XEN is used to allow privileged domains to map restricted parts of
562
 * Xen's heap space (e.g., the machine_to_phys table).
563
 * This only makes sense as
564
 * - HYPERVISOR_mmu_update()'s, HYPERVISOR_mmuext_op()'s, or
565
 *   HYPERVISOR_update_va_mapping_otherdomain()'s "foreigndom" argument,
566
 * - with XENMAPSPACE_gmfn_foreign,
567
 * and is only permitted if the caller is privileged.
568
 */
569
1
#define DOMID_XEN            xen_mk_uint(0x7FF2)
570
571
/*
572
 * DOMID_COW is used as the owner of sharable pages */
573
1
#define DOMID_COW            xen_mk_uint(0x7FF3)
574
575
/* DOMID_INVALID is used to identify pages with unknown owner. */
576
6
#define DOMID_INVALID        xen_mk_uint(0x7FF4)
577
578
/* Idle domain. */
579
15.0M
#define DOMID_IDLE           xen_mk_uint(0x7FFF)
580
581
#ifndef __ASSEMBLY__
582
583
typedef uint16_t domid_t;
584
585
/*
586
 * Send an array of these to HYPERVISOR_mmu_update().
587
 * NB. The fields are natural pointer/address size for this architecture.
588
 */
589
struct mmu_update {
590
    uint64_t ptr;       /* Machine address of PTE. */
591
    uint64_t val;       /* New contents of PTE.    */
592
};
593
typedef struct mmu_update mmu_update_t;
594
DEFINE_XEN_GUEST_HANDLE(mmu_update_t);
595
596
/*
597
 * ` enum neg_errnoval
598
 * ` HYPERVISOR_multicall(multicall_entry_t call_list[],
599
 * `                      uint32_t nr_calls);
600
 *
601
 * NB. The fields are logically the natural register size for this
602
 * architecture. In cases where xen_ulong_t is larger than this then
603
 * any unused bits in the upper portion must be zero.
604
 */
605
struct multicall_entry {
606
    xen_ulong_t op, result;
607
    xen_ulong_t args[6];
608
};
609
typedef struct multicall_entry multicall_entry_t;
610
DEFINE_XEN_GUEST_HANDLE(multicall_entry_t);
611
612
#if __XEN_INTERFACE_VERSION__ < 0x00040400
613
/*
614
 * Event channel endpoints per domain (when using the 2-level ABI):
615
 *  1024 if a long is 32 bits; 4096 if a long is 64 bits.
616
 */
617
#define NR_EVENT_CHANNELS EVTCHN_2L_NR_CHANNELS
618
#endif
619
620
struct vcpu_time_info {
621
    /*
622
     * Updates to the following values are preceded and followed by an
623
     * increment of 'version'. The guest can therefore detect updates by
624
     * looking for changes to 'version'. If the least-significant bit of
625
     * the version number is set then an update is in progress and the guest
626
     * must wait to read a consistent set of values.
627
     * The correct way to interact with the version number is similar to
628
     * Linux's seqlock: see the implementations of read_seqbegin/read_seqretry.
629
     */
630
    uint32_t version;
631
    uint32_t pad0;
632
    uint64_t tsc_timestamp;   /* TSC at last update of time vals.  */
633
    uint64_t system_time;     /* Time, in nanosecs, since boot.    */
634
    /*
635
     * Current system time:
636
     *   system_time +
637
     *   ((((tsc - tsc_timestamp) << tsc_shift) * tsc_to_system_mul) >> 32)
638
     * CPU frequency (Hz):
639
     *   ((10^9 << 32) / tsc_to_system_mul) >> tsc_shift
640
     */
641
    uint32_t tsc_to_system_mul;
642
    int8_t   tsc_shift;
643
#if __XEN_INTERFACE_VERSION__ > 0x040600
644
    uint8_t  flags;
645
    uint8_t  pad1[2];
646
#else
647
    int8_t   pad1[3];
648
#endif
649
}; /* 32 bytes */
650
typedef struct vcpu_time_info vcpu_time_info_t;
651
652
0
#define XEN_PVCLOCK_TSC_STABLE_BIT     (1 << 0)
653
#define XEN_PVCLOCK_GUEST_STOPPED      (1 << 1)
654
655
struct vcpu_info {
656
    /*
657
     * 'evtchn_upcall_pending' is written non-zero by Xen to indicate
658
     * a pending notification for a particular VCPU. It is then cleared 
659
     * by the guest OS /before/ checking for pending work, thus avoiding
660
     * a set-and-check race. Note that the mask is only accessed by Xen
661
     * on the CPU that is currently hosting the VCPU. This means that the
662
     * pending and mask flags can be updated by the guest without special
663
     * synchronisation (i.e., no need for the x86 LOCK prefix).
664
     * This may seem suboptimal because if the pending flag is set by
665
     * a different CPU then an IPI may be scheduled even when the mask
666
     * is set. However, note:
667
     *  1. The task of 'interrupt holdoff' is covered by the per-event-
668
     *     channel mask bits. A 'noisy' event that is continually being
669
     *     triggered can be masked at source at this very precise
670
     *     granularity.
671
     *  2. The main purpose of the per-VCPU mask is therefore to restrict
672
     *     reentrant execution: whether for concurrency control, or to
673
     *     prevent unbounded stack usage. Whatever the purpose, we expect
674
     *     that the mask will be asserted only for short periods at a time,
675
     *     and so the likelihood of a 'spurious' IPI is suitably small.
676
     * The mask is read before making an event upcall to the guest: a
677
     * non-zero mask therefore guarantees that the VCPU will not receive
678
     * an upcall activation. The mask is cleared when the VCPU requests
679
     * to block: this avoids wakeup-waiting races.
680
     */
681
    uint8_t evtchn_upcall_pending;
682
#ifdef XEN_HAVE_PV_UPCALL_MASK
683
    uint8_t evtchn_upcall_mask;
684
#else /* XEN_HAVE_PV_UPCALL_MASK */
685
    uint8_t pad0;
686
#endif /* XEN_HAVE_PV_UPCALL_MASK */
687
    xen_ulong_t evtchn_pending_sel;
688
    struct arch_vcpu_info arch;
689
    struct vcpu_time_info time;
690
}; /* 64 bytes (x86) */
691
#ifndef __XEN__
692
typedef struct vcpu_info vcpu_info_t;
693
#endif
694
695
/*
696
 * `incontents 200 startofday_shared Start-of-day shared data structure
697
 * Xen/kernel shared data -- pointer provided in start_info.
698
 *
699
 * This structure is defined to be both smaller than a page, and the
700
 * only data on the shared page, but may vary in actual size even within
701
 * compatible Xen versions; guests should not rely on the size
702
 * of this structure remaining constant.
703
 */
704
struct shared_info {
705
    struct vcpu_info vcpu_info[XEN_LEGACY_MAX_VCPUS];
706
707
    /*
708
     * A domain can create "event channels" on which it can send and receive
709
     * asynchronous event notifications. There are three classes of event that
710
     * are delivered by this mechanism:
711
     *  1. Bi-directional inter- and intra-domain connections. Domains must
712
     *     arrange out-of-band to set up a connection (usually by allocating
713
     *     an unbound 'listener' port and avertising that via a storage service
714
     *     such as xenstore).
715
     *  2. Physical interrupts. A domain with suitable hardware-access
716
     *     privileges can bind an event-channel port to a physical interrupt
717
     *     source.
718
     *  3. Virtual interrupts ('events'). A domain can bind an event-channel
719
     *     port to a virtual interrupt source, such as the virtual-timer
720
     *     device or the emergency console.
721
     * 
722
     * Event channels are addressed by a "port index". Each channel is
723
     * associated with two bits of information:
724
     *  1. PENDING -- notifies the domain that there is a pending notification
725
     *     to be processed. This bit is cleared by the guest.
726
     *  2. MASK -- if this bit is clear then a 0->1 transition of PENDING
727
     *     will cause an asynchronous upcall to be scheduled. This bit is only
728
     *     updated by the guest. It is read-only within Xen. If a channel
729
     *     becomes pending while the channel is masked then the 'edge' is lost
730
     *     (i.e., when the channel is unmasked, the guest must manually handle
731
     *     pending notifications as no upcall will be scheduled by Xen).
732
     * 
733
     * To expedite scanning of pending notifications, any 0->1 pending
734
     * transition on an unmasked channel causes a corresponding bit in a
735
     * per-vcpu selector word to be set. Each bit in the selector covers a
736
     * 'C long' in the PENDING bitfield array.
737
     */
738
    xen_ulong_t evtchn_pending[sizeof(xen_ulong_t) * 8];
739
    xen_ulong_t evtchn_mask[sizeof(xen_ulong_t) * 8];
740
741
    /*
742
     * Wallclock time: updated only by control software. Guests should base
743
     * their gettimeofday() syscall on this wallclock-base value.
744
     */
745
    uint32_t wc_version;      /* Version counter: see vcpu_time_info_t. */
746
    uint32_t wc_sec;          /* Secs  00:00:00 UTC, Jan 1, 1970.  */
747
    uint32_t wc_nsec;         /* Nsecs 00:00:00 UTC, Jan 1, 1970.  */
748
#if !defined(__i386__)
749
    uint32_t wc_sec_hi;
750
# define xen_wc_sec_hi wc_sec_hi
751
#elif !defined(__XEN__) && !defined(__XEN_TOOLS__)
752
# define xen_wc_sec_hi arch.wc_sec_hi
753
#endif
754
755
    struct arch_shared_info arch;
756
757
};
758
#ifndef __XEN__
759
typedef struct shared_info shared_info_t;
760
#endif
761
762
/*
763
 * `incontents 200 startofday Start-of-day memory layout
764
 *
765
 *  1. The domain is started within contiguous virtual-memory region.
766
 *  2. The contiguous region ends on an aligned 4MB boundary.
767
 *  3. This the order of bootstrap elements in the initial virtual region:
768
 *      a. relocated kernel image
769
 *      b. initial ram disk              [mod_start, mod_len]
770
 *         (may be omitted)
771
 *      c. list of allocated page frames [mfn_list, nr_pages]
772
 *         (unless relocated due to XEN_ELFNOTE_INIT_P2M)
773
 *      d. start_info_t structure        [register rSI (x86)]
774
 *         in case of dom0 this page contains the console info, too
775
 *      e. unless dom0: xenstore ring page
776
 *      f. unless dom0: console ring page
777
 *      g. bootstrap page tables         [pt_base and CR3 (x86)]
778
 *      h. bootstrap stack               [register ESP (x86)]
779
 *  4. Bootstrap elements are packed together, but each is 4kB-aligned.
780
 *  5. The list of page frames forms a contiguous 'pseudo-physical' memory
781
 *     layout for the domain. In particular, the bootstrap virtual-memory
782
 *     region is a 1:1 mapping to the first section of the pseudo-physical map.
783
 *  6. All bootstrap elements are mapped read-writable for the guest OS. The
784
 *     only exception is the bootstrap page table, which is mapped read-only.
785
 *  7. There is guaranteed to be at least 512kB padding after the final
786
 *     bootstrap element. If necessary, the bootstrap virtual region is
787
 *     extended by an extra 4MB to ensure this.
788
 *
789
 * Note: Prior to 25833:bb85bbccb1c9. ("x86/32-on-64 adjust Dom0 initial page
790
 * table layout") a bug caused the pt_base (3.g above) and cr3 to not point
791
 * to the start of the guest page tables (it was offset by two pages).
792
 * This only manifested itself on 32-on-64 dom0 kernels and not 32-on-64 domU
793
 * or 64-bit kernels of any colour. The page tables for a 32-on-64 dom0 got
794
 * allocated in the order: 'first L1','first L2', 'first L3', so the offset
795
 * to the page table base is by two pages back. The initial domain if it is
796
 * 32-bit and runs under a 64-bit hypervisor should _NOT_ use two of the
797
 * pages preceding pt_base and mark them as reserved/unused.
798
 */
799
#ifdef XEN_HAVE_PV_GUEST_ENTRY
800
struct start_info {
801
    /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME.    */
802
    char magic[32];             /* "xen-<version>-<platform>".            */
803
    unsigned long nr_pages;     /* Total pages allocated to this domain.  */
804
    unsigned long shared_info;  /* MACHINE address of shared info struct. */
805
    uint32_t flags;             /* SIF_xxx flags.                         */
806
    xen_pfn_t store_mfn;        /* MACHINE page number of shared page.    */
807
    uint32_t store_evtchn;      /* Event channel for store communication. */
808
    union {
809
        struct {
810
            xen_pfn_t mfn;      /* MACHINE page number of console page.   */
811
            uint32_t  evtchn;   /* Event channel for console page.        */
812
        } domU;
813
        struct {
814
            uint32_t info_off;  /* Offset of console_info struct.         */
815
            uint32_t info_size; /* Size of console_info struct from start.*/
816
        } dom0;
817
    } console;
818
    /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME).     */
819
    unsigned long pt_base;      /* VIRTUAL address of page directory.     */
820
    unsigned long nr_pt_frames; /* Number of bootstrap p.t. frames.       */
821
    unsigned long mfn_list;     /* VIRTUAL address of page-frame list.    */
822
    unsigned long mod_start;    /* VIRTUAL address of pre-loaded module   */
823
                                /* (PFN of pre-loaded module if           */
824
                                /*  SIF_MOD_START_PFN set in flags).      */
825
    unsigned long mod_len;      /* Size (bytes) of pre-loaded module.     */
826
#define MAX_GUEST_CMDLINE 1024
827
    int8_t cmd_line[MAX_GUEST_CMDLINE];
828
    /* The pfn range here covers both page table and p->m table frames.   */
829
    unsigned long first_p2m_pfn;/* 1st pfn forming initial P->M table.    */
830
    unsigned long nr_p2m_frames;/* # of pfns forming initial P->M table.  */
831
};
832
typedef struct start_info start_info_t;
833
834
/* New console union for dom0 introduced in 0x00030203. */
835
#if __XEN_INTERFACE_VERSION__ < 0x00030203
836
#define console_mfn    console.domU.mfn
837
#define console_evtchn console.domU.evtchn
838
#endif
839
#endif /* XEN_HAVE_PV_GUEST_ENTRY */
840
841
/* These flags are passed in the 'flags' field of start_info_t. */
842
#define SIF_PRIVILEGED    (1<<0)  /* Is the domain privileged? */
843
#define SIF_INITDOMAIN    (1<<1)  /* Is this the initial control domain? */
844
#define SIF_MULTIBOOT_MOD (1<<2)  /* Is mod_start a multiboot module? */
845
#define SIF_MOD_START_PFN (1<<3)  /* Is mod_start a PFN? */
846
#define SIF_VIRT_P2M_4TOOLS (1<<4) /* Do Xen tools understand a virt. mapped */
847
                                   /* P->M making the 3 level tree obsolete? */
848
#define SIF_PM_MASK       (0xFF<<8) /* reserve 1 byte for xen-pm options */
849
850
/*
851
 * A multiboot module is a package containing modules very similar to a
852
 * multiboot module array. The only differences are:
853
 * - the array of module descriptors is by convention simply at the beginning
854
 *   of the multiboot module,
855
 * - addresses in the module descriptors are based on the beginning of the
856
 *   multiboot module,
857
 * - the number of modules is determined by a termination descriptor that has
858
 *   mod_start == 0.
859
 *
860
 * This permits to both build it statically and reference it in a configuration
861
 * file, and let the PV guest easily rebase the addresses to virtual addresses
862
 * and at the same time count the number of modules.
863
 */
864
struct xen_multiboot_mod_list
865
{
866
    /* Address of first byte of the module */
867
    uint32_t mod_start;
868
    /* Address of last byte of the module (inclusive) */
869
    uint32_t mod_end;
870
    /* Address of zero-terminated command line */
871
    uint32_t cmdline;
872
    /* Unused, must be zero */
873
    uint32_t pad;
874
};
875
/*
876
 * `incontents 200 startofday_dom0_console Dom0_console
877
 *
878
 * The console structure in start_info.console.dom0
879
 *
880
 * This structure includes a variety of information required to
881
 * have a working VGA/VESA console.
882
 */
883
typedef struct dom0_vga_console_info {
884
    uint8_t video_type; /* DOM0_VGA_CONSOLE_??? */
885
4
#define XEN_VGATYPE_TEXT_MODE_3 0x03
886
0
#define XEN_VGATYPE_VESA_LFB    0x23
887
0
#define XEN_VGATYPE_EFI_LFB     0x70
888
889
    union {
890
        struct {
891
            /* Font height, in pixels. */
892
            uint16_t font_height;
893
            /* Cursor location (column, row). */
894
            uint16_t cursor_x, cursor_y;
895
            /* Number of rows and columns (dimensions in characters). */
896
            uint16_t rows, columns;
897
        } text_mode_3;
898
899
        struct {
900
            /* Width and height, in pixels. */
901
            uint16_t width, height;
902
            /* Bytes per scan line. */
903
            uint16_t bytes_per_line;
904
            /* Bits per pixel. */
905
            uint16_t bits_per_pixel;
906
            /* LFB physical address, and size (in units of 64kB). */
907
            uint32_t lfb_base;
908
            uint32_t lfb_size;
909
            /* RGB mask offsets and sizes, as defined by VBE 1.2+ */
910
            uint8_t  red_pos, red_size;
911
            uint8_t  green_pos, green_size;
912
            uint8_t  blue_pos, blue_size;
913
            uint8_t  rsvd_pos, rsvd_size;
914
#if __XEN_INTERFACE_VERSION__ >= 0x00030206
915
            /* VESA capabilities (offset 0xa, VESA command 0x4f00). */
916
            uint32_t gbl_caps;
917
            /* Mode attributes (offset 0x0, VESA command 0x4f01). */
918
            uint16_t mode_attrs;
919
#endif
920
        } vesa_lfb;
921
    } u;
922
} dom0_vga_console_info_t;
923
#define xen_vga_console_info dom0_vga_console_info
924
#define xen_vga_console_info_t dom0_vga_console_info_t
925
926
typedef uint8_t xen_domain_handle_t[16];
927
928
__DEFINE_XEN_GUEST_HANDLE(uint8,  uint8_t);
929
__DEFINE_XEN_GUEST_HANDLE(uint16, uint16_t);
930
__DEFINE_XEN_GUEST_HANDLE(uint32, uint32_t);
931
__DEFINE_XEN_GUEST_HANDLE(uint64, uint64_t);
932
933
typedef struct {
934
    uint8_t a[16];
935
} xen_uuid_t;
936
937
/*
938
 * XEN_DEFINE_UUID(0x00112233, 0x4455, 0x6677, 0x8899,
939
 *                 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff)
940
 * will construct UUID 00112233-4455-6677-8899-aabbccddeeff presented as
941
 * {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
942
 * 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
943
 *
944
 * NB: This is compatible with Linux kernel and with libuuid, but it is not
945
 * compatible with Microsoft, as they use mixed-endian encoding (some
946
 * components are little-endian, some are big-endian).
947
 */
948
#define XEN_DEFINE_UUID_(a, b, c, d, e1, e2, e3, e4, e5, e6)            \
949
    {{((a) >> 24) & 0xFF, ((a) >> 16) & 0xFF,                           \
950
      ((a) >>  8) & 0xFF, ((a) >>  0) & 0xFF,                           \
951
      ((b) >>  8) & 0xFF, ((b) >>  0) & 0xFF,                           \
952
      ((c) >>  8) & 0xFF, ((c) >>  0) & 0xFF,                           \
953
      ((d) >>  8) & 0xFF, ((d) >>  0) & 0xFF,                           \
954
                e1, e2, e3, e4, e5, e6}}
955
956
#if defined(__STDC_VERSION__) ? __STDC_VERSION__ >= 199901L : defined(__GNUC__)
957
#define XEN_DEFINE_UUID(a, b, c, d, e1, e2, e3, e4, e5, e6)             \
958
    ((xen_uuid_t)XEN_DEFINE_UUID_(a, b, c, d, e1, e2, e3, e4, e5, e6))
959
#else
960
#define XEN_DEFINE_UUID(a, b, c, d, e1, e2, e3, e4, e5, e6)             \
961
    XEN_DEFINE_UUID_(a, b, c, d, e1, e2, e3, e4, e5, e6)
962
#endif /* __STDC_VERSION__ / __GNUC__ */
963
964
#endif /* !__ASSEMBLY__ */
965
966
/* Default definitions for macros used by domctl/sysctl. */
967
#if defined(__XEN__) || defined(__XEN_TOOLS__)
968
969
#ifndef int64_aligned_t
970
#define int64_aligned_t int64_t
971
#endif
972
#ifndef uint64_aligned_t
973
#define uint64_aligned_t uint64_t
974
#endif
975
#ifndef XEN_GUEST_HANDLE_64
976
0
#define XEN_GUEST_HANDLE_64(name) XEN_GUEST_HANDLE(name)
977
#endif
978
979
#ifndef __ASSEMBLY__
980
struct xenctl_bitmap {
981
    XEN_GUEST_HANDLE_64(uint8) bitmap;
982
    uint32_t nr_bits;
983
};
984
#endif
985
986
#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
987
988
#endif /* __XEN_PUBLIC_XEN_H__ */
989
990
/*
991
 * Local variables:
992
 * mode: C
993
 * c-file-style: "BSD"
994
 * c-basic-offset: 4
995
 * tab-width: 4
996
 * indent-tabs-mode: nil
997
 * End:
998
 */