This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / xen / interface / arch-powerpc.h
1 /*
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.
6  *
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.
11  *
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.
15  *
16  * Copyright (C) IBM Corp. 2005, 2006
17  *
18  * Authors: Hollis Blanchard <hollisb@us.ibm.com>
19  */
20
21 #ifndef __XEN_PUBLIC_ARCH_PPC_64_H__
22 #define __XEN_PUBLIC_ARCH_PPC_64_H__
23
24 #if !(defined(__XEN__) || defined(__XEN_TOOLS__))
25 /* not sure how this is supposed to get asserted */
26 #define __XEN_INTERFACE_VERSION__ 0x00030202
27 #endif
28
29 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \
30     typedef struct { \
31         int __pad[(sizeof (long long) - sizeof (void *)) / sizeof (int)]; \
32         type *p; \
33     } __attribute__((__aligned__(8))) __guest_handle_ ## name
34
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) \
38     do { \
39         if (sizeof ((hnd).__pad)) \
40             (hnd).__pad[0] = 0; \
41         (hnd).p = val; \
42     } while (0)
43
44 #ifdef __XEN_TOOLS__
45 #define get_xen_guest_handle(val, hnd)  do { val = (hnd).p; } while (0)
46 #endif
47
48 #ifndef __ASSEMBLY__
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);
57
58 typedef unsigned long long xen_pfn_t;
59 DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
60 #endif
61
62 /*
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. 
66  */
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__)
71
72 /* And the trap vector is... */
73 #define TRAP_INSTR "li 0,-1; sc" /* XXX just "sc"? */
74
75 #ifndef __ASSEMBLY__
76
77 typedef uint64_t xen_ulong_t;
78
79 /* User-accessible registers: need to be saved/restored for every nested Xen
80  * invocation. */
81 struct cpu_user_regs
82 {
83     uint64_t gprs[32];
84     uint64_t lr;
85     uint64_t ctr;
86     uint64_t srr0;
87     uint64_t srr1;
88     uint64_t pc;
89     uint64_t msr;
90     uint64_t fpscr;
91     uint64_t xer;
92     uint64_t hid4;
93     uint32_t cr;
94     uint32_t entry_vector;
95 };
96 typedef struct cpu_user_regs cpu_user_regs_t;
97
98 typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */ /* XXX timebase */
99
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               */
104     /* XXX etc */
105 };
106 typedef struct vcpu_guest_context vcpu_guest_context_t;
107 DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
108
109 struct arch_shared_info {
110     uint64_t pad[32];
111 };
112
113 struct arch_vcpu_info {
114 };
115
116 /* Support for multi-processor guests. */
117 #define MAX_VIRT_CPUS 32
118 #endif
119
120 #endif