to avoid them being easily confused with the environment-specific defined.
Additionally, reduce the usage of the environment-specific defines to an
absolute minimum, to avoid latent issues when introducing new environments.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
.base = (unsigned long)&gdt,
};
-#if defined(CONFIG_ENV_hvm)
+#if defined(CONFIG_HVM)
gate_desc idt[256] = { };
*/
.macro env_IRET /* Environment specific version of `iret`. */
-#if defined(CONFIG_ENV_pv)
+#if defined(CONFIG_PV)
jmp HYPERCALL_iret /* PV guests use the 'iret' hypercall. */
addl $4, (%esp) /* ESP */
pushf /* EFLAGS */
-#if defined(CONFIG_ENV_pv) /* PV guests see the real interrupt flag. Clobber it. */
+#if defined(CONFIG_PV) /* PV guests see the real interrupt flag. Clobber it. */
andl $~X86_EFLAGS_IF, (%esp)
#endif
*/
.macro env_ADJUST_FRAME /* Environment specific exception entry. */
-#if defined(CONFIG_ENV_pv64)
+#if defined(CONFIG_PV)
/* Restore results of Xen SYSRET'ing to this point. */
pop %rcx
pop %r11
.endm
.macro env_IRETQ /* Environment specific version of `iretq`. */
-#if defined(CONFIG_ENV_pv64)
+#if defined(CONFIG_PV)
push $0 /* Indicate that this isn't a SYSRET'able */
jmp HYPERCALL_iret /* situation, and use the 'iret' hypercall. */
addq $8, (%rsp) /* RSP */
pushf /* RFLAGS */
-#if defined(CONFIG_ENV_pv) /* PV guests see the real interrupt flag. Clobber it. */
+#if defined(CONFIG_PV) /* PV guests see the real interrupt flag. Clobber it. */
andq $~X86_EFLAGS_IF, (%rsp)
#endif
uint8_t boot_stack[2 * PAGE_SIZE] __aligned(PAGE_SIZE);
const char *environment_description =
-#if defined(CONFIG_ENV_pv32)
- "PV 32bit"
-#elif defined(CONFIG_ENV_pv64)
- "PV 64bit"
-#elif defined(CONFIG_ENV_hvm32)
- "HVM 32bit"
-#elif defined(CONFIG_ENV_hvm64)
- "HVM 64bit"
+#if defined(CONFIG_PV)
+ "PV"
+#elif defined(CONFIG_HVM)
+ "HVM"
#else
-# error Bad Environment
+# error Bad Guest Type
+#endif
+
+#if defined(__x86_64__)
+ " 64bit"
+#elif defined(__i386__)
+ " 32bit"
+#else
+# error Bad Width
#endif
;
-#ifdef CONFIG_ENV_pv
+#ifdef CONFIG_PV
/* Filled in by head_pv.S */
start_info_t *start_info = NULL;
#endif
*/
static void init_hypercalls(void)
{
-#ifdef CONFIG_ENV_hvm
+#ifdef CONFIG_HVM
uint32_t eax, ebx, ecx, edx, base;
bool found = false;
cpuid(base + 2, &eax, &ebx, &ecx, &edx);
wrmsr(ebx, (unsigned long)&hypercall_page);
barrier();
-#endif
+#endif /* CONFIG_HVM */
/*
* Confirm that the `ret` poision has been overwritten with a real
xencons_interface_t *cons_ring;
evtchn_port_t cons_evtchn;
-#if defined(CONFIG_ENV_pv)
+#if defined(CONFIG_PV)
cons_ring = mfn_to_virt(start_info->console.domU.mfn);
cons_evtchn = start_info->console.domU.evtchn;
-#elif defined(CONFIG_ENV_hvm)
+#elif defined(CONFIG_HVM)
{
uint64_t raw_pfn, raw_evtchn;
init_pv_console(cons_ring, cons_evtchn);
}
-#if defined(CONFIG_ENV_hvm)
+#if defined(CONFIG_HVM)
static void qemu_console_write(const char *buf, size_t len)
{
asm volatile("rep; outsb"
void arch_setup(void)
{
-#if defined(CONFIG_ENV_hvm)
+#if defined(CONFIG_HVM)
register_console_callback(qemu_console_write);
#endif
#define XTF_X86_CONFIG_H
#if defined(CONFIG_ENV_pv64) || defined(CONFIG_ENV_pv32)
-# define CONFIG_ENV_pv
+# define CONFIG_PV
#elif defined(CONFIG_ENV_hvm64) || defined(CONFIG_ENV_hvm32)
-# define CONFIG_ENV_hvm
+# define CONFIG_HVM
#endif
#endif /* XTF_X86_CONFIG_H */
extern user_desc gdt[NR_GDT_ENTRIES];
extern desc_ptr gdt_ptr;
-#if defined(CONFIG_ENV_hvm)
+#if defined(CONFIG_HVM)
extern gate_desc idt[256];
extern desc_ptr idt_ptr;
return (void *)(pfn << PAGE_SHIFT);
}
-#if defined(CONFIG_ENV_pv)
+#if defined(CONFIG_PV)
#define m2p ((unsigned long *)MACH2PHYS_VIRT_START)
#undef m2p
-#endif /* CONFIG_ENV_pv */
+#endif /* CONFIG_PV */
#endif /* XTF_X86_MM_H */
#define NR_GDT_ENTRIES 9
-#if defined(CONFIG_ENV_hvm64)
+/*
+ * HVM guests use the GDT directly.
+ */
+#if defined(CONFIG_HVM)
+
+#ifdef __x86_64__
#define __KERN_CS (GDTE_CS64_DPL0 * 8)
#define __KERN_DS (0)
#define __USER_CS (GDTE_CS64_DPL3 * 8 + 3)
#define __USER_DS (GDTE_DS32_DPL3 * 8 + 3)
-#elif defined(CONFIG_ENV_hvm32)
+#else /* __x86_64__ */
#define __KERN_CS (GDTE_CS32_DPL0 * 8)
#define __KERN_DS (GDTE_DS32_DPL0 * 8)
#define __USER_CS (GDTE_CS32_DPL3 * 8 + 3)
#define __USER_DS (GDTE_DS32_DPL3 * 8 + 3)
-#endif
+#endif /* __x86_64__ */
+
+#endif /* CONFIG_HVM */
/*
* PV guests by default use the Xen ABI-provided selectors.
*/
-#if defined(CONFIG_ENV_pv64)
+#if defined(CONFIG_PV)
+#ifdef __x86_64__
/*
* 64bit PV guest kernels run in cpl3, but exception frames generated by Xen
* report cpl0 when interrupting kernel mode. Trim the kernel selectors down
#define __USER_CS FLAT_RING3_CS64
#define __USER_DS FLAT_RING3_SS64
-#elif defined(CONFIG_ENV_pv32)
+#else /* __x86_64__ */
#define __KERN_CS FLAT_RING1_CS
#define __KERN_DS FLAT_RING1_DS
#define __USER_CS FLAT_RING3_CS
#define __USER_DS FLAT_RING3_DS
-#endif
+#endif /* __x86_64__ */
+
+#endif /* CONFIG_PV */
#endif /* XTF_X86_SEGMENT_H */
extern uint8_t boot_stack[2 * PAGE_SIZE];
-#if defined(CONFIG_ENV_pv)
+#if defined(CONFIG_PV)
#include <xen/xen.h>
extern struct start_info *start_info;