diff options
-rw-r--r-- | include/asm-x86/xen/hypercall.h | 6 | ||||
-rw-r--r-- | include/asm-x86/xen/interface.h | 4 | ||||
-rw-r--r-- | include/xen/interface/callback.h | 102 |
3 files changed, 112 insertions, 0 deletions
diff --git a/include/asm-x86/xen/hypercall.h b/include/asm-x86/xen/hypercall.h index bc0ee7d961ca..c2ccd997ed35 100644 --- a/include/asm-x86/xen/hypercall.h +++ b/include/asm-x86/xen/hypercall.h | |||
@@ -164,6 +164,12 @@ HYPERVISOR_set_callbacks(unsigned long event_selector, | |||
164 | } | 164 | } |
165 | 165 | ||
166 | static inline int | 166 | static inline int |
167 | HYPERVISOR_callback_op(int cmd, void *arg) | ||
168 | { | ||
169 | return _hypercall2(int, callback_op, cmd, arg); | ||
170 | } | ||
171 | |||
172 | static inline int | ||
167 | HYPERVISOR_fpu_taskswitch(int set) | 173 | HYPERVISOR_fpu_taskswitch(int set) |
168 | { | 174 | { |
169 | return _hypercall1(int, fpu_taskswitch, set); | 175 | return _hypercall1(int, fpu_taskswitch, set); |
diff --git a/include/asm-x86/xen/interface.h b/include/asm-x86/xen/interface.h index 165c3968e138..588a0716cd78 100644 --- a/include/asm-x86/xen/interface.h +++ b/include/asm-x86/xen/interface.h | |||
@@ -171,6 +171,10 @@ struct arch_vcpu_info { | |||
171 | unsigned long pad[5]; /* sizeof(struct vcpu_info) == 64 */ | 171 | unsigned long pad[5]; /* sizeof(struct vcpu_info) == 64 */ |
172 | }; | 172 | }; |
173 | 173 | ||
174 | struct xen_callback { | ||
175 | unsigned long cs; | ||
176 | unsigned long eip; | ||
177 | }; | ||
174 | #endif /* !__ASSEMBLY__ */ | 178 | #endif /* !__ASSEMBLY__ */ |
175 | 179 | ||
176 | /* | 180 | /* |
diff --git a/include/xen/interface/callback.h b/include/xen/interface/callback.h new file mode 100644 index 000000000000..4aadcba31af9 --- /dev/null +++ b/include/xen/interface/callback.h | |||
@@ -0,0 +1,102 @@ | |||
1 | /****************************************************************************** | ||
2 | * callback.h | ||
3 | * | ||
4 | * Register guest OS callbacks with Xen. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
7 | * of this software and associated documentation files (the "Software"), to | ||
8 | * deal in the Software without restriction, including without limitation the | ||
9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
10 | * sell copies of the Software, and to permit persons to whom the Software is | ||
11 | * furnished to do so, subject to the following conditions: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice shall be included in | ||
14 | * all copies or substantial portions of the Software. | ||
15 | * | ||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | * | ||
24 | * Copyright (c) 2006, Ian Campbell | ||
25 | */ | ||
26 | |||
27 | #ifndef __XEN_PUBLIC_CALLBACK_H__ | ||
28 | #define __XEN_PUBLIC_CALLBACK_H__ | ||
29 | |||
30 | #include "xen.h" | ||
31 | |||
32 | /* | ||
33 | * Prototype for this hypercall is: | ||
34 | * long callback_op(int cmd, void *extra_args) | ||
35 | * @cmd == CALLBACKOP_??? (callback operation). | ||
36 | * @extra_args == Operation-specific extra arguments (NULL if none). | ||
37 | */ | ||
38 | |||
39 | /* ia64, x86: Callback for event delivery. */ | ||
40 | #define CALLBACKTYPE_event 0 | ||
41 | |||
42 | /* x86: Failsafe callback when guest state cannot be restored by Xen. */ | ||
43 | #define CALLBACKTYPE_failsafe 1 | ||
44 | |||
45 | /* x86/64 hypervisor: Syscall by 64-bit guest app ('64-on-64-on-64'). */ | ||
46 | #define CALLBACKTYPE_syscall 2 | ||
47 | |||
48 | /* | ||
49 | * x86/32 hypervisor: Only available on x86/32 when supervisor_mode_kernel | ||
50 | * feature is enabled. Do not use this callback type in new code. | ||
51 | */ | ||
52 | #define CALLBACKTYPE_sysenter_deprecated 3 | ||
53 | |||
54 | /* x86: Callback for NMI delivery. */ | ||
55 | #define CALLBACKTYPE_nmi 4 | ||
56 | |||
57 | /* | ||
58 | * x86: sysenter is only available as follows: | ||
59 | * - 32-bit hypervisor: with the supervisor_mode_kernel feature enabled | ||
60 | * - 64-bit hypervisor: 32-bit guest applications on Intel CPUs | ||
61 | * ('32-on-32-on-64', '32-on-64-on-64') | ||
62 | * [nb. also 64-bit guest applications on Intel CPUs | ||
63 | * ('64-on-64-on-64'), but syscall is preferred] | ||
64 | */ | ||
65 | #define CALLBACKTYPE_sysenter 5 | ||
66 | |||
67 | /* | ||
68 | * x86/64 hypervisor: Syscall by 32-bit guest app on AMD CPUs | ||
69 | * ('32-on-32-on-64', '32-on-64-on-64') | ||
70 | */ | ||
71 | #define CALLBACKTYPE_syscall32 7 | ||
72 | |||
73 | /* | ||
74 | * Disable event deliver during callback? This flag is ignored for event and | ||
75 | * NMI callbacks: event delivery is unconditionally disabled. | ||
76 | */ | ||
77 | #define _CALLBACKF_mask_events 0 | ||
78 | #define CALLBACKF_mask_events (1U << _CALLBACKF_mask_events) | ||
79 | |||
80 | /* | ||
81 | * Register a callback. | ||
82 | */ | ||
83 | #define CALLBACKOP_register 0 | ||
84 | struct callback_register { | ||
85 | uint16_t type; | ||
86 | uint16_t flags; | ||
87 | struct xen_callback address; | ||
88 | }; | ||
89 | |||
90 | /* | ||
91 | * Unregister a callback. | ||
92 | * | ||
93 | * Not all callbacks can be unregistered. -EINVAL will be returned if | ||
94 | * you attempt to unregister such a callback. | ||
95 | */ | ||
96 | #define CALLBACKOP_unregister 1 | ||
97 | struct callback_unregister { | ||
98 | uint16_t type; | ||
99 | uint16_t _unused; | ||
100 | }; | ||
101 | |||
102 | #endif /* __XEN_PUBLIC_CALLBACK_H__ */ | ||