Module Name:    src
Committed By:   bouyer
Date:           Thu Dec 22 16:29:05 UTC 2016

Modified Files:
        src/sys/arch/amd64/amd64: machdep.c
        src/sys/arch/i386/i386: machdep.c
        src/sys/arch/x86/x86: pmap.c

Log Message:
Xen doens't need lapic so don't allocate a lapic VA/PA for Xen.
As a side effect this makes XEN3PAE boot again but I don't know why ...


To generate a diff of this commit:
cvs rdiff -u -r1.241 -r1.242 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.771 -r1.772 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.234 -r1.235 src/sys/arch/x86/x86/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.241 src/sys/arch/amd64/amd64/machdep.c:1.242
--- src/sys/arch/amd64/amd64/machdep.c:1.241	Thu Dec 22 14:47:54 2016
+++ src/sys/arch/amd64/amd64/machdep.c	Thu Dec 22 16:29:05 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.241 2016/12/22 14:47:54 cherry Exp $	*/
+/*	$NetBSD: machdep.c,v 1.242 2016/12/22 16:29:05 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.241 2016/12/22 14:47:54 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.242 2016/12/22 16:29:05 bouyer Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -1543,11 +1543,11 @@ void
 init_x86_64(paddr_t first_avail)
 {
 	extern void consinit(void);
-	extern paddr_t local_apic_pa;
 	struct region_descriptor region;
 	struct mem_segment_descriptor *ldt_segp;
 	int x;
 #ifndef XEN
+	extern paddr_t local_apic_pa;
 	int ist;
 #endif
 
@@ -1640,10 +1640,12 @@ init_x86_64(paddr_t first_avail)
 
 	kpreempt_disable();
 
+#ifndef XEN
 	pmap_kenter_pa(local_apic_va, local_apic_pa,
 	    VM_PROT_READ|VM_PROT_WRITE, 0);
 	pmap_update(pmap_kernel());
 	memset((void *)local_apic_va, 0, PAGE_SIZE);
+#endif
 
 	pmap_kenter_pa(idt_vaddr, idt_paddr, VM_PROT_READ|VM_PROT_WRITE, 0);
 	pmap_kenter_pa(gdt_vaddr, gdt_paddr, VM_PROT_READ|VM_PROT_WRITE, 0);

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.771 src/sys/arch/i386/i386/machdep.c:1.772
--- src/sys/arch/i386/i386/machdep.c:1.771	Thu Dec 22 14:47:58 2016
+++ src/sys/arch/i386/i386/machdep.c	Thu Dec 22 16:29:05 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.771 2016/12/22 14:47:58 cherry Exp $	*/
+/*	$NetBSD: machdep.c,v 1.772 2016/12/22 16:29:05 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.771 2016/12/22 14:47:58 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.772 2016/12/22 16:29:05 bouyer Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -1137,9 +1137,9 @@ void
 init386(paddr_t first_avail)
 {
 	extern void consinit(void);
-	extern paddr_t local_apic_pa;
 	int x;
 #ifndef XEN
+	extern paddr_t local_apic_pa;
 	union descriptor *tgdt;
 	struct region_descriptor region;
 #endif
@@ -1305,10 +1305,12 @@ init386(paddr_t first_avail)
 	cpu_info_primary.ci_pmap = pmap_kernel();
 #endif
 
+#ifndef XEN
 	pmap_kenter_pa(local_apic_va, local_apic_pa,
 	    VM_PROT_READ|VM_PROT_WRITE, 0);
 	pmap_update(pmap_kernel());
 	memset((void *)local_apic_va, 0, PAGE_SIZE);
+#endif
 
 	pmap_kenter_pa(idt_vaddr, idt_paddr, VM_PROT_READ|VM_PROT_WRITE, 0);
 	pmap_kenter_pa(gdt_vaddr, gdt_paddr, VM_PROT_READ|VM_PROT_WRITE, 0);

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.234 src/sys/arch/x86/x86/pmap.c:1.235
--- src/sys/arch/x86/x86/pmap.c:1.234	Tue Dec 20 14:03:15 2016
+++ src/sys/arch/x86/x86/pmap.c	Thu Dec 22 16:29:05 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.234 2016/12/20 14:03:15 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.235 2016/12/22 16:29:05 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010, 2016 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.234 2016/12/20 14:03:15 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.235 2016/12/22 16:29:05 bouyer Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -480,11 +480,13 @@ static bool pmap_initialized __read_most
 static vaddr_t virtual_avail __read_mostly;	/* VA of first free KVA */
 static vaddr_t virtual_end __read_mostly;	/* VA of last free KVA */
 
+#ifndef XEN
 /*
  * LAPIC virtual address, and fake physical address.
  */
 volatile vaddr_t local_apic_va;
 paddr_t local_apic_pa;
+#endif
 
 /*
  * pool that pmap structures are allocated from
@@ -558,11 +560,11 @@ extern vaddr_t pentium_idt_vaddr;
  * Local prototypes
  */
 
-static void pmap_init_lapic(void);
 #ifdef __HAVE_DIRECT_MAP
 static void pmap_init_directmap(struct pmap *);
 #endif
 #ifndef XEN
+static void pmap_init_lapic(void);
 static void pmap_remap_largepages(void);
 #endif
 
@@ -1327,9 +1329,9 @@ pmap_bootstrap(vaddr_t kva_start)
 		/* Remap the kernel. */
 		pmap_remap_largepages();
 	}
+	pmap_init_lapic();
 #endif /* !XEN */
 
-	pmap_init_lapic();
 
 #ifdef __HAVE_DIRECT_MAP
 	pmap_init_directmap(kpm);
@@ -1451,6 +1453,7 @@ pmap_bootstrap(vaddr_t kva_start)
 	pmap_maxkvaddr = kva;
 }
 
+#ifndef XEN
 static void
 pmap_init_lapic(void)
 {
@@ -1466,6 +1469,7 @@ pmap_init_lapic(void)
 	local_apic_va = pmap_bootstrap_valloc(1);
 	local_apic_pa = pmap_bootstrap_palloc(1);
 }
+#endif
 
 #ifdef __HAVE_DIRECT_MAP
 /*

Reply via email to