Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / xen / include / xen3-public / callback.h
blob67c10073618a4323e4257bc3ffe065f37d49f997
1 /* $NetBSD: callback.h,v 1.2 2007/09/23 16:25:29 bouyer Exp $ */
2 /******************************************************************************
3 * callback.h
5 * Register guest OS callbacks with Xen.
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
9 * deal in the Software without restriction, including without limitation the
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
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
25 * Copyright (c) 2006, Ian Campbell
28 #ifndef __XEN_PUBLIC_CALLBACK_H__
29 #define __XEN_PUBLIC_CALLBACK_H__
31 #include "xen.h"
34 * Prototype for this hypercall is:
35 * long callback_op(int cmd, void *extra_args)
36 * @cmd == CALLBACKOP_??? (callback operation).
37 * @extra_args == Operation-specific extra arguments (NULL if none).
40 /* ia64, x86: Callback for event delivery. */
41 #define CALLBACKTYPE_event 0
43 /* x86: Failsafe callback when guest state cannot be restored by Xen. */
44 #define CALLBACKTYPE_failsafe 1
46 /* x86/64 hypervisor: Syscall by 64-bit guest app ('64-on-64-on-64'). */
47 #define CALLBACKTYPE_syscall 2
50 * x86/32 hypervisor: Only available on x86/32 when supervisor_mode_kernel
51 * feature is enabled. Do not use this callback type in new code.
53 #define CALLBACKTYPE_sysenter_deprecated 3
55 /* x86: Callback for NMI delivery. */
56 #define CALLBACKTYPE_nmi 4
59 * x86: sysenter is only available as follows:
60 * - 32-bit hypervisor: with the supervisor_mode_kernel feature enabled
61 * - 64-bit hypervisor: 32-bit guest applications on Intel CPUs
62 * ('32-on-32-on-64', '32-on-64-on-64')
63 * [nb. also 64-bit guest applications on Intel CPUs
64 * ('64-on-64-on-64'), but syscall is preferred]
66 #define CALLBACKTYPE_sysenter 5
69 * x86/64 hypervisor: Syscall by 32-bit guest app on AMD CPUs
70 * ('32-on-32-on-64', '32-on-64-on-64')
72 #define CALLBACKTYPE_syscall32 7
75 * Disable event deliver during callback? This flag is ignored for event and
76 * NMI callbacks: event delivery is unconditionally disabled.
78 #define _CALLBACKF_mask_events 0
79 #define CALLBACKF_mask_events (1U << _CALLBACKF_mask_events)
82 * Register a callback.
84 #define CALLBACKOP_register 0
85 struct callback_register {
86 uint16_t type;
87 uint16_t flags;
88 xen_callback_t address;
90 typedef struct callback_register callback_register_t;
91 DEFINE_XEN_GUEST_HANDLE(callback_register_t);
94 * Unregister a callback.
96 * Not all callbacks can be unregistered. -EINVAL will be returned if
97 * you attempt to unregister such a callback.
99 #define CALLBACKOP_unregister 1
100 struct callback_unregister {
101 uint16_t type;
102 uint16_t _unused;
104 typedef struct callback_unregister callback_unregister_t;
105 DEFINE_XEN_GUEST_HANDLE(callback_unregister_t);
107 #if __XEN_INTERFACE_VERSION__ < 0x00030207
108 #undef CALLBACKTYPE_sysenter
109 #define CALLBACKTYPE_sysenter CALLBACKTYPE_sysenter_deprecated
110 #endif
112 #endif /* __XEN_PUBLIC_CALLBACK_H__ */
115 * Local variables:
116 * mode: C
117 * c-set-style: "BSD"
118 * c-basic-offset: 4
119 * tab-width: 4
120 * indent-tabs-mode: nil
121 * End: