1843e1988Sjohnlev /****************************************************************************** 2843e1988Sjohnlev * callback.h 3843e1988Sjohnlev * 4843e1988Sjohnlev * Register guest OS callbacks with Xen. 5843e1988Sjohnlev * 6843e1988Sjohnlev * Permission is hereby granted, free of charge, to any person obtaining a copy 7843e1988Sjohnlev * of this software and associated documentation files (the "Software"), to 8843e1988Sjohnlev * deal in the Software without restriction, including without limitation the 9843e1988Sjohnlev * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10843e1988Sjohnlev * sell copies of the Software, and to permit persons to whom the Software is 11843e1988Sjohnlev * furnished to do so, subject to the following conditions: 12843e1988Sjohnlev * 13843e1988Sjohnlev * The above copyright notice and this permission notice shall be included in 14843e1988Sjohnlev * all copies or substantial portions of the Software. 15843e1988Sjohnlev * 16843e1988Sjohnlev * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17843e1988Sjohnlev * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18843e1988Sjohnlev * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19843e1988Sjohnlev * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20843e1988Sjohnlev * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21843e1988Sjohnlev * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22843e1988Sjohnlev * DEALINGS IN THE SOFTWARE. 23843e1988Sjohnlev * 24843e1988Sjohnlev * Copyright (c) 2006, Ian Campbell 25843e1988Sjohnlev */ 26843e1988Sjohnlev 27843e1988Sjohnlev #ifndef __XEN_PUBLIC_CALLBACK_H__ 28843e1988Sjohnlev #define __XEN_PUBLIC_CALLBACK_H__ 29843e1988Sjohnlev 30843e1988Sjohnlev #include "xen.h" 31843e1988Sjohnlev 32843e1988Sjohnlev /* 33843e1988Sjohnlev * Prototype for this hypercall is: 34843e1988Sjohnlev * long callback_op(int cmd, void *extra_args) 35843e1988Sjohnlev * @cmd == CALLBACKOP_??? (callback operation). 36843e1988Sjohnlev * @extra_args == Operation-specific extra arguments (NULL if none). 37843e1988Sjohnlev */ 38843e1988Sjohnlev 39*349b53ddSStuart Maybee /* ia64, x86: Callback for event delivery. */ 40843e1988Sjohnlev #define CALLBACKTYPE_event 0 41*349b53ddSStuart Maybee 42*349b53ddSStuart Maybee /* x86: Failsafe callback when guest state cannot be restored by Xen. */ 43843e1988Sjohnlev #define CALLBACKTYPE_failsafe 1 44*349b53ddSStuart Maybee 45*349b53ddSStuart Maybee /* x86/64 hypervisor: Syscall by 64-bit guest app ('64-on-64-on-64'). */ 46*349b53ddSStuart Maybee #define CALLBACKTYPE_syscall 2 47*349b53ddSStuart Maybee 48843e1988Sjohnlev /* 49*349b53ddSStuart Maybee * x86/32 hypervisor: Only available on x86/32 when supervisor_mode_kernel 50*349b53ddSStuart Maybee * feature is enabled. Do not use this callback type in new code. 51843e1988Sjohnlev */ 52*349b53ddSStuart Maybee #define CALLBACKTYPE_sysenter_deprecated 3 53*349b53ddSStuart Maybee 54*349b53ddSStuart Maybee /* x86: Callback for NMI delivery. */ 55843e1988Sjohnlev #define CALLBACKTYPE_nmi 4 56843e1988Sjohnlev 57*349b53ddSStuart Maybee /* 58*349b53ddSStuart Maybee * x86: sysenter is only available as follows: 59*349b53ddSStuart Maybee * - 32-bit hypervisor: with the supervisor_mode_kernel feature enabled 60*349b53ddSStuart Maybee * - 64-bit hypervisor: 32-bit guest applications on Intel CPUs 61*349b53ddSStuart Maybee * ('32-on-32-on-64', '32-on-64-on-64') 62*349b53ddSStuart Maybee * [nb. also 64-bit guest applications on Intel CPUs 63*349b53ddSStuart Maybee * ('64-on-64-on-64'), but syscall is preferred] 64*349b53ddSStuart Maybee */ 65*349b53ddSStuart Maybee #define CALLBACKTYPE_sysenter 5 66*349b53ddSStuart Maybee 67*349b53ddSStuart Maybee /* 68*349b53ddSStuart Maybee * x86/64 hypervisor: Syscall by 32-bit guest app on AMD CPUs 69*349b53ddSStuart Maybee * ('32-on-32-on-64', '32-on-64-on-64') 70*349b53ddSStuart Maybee */ 71*349b53ddSStuart Maybee #define CALLBACKTYPE_syscall32 7 72*349b53ddSStuart Maybee 73843e1988Sjohnlev /* 74843e1988Sjohnlev * Disable event deliver during callback? This flag is ignored for event and 75843e1988Sjohnlev * NMI callbacks: event delivery is unconditionally disabled. 76843e1988Sjohnlev */ 77843e1988Sjohnlev #define _CALLBACKF_mask_events 0 78843e1988Sjohnlev #define CALLBACKF_mask_events (1U << _CALLBACKF_mask_events) 79843e1988Sjohnlev 80843e1988Sjohnlev /* 81843e1988Sjohnlev * Register a callback. 82843e1988Sjohnlev */ 83843e1988Sjohnlev #define CALLBACKOP_register 0 84843e1988Sjohnlev struct callback_register { 85843e1988Sjohnlev uint16_t type; 86843e1988Sjohnlev uint16_t flags; 87843e1988Sjohnlev xen_callback_t address; 88843e1988Sjohnlev }; 89843e1988Sjohnlev typedef struct callback_register callback_register_t; 90843e1988Sjohnlev DEFINE_XEN_GUEST_HANDLE(callback_register_t); 91843e1988Sjohnlev 92843e1988Sjohnlev /* 93843e1988Sjohnlev * Unregister a callback. 94843e1988Sjohnlev * 95843e1988Sjohnlev * Not all callbacks can be unregistered. -EINVAL will be returned if 96843e1988Sjohnlev * you attempt to unregister such a callback. 97843e1988Sjohnlev */ 98843e1988Sjohnlev #define CALLBACKOP_unregister 1 99843e1988Sjohnlev struct callback_unregister { 100843e1988Sjohnlev uint16_t type; 101843e1988Sjohnlev uint16_t _unused; 102843e1988Sjohnlev }; 103843e1988Sjohnlev typedef struct callback_unregister callback_unregister_t; 104843e1988Sjohnlev DEFINE_XEN_GUEST_HANDLE(callback_unregister_t); 105843e1988Sjohnlev 106*349b53ddSStuart Maybee #if __XEN_INTERFACE_VERSION__ < 0x00030207 107*349b53ddSStuart Maybee #undef CALLBACKTYPE_sysenter 108*349b53ddSStuart Maybee #define CALLBACKTYPE_sysenter CALLBACKTYPE_sysenter_deprecated 109*349b53ddSStuart Maybee #endif 110*349b53ddSStuart Maybee 111843e1988Sjohnlev #endif /* __XEN_PUBLIC_CALLBACK_H__ */ 112843e1988Sjohnlev 113843e1988Sjohnlev /* 114843e1988Sjohnlev * Local variables: 115843e1988Sjohnlev * mode: C 116843e1988Sjohnlev * c-set-style: "BSD" 117843e1988Sjohnlev * c-basic-offset: 4 118843e1988Sjohnlev * tab-width: 4 119843e1988Sjohnlev * indent-tabs-mode: nil 120843e1988Sjohnlev * End: 121843e1988Sjohnlev */ 122