Module Name:    src
Committed By:   maxv
Date:           Wed Jul 13 15:53:27 UTC 2016

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

Log Message:
Reorder some instructions, reduces the diff between amd64 and i386.


To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.757 -r1.758 src/sys/arch/i386/i386/machdep.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.222 src/sys/arch/amd64/amd64/machdep.c:1.223
--- src/sys/arch/amd64/amd64/machdep.c:1.222	Wed Jul 13 15:39:33 2016
+++ src/sys/arch/amd64/amd64/machdep.c	Wed Jul 13 15:53:26 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.222 2016/07/13 15:39:33 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.223 2016/07/13 15:53:26 maxv 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.222 2016/07/13 15:39:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.223 2016/07/13 15:53:26 maxv Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -1543,8 +1543,6 @@ init_x86_64(paddr_t first_avail)
 #endif
 #endif /* !XEN */
 
-	cpu_probe(&cpu_info_primary);
-
 #ifdef XEN
 	KASSERT(HYPERVISOR_shared_info != NULL);
 	cpu_info_primary.ci_vcpu = &HYPERVISOR_shared_info->vcpu_info[0];
@@ -1552,6 +1550,7 @@ init_x86_64(paddr_t first_avail)
 	__PRINTK(("init_x86_64(0x%lx)\n", first_avail));
 #endif /* XEN */
 
+	cpu_probe(&cpu_info_primary);
 	cpu_init_msrs(&cpu_info_primary, true);
 
 	use_pae = 1; /* PAE always enabled in long mode */

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.757 src/sys/arch/i386/i386/machdep.c:1.758
--- src/sys/arch/i386/i386/machdep.c:1.757	Wed Jul 13 15:39:33 2016
+++ src/sys/arch/i386/i386/machdep.c	Wed Jul 13 15:53:27 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.757 2016/07/13 15:39:33 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.758 2016/07/13 15:53:27 maxv 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.757 2016/07/13 15:39:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.758 2016/07/13 15:53:27 maxv Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -1145,10 +1145,9 @@ init386(paddr_t first_avail)
 	cpu_info_primary.ci_vcpu = &HYPERVISOR_shared_info->vcpu_info[0];
 #endif
 
-	cpu_probe(&cpu_info_primary);
-
 	uvm_lwp_setuarea(&lwp0, lwp0uarea);
 
+	cpu_probe(&cpu_info_primary);
 	cpu_init_msrs(&cpu_info_primary, true);
 
 #ifdef PAE
@@ -1177,10 +1176,6 @@ init386(paddr_t first_avail)
 	cpu_info_primary.ci_pae_l3_pdir = (pd_entry_t *)(rcr3() + KERNBASE);
 #endif /* PAE && !XEN */
 
-#ifdef XEN
-	xen_parse_cmdline(XEN_PARSE_BOOTFLAGS, NULL);
-#endif
-
 	/*
 	 * Initialize PAGE_SIZE-dependent variables.
 	 */
@@ -1205,10 +1200,14 @@ init386(paddr_t first_avail)
 	 */
 	avail_start = 6 * PAGE_SIZE;
 #else /* !XEN */
-	/* steal one page for gdt */
+	/* Parse Xen command line (replace bootinfo) */
+	xen_parse_cmdline(XEN_PARSE_BOOTFLAGS, NULL);
+
+	/* Steal one page for gdt */
 	gdt = (void *)((u_long)first_avail + KERNBASE);
 	first_avail += PAGE_SIZE;
-	/* Make sure the end of the space used by the kernel is rounded. */
+
+	/* Determine physical address space */
 	first_avail = round_page(first_avail);
 	avail_start = first_avail;
 	avail_end = ctob((paddr_t)xen_start_info.nr_pages);
@@ -1219,12 +1218,12 @@ init386(paddr_t first_avail)
 	mem_cluster_cnt++;
 	physmem += xen_start_info.nr_pages;
 	uvmexp.wired += atop(avail_start);
+
 	/*
 	 * initgdt() has to be done before consinit(), so that %fs is properly
 	 * initialised. initgdt() uses pmap_kenter_pa so it can't be called
 	 * before the above variables are set.
 	 */
-
 	initgdt(gdt);
 
 	mutex_init(&pte_lock, MUTEX_DEFAULT, IPL_VM);

Reply via email to