2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * Copyright (C) IBM Corp. 2005, 2006
18 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
21 #ifndef __XEN_PUBLIC_ARCH_PPC_64_H__
22 #define __XEN_PUBLIC_ARCH_PPC_64_H__
24 #if !(defined(__XEN__) || defined(__XEN_TOOLS__))
25 /* not sure how this is supposed to get asserted */
26 #define __XEN_INTERFACE_VERSION__ 0x00030202
29 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \
31 int __pad[(sizeof (long long) - sizeof (void *)) / sizeof (int)]; \
33 } __attribute__((__aligned__(8))) __guest_handle_ ## name
35 #define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
36 #define XEN_GUEST_HANDLE(name) __guest_handle_ ## name
37 #define set_xen_guest_handle(hnd, val) \
39 if (sizeof ((hnd).__pad)) \
45 #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
49 /* Guest handles for primitive C types. */
50 __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char);
51 __DEFINE_XEN_GUEST_HANDLE(uint, unsigned int);
52 __DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long);
53 DEFINE_XEN_GUEST_HANDLE(char);
54 DEFINE_XEN_GUEST_HANDLE(int);
55 DEFINE_XEN_GUEST_HANDLE(long);
56 DEFINE_XEN_GUEST_HANDLE(void);
58 typedef unsigned long long xen_pfn_t;
59 DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
63 * Pointers and other address fields inside interface structures are padded to
64 * 64 bits. This means that field alignments aren't different between 32- and
65 * 64-bit architectures.
67 /* NB. Multi-level macro ensures __LINE__ is expanded before concatenation. */
68 #define __MEMORY_PADDING(_X)
69 #define _MEMORY_PADDING(_X) __MEMORY_PADDING(_X)
70 #define MEMORY_PADDING _MEMORY_PADDING(__LINE__)
72 /* And the trap vector is... */
73 #define TRAP_INSTR "li 0,-1; sc" /* XXX just "sc"? */
77 typedef uint64_t xen_ulong_t;
79 /* User-accessible registers: need to be saved/restored for every nested Xen
94 uint32_t entry_vector;
96 typedef struct cpu_user_regs cpu_user_regs_t;
98 typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */ /* XXX timebase */
100 /* ONLY used to communicate with dom0! See also struct exec_domain. */
101 struct vcpu_guest_context {
102 cpu_user_regs_t user_regs; /* User-level CPU registers */
103 uint64_t sdr1; /* Pagetable base */
106 typedef struct vcpu_guest_context vcpu_guest_context_t;
107 DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
109 struct arch_shared_info {
113 struct arch_vcpu_info {
116 /* Support for multi-processor guests. */
117 #define MAX_VIRT_CPUS 32