hypercall.S 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* SPDX-License-Identifier: GPL-2.0
  2. *
  3. * hypercall.S
  4. *
  5. * Xen hypercall wrappers
  6. *
  7. * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License version 2
  11. * as published by the Free Software Foundation; or, when distributed
  12. * separately from the Linux kernel or incorporated into other
  13. * software packages, subject to the following license:
  14. *
  15. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16. * of this source file (the "Software"), to deal in the Software without
  17. * restriction, including without limitation the rights to use, copy, modify,
  18. * merge, publish, distribute, sublicense, and/or sell copies of the Software,
  19. * and to permit persons to whom the Software is furnished to do so, subject to
  20. * the following conditions:
  21. *
  22. * The above copyright notice and this permission notice shall be included in
  23. * all copies or substantial portions of the Software.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  27. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  28. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  29. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  30. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  31. * IN THE SOFTWARE.
  32. */
  33. /*
  34. * The Xen hypercall calling convention is very similar to the procedure
  35. * call standard for the ARM 64-bit architecture: the first parameter is
  36. * passed in x0, the second in x1, the third in x2, the fourth in x3 and
  37. * the fifth in x4.
  38. *
  39. * The hypercall number is passed in x16.
  40. *
  41. * The return value is in x0.
  42. *
  43. * The hvc ISS is required to be 0xEA1, that is the Xen specific ARM
  44. * hypercall tag.
  45. *
  46. * Parameter structs passed to hypercalls are laid out according to
  47. * the ARM 64-bit EABI standard.
  48. */
  49. #include <xen/interface/xen.h>
  50. #define XEN_HYPERCALL_TAG 0xEA1
  51. #define HYPERCALL_SIMPLE(hypercall) \
  52. .globl HYPERVISOR_##hypercall; \
  53. .align 4,0x90; \
  54. HYPERVISOR_##hypercall: \
  55. mov x16, #__HYPERVISOR_##hypercall; \
  56. hvc XEN_HYPERCALL_TAG; \
  57. ret; \
  58. #define HYPERCALL0 HYPERCALL_SIMPLE
  59. #define HYPERCALL1 HYPERCALL_SIMPLE
  60. #define HYPERCALL2 HYPERCALL_SIMPLE
  61. #define HYPERCALL3 HYPERCALL_SIMPLE
  62. #define HYPERCALL4 HYPERCALL_SIMPLE
  63. #define HYPERCALL5 HYPERCALL_SIMPLE
  64. .text
  65. HYPERCALL2(xen_version);
  66. HYPERCALL3(console_io);
  67. HYPERCALL3(grant_table_op);
  68. HYPERCALL2(sched_op);
  69. HYPERCALL2(event_channel_op);
  70. HYPERCALL2(hvm_op);
  71. HYPERCALL2(memory_op);