debuggers.hg

view xen/include/asm-x86/hap.h @ 22855:1d1eec7e1fb4

xl: Perform minimal validation of virtual disk file while parsing config file

This patch performs some very basic validation on the virtual disk
file passed through the config file. This validation ensures that we
don't go too far with the initialization like spawn qemu and more
while there could be some potentially fundamental issues.

[ Patch fixed up to work with PHYSTYPE_EMPTY 22808:6ec61438713a -iwj ]

Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Kamala Narasimhan <kamala.narasimhan@gmail.com>
date Tue Jan 25 18:09:49 2011 +0000 (2011-01-25)
parents 5a224e101cb3
children
line source
1 /******************************************************************************
2 * include/asm-x86/hap.h
3 *
4 * hardware-assisted paging
5 * Copyright (c) 2007 Advanced Micro Devices (Wei Huang)
6 *
7 * Parts of this code are Copyright (c) 2006 by XenSource Inc.
8 * Parts of this code are Copyright (c) 2006 by Michael A Fetterman
9 * Parts based on earlier work by Michael A Fetterman, Ian Pratt et al.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
26 #ifndef _XEN_HAP_H
27 #define _XEN_HAP_H
29 #define HAP_PRINTK(_f, _a...) \
30 debugtrace_printk("hap: %s(): " _f, __func__, ##_a)
31 #define HAP_ERROR(_f, _a...) \
32 printk("hap error: %s(): " _f, __func__, ##_a)
34 /************************************************/
35 /* hap domain page mapping */
36 /************************************************/
37 static inline void *
38 hap_map_domain_page(mfn_t mfn)
39 {
40 return map_domain_page(mfn_x(mfn));
41 }
43 static inline void
44 hap_unmap_domain_page(void *p)
45 {
46 unmap_domain_page(p);
47 }
49 /************************************************/
50 /* locking for hap code */
51 /************************************************/
52 #define hap_lock_init(_d) \
53 do { \
54 spin_lock_init(&(_d)->arch.paging.hap.lock); \
55 (_d)->arch.paging.hap.locker = -1; \
56 (_d)->arch.paging.hap.locker_function = "nobody"; \
57 } while (0)
59 #define hap_locked_by_me(_d) \
60 (current->processor == (_d)->arch.paging.hap.locker)
62 #define hap_lock(_d) \
63 do { \
64 if ( unlikely((_d)->arch.paging.hap.locker == current->processor) )\
65 { \
66 printk("Error: hap lock held by %s\n", \
67 (_d)->arch.paging.hap.locker_function); \
68 BUG(); \
69 } \
70 spin_lock(&(_d)->arch.paging.hap.lock); \
71 ASSERT((_d)->arch.paging.hap.locker == -1); \
72 (_d)->arch.paging.hap.locker = current->processor; \
73 (_d)->arch.paging.hap.locker_function = __func__; \
74 } while (0)
76 #define hap_unlock(_d) \
77 do { \
78 ASSERT((_d)->arch.paging.hap.locker == current->processor); \
79 (_d)->arch.paging.hap.locker = -1; \
80 (_d)->arch.paging.hap.locker_function = "nobody"; \
81 spin_unlock(&(_d)->arch.paging.hap.lock); \
82 } while (0)
84 /************************************************/
85 /* hap domain level functions */
86 /************************************************/
87 void hap_domain_init(struct domain *d);
88 int hap_domctl(struct domain *d, xen_domctl_shadow_op_t *sc,
89 XEN_GUEST_HANDLE(void) u_domctl);
90 int hap_enable(struct domain *d, u32 mode);
91 void hap_final_teardown(struct domain *d);
92 void hap_teardown(struct domain *d);
93 void hap_vcpu_init(struct vcpu *v);
94 void hap_logdirty_init(struct domain *d);
95 int hap_track_dirty_vram(struct domain *d,
96 unsigned long begin_pfn,
97 unsigned long nr,
98 XEN_GUEST_HANDLE_64(uint8) dirty_bitmap);
100 #endif /* XEN_HAP_H */
102 /*
103 * Local variables:
104 * mode: C
105 * c-set-style: "BSD"
106 * c-basic-offset: 4
107 * indent-tabs-mode: nil
108 * End:
109 */