aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/boot/head.S
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2012-09-11 16:03:38 +0200
committerJan Beulich <jbeulich@suse.com>2012-09-11 16:03:38 +0200
commita495404575be41b26d86464b1ecc33c4a0d4b90f (patch)
tree5e5a204ec2ab57ee690eb90f4e07f7573df111f5 /xen/arch/x86/boot/head.S
parente46ea4d44dc0929d9e15dcde5c13b569278970d2 (diff)
downloadxen-a495404575be41b26d86464b1ecc33c4a0d4b90f.tar.gz
xen-a495404575be41b26d86464b1ecc33c4a0d4b90f.tar.bz2
xen-a495404575be41b26d86464b1ecc33c4a0d4b90f.zip
x86: construct static part of 1:1 mapping at build time
... rather than at boot time, removing unnecessary redundancy between EFI and legacy boot code. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/boot/head.S')
-rw-r--r--xen/arch/x86/boot/head.S74
1 files changed, 25 insertions, 49 deletions
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 5d2ca4ebc0..23d0d48bf5 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -124,14 +124,11 @@ __start:
bt $29,%edx
jnc bad_cpu
/* Initialise L2 identity-map and xen page table entries (16MB). */
- mov $sym_phys(l2_identmap),%edi
mov $sym_phys(l2_xenmap),%esi
mov $sym_phys(l2_bootmap),%edx
mov $0x1e3,%eax /* PRESENT+RW+A+D+2MB+GLOBAL */
mov $8,%ecx
-1: mov %eax,(%edi)
- add $8,%edi
- mov %eax,(%esi)
+1: mov %eax,(%esi)
add $8,%esi
mov %eax,(%edx)
add $8,%edx
@@ -163,54 +160,11 @@ __start:
mov %eax,sym_phys(idle_pg_table) + l4_table_offset(DIRECTMAP_VIRT_START)*8
mov $(sym_phys(l3_xenmap)+7),%eax
mov %eax,sym_phys(idle_pg_table) + l4_table_offset(XEN_VIRT_START)*8
-#else
- /* Initialize low and high mappings of memory with 2MB pages */
- mov $sym_phys(idle_pg_table_l2),%edi
- mov $0xe3,%eax /* PRESENT+RW+A+D+2MB */
-1: mov %eax,__PAGE_OFFSET>>18(%edi) /* high mapping */
- stosl /* low mapping */
- add $4,%edi
- add $(1<<L2_PAGETABLE_SHIFT),%eax
- cmp $DIRECTMAP_PHYS_END+0xe3,%eax
- jne 1b
-1: stosl /* low mappings cover up to 16MB */
- add $4,%edi
- add $(1<<L2_PAGETABLE_SHIFT),%eax
- cmp $(16<<20)+0xe3,%eax
- jne 1b
- /* Initialise L2 fixmap page directory entry. */
- mov $(sym_phys(l1_fixmap)+7),%eax
- mov %eax,sym_phys(idle_pg_table_l2) + l2_table_offset(FIXADDR_TOP-1)*8
-#endif
-
- /* Initialize 4kB mappings of first 2MB or 4MB of memory. */
- mov $sym_phys(l1_identmap),%edi
- mov $0x263,%eax /* PRESENT+RW+A+D+SMALL_PAGES */
-#if defined(__x86_64__)
- or $0x100,%eax /* GLOBAL */
-#endif
- xor %ecx,%ecx
-1: stosl
- add $4,%edi
- add $PAGE_SIZE,%eax
- inc %ecx
- /* VGA hole (0xa0000-0xc0000) should be mapped UC. */
- cmp $0xa0,%ecx
- jne 2f
- or $0x10,%eax /* +PCD */
-2: cmp $0xc0,%ecx
- jne 2f
- and $~0x10,%eax /* -PCD */
-2: cmp $L1_PAGETABLE_ENTRIES,%ecx
- jne 1b
- sub $(PAGE_SIZE-0x63),%edi
-#if defined(__x86_64__)
+ /* Hook 4kB mappings of first 2MB of memory into L2. */
+ mov $sym_phys(l1_identmap)+__PAGE_HYPERVISOR,%edi
mov %edi,sym_phys(l2_identmap)
mov %edi,sym_phys(l2_xenmap)
mov %edi,sym_phys(l2_bootmap)
-#else
- mov %edi,sym_phys(idle_pg_table_l2)
- mov %edi,sym_phys(idle_pg_table_l2) + (__PAGE_OFFSET>>18)
#endif
/* Apply relocations to bootstrap trampoline. */
@@ -269,3 +223,25 @@ __high_start:
#else
#include "x86_32.S"
#endif
+
+ .section .data.page_aligned, "aw", @progbits
+ .p2align PAGE_SHIFT
+/*
+ * Mapping of first 2 megabytes of memory. This is mapped with 4kB mappings
+ * to avoid type conflicts with fixed-range MTRRs covering the lowest megabyte
+ * of physical memory. In any case the VGA hole should be mapped with type UC.
+ */
+ .globl l1_identmap
+l1_identmap:
+ pfn = 0
+ .rept L1_PAGETABLE_ENTRIES
+ /* VGA hole (0xa0000-0xc0000) should be mapped UC. */
+ .if pfn >= 0xa0 && pfn < 0xc0
+ .long (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR_NOCACHE | MAP_SMALL_PAGES
+ .else
+ .long (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR | MAP_SMALL_PAGES
+ .endif
+ .long 0
+ pfn = pfn + 1
+ .endr
+ .size l1_identmap, . - l1_identmap