debuggers.hg

view xen/include/asm-x86/hap.h @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children 62cf917432fa
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);
95 extern struct paging_mode hap_paging_real_mode;
96 extern struct paging_mode hap_paging_protected_mode;
97 extern struct paging_mode hap_paging_pae_mode;
98 extern struct paging_mode hap_paging_long_mode;
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 */