start_info.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3. * of this software and associated documentation files (the "Software"), to
  4. * deal in the Software without restriction, including without limitation the
  5. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  6. * sell copies of the Software, and to permit persons to whom the Software is
  7. * furnished to do so, subject to the following conditions:
  8. *
  9. * The above copyright notice and this permission notice shall be included in
  10. * all copies or substantial portions of the Software.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  17. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  18. * DEALINGS IN THE SOFTWARE.
  19. *
  20. * Copyright (c) 2016, Citrix Systems, Inc.
  21. */
  22. #ifndef XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H
  23. #define XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H
  24. /*
  25. * Start of day structure passed to PVH guests and to HVM guests in %ebx.
  26. *
  27. * NOTE: nothing will be loaded at physical address 0, so a 0 value in any
  28. * of the address fields should be treated as not present.
  29. *
  30. * 0 +----------------+
  31. * | magic | Contains the magic value XEN_HVM_START_MAGIC_VALUE
  32. * | | ("xEn3" with the 0x80 bit of the "E" set).
  33. * 4 +----------------+
  34. * | version | Version of this structure. Current version is 1. New
  35. * | | versions are guaranteed to be backwards-compatible.
  36. * 8 +----------------+
  37. * | flags | SIF_xxx flags.
  38. * 12 +----------------+
  39. * | nr_modules | Number of modules passed to the kernel.
  40. * 16 +----------------+
  41. * | modlist_paddr | Physical address of an array of modules
  42. * | | (layout of the structure below).
  43. * 24 +----------------+
  44. * | cmdline_paddr | Physical address of the command line,
  45. * | | a zero-terminated ASCII string.
  46. * 32 +----------------+
  47. * | rsdp_paddr | Physical address of the RSDP ACPI data structure.
  48. * 40 +----------------+
  49. * | memmap_paddr | Physical address of the (optional) memory map. Only
  50. * | | present in version 1 and newer of the structure.
  51. * 48 +----------------+
  52. * | memmap_entries | Number of entries in the memory map table. Only
  53. * | | present in version 1 and newer of the structure.
  54. * | | Zero if there is no memory map being provided.
  55. * 52 +----------------+
  56. * | reserved | Version 1 and newer only.
  57. * 56 +----------------+
  58. *
  59. * The layout of each entry in the module structure is the following:
  60. *
  61. * 0 +----------------+
  62. * | paddr | Physical address of the module.
  63. * 8 +----------------+
  64. * | size | Size of the module in bytes.
  65. * 16 +----------------+
  66. * | cmdline_paddr | Physical address of the command line,
  67. * | | a zero-terminated ASCII string.
  68. * 24 +----------------+
  69. * | reserved |
  70. * 32 +----------------+
  71. *
  72. * The layout of each entry in the memory map table is as follows:
  73. *
  74. * 0 +----------------+
  75. * | addr | Base address
  76. * 8 +----------------+
  77. * | size | Size of mapping in bytes
  78. * 16 +----------------+
  79. * | type | Type of mapping as defined between the hypervisor
  80. * | | and guest it's starting. E820_TYPE_xxx, for example.
  81. * 20 +----------------|
  82. * | reserved |
  83. * 24 +----------------+
  84. *
  85. * The address and sizes are always a 64bit little endian unsigned integer.
  86. *
  87. * NB: Xen on x86 will always try to place all the data below the 4GiB
  88. * boundary.
  89. *
  90. * Version numbers of the hvm_start_info structure have evolved like this:
  91. *
  92. * Version 0:
  93. *
  94. * Version 1: Added the memmap_paddr/memmap_entries fields (plus 4 bytes of
  95. * padding) to the end of the hvm_start_info struct. These new
  96. * fields can be used to pass a memory map to the guest. The
  97. * memory map is optional and so guests that understand version 1
  98. * of the structure must check that memmap_entries is non-zero
  99. * before trying to read the memory map.
  100. */
  101. #define XEN_HVM_START_MAGIC_VALUE 0x336ec578
  102. /*
  103. * C representation of the x86/HVM start info layout.
  104. *
  105. * The canonical definition of this layout is above, this is just a way to
  106. * represent the layout described there using C types.
  107. */
  108. struct hvm_start_info {
  109. uint32_t magic; /* Contains the magic value 0x336ec578 */
  110. /* ("xEn3" with the 0x80 bit of the "E" set).*/
  111. uint32_t version; /* Version of this structure. */
  112. uint32_t flags; /* SIF_xxx flags. */
  113. uint32_t nr_modules; /* Number of modules passed to the kernel. */
  114. uint64_t modlist_paddr; /* Physical address of an array of */
  115. /* hvm_modlist_entry. */
  116. uint64_t cmdline_paddr; /* Physical address of the command line. */
  117. uint64_t rsdp_paddr; /* Physical address of the RSDP ACPI data */
  118. /* structure. */
  119. uint64_t memmap_paddr; /* Physical address of an array of */
  120. /* hvm_memmap_table_entry. Only present in */
  121. /* version 1 and newer of the structure */
  122. uint32_t memmap_entries; /* Number of entries in the memmap table. */
  123. /* Only present in version 1 and newer of */
  124. /* the structure. Value will be zero if */
  125. /* there is no memory map being provided. */
  126. uint32_t reserved;
  127. };
  128. struct hvm_modlist_entry {
  129. uint64_t paddr; /* Physical address of the module. */
  130. uint64_t size; /* Size of the module in bytes. */
  131. uint64_t cmdline_paddr; /* Physical address of the command line. */
  132. uint64_t reserved;
  133. };
  134. struct hvm_memmap_table_entry {
  135. uint64_t addr; /* Base address of the memory region */
  136. uint64_t size; /* Size of the memory region in bytes */
  137. uint32_t type; /* Mapping type */
  138. uint32_t reserved;
  139. };
  140. #endif /* XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H */