| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: xen.h,v 1.1.1.2 2011/12/07 14:41:17 cegger Exp $ */ | | 1 | /* $NetBSD: xen.h,v 1.2 2011/12/09 10:14:20 cegger Exp $ */ |
2 | /****************************************************************************** | | 2 | /****************************************************************************** |
3 | * arch-x86/xen.h | | 3 | * arch-x86/xen.h |
4 | * | | 4 | * |
5 | * Guest OS interface to x86 Xen. | | 5 | * Guest OS interface to x86 Xen. |
6 | * | | 6 | * |
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy | | 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
8 | * of this software and associated documentation files (the "Software"), to | | 8 | * of this software and associated documentation files (the "Software"), to |
9 | * deal in the Software without restriction, including without limitation the | | 9 | * deal in the Software without restriction, including without limitation the |
10 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | | 10 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
11 | * sell copies of the Software, and to permit persons to whom the Software is | | 11 | * sell copies of the Software, and to permit persons to whom the Software is |
12 | * furnished to do so, subject to the following conditions: | | 12 | * furnished to do so, subject to the following conditions: |
13 | * | | 13 | * |
14 | * The above copyright notice and this permission notice shall be included in | | 14 | * The above copyright notice and this permission notice shall be included in |
| @@ -36,30 +36,34 @@ | | | @@ -36,30 +36,34 @@ |
36 | typedef struct { type *p; } __guest_handle_ ## name | | 36 | typedef struct { type *p; } __guest_handle_ ## name |
37 | #else | | 37 | #else |
38 | #define ___DEFINE_XEN_GUEST_HANDLE(name, type) \ | | 38 | #define ___DEFINE_XEN_GUEST_HANDLE(name, type) \ |
39 | typedef type * __guest_handle_ ## name | | 39 | typedef type * __guest_handle_ ## name |
40 | #endif | | 40 | #endif |
41 | | | 41 | |
42 | #define __DEFINE_XEN_GUEST_HANDLE(name, type) \ | | 42 | #define __DEFINE_XEN_GUEST_HANDLE(name, type) \ |
43 | ___DEFINE_XEN_GUEST_HANDLE(name, type); \ | | 43 | ___DEFINE_XEN_GUEST_HANDLE(name, type); \ |
44 | ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type) | | 44 | ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type) |
45 | #define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) | | 45 | #define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) |
46 | #define __XEN_GUEST_HANDLE(name) __guest_handle_ ## name | | 46 | #define __XEN_GUEST_HANDLE(name) __guest_handle_ ## name |
47 | #define XEN_GUEST_HANDLE(name) __XEN_GUEST_HANDLE(name) | | 47 | #define XEN_GUEST_HANDLE(name) __XEN_GUEST_HANDLE(name) |
48 | #define set_xen_guest_handle_raw(hnd, val) do { (hnd).p = val; } while (0) | | 48 | #define set_xen_guest_handle_raw(hnd, val) do { (hnd).p = val; } while (0) |
49 | #ifdef __XEN_TOOLS__ | | 49 | |
| | | 50 | #if __XEN_INTERFACE_VERSION__ >= 0x00030201 |
| | | 51 | #define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val) |
50 | #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0) | | 52 | #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0) |
| | | 53 | #else |
| | | 54 | #define set_xen_guest_handle(hnd, val) (hnd) = val |
| | | 55 | #define get_xen_guest_handle(val, hnd) val = (hnd) |
51 | #endif | | 56 | #endif |
52 | #define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val) | | | |
53 | | | 57 | |
54 | #if defined(__i386__) | | 58 | #if defined(__i386__) |
55 | #include "xen-x86_32.h" | | 59 | #include "xen-x86_32.h" |
56 | #elif defined(__x86_64__) | | 60 | #elif defined(__x86_64__) |
57 | #include "xen-x86_64.h" | | 61 | #include "xen-x86_64.h" |
58 | #endif | | 62 | #endif |
59 | | | 63 | |
60 | #ifndef __ASSEMBLY__ | | 64 | #ifndef __ASSEMBLY__ |
61 | typedef unsigned long xen_pfn_t; | | 65 | typedef unsigned long xen_pfn_t; |
62 | #define PRI_xen_pfn "lx" | | 66 | #define PRI_xen_pfn "lx" |
63 | #endif | | 67 | #endif |
64 | | | 68 | |
65 | /* | | 69 | /* |