callback.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. #ifndef __XEN_PUBLIC_CALLBACK_H__
  27. #define __XEN_PUBLIC_CALLBACK_H__
  28. #include <xen/interface/xen.h>
  29. /*
  30. * Prototype for this hypercall is:
  31. * long callback_op(int cmd, void *extra_args)
  32. * @cmd == CALLBACKOP_??? (callback operation).
  33. * @extra_args == Operation-specific extra arguments (NULL if none).
  34. */
  35. /* x86: Callback for event delivery. */
  36. #define CALLBACKTYPE_event 0
  37. /* x86: Failsafe callback when guest state cannot be restored by Xen. */
  38. #define CALLBACKTYPE_failsafe 1
  39. /* x86/64 hypervisor: Syscall by 64-bit guest app ('64-on-64-on-64'). */
  40. #define CALLBACKTYPE_syscall 2
  41. /*
  42. * x86/32 hypervisor: Only available on x86/32 when supervisor_mode_kernel
  43. * feature is enabled. Do not use this callback type in new code.
  44. */
  45. #define CALLBACKTYPE_sysenter_deprecated 3
  46. /* x86: Callback for NMI delivery. */
  47. #define CALLBACKTYPE_nmi 4
  48. /*
  49. * x86: sysenter is only available as follows:
  50. * - 32-bit hypervisor: with the supervisor_mode_kernel feature enabled
  51. * - 64-bit hypervisor: 32-bit guest applications on Intel CPUs
  52. * ('32-on-32-on-64', '32-on-64-on-64')
  53. * [nb. also 64-bit guest applications on Intel CPUs
  54. * ('64-on-64-on-64'), but syscall is preferred]
  55. */
  56. #define CALLBACKTYPE_sysenter 5
  57. /*
  58. * x86/64 hypervisor: Syscall by 32-bit guest app on AMD CPUs
  59. * ('32-on-32-on-64', '32-on-64-on-64')
  60. */
  61. #define CALLBACKTYPE_syscall32 7
  62. /*
  63. * Disable event deliver during callback? This flag is ignored for event and
  64. * NMI callbacks: event delivery is unconditionally disabled.
  65. */
  66. #define _CALLBACKF_mask_events 0
  67. #define CALLBACKF_mask_events (1U << _CALLBACKF_mask_events)
  68. /*
  69. * Register a callback.
  70. */
  71. #define CALLBACKOP_register 0
  72. struct callback_register {
  73. uint16_t type;
  74. uint16_t flags;
  75. xen_callback_t address;
  76. };
  77. /*
  78. * Unregister a callback.
  79. *
  80. * Not all callbacks can be unregistered. -EINVAL will be returned if
  81. * you attempt to unregister such a callback.
  82. */
  83. #define CALLBACKOP_unregister 1
  84. struct callback_unregister {
  85. uint16_t type;
  86. uint16_t _unused;
  87. };
  88. #endif /* __XEN_PUBLIC_CALLBACK_H__ */