aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2004-06-11 21:36:10 +0000
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2004-06-11 21:36:10 +0000
commit976f815cf309158ba134cb945d0ad0817d86891c (patch)
treebeaad726cad5c0a186e97fcb5443d94620593364
parent9a36e18cd692a4d30b5a339c2a284a67f63a1a3d (diff)
downloadxen-976f815cf309158ba134cb945d0ad0817d86891c.tar.gz
xen-976f815cf309158ba134cb945d0ad0817d86891c.tar.bz2
xen-976f815cf309158ba134cb945d0ad0817d86891c.zip
bitkeeper revision 1.955.1.4 (40ca25caD-WBu24eVfed1yswCl7JeQ)
Many files: More x86_64 stuff. pda.h: Rename: xen/include/asm-x86/x86_64/pda.h -> xen/include/asm-x86/pda.h .del-config.h~ab742eeb14ad808f: Delete: xen/include/asm-x86/x86_64/config.h arch-x86_32.h: Rename: xen/include/hypervisor-ifs/arch_x86_32.h -> xen/include/hypervisor-ifs/arch-x86_32.h arch-x86_64.h: Rename: xen/include/hypervisor-ifs/arch_x86_64.h -> xen/include/hypervisor-ifs/arch-x86_64.h arch_x86_32.h: Rename: xen/include/hypervisor-ifs/arch-x86/hypervisor-if.h -> xen/include/hypervisor-ifs/arch_x86_32.h arch_x86_64.h: Rename: xen/include/hypervisor-ifs/arch-x86_64/hypervisor-if.h -> xen/include/hypervisor-ifs/arch_x86_64.h
-rw-r--r--.rootkeys7
-rw-r--r--linux-2.4.26-xen-sparse/arch/xen/Makefile3
-rw-r--r--xen/Makefile3
-rw-r--r--xen/arch/x86/Rules.mk4
-rw-r--r--xen/arch/x86/mm.c4
-rw-r--r--xen/common/domain.c2
-rw-r--r--xen/include/asm-x86/config.h153
-rw-r--r--xen/include/asm-x86/msr.h4
-rw-r--r--xen/include/asm-x86/pda.h (renamed from xen/include/asm-x86/x86_64/pda.h)0
-rw-r--r--xen/include/asm-x86/smp.h4
-rw-r--r--xen/include/asm-x86/string.h1
-rw-r--r--xen/include/asm-x86/system.h24
-rw-r--r--xen/include/asm-x86/types.h8
-rw-r--r--xen/include/asm-x86/x86_64/config.h292
-rw-r--r--xen/include/hypervisor-ifs/arch-x86_32.h (renamed from xen/include/hypervisor-ifs/arch-x86/hypervisor-if.h)0
-rw-r--r--xen/include/hypervisor-ifs/arch-x86_64.h (renamed from xen/include/hypervisor-ifs/arch-x86_64/hypervisor-if.h)3
-rw-r--r--xen/include/hypervisor-ifs/hypervisor-if.h8
17 files changed, 149 insertions, 371 deletions
diff --git a/.rootkeys b/.rootkeys
index a043e4deb5..785aff2998 100644
--- a/.rootkeys
+++ b/.rootkeys
@@ -425,6 +425,7 @@
3ddb79c3xjYnrv5t3VqYlR4tNEOl4Q xen/include/asm-x86/page.h
3e450943kzme29HPCtq5HNOVQkddfw xen/include/asm-x86/param.h
3ddb79c3ysKUbxZuwKBRK3WXU2TlEg xen/include/asm-x86/pci.h
+404f1bb41Yl-5ZjIWnG66HDCj6OIWA xen/include/asm-x86/pda.h
4022a73diKn2Ax4-R4gzk59lm1YdDg xen/include/asm-x86/pdb.h
3ddb79c2QF5-pZGzuX4QukPCDAl59A xen/include/asm-x86/processor.h
3ddb79c3mbqEM7QQr3zVq7NiBNhouA xen/include/asm-x86/ptrace.h
@@ -440,18 +441,16 @@
3ddb79c4HugMq7IYGxcQKFBpKwKhzA xen/include/asm-x86/types.h
3ddb79c3M2n1ROZH6xk3HbyN4CPDqg xen/include/asm-x86/uaccess.h
3ddb79c3uPGcP_l_2xyGgBSWd5aC-Q xen/include/asm-x86/unaligned.h
-404f1b9b_phpQlRnyiWqP6RodfZDpg xen/include/asm-x86/x86_64/config.h
404f1b9ceJeGVaPNIENm2FkK0AgEOQ xen/include/asm-x86/x86_64/current.h
404f1b9fl6AQ_a-T1TDK3fuwTPXmHw xen/include/asm-x86/x86_64/desc.h
404f1badfXZJZ2sU8sh9PS2EZvd19Q xen/include/asm-x86/x86_64/ldt.h
404f1bb1LSCqrMDSfRAti5NdMQPJBQ xen/include/asm-x86/x86_64/page.h
-404f1bb41Yl-5ZjIWnG66HDCj6OIWA xen/include/asm-x86/x86_64/pda.h
404f1bb756fZfxk5HDx7J7BW3R-1jQ xen/include/asm-x86/x86_64/processor.h
404f1bb86rAXB3aLS1vYdcqpJiEcyg xen/include/asm-x86/x86_64/ptrace.h
404f1bc4tWkB9Qr8RkKtZGW5eMQzhw xen/include/asm-x86/x86_64/uaccess.h
400304fcmRQmDdFYEzDh0wcBba9alg xen/include/hypervisor-ifs/COPYING
-404f1bc68SXxmv0zQpXBWGrCzSyp8w xen/include/hypervisor-ifs/arch-x86/hypervisor-if.h
-404f1bc7IwU-qnH8mJeVu0YsNGMrcw xen/include/hypervisor-ifs/arch-x86_64/hypervisor-if.h
+404f1bc68SXxmv0zQpXBWGrCzSyp8w xen/include/hypervisor-ifs/arch-x86_32.h
+404f1bc7IwU-qnH8mJeVu0YsNGMrcw xen/include/hypervisor-ifs/arch-x86_64.h
3ddb79c2PMeWTK86y4C3F4MzHw4A1g xen/include/hypervisor-ifs/dom0_ops.h
403cd194j2pyLqXD8FJ-ukvZzkPenw xen/include/hypervisor-ifs/event_channel.h
3ddb79c25UE59iu4JJcbRalx95mvcg xen/include/hypervisor-ifs/hypervisor-if.h
diff --git a/linux-2.4.26-xen-sparse/arch/xen/Makefile b/linux-2.4.26-xen-sparse/arch/xen/Makefile
index 8e2225d13a..a8c7def633 100644
--- a/linux-2.4.26-xen-sparse/arch/xen/Makefile
+++ b/linux-2.4.26-xen-sparse/arch/xen/Makefile
@@ -115,9 +115,6 @@ archclean:
@$(MAKEBOOT) clean
archmrproper:
- rm -f include/asm-xen/hypervisor-ifs/arch
archdep:
- rm -f include/asm-xen/hypervisor-ifs/arch
- ( cd include/asm-xen/hypervisor-ifs ; rm -rf arch ; ln -sf arch-x86 arch)
@$(MAKEBOOT) dep
diff --git a/xen/Makefile b/xen/Makefile
index f149ad8ba6..646a91eb9f 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -41,10 +41,9 @@ $(TARGET): delete-unfresh-files make-links $(GENERATED_FILES)
make-links: delete-links
ln -sf asm-$(TARGET_ARCH) include/asm
- ln -sf arch-$(TARGET_ARCH) include/hypervisor-ifs/arch
delete-links:
- rm -f include/asm include/hypervisor-ifs/arch
+ rm -f include/asm
# Blow away kernel.o because build info is stored statically within it.
delete-unfresh-files:
diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index ea108159b6..744ce6da26 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -13,7 +13,7 @@ LOAD_BASE := 0x00100000
CFLAGS := -nostdinc -fno-builtin -fno-common -fno-strict-aliasing -O3
CFLAGS += -iwithprefix include -Wall -Werror -DMONITOR_BASE=$(MONITOR_BASE)
CFLAGS += -fomit-frame-pointer -I$(BASEDIR)/include -D__KERNEL__
-CFLAGS += -Wno-pointer-arith -Wredundant-decls -D$(TARGET_SUBARCH)
+CFLAGS += -Wno-pointer-arith -Wredundant-decls
LDFLAGS := -T xen.lds -N
@@ -24,5 +24,5 @@ endif
ifeq ($(TARGET_SUBARCH),x86_64)
CFLAGS += -m64
-LDARCHFLAGS :=
+LDARCHFLAGS := --oformat elf64-x86-64
endif
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 57c99aba62..d5174df23a 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -103,10 +103,10 @@ void __init paging_init(void)
mk_l2_pgentry(__pa(ioremap_pt) | __PAGE_HYPERVISOR);
/* Create read-only mapping of MPT for guest-OS use. */
- idle_pg_table[READONLY_MPT_VIRT_START >> L2_PAGETABLE_SHIFT] =
+ idle_pg_table[RO_MPT_VIRT_START >> L2_PAGETABLE_SHIFT] =
idle_pg_table[RDWR_MPT_VIRT_START >> L2_PAGETABLE_SHIFT];
mk_l2_readonly(idle_pg_table +
- (READONLY_MPT_VIRT_START >> L2_PAGETABLE_SHIFT));
+ (RO_MPT_VIRT_START >> L2_PAGETABLE_SHIFT));
/* Set up mapping cache for domain pages. */
mapcache = (unsigned long *)get_free_page(GFP_KERNEL);
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 9bad3e1cdf..f42d24655b 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -19,7 +19,7 @@
#include <asm/i387.h>
#include <xen/shadow.h>
-#ifdef CONFIG_X86_64BITMODE
+#if defined(__x86_64__)
#define ELFSIZE 64
#else
#define ELFSIZE 32
diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h
index 309cfed5e0..f9f153323c 100644
--- a/xen/include/asm-x86/config.h
+++ b/xen/include/asm-x86/config.h
@@ -43,29 +43,131 @@
#define CONFIG_XEN_ATTENTION_KEY 1
-
#define HZ 100
/*
* Just to keep compiler happy.
* NB. DO NOT CHANGE SMP_CACHE_BYTES WITHOUT FIXING arch/i386/entry.S!!!
* It depends on size of irq_cpustat_t, for example, being 64 bytes. :-)
- * Mmmm... so niiiiiice....
*/
#define SMP_CACHE_BYTES 64
#define NR_CPUS 16
#define __cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
#define ____cacheline_aligned __cacheline_aligned
-/*** Hypervisor owns top 64MB of virtual address space. ***/
+/*
+ * Amount of slack domain memory to leave in system, in megabytes.
+ * Prevents a hard out-of-memory crunch for things like network receive.
+ */
+#define SLACK_DOMAIN_MEM_KILOBYTES 2048
+
+/* Linkage for x86 */
+#define FASTCALL(x) x __attribute__((regparm(3)))
+#define asmlinkage __attribute__((regparm(0)))
+#define __ALIGN .align 16,0x90
+#define __ALIGN_STR ".align 16,0x90"
+#define SYMBOL_NAME_STR(X) #X
+#define SYMBOL_NAME(X) X
+#define SYMBOL_NAME_LABEL(X) X##:
+#ifdef __ASSEMBLY__
+#define ALIGN __ALIGN
+#define ALIGN_STR __ALIGN_STR
+#define ENTRY(name) \
+ .globl SYMBOL_NAME(name); \
+ ALIGN; \
+ SYMBOL_NAME_LABEL(name)
+#endif
+
+#define barrier() __asm__ __volatile__("": : :"memory")
+
+#define NR_syscalls 256
+
+#ifndef NDEBUG
+#define MEMORY_GUARD
+#endif
+
+#ifndef __ASSEMBLY__
+extern unsigned long _end; /* standard ELF symbol */
+extern void __out_of_line_bug(int line) __attribute__((noreturn));
+#define out_of_line_bug() __out_of_line_bug(__LINE__)
+#endif /* __ASSEMBLY__ */
+
+#if defined(__x86_64__)
+
+#define PML4_ENTRY_BITS 39
+#define PML4_ENTRY_BYTES (1<<PML4_ENTRY_BITS)
+
+/*
+ * Memory layout:
+ * 0x0000000000000000 - 0x00007fffffffffff [128TB, 2^47 bytes, PML4:0-255]
+ * Guest-defined use.
+ * 0x0000800000000000 - 0xffff7fffffffffff [16EB]
+ * Inaccessible: current arch only supports 48-bit sign-extended VAs.
+ * 0xffff800000000000 - 0xffff803fffffffff [256GB, 2^38 bytes, PML4:256]
+ * Read-only machine-to-phys translation table (GUEST ACCESSIBLE).
+ * 0xffff804000000000 - 0xffff807fffffffff [256GB, 2^38 bytes, PML4:256]
+ * Reserved for future shared info with the guest OS (GUEST ACCESSIBLE).
+ * 0xffff808000000000 - 0xffff80ffffffffff [512GB, 2^39 bytes, PML4:257]
+ * Read-only guest linear page table (GUEST ACCESSIBLE).
+ * 0xffff810000000000 - 0xffff817fffffffff [512GB, 2^39 bytes, PML4:258]
+ * Guest linear page table.
+ * 0xffff818000000000 - 0xffff81ffffffffff [512GB, 2^39 bytes, PML4:259]
+ * Shadow linear page table.
+ * 0xffff820000000000 - 0xffff827fffffffff [512GB, 2^39 bytes, PML4:260]
+ * Per-domain mappings (e.g., GDT, LDT).
+ * 0xffff828000000000 - 0xffff8287ffffffff [512GB, 2^39 bytes, PML4:261]
+ * Reserved for future use.
+ * 0xffff830000000000 - 0xffff83ffffffffff [1TB, 2^40 bytes, PML4:262-263]
+ * 1:1 direct mapping of all physical memory. Xen and its heap live here.
+ * 0xffff840000000000 - 0xffff87ffffffffff [4TB, 2^42 bytes, PML4:264-271]
+ * Reserved for future use.
+ * 0xffff880000000000 - 0xffffffffffffffff [120TB, PML4:272-511]
+ * Guest-defined use.
+ */
+
+/* Hypervisor reserves PML4 slots 256 to 271 inclusive. */
+#define HYPERVISOR_VIRT_START (0xFFFF800000000000UL)
+#define HYPERVISOR_VIRT_END (0xFFFF880000000000UL)
+/* Slot 256: read-only guest-accessible machine-to-phys translation table. */
+#define RO_MPT_VIRT_START (HYPERVISOR_VIRT_START)
+#define RO_MPT_VIRT_END (RO_MPT_VIRT_START + PML4_ENTRY_BYTES/2)
+/* Slot 257: read-only guest-accessible linear page table. */
+#define RO_LINEAR_PT_VIRT_START (RO_MPT_VIRT_END + PML4_ENTRY_BYTES/2)
+#define RO_LINEAR_PT_VIRT_END (RO_LINEAR_PT_VIRT_START + PML4_ENTRY_BYTES)
+/* Slot 258: linear page table (guest table). */
+#define LINEAR_PT_VIRT_START (RO_LINEAR_PT_VIRT_END)
+#define LINEAR_PT_VIRT_END (LINEAR_PT_VIRT_START + PML4_ENTRY_BYTES)
+/* Slot 259: linear page table (shadow table). */
+#define SH_LINEAR_PT_VIRT_START (LINEAR_PT_VIRT_END)
+#define SH_LINEAR_PT_VIRT_END (SH_LINEAR_PT_VIRT_START + PML4_ENTRY_BYTES)
+/* Slot 260: per-domain mappings. */
+#define PERDOMAIN_VIRT_START (SH_LINEAR_PT_VIRT_END)
+#define PERDOMAIN_VIRT_END (PERDOMAIN_VIRT_START + PML4_ENTRY_BYTES)
+/* Slot 262-263: A direct 1:1 mapping of all of physical memory. */
+#define DIRECTMAP_VIRT_START (PERDOMAIN_VIRT_END + PML4_ENTRY_BYTES)
+#define DIRECTMAP_VIRT_END (DIRECTMAP_VIRT_START + PML4_ENTRY_BYTES*2)
+
+#define PGT_base_page_table PGT_l4_page_table
+
+#define __HYPERVISOR_CS64 0x0810
+#define __HYPERVISOR_CS32 0x0808
+#define __HYPERVISOR_DS 0x0818
+
+/* For generic assembly code: use macros to define operation/operand sizes. */
+#define __OS "q" /* Operation Suffix */
+#define __OP "r" /* Operand Prefix */
+
+#elif defined(__i386__)
+
+/* Hypervisor owns top 64MB of virtual address space. */
#define HYPERVISOR_VIRT_START (0xFC000000UL)
/*
* First 4MB are mapped read-only for all. It's for the machine->physical
* mapping table (MPT table). The following are virtual addresses.
*/
-#define READONLY_MPT_VIRT_START (HYPERVISOR_VIRT_START)
-#define READONLY_MPT_VIRT_END (READONLY_MPT_VIRT_START + (4*1024*1024))
+#define RO_MPT_VIRT_START (HYPERVISOR_VIRT_START)
+#define RO_MPT_VIRT_END (RO_MPT_VIRT_START + (4*1024*1024))
/*
* Next 12MB is fixed monitor space, which is part of a 40MB direct-mapped
* memory region. The following are machine addresses.
@@ -73,7 +175,7 @@
#define MAX_MONITOR_ADDRESS (12*1024*1024)
#define MAX_DIRECTMAP_ADDRESS (40*1024*1024)
/* And the virtual addresses for the direct-map region... */
-#define DIRECTMAP_VIRT_START (READONLY_MPT_VIRT_END)
+#define DIRECTMAP_VIRT_START (RO_MPT_VIRT_END)
#define DIRECTMAP_VIRT_END (DIRECTMAP_VIRT_START + MAX_DIRECTMAP_ADDRESS)
#define MONITOR_VIRT_START (DIRECTMAP_VIRT_START)
#define MONITOR_VIRT_END (MONITOR_VIRT_START + MAX_MONITOR_ADDRESS)
@@ -101,50 +203,15 @@
#define IOREMAP_VIRT_START (MAPCACHE_VIRT_END)
#define IOREMAP_VIRT_END (IOREMAP_VIRT_START + (4*1024*1024))
-/*
- * Amount of slack domain memory to leave in system, in megabytes.
- * Prevents a hard out-of-memory crunch for thinsg like network receive.
- */
-#define SLACK_DOMAIN_MEM_KILOBYTES 2048
-
-/* Linkage for x86 */
-#define FASTCALL(x) x __attribute__((regparm(3)))
-#define asmlinkage __attribute__((regparm(0)))
-#define __ALIGN .align 16,0x90
-#define __ALIGN_STR ".align 16,0x90"
-#define SYMBOL_NAME_STR(X) #X
-#define SYMBOL_NAME(X) X
-#define SYMBOL_NAME_LABEL(X) X##:
-#ifdef __ASSEMBLY__
-#define ALIGN __ALIGN
-#define ALIGN_STR __ALIGN_STR
-#define ENTRY(name) \
- .globl SYMBOL_NAME(name); \
- ALIGN; \
- SYMBOL_NAME_LABEL(name)
-#endif
-
#define PGT_base_page_table PGT_l2_page_table
-#define barrier() __asm__ __volatile__("": : :"memory")
-
#define __HYPERVISOR_CS 0x0808
#define __HYPERVISOR_DS 0x0810
-#define NR_syscalls 256
-
-#ifndef NDEBUG
-#define MEMORY_GUARD
-#endif
-
-#ifndef __ASSEMBLY__
-extern unsigned long _end; /* standard ELF symbol */
-extern void __out_of_line_bug(int line) __attribute__((noreturn));
-#define out_of_line_bug() __out_of_line_bug(__LINE__)
-#endif /* __ASSEMBLY__ */
-
/* For generic assembly code: use macros to define operation/operand sizes. */
#define __OS "l" /* Operation Suffix */
#define __OP "e" /* Operand Prefix */
+#endif /* __i386__ */
+
#endif /* __XEN_I386_CONFIG_H__ */
diff --git a/xen/include/asm-x86/msr.h b/xen/include/asm-x86/msr.h
index 2a938479b9..b66ccd2ff7 100644
--- a/xen/include/asm-x86/msr.h
+++ b/xen/include/asm-x86/msr.h
@@ -30,10 +30,10 @@
#define rdtscl(low) \
__asm__ __volatile__("rdtsc" : "=a" (low) : : "edx")
-#ifdef x86_32
+#if defined(__i386__)
#define rdtscll(val) \
__asm__ __volatile__("rdtsc" : "=A" (val))
-#else
+#elif defined(__x86_64__)
#define rdtscll(val) do { \
unsigned int a,d; \
asm volatile("rdtsc" : "=a" (a), "=d" (d)); \
diff --git a/xen/include/asm-x86/x86_64/pda.h b/xen/include/asm-x86/pda.h
index b9ca345ee4..b9ca345ee4 100644
--- a/xen/include/asm-x86/x86_64/pda.h
+++ b/xen/include/asm-x86/pda.h
diff --git a/xen/include/asm-x86/smp.h b/xen/include/asm-x86/smp.h
index 8d8bdcd06f..ac9cc5292f 100644
--- a/xen/include/asm-x86/smp.h
+++ b/xen/include/asm-x86/smp.h
@@ -81,9 +81,9 @@ extern void smp_store_cpu_info(int id); /* Store per CPU info (like the initial
* so this is correct in the x86 case.
*/
-#ifdef x86_32
+#if defined(__i386__)
#define smp_processor_id() (current->processor)
-#else
+#elif defined(__x86_64__)
#include <asm/pda.h>
#define smp_processor_id() read_pda(cpunumber)
#endif
diff --git a/xen/include/asm-x86/string.h b/xen/include/asm-x86/string.h
index bef20a71d5..3944789251 100644
--- a/xen/include/asm-x86/string.h
+++ b/xen/include/asm-x86/string.h
@@ -335,6 +335,7 @@ __asm__ __volatile__(
return dest;
}
+#define __HAVE_ARCH_MEMCMP
#define memcmp __builtin_memcmp
#define __HAVE_ARCH_MEMCHR
diff --git a/xen/include/asm-x86/system.h b/xen/include/asm-x86/system.h
index 4b787e6830..b15499cce8 100644
--- a/xen/include/asm-x86/system.h
+++ b/xen/include/asm-x86/system.h
@@ -47,14 +47,14 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
:"m" (*__xg(ptr)), "0" (x)
:"memory");
break;
-#ifdef x86_32
+#if defined(__i386__)
case 4:
__asm__ __volatile__("xchgl %0,%1"
:"=r" (x)
:"m" (*__xg(ptr)), "0" (x)
:"memory");
break;
-#else
+#elif defined(__x86_64__)
case 4:
__asm__ __volatile__("xchgl %k0,%1"
:"=r" (x)
@@ -95,14 +95,14 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
: "q"(new), "m"(*__xg(ptr)), "0"(old)
: "memory");
return prev;
-#ifdef x86_32
+#if defined(__i386__)
case 4:
__asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2"
: "=a"(prev)
: "q"(new), "m"(*__xg(ptr)), "0"(old)
: "memory");
return prev;
-#else
+#elif defined(__x86_64__)
case 4:
__asm__ __volatile__(LOCK_PREFIX "cmpxchgl %k1,%2"
: "=a"(prev)
@@ -192,12 +192,12 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
#define set_wmb(var, value) do { var = value; wmb(); } while (0)
/* interrupt control.. */
-#ifdef x86_64
-#define __save_flags(x) do { warn_if_not_ulong(x); __asm__ __volatile__("# save_flags \n\t pushfq ; popq %q0":"=g" (x): /* no input */ :"memory"); } while (0)
-#define __restore_flags(x) __asm__ __volatile__("# restore_flags \n\t pushq %0 ; popfq": /* no output */ :"g" (x):"memory", "cc")
-#else
+#if defined(__i386__)
#define __save_flags(x) __asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */)
#define __restore_flags(x) __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory", "cc")
+#elif defined(__x86_64__)
+#define __save_flags(x) do { __asm__ __volatile__("# save_flags \n\t pushfq ; popq %q0":"=g" (x): /* no input */ :"memory"); } while (0)
+#define __restore_flags(x) __asm__ __volatile__("# restore_flags \n\t pushq %0 ; popfq": /* no output */ :"g" (x):"memory", "cc")
#endif
#define __cli() __asm__ __volatile__("cli": : :"memory")
#define __sti() __asm__ __volatile__("sti": : :"memory")
@@ -205,12 +205,12 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
#define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory")
/* For spinlocks etc */
-#ifdef x86_64
-#define local_irq_save(x) do { warn_if_not_ulong(x); __asm__ __volatile__("# local_irq_save \n\t pushfq ; popq %0 ; cli":"=g" (x): /* no input */ :"memory"); } while (0)
-#define local_irq_restore(x) __asm__ __volatile__("# local_irq_restore \n\t pushq %0 ; popfq": /* no output */ :"g" (x):"memory")
-#else
+#if defined(__i386__)
#define local_irq_save(x) __asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (x): /* no input */ :"memory")
#define local_irq_restore(x) __restore_flags(x)
+#elif defined(__x86_64__)
+#define local_irq_save(x) do { __asm__ __volatile__("# local_irq_save \n\t pushfq ; popq %0 ; cli":"=g" (x): /* no input */ :"memory"); } while (0)
+#define local_irq_restore(x) __asm__ __volatile__("# local_irq_restore \n\t pushq %0 ; popfq": /* no output */ :"g" (x):"memory")
#endif
#define local_irq_disable() __cli()
#define local_irq_enable() __sti()
diff --git a/xen/include/asm-x86/types.h b/xen/include/asm-x86/types.h
index adb63db4d1..0b4b616b24 100644
--- a/xen/include/asm-x86/types.h
+++ b/xen/include/asm-x86/types.h
@@ -20,10 +20,10 @@ typedef __signed__ int __s32;
typedef unsigned int __u32;
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-#ifdef x86_32
+#if defined(__i386__)
typedef __signed__ long long __s64;
typedef unsigned long long __u64;
-#else
+#elif defined(__x86_64__)
typedef __signed__ long __s64;
typedef unsigned long __u64;
#endif
@@ -40,11 +40,11 @@ typedef unsigned short u16;
typedef signed int s32;
typedef unsigned int u32;
-#ifdef x86_32
+#if defined(__i386__)
typedef signed long long s64;
typedef unsigned long long u64;
#define BITS_PER_LONG 32
-#else
+#elif defined(__x86_64__)
typedef signed long s64;
typedef unsigned long u64;
#define BITS_PER_LONG 64
diff --git a/xen/include/asm-x86/x86_64/config.h b/xen/include/asm-x86/x86_64/config.h
deleted file mode 100644
index 5a0acabf2a..0000000000
--- a/xen/include/asm-x86/x86_64/config.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/******************************************************************************
- * config.h
- *
- * A Linux-style configuration list.
- *
- */
-
-#ifndef __XEN_X86_64_CONFIG_H__
-#define __XEN_X86_64_CONFIG_H__
-
-#define CONFIG_X86 1
-#define CONFIG_X86_64BITMODE 1
-
-#define CONFIG_SMP 1
-#define CONFIG_X86_LOCAL_APIC 1
-#define CONFIG_X86_IO_APIC 1
-#define CONFIG_X86_L1_CACHE_SHIFT 5
-
-#define CONFIG_PCI 1
-#define CONFIG_PCI_BIOS 1
-#define CONFIG_PCI_DIRECT 1
-
-#define CONFIG_IDE 1
-#define CONFIG_BLK_DEV_IDE 1
-#define CONFIG_BLK_DEV_IDEDMA 1
-#define CONFIG_BLK_DEV_IDEPCI 1
-#define CONFIG_IDEDISK_MULTI_MODE 1
-#define CONFIG_IDEDISK_STROKE 1
-#define CONFIG_IDEPCI_SHARE_IRQ 1
-#define CONFIG_BLK_DEV_IDEDMA_PCI 1
-#define CONFIG_IDEDMA_PCI_AUTO 1
-#define CONFIG_IDEDMA_AUTO 1
-#define CONFIG_IDEDMA_ONLYDISK 1
-#define CONFIG_BLK_DEV_IDE_MODES 1
-#define CONFIG_BLK_DEV_PIIX 1
-
-#define CONFIG_SCSI 1
-#define CONFIG_SCSI_LOGGING 1
-#define CONFIG_BLK_DEV_SD 1
-#define CONFIG_SD_EXTRA_DEVS 40
-#define CONFIG_SCSI_MULTI_LUN 1
-
-#define CONFIG_XEN_ATTENTION_KEY 1
-
-#define HZ 100
-
-/*
- * Just to keep compiler happy.
- * NB. DO NOT CHANGE SMP_CACHE_BYTES WITHOUT FIXING arch/i386/entry.S!!!
- * It depends on size of irq_cpustat_t, for example, being 64 bytes. :-)
- * Mmmm... so niiiiiice....
- */
-#define SMP_CACHE_BYTES 64
-#define NR_CPUS 16
-#define __cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
-#define ____cacheline_aligned __cacheline_aligned
-
-#define PHYSICAL_ADDRESS_BITS 52
-#define MAX_PHYSICAL_ADDRESS (1 << PHYSICAL_ADDRESS_BITS)
-#define VIRTUAL_ADDRESS_BITS 48
-#define XEN_PAGE_SIZE 4096
-
-#define PTE_SIZE 8
-#define TOTAL_PTES (512ULL * 512 * 512 * 512)
-
-/* next PML4 from an _END address */
-#define PML4_BITS 39
-#define PML4_SPACE (1ULL << PML4_BITS)
-
-/*
- * Memory layout
- *
- * 0x0000000000000000 - 0x00007fffffffffff Guest & user apps (128TB)
- * (Only for 32-bit guests)
- * 0x00000000fc000000 - 0x00000000fc3fffff Machine/Physical 32-bit shadow (4MB)
- * 0x00000000fc400000 - 0x00000000feffffff IO remap for 32-bit guests (44MB)
- * 0x00000000ff000000 - 0x00000000ff3fffff 32-bit PTE shadow (4MB)
- *
- * 0xffff800000000000 - 0xffff807fffffffff Linear page table (512GB)
- * 0xffff808000000000 - 0xffff80ffffffffff Reserved for shadow page table (512GB)
- *
- * 0xffff810000000000 - 0xffff82ffffffffff Xen PML4 slots
- * 0xffff810000000000 - 0xffff81003fffffff Xen hypervisor virtual space (1GB)
- * 0xffff810040000000 - 0xffff81807fffffff Per-domain mappings (1GB)
- * 0xffff810080000000 - 0xffff81387fffffff R/O physical map (224GB)
- * 0xffff813880000000 - 0xffff81707fffffff R/W physical map (224GB)
- * 0xffff817080000000 - 0xffff82c07fffffff Frame table (1344GB)
- * 0xffff82c080000000 - 0xffff82c0bfffffff I/O remap space (1GB)
- * 0xffff82c0c0000000 - 0xffff82ffffffffff (253GB)
- *
- * 0xffff830000000000 - 0xffff87ffffffffff RESERVED (5TB)
- *
- * 0xffff880000000000 - ... Physical 1:1 direct mapping (112TB max)
- * 0xffff880000000000 - 0xffff880001000000 Low memory DMA region (16M)
- *
- * 0xfffff80000000000 - 0xffffffffffffffff Reserved for guest (8TB)
- *
- * The requirement that we have a 1:1 map of physical memory limits
- * the maximum memory size we can support. With only 48 virtual address
- * bits, and the assumption that guests will run users in positive address
- * space, a contiguous 1:1 map can only live in the negative address space.
- * Since we don't want to bump guests out of the very top of memory and
- * force relocation, we can't use this entire space, and Xen has several
- * heavy mapping that require PML4 slices. Just to be safe, we reserve
- * 16 PML4s each for Xen and the guest. 224 PML4s give us 112 terabytes
- * of addressable memory. Any high device physical addresses beyond this
- * region can be mapped into the IO remap space or some of the reserved
- * 6TB region.
- *
- * 112 TB is just 16 TB shy of the maximum physical memory supported
- * on Linux 2.6.0, and should be enough for anybody.
- *
- * There are some additional constraints in the memory layout that require
- * several changes from the i386 architecture.
- *
- * ACPI data and ACPI non-volatile storage must be placed in some region
- * of memory below the 4GB mark. Depending on the BIOS and system, we
- * may have this located as low as 1GB. This means allocating large
- * chunks of physically contiguous memory from the direct mapping may not
- * be possible.
- *
- * The full frame table for 112TB of physical memory currently occupies
- * 1344GB space. This clearly can not be allocated in physically contiguous
- * space, so it must be moved to a virtual address.
- *
- * Both copies of the machine->physical table must also be relocated.
- * (112 TB / 4k) * 8 bytes means that each copy of the physical map requires
- * 224GB of space, thus it also must move to VM space.
- *
- * The physical pages used to allocate the page tables for the direct 1:1
- * map may occupy (112TB / 2M) * 8 bytes = 448MB. This is almost guaranteed
- * to fit in contiguous physical memory, but these pages used to be allocated
- * in the Xen monitor address space. This means the Xen address space must
- * accomodate up to ~500 MB, which means it also must move out of the
- * direct mapped region.
- *
- * Since both copies of the MPT, the frame table, and Xen now exist in
- * purely virtual space, we have the added advantage of being able to
- * map them to local pages on NUMA machines, or use NUMA aware memory
- * allocation within Xen itself.
- *
- * Additionally, the 1:1 page table now exists contiguously in virtual
- * space, but may be mapped to physically separated pages, allowing
- * each node to contain the page tables for its own local memory. Setting
- * up this mapping presents a bit of a chicken-egg problem, but is possible
- * as a future enhancement.
- *
- * Zachary Amsden (zamsden@cisco.com)
- *
- */
-
-/* Guest and user space */
-#define NSPACE_VIRT_START 0
-#define NSPACE_VIRT_END (1ULL << (VIRTUAL_ADDRESS_BITS - 1))
-
-/* Priviledged space */
-#define ESPACE_VIRT_END 0
-#define ESPACE_VIRT_START (ESPACE_VIRT_END-(1ULL << (VIRTUAL_ADDRESS_BITS-1)))
-
-/* reservations in e-space */
-#define GUEST_RESERVED_PML4S 16
-#define XEN_RESERVED_PML4S 16
-
-#define MAX_MEMORY_SIZE ((1ULL << (VIRTUAL_ADDRESS_BITS-1)) \
- -((GUEST_RESERVED_PML4S + XEN_RESERVED_PML4S) * PML4_SPACE))
-#define MAX_MEMORY_FRAMES (MAX_MEMORY_SIZE / XEN_PAGE_SIZE)
-
-/*
- * Virtual addresses beyond this are not modifiable by guest OSes.
- */
-#define HYPERVISOR_VIRT_START ESPACE_VIRT_START
-#define HYPERVISOR_VIRT_END (ESPACE_VIRT_END-(GUEST_RESERVED_PML4S * PML4_SPACE))
-
-/* First 512GB of virtual address space is used as a linear p.t. mapping. */
-#define LINEAR_PT_VIRT_START (HYPERVISOR_VIRT_START)
-#define LINEAR_PT_VIRT_END (LINEAR_PT_VIRT_START + (PTE_SIZE * TOTAL_PTES))
-
-/* Reserve some space for a shadow PT mapping */
-#define SHADOW_PT_VIRT_START (LINEAR_PT_VIRT_END)
-#define SHADOW_PT_VIRT_END (SHADOW_PT_VIRT_START + (PTE_SIZE * TOTAL_PTES))
-
-/* Xen exists in the first 1GB of the next PML4 space */
-#define MAX_MONITOR_ADDRESS (1 * 1024 * 1024 * 1024)
-#define MONITOR_VIRT_START (SHADOW_PT_VIRT_END)
-#define MONITOR_VIRT_END (MONITOR_VIRT_START + MAX_MONITOR_ADDRESS)
-
-/* Next 1GB of virtual address space used for per-domain mappings (eg. GDT). */
-#define PERDOMAIN_VIRT_START (MONITOR_VIRT_END)
-#define PERDOMAIN_VIRT_END (PERDOMAIN_VIRT_START + (512 * 512 * 4096))
-#define GDT_VIRT_START (PERDOMAIN_VIRT_START)
-#define GDT_VIRT_END (GDT_VIRT_START + (128*1024))
-#define LDT_VIRT_START (GDT_VIRT_END)
-#define LDT_VIRT_END (LDT_VIRT_START + (128*1024))
-
-/*
- * First set of MPTs are mapped read-only for all. It's for the machine->physical
- * mapping table (MPT table). The following are virtual addresses.
- */
-#define READONLY_MPT_VIRT_START (PERDOMAIN_VIRT_END)
-#define READONLY_MPT_VIRT_END (READONLY_MPT_VIRT_START + (PTE_SIZE * MAX_MEMORY_FRAMES))
-
-/* R/W machine->physical table */
-#define RDWR_MPT_VIRT_START (READONLY_MPT_VIRT_END)
-#define RDWR_MPT_VIRT_END (RDWR_MPT_VIRT_START + (PTE_SIZE * MAX_MEMORY_FRAMES))
-
-/* Frame table */
-#define FRAMETABLE_ENTRY_SIZE (48)
-#define FRAMETABLE_VIRT_START (RDWR_MPT_VIRT_END)
-#define FRAMETABLE_VIRT_END (FRAMETABLE_VIRT_START + (FRAMETABLE_ENTRY_SIZE * MAX_MEMORY_FRAMES))
-
-/* Next 1GB of virtual address space used for ioremap(). */
-#define IOREMAP_VIRT_START (FRAMETABLE_VIRT_END)
-#define IOREMAP_VIRT_END (IOREMAP_VIRT_START + (512 * 512 * 4096))
-
-/* And the virtual addresses for the direct-map region... */
-#define DIRECTMAP_VIRT_START (ESPACE_VIRT_START + (XEN_RESERVED_PML4S * PML4_SPACE))
-#define DIRECTMAP_VIRT_END (DIRECTMAP_VIRT_START + MAX_DIRECTMAP_ADDRESS)
-
-/*
- * Next is the direct-mapped memory region. The following are machine addresses.
- */
-#define MAX_DMA_ADDRESS (16*1024*1024)
-#define MAX_DIRECTMAP_ADDRESS MAX_MEMORY_SIZE
-
-
-
-/*
- * Amount of slack domain memory to leave in system, in kilobytes.
- * Prevents a hard out-of-memory crunch for thinsg like network receive.
- */
-#define SLACK_DOMAIN_MEM_KILOBYTES 2048
-
-
-/*
- * These will probably change in the future..
- * locations for 32-bit guest compatibility mappings
- */
-
-/* 4M of 32-bit machine-physical shadow in low 4G of VM space */
-#define SHADOW_MPT32_VIRT_START (0xfc000000)
-#define SHADOW_MPT32_VIRT_END (SHADOW_MPT32_VIRT_START + (4 * 1024 * 1024))
-
-/* 44M of I/O remap for 32-bit drivers */
-#define IOREMAP_LOW_VIRT_START (SHADOW_MPT32_VIRT_END)
-#define IOREMAP_LOW_VIRT_END (IOREMAP_LOW_VIRT_START + (44 * 1024 * 1024))
-
-/* 4M of 32-bit page table */
-#define SHADOW_PT32_VIRT_START (IOREMAP_LOW_VIRT_END)
-#define SHADOW_PT32_VIRT_END (SHADOW_PT32_VIRT_START + (4 * 1024 * 1024))
-
-
-/* Linkage for x86 */
-#define FASTCALL(x) x __attribute__((regparm(3)))
-#define asmlinkage __attribute__((regparm(0)))
-#define __ALIGN .align 16,0x90
-#define __ALIGN_STR ".align 16,0x90"
-#define SYMBOL_NAME_STR(X) #X
-#define SYMBOL_NAME(X) X
-#define SYMBOL_NAME_LABEL(X) X##:
-#ifdef __ASSEMBLY__
-#define ALIGN __ALIGN
-#define ALIGN_STR __ALIGN_STR
-#define ENTRY(name) \
- .globl SYMBOL_NAME(name); \
- ALIGN; \
- SYMBOL_NAME_LABEL(name)
-#endif
-
-#define PGT_base_page_table PGT_l4_page_table
-
-#define barrier() __asm__ __volatile__("": : :"memory")
-
-/*
- * Hypervisor segment selectors
- */
-#define __HYPERVISOR_CS64 0x0810
-#define __HYPERVISOR_CS32 0x0808
-#define __HYPERVISOR_DS 0x0818
-
-#define NR_syscalls 256
-
-#ifndef NDEBUG
-#define MEMORY_GUARD
-#endif
-
-#ifndef __ASSEMBLY__
-extern unsigned long _end; /* standard ELF symbol */
-extern void __out_of_line_bug(int line) __attribute__((noreturn));
-#define out_of_line_bug() __out_of_line_bug(__LINE__)
-#endif /* __ASSEMBLY__ */
-
-#endif /* __XEN_X86_64_CONFIG_H__ */
diff --git a/xen/include/hypervisor-ifs/arch-x86/hypervisor-if.h b/xen/include/hypervisor-ifs/arch-x86_32.h
index 80055a5062..80055a5062 100644
--- a/xen/include/hypervisor-ifs/arch-x86/hypervisor-if.h
+++ b/xen/include/hypervisor-ifs/arch-x86_32.h
diff --git a/xen/include/hypervisor-ifs/arch-x86_64/hypervisor-if.h b/xen/include/hypervisor-ifs/arch-x86_64.h
index 9eb578b781..701084cec6 100644
--- a/xen/include/hypervisor-ifs/arch-x86_64/hypervisor-if.h
+++ b/xen/include/hypervisor-ifs/arch-x86_64.h
@@ -8,7 +8,8 @@
#define __HYPERVISOR_IF_X86_64_H__
/* Pointers are naturally 64 bits in this architecture; no padding needed. */
-#define MEMORY_PADDING() ((void)0)
+#define _MEMORY_PADDING(_X)
+#define MEMORY_PADDING
/*
* SEGMENT DESCRIPTOR TABLES
diff --git a/xen/include/hypervisor-ifs/hypervisor-if.h b/xen/include/hypervisor-ifs/hypervisor-if.h
index 6765b72cb4..00d591d922 100644
--- a/xen/include/hypervisor-ifs/hypervisor-if.h
+++ b/xen/include/hypervisor-ifs/hypervisor-if.h
@@ -10,7 +10,13 @@
/* GCC-specific way to pack structure definitions (no implicit padding). */
#define PACKED __attribute__ ((packed))
-#include "arch/hypervisor-if.h"
+#if defined(__i386__)
+#include "arch-x86_32.h"
+#elif defined(__x86_64__)
+#include "arch-x86_64.h"
+#else
+#error "Unsupported architecture"
+#endif
/*
* HYPERVISOR "SYSTEM CALLS"