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 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \
26 int __pad[(sizeof (long long) - sizeof (void *)) / sizeof (int)]; \
28 } __attribute__((__aligned__(8))) __guest_handle_ ## name
30 #define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
31 #define XEN_GUEST_HANDLE(name) __guest_handle_ ## name
32 #define set_xen_guest_handle(hnd, val) \
34 if (sizeof ((hnd).__pad)) \
40 #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
44 /* Guest handles for primitive C types. */
45 __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char);
46 __DEFINE_XEN_GUEST_HANDLE(uint, unsigned int);
47 __DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long);
48 DEFINE_XEN_GUEST_HANDLE(char);
49 DEFINE_XEN_GUEST_HANDLE(int);
50 DEFINE_XEN_GUEST_HANDLE(long);
51 DEFINE_XEN_GUEST_HANDLE(void);
53 typedef unsigned long long xen_pfn_t;
54 DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
58 * Pointers and other address fields inside interface structures are padded to
59 * 64 bits. This means that field alignments aren't different between 32- and
60 * 64-bit architectures.
62 /* NB. Multi-level macro ensures __LINE__ is expanded before concatenation. */
63 #define __MEMORY_PADDING(_X)
64 #define _MEMORY_PADDING(_X) __MEMORY_PADDING(_X)
65 #define MEMORY_PADDING _MEMORY_PADDING(__LINE__)
67 /* And the trap vector is... */
68 #define TRAP_INSTR "li 0,-1; sc" /* XXX just "sc"? */
72 typedef uint64_t xen_ulong_t;
74 /* User-accessible registers: need to be saved/restored for every nested Xen
89 uint32_t entry_vector;
91 typedef struct cpu_user_regs cpu_user_regs_t;
93 typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */ /* XXX timebase */
95 /* ONLY used to communicate with dom0! See also struct exec_domain. */
96 struct vcpu_guest_context {
97 cpu_user_regs_t user_regs; /* User-level CPU registers */
98 uint64_t sdr1; /* Pagetable base */
101 typedef struct vcpu_guest_context vcpu_guest_context_t;
102 DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
104 struct arch_shared_info {
108 struct arch_vcpu_info {
111 /* Support for multi-processor guests. */
112 #define MAX_VIRT_CPUS 32