ia64/xen-unstable

view tools/libxc/xg_private.h @ 9488:0a6f5527ca4b

[IA64] set itv handoff as masked and enable reading irr[0-3]

Set initial vcpu itv handoff state to mask the timer vector.
This seems to match hardware and makes logical sense from a
spurious interrupt perspective. Enable vcpu_get_irr[0-3]
functions as they seem to work and have the proper backing.
This enables the check_sal_cache_flush() in arch/ia64/kernel.sal.c
to work unmodified, allowing us to remove the Xen changes from
the file (and thus the file from the sparse tree).

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author awilliam@xenbuild.aw
date Tue Apr 04 09:39:45 2006 -0600 (2006-04-04)
parents a1fcee3b2abe
children 74ee53209cca
line source
1 #ifndef XG_PRIVATE_H
2 #define XG_PRIVATE_H
4 #include <unistd.h>
5 #include <errno.h>
6 #include <fcntl.h>
7 #include <stdio.h>
8 #include <string.h>
9 #include <sys/mman.h>
10 #include <sys/types.h>
11 #include <sys/stat.h>
13 #include "xenctrl.h"
14 #include "xenguest.h"
16 #include <xen/linux/privcmd.h>
17 #include <xen/memory.h>
19 /* valgrind cannot see when a hypercall has filled in some values. For this
20 reason, we must zero the dom0_op_t instance before a call, if using
21 valgrind. */
22 #ifdef VALGRIND
23 #define DECLARE_DOM0_OP dom0_op_t op = { 0 }
24 #else
25 #define DECLARE_DOM0_OP dom0_op_t op
26 #endif
29 char *xc_read_image(const char *filename, unsigned long *size);
30 char *xc_inflate_buffer(const char *in_buf,
31 unsigned long in_size,
32 unsigned long *out_size);
34 unsigned long csum_page (void * page);
36 #define _PAGE_PRESENT 0x001
37 #define _PAGE_RW 0x002
38 #define _PAGE_USER 0x004
39 #define _PAGE_PWT 0x008
40 #define _PAGE_PCD 0x010
41 #define _PAGE_ACCESSED 0x020
42 #define _PAGE_DIRTY 0x040
43 #define _PAGE_PAT 0x080
44 #define _PAGE_PSE 0x080
45 #define _PAGE_GLOBAL 0x100
47 #define L1_PAGETABLE_SHIFT_PAE 12
48 #define L2_PAGETABLE_SHIFT_PAE 21
49 #define L3_PAGETABLE_SHIFT_PAE 30
51 #if defined(__i386__)
52 #define L1_PAGETABLE_SHIFT 12
53 #define L2_PAGETABLE_SHIFT 22
54 #elif defined(__x86_64__)
55 #define L1_PAGETABLE_SHIFT 12
56 #define L2_PAGETABLE_SHIFT 21
57 #define L3_PAGETABLE_SHIFT 30
58 #define L4_PAGETABLE_SHIFT 39
59 #endif
61 #define L1_PAGETABLE_ENTRIES_PAE 512
62 #define L2_PAGETABLE_ENTRIES_PAE 512
63 #define L3_PAGETABLE_ENTRIES_PAE 4
65 #if defined(__i386__)
66 #define L1_PAGETABLE_ENTRIES 1024
67 #define L2_PAGETABLE_ENTRIES 1024
68 #elif defined(__x86_64__)
69 #define L1_PAGETABLE_ENTRIES 512
70 #define L2_PAGETABLE_ENTRIES 512
71 #define L3_PAGETABLE_ENTRIES 512
72 #define L4_PAGETABLE_ENTRIES 512
73 #endif
75 #define PAGE_SHIFT XC_PAGE_SHIFT
76 #define PAGE_SIZE (1UL << PAGE_SHIFT)
77 #define PAGE_MASK (~(PAGE_SIZE-1))
79 typedef uint32_t l1_pgentry_32_t;
80 typedef uint32_t l2_pgentry_32_t;
81 typedef uint64_t l1_pgentry_64_t;
82 typedef uint64_t l2_pgentry_64_t;
83 typedef uint64_t l3_pgentry_64_t;
84 typedef unsigned long l1_pgentry_t;
85 typedef unsigned long l2_pgentry_t;
86 #if defined(__x86_64__)
87 typedef unsigned long l3_pgentry_t;
88 typedef unsigned long l4_pgentry_t;
89 #endif
91 #define l1_table_offset_pae(_a) \
92 (((_a) >> L1_PAGETABLE_SHIFT_PAE) & (L1_PAGETABLE_ENTRIES_PAE - 1))
93 #define l2_table_offset_pae(_a) \
94 (((_a) >> L2_PAGETABLE_SHIFT_PAE) & (L2_PAGETABLE_ENTRIES_PAE - 1))
95 #define l3_table_offset_pae(_a) \
96 (((_a) >> L3_PAGETABLE_SHIFT_PAE) & (L3_PAGETABLE_ENTRIES_PAE - 1))
98 #if defined(__i386__)
99 #define l1_table_offset(_a) \
100 (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))
101 #define l2_table_offset(_a) \
102 ((_a) >> L2_PAGETABLE_SHIFT)
103 #elif defined(__x86_64__)
104 #define l1_table_offset(_a) \
105 (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))
106 #define l2_table_offset(_a) \
107 (((_a) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1))
108 #define l3_table_offset(_a) \
109 (((_a) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1))
110 #define l4_table_offset(_a) \
111 (((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1))
112 #endif
114 #define ERROR(_m, _a...) \
115 do { \
116 int __saved_errno = errno; \
117 fprintf(stderr, "ERROR: " _m "\n" , ## _a ); \
118 errno = __saved_errno; \
119 } while (0)
122 #define PERROR(_m, _a...) \
123 do { \
124 int __saved_errno = errno; \
125 fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ## _a , \
126 __saved_errno, strerror(__saved_errno)); \
127 errno = __saved_errno; \
128 } while (0)
131 struct domain_setup_info
132 {
133 unsigned long v_start;
134 unsigned long v_end;
135 unsigned long v_kernstart;
136 unsigned long v_kernend;
137 unsigned long v_kernentry;
139 unsigned int load_symtab;
140 unsigned int pae_kernel;
141 unsigned long symtab_addr;
142 unsigned long symtab_len;
144 /* __xen_guest info string for convenient loader parsing. */
145 char *xen_guest_string;
146 };
148 typedef int (*parseimagefunc)(const char *image, unsigned long image_size,
149 struct domain_setup_info *dsi);
150 typedef int (*loadimagefunc)(const char *image, unsigned long image_size,
151 int xch,
152 uint32_t dom, unsigned long *parray,
153 struct domain_setup_info *dsi);
155 struct load_funcs
156 {
157 parseimagefunc parseimage;
158 loadimagefunc loadimage;
159 };
161 #define mfn_mapper_queue_size 128
163 typedef struct mfn_mapper {
164 int xc_handle;
165 int size;
166 int prot;
167 int error;
168 int max_queue_size;
169 void * addr;
170 privcmd_mmap_t ioctl;
172 } mfn_mapper_t;
174 int xc_copy_to_domain_page(int xc_handle, uint32_t domid,
175 unsigned long dst_pfn, const char *src_page);
177 unsigned long xc_get_filesz(int fd);
179 void xc_map_memcpy(unsigned long dst, const char *src, unsigned long size,
180 int xch, uint32_t dom, unsigned long *parray,
181 unsigned long vstart);
183 int pin_table(int xc_handle, unsigned int type, unsigned long mfn,
184 domid_t dom);
186 /* image loading */
187 int probe_elf(const char *image, unsigned long image_size,
188 struct load_funcs *funcs);
189 int probe_bin(const char *image, unsigned long image_size,
190 struct load_funcs *funcs);
191 int probe_aout9(const char *image, unsigned long image_size,
192 struct load_funcs *funcs);
194 #endif