]> xenbits.xensource.com Git - people/royger/xen-test-framework.git/commitdiff
Rename CONFIG_ENV_{pv,hvm} to CONFIG_{PV,HVM}
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 18 Jan 2016 10:48:44 +0000 (10:48 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 18 Jan 2016 10:48:44 +0000 (10:48 +0000)
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>
arch/x86/desc.c
arch/x86/entry_32.S
arch/x86/entry_64.S
arch/x86/setup.c
include/arch/x86/config.h
include/arch/x86/desc.h
include/arch/x86/mm.h
include/arch/x86/segment.h
include/arch/x86/traps.h

index ec49b47414402c18dde8a8d8764b6c0d2febfb98..86fc980ef6b98c79d2d3762a505344317d8c52c2 100644 (file)
@@ -22,7 +22,7 @@ desc_ptr gdt_ptr =
     .base = (unsigned long)&gdt,
 };
 
-#if defined(CONFIG_ENV_hvm)
+#if defined(CONFIG_HVM)
 
 gate_desc idt[256] = { };
 
index b36eee8799f100930ddbd04c0d3928b04d0b5386..9f2fd51ecb419a7206b2e3ff4112d79e31f2a6ca 100644 (file)
@@ -24,7 +24,7 @@ containing the entry vector.
 */
 
 .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. */
 
@@ -99,7 +99,7 @@ ENTRY(exec_user)                /* void (*fn)(void) */
         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
 
index 2fe5760540656a816bd0da304e90f9bdc5c59043..d8f13e71eafbcf6cdb8a12f8e3d871f82e221a22 100644 (file)
@@ -29,7 +29,7 @@ metadata.  Currently just the entry vector.
 */
 
 .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
@@ -37,7 +37,7 @@ metadata.  Currently just the entry vector.
 .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. */
@@ -112,7 +112,7 @@ ENTRY(exec_user)                /* void (*fn)(void) */
         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
 
index a039aa1b25e303c590f0d3b16f0bf8ea734c2053..4d092b91ecc4baa090ef4e0deca310053b8119c6 100644 (file)
 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
@@ -42,7 +46,7 @@ start_info_t *start_info = NULL;
  */
 static void init_hypercalls(void)
 {
-#ifdef CONFIG_ENV_hvm
+#ifdef CONFIG_HVM
     uint32_t eax, ebx, ecx, edx, base;
     bool found = false;
 
@@ -67,7 +71,7 @@ static void init_hypercalls(void)
     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
@@ -83,10 +87,10 @@ static void setup_pv_console(void)
     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;
 
@@ -102,7 +106,7 @@ static void setup_pv_console(void)
     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"
@@ -118,7 +122,7 @@ static void xen_console_write(const char *buf, size_t len)
 
 void arch_setup(void)
 {
-#if defined(CONFIG_ENV_hvm)
+#if defined(CONFIG_HVM)
     register_console_callback(qemu_console_write);
 #endif
 
index b0eb93364e7052d28d8dc552136e3996986fd752..2d970fd52bd0766df8acd454cc2af3979c6dbe9b 100644 (file)
@@ -2,9 +2,9 @@
 #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 */
index f8e6235ce29f47753c3393ede26bca1dd82bd759..81a969d39fcffd88fd18c109a337300901be08a5 100644 (file)
@@ -218,7 +218,7 @@ typedef struct hw_tss32 hw_tss;
 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;
 
index 59c941e2cf143ad46568b2f6768fb1b8c0c9664a..dfdab219568f887b977cb01e42bef8800a9261a9 100644 (file)
@@ -24,7 +24,7 @@ static inline void *pfn_to_virt(unsigned long pfn)
     return (void *)(pfn << PAGE_SHIFT);
 }
 
-#if defined(CONFIG_ENV_pv)
+#if defined(CONFIG_PV)
 
 #define m2p ((unsigned long *)MACH2PHYS_VIRT_START)
 
@@ -40,7 +40,7 @@ static inline void *maddr_to_virt(uint64_t maddr)
 
 #undef m2p
 
-#endif /* CONFIG_ENV_pv */
+#endif /* CONFIG_PV */
 
 #endif /* XTF_X86_MM_H */
 
index 444c903130b8726b99184519802b6794201c6f3f..7ac52f9b4624d7bfd7223f14d71b7c19961b4f8f 100644 (file)
 
 #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 */
 
index f2d0450a14b3ece7302b0d6d0e76b066bb30c685..600aa763179b19aea59d085c569300ac4337c655 100644 (file)
@@ -18,7 +18,7 @@ void __noreturn arch_crash_hard(void);
 
 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;