1 /* SPDX-License-Identifier: MIT */
2 /******************************************************************************
5 * Register guest OS callbacks with Xen.
7 * Copyright (c) 2006, Ian Campbell
10 #ifndef __XEN_PUBLIC_CALLBACK_H__
11 #define __XEN_PUBLIC_CALLBACK_H__
13 #include <xen/interface/xen.h>
16 * Prototype for this hypercall is:
17 * long callback_op(int cmd, void *extra_args)
18 * @cmd == CALLBACKOP_??? (callback operation).
19 * @extra_args == Operation-specific extra arguments (NULL if none).
22 /* x86: Callback for event delivery. */
23 #define CALLBACKTYPE_event 0
25 /* x86: Failsafe callback when guest state cannot be restored by Xen. */
26 #define CALLBACKTYPE_failsafe 1
28 /* x86/64 hypervisor: Syscall by 64-bit guest app ('64-on-64-on-64'). */
29 #define CALLBACKTYPE_syscall 2
32 * x86/32 hypervisor: Only available on x86/32 when supervisor_mode_kernel
33 * feature is enabled. Do not use this callback type in new code.
35 #define CALLBACKTYPE_sysenter_deprecated 3
37 /* x86: Callback for NMI delivery. */
38 #define CALLBACKTYPE_nmi 4
41 * x86: sysenter is only available as follows:
42 * - 32-bit hypervisor: with the supervisor_mode_kernel feature enabled
43 * - 64-bit hypervisor: 32-bit guest applications on Intel CPUs
44 * ('32-on-32-on-64', '32-on-64-on-64')
45 * [nb. also 64-bit guest applications on Intel CPUs
46 * ('64-on-64-on-64'), but syscall is preferred]
48 #define CALLBACKTYPE_sysenter 5
51 * x86/64 hypervisor: Syscall by 32-bit guest app on AMD CPUs
52 * ('32-on-32-on-64', '32-on-64-on-64')
54 #define CALLBACKTYPE_syscall32 7
57 * Disable event deliver during callback? This flag is ignored for event and
58 * NMI callbacks: event delivery is unconditionally disabled.
60 #define _CALLBACKF_mask_events 0
61 #define CALLBACKF_mask_events (1U << _CALLBACKF_mask_events)
64 * Register a callback.
66 #define CALLBACKOP_register 0
67 struct callback_register {
70 xen_callback_t address;
74 * Unregister a callback.
76 * Not all callbacks can be unregistered. -EINVAL will be returned if
77 * you attempt to unregister such a callback.
79 #define CALLBACKOP_unregister 1
80 struct callback_unregister {
85 #endif /* __XEN_PUBLIC_CALLBACK_H__ */