···193193#define XEN_ELFNOTE_SUPPORTED_FEATURES 17194194195195/*196196+ * Physical entry point into the kernel.197197+ *198198+ * 32bit entry point into the kernel. When requested to launch the199199+ * guest kernel in a HVM container, Xen will use this entry point to200200+ * launch the guest in 32bit protected mode with paging disabled.201201+ * Ignored otherwise.202202+ */203203+#define XEN_ELFNOTE_PHYS32_ENTRY 18204204+205205+/*196206 * The number of the highest elfnote defined.197207 */198198-#define XEN_ELFNOTE_MAX XEN_ELFNOTE_SUPPORTED_FEATURES208208+#define XEN_ELFNOTE_MAX XEN_ELFNOTE_PHYS32_ENTRY199209200210#endif /* __XEN_PUBLIC_ELFNOTE_H__ */201211
+143
include/xen/interface/hvm/hvm_vcpu.h
···11+/*22+ * Permission is hereby granted, free of charge, to any person obtaining a copy33+ * of this software and associated documentation files (the "Software"), to44+ * deal in the Software without restriction, including without limitation the55+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or66+ * sell copies of the Software, and to permit persons to whom the Software is77+ * furnished to do so, subject to the following conditions:88+ *99+ * The above copyright notice and this permission notice shall be included in1010+ * all copies or substantial portions of the Software.1111+ *1212+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR1313+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,1414+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE1515+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER1616+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING1717+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER1818+ * DEALINGS IN THE SOFTWARE.1919+ *2020+ * Copyright (c) 2015, Roger Pau Monne <roger.pau@citrix.com>2121+ */2222+2323+#ifndef __XEN_PUBLIC_HVM_HVM_VCPU_H__2424+#define __XEN_PUBLIC_HVM_HVM_VCPU_H__2525+2626+#include "../xen.h"2727+2828+struct vcpu_hvm_x86_32 {2929+ uint32_t eax;3030+ uint32_t ecx;3131+ uint32_t edx;3232+ uint32_t ebx;3333+ uint32_t esp;3434+ uint32_t ebp;3535+ uint32_t esi;3636+ uint32_t edi;3737+ uint32_t eip;3838+ uint32_t eflags;3939+4040+ uint32_t cr0;4141+ uint32_t cr3;4242+ uint32_t cr4;4343+4444+ uint32_t pad1;4545+4646+ /*4747+ * EFER should only be used to set the NXE bit (if required)4848+ * when starting a vCPU in 32bit mode with paging enabled or4949+ * to set the LME/LMA bits in order to start the vCPU in5050+ * compatibility mode.5151+ */5252+ uint64_t efer;5353+5454+ uint32_t cs_base;5555+ uint32_t ds_base;5656+ uint32_t ss_base;5757+ uint32_t es_base;5858+ uint32_t tr_base;5959+ uint32_t cs_limit;6060+ uint32_t ds_limit;6161+ uint32_t ss_limit;6262+ uint32_t es_limit;6363+ uint32_t tr_limit;6464+ uint16_t cs_ar;6565+ uint16_t ds_ar;6666+ uint16_t ss_ar;6767+ uint16_t es_ar;6868+ uint16_t tr_ar;6969+7070+ uint16_t pad2[3];7171+};7272+7373+/*7474+ * The layout of the _ar fields of the segment registers is the7575+ * following:7676+ *7777+ * Bits [0,3]: type (bits 40-43).7878+ * Bit 4: s (descriptor type, bit 44).7979+ * Bit [5,6]: dpl (descriptor privilege level, bits 45-46).8080+ * Bit 7: p (segment-present, bit 47).8181+ * Bit 8: avl (available for system software, bit 52).8282+ * Bit 9: l (64-bit code segment, bit 53).8383+ * Bit 10: db (meaning depends on the segment, bit 54).8484+ * Bit 11: g (granularity, bit 55)8585+ * Bits [12,15]: unused, must be blank.8686+ *8787+ * A more complete description of the meaning of this fields can be8888+ * obtained from the Intel SDM, Volume 3, section 3.4.5.8989+ */9090+9191+struct vcpu_hvm_x86_64 {9292+ uint64_t rax;9393+ uint64_t rcx;9494+ uint64_t rdx;9595+ uint64_t rbx;9696+ uint64_t rsp;9797+ uint64_t rbp;9898+ uint64_t rsi;9999+ uint64_t rdi;100100+ uint64_t rip;101101+ uint64_t rflags;102102+103103+ uint64_t cr0;104104+ uint64_t cr3;105105+ uint64_t cr4;106106+ uint64_t efer;107107+108108+ /*109109+ * Using VCPU_HVM_MODE_64B implies that the vCPU is launched110110+ * directly in long mode, so the cached parts of the segment111111+ * registers get set to match that environment.112112+ *113113+ * If the user wants to launch the vCPU in compatibility mode114114+ * the 32-bit structure should be used instead.115115+ */116116+};117117+118118+struct vcpu_hvm_context {119119+#define VCPU_HVM_MODE_32B 0 /* 32bit fields of the structure will be used. */120120+#define VCPU_HVM_MODE_64B 1 /* 64bit fields of the structure will be used. */121121+ uint32_t mode;122122+123123+ uint32_t pad;124124+125125+ /* CPU registers. */126126+ union {127127+ struct vcpu_hvm_x86_32 x86_32;128128+ struct vcpu_hvm_x86_64 x86_64;129129+ } cpu_regs;130130+};131131+typedef struct vcpu_hvm_context vcpu_hvm_context_t;132132+133133+#endif /* __XEN_PUBLIC_HVM_HVM_VCPU_H__ */134134+135135+/*136136+ * Local variables:137137+ * mode: C138138+ * c-file-style: "BSD"139139+ * c-basic-offset: 4140140+ * tab-width: 4141141+ * indent-tabs-mode: nil142142+ * End:143143+ */
+98
include/xen/interface/hvm/start_info.h
···11+/*22+ * Permission is hereby granted, free of charge, to any person obtaining a copy33+ * of this software and associated documentation files (the "Software"), to44+ * deal in the Software without restriction, including without limitation the55+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or66+ * sell copies of the Software, and to permit persons to whom the Software is77+ * furnished to do so, subject to the following conditions:88+ *99+ * The above copyright notice and this permission notice shall be included in1010+ * all copies or substantial portions of the Software.1111+ *1212+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR1313+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,1414+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE1515+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER1616+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING1717+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER1818+ * DEALINGS IN THE SOFTWARE.1919+ *2020+ * Copyright (c) 2016, Citrix Systems, Inc.2121+ */2222+2323+#ifndef __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__2424+#define __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__2525+2626+/*2727+ * Start of day structure passed to PVH guests and to HVM guests in %ebx.2828+ *2929+ * NOTE: nothing will be loaded at physical address 0, so a 0 value in any3030+ * of the address fields should be treated as not present.3131+ *3232+ * 0 +----------------+3333+ * | magic | Contains the magic value XEN_HVM_START_MAGIC_VALUE3434+ * | | ("xEn3" with the 0x80 bit of the "E" set).3535+ * 4 +----------------+3636+ * | version | Version of this structure. Current version is 0. New3737+ * | | versions are guaranteed to be backwards-compatible.3838+ * 8 +----------------+3939+ * | flags | SIF_xxx flags.4040+ * 12 +----------------+4141+ * | nr_modules | Number of modules passed to the kernel.4242+ * 16 +----------------+4343+ * | modlist_paddr | Physical address of an array of modules4444+ * | | (layout of the structure below).4545+ * 24 +----------------+4646+ * | cmdline_paddr | Physical address of the command line,4747+ * | | a zero-terminated ASCII string.4848+ * 32 +----------------+4949+ * | rsdp_paddr | Physical address of the RSDP ACPI data structure.5050+ * 40 +----------------+5151+ *5252+ * The layout of each entry in the module structure is the following:5353+ *5454+ * 0 +----------------+5555+ * | paddr | Physical address of the module.5656+ * 8 +----------------+5757+ * | size | Size of the module in bytes.5858+ * 16 +----------------+5959+ * | cmdline_paddr | Physical address of the command line,6060+ * | | a zero-terminated ASCII string.6161+ * 24 +----------------+6262+ * | reserved |6363+ * 32 +----------------+6464+ *6565+ * The address and sizes are always a 64bit little endian unsigned integer.6666+ *6767+ * NB: Xen on x86 will always try to place all the data below the 4GiB6868+ * boundary.6969+ */7070+#define XEN_HVM_START_MAGIC_VALUE 0x336ec5787171+7272+/*7373+ * C representation of the x86/HVM start info layout.7474+ *7575+ * The canonical definition of this layout is above, this is just a way to7676+ * represent the layout described there using C types.7777+ */7878+struct hvm_start_info {7979+ uint32_t magic; /* Contains the magic value 0x336ec578 */8080+ /* ("xEn3" with the 0x80 bit of the "E" set).*/8181+ uint32_t version; /* Version of this structure. */8282+ uint32_t flags; /* SIF_xxx flags. */8383+ uint32_t nr_modules; /* Number of modules passed to the kernel. */8484+ uint64_t modlist_paddr; /* Physical address of an array of */8585+ /* hvm_modlist_entry. */8686+ uint64_t cmdline_paddr; /* Physical address of the command line. */8787+ uint64_t rsdp_paddr; /* Physical address of the RSDP ACPI data */8888+ /* structure. */8989+};9090+9191+struct hvm_modlist_entry {9292+ uint64_t paddr; /* Physical address of the module. */9393+ uint64_t size; /* Size of the module in bytes. */9494+ uint64_t cmdline_paddr; /* Physical address of the command line. */9595+ uint64_t reserved;9696+};9797+9898+#endif /* __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ */