Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Clean up, it is easier to debug with qemu+gdb anyway.
details: https://anonhg.NetBSD.org/src/rev/d587cfc100f4
branches: trunk
changeset: 355261:d587cfc100f4
user: maxv <maxv%NetBSD.org@localhost>
date: Sat Jul 22 08:01:35 2017 +0000
description:
Clean up, it is easier to debug with qemu+gdb anyway.
diffstat:
sys/arch/amd64/amd64/mptramp.S | 84 ++++++++------------------
sys/arch/i386/i386/mptramp.S | 127 ++++++++++------------------------------
2 files changed, 59 insertions(+), 152 deletions(-)
diffs (truncated from 383 to 300 lines):
diff -r c246960acbce -r d587cfc100f4 sys/arch/amd64/amd64/mptramp.S
--- a/sys/arch/amd64/amd64/mptramp.S Fri Jul 21 21:01:13 2017 +0000
+++ b/sys/arch/amd64/amd64/mptramp.S Sat Jul 22 08:01:35 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mptramp.S,v 1.23 2016/07/25 15:29:06 maxv Exp $ */
+/* $NetBSD: mptramp.S,v 1.24 2017/07/22 08:01:35 maxv Exp $ */
/*
* Copyright (c) 2000, 2016 The NetBSD Foundation, Inc.
@@ -42,11 +42,11 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -74,8 +74,6 @@
* by a idle-thread
*/
-#include "opt_mpbios.h" /* for MPDEBUG */
-
#include "assym.h"
#include <machine/asm.h>
#include <machine/specialreg.h>
@@ -89,29 +87,6 @@
#define _TRMP_LABEL(a) a = . - _C_LABEL(cpu_spinup_trampoline) + MP_TRAMPOLINE
-#ifdef MPDEBUG
-/*
- * Debug code to stop aux. processors in various stages based on the
- * value in cpu_trace.
- *
- * %edi points at cpu_trace;
- * cpu_trace[0] is the "hold point";
- * cpu_trace[1] is the point which the CPU has reached;
- * cpu_trace[2] is the last value stored by HALTT.
- */
-#define HALT(x) \
-1: movl (%edi),%ebx ; \
- cmpl $x,%ebx ; \
- jle 1b ; \
- movl $x,4(%edi) ;
-#define HALTT(x,y) \
- movl y,8(%edi) ; \
- HALT(x) ;
-#else
-#define HALT(x)
-#define HALTT(x,y)
-#endif /* MPDEBUG */
-
.global _C_LABEL(cpu_spinup_trampoline)
.global _C_LABEL(cpu_spinup_trampoline_end)
.global _C_LABEL(cpu_hatch)
@@ -127,34 +102,33 @@
movw %ax,%ds
movw %ax,%es
movw %ax,%ss
+
+ /* load flat descriptor table */
#ifdef __clang__
- lgdt (mptramp_gdt32_desc) /* load flat descriptor table */
+ lgdt (mptramp_gdt32_desc)
#else
- data32 addr32 lgdt (mptramp_gdt32_desc) /* load flat descriptor table */
+ data32 addr32 lgdt (mptramp_gdt32_desc)
#endif
- movl %cr0, %eax /* get cr0 */
- orl $CR0_PE, %eax /* enable protected mode */
- movl %eax, %cr0 /* doit */
- ljmpl $0x8, $mp_startup
+
+ /* enable protected mode */
+ movl %cr0,%eax
+ orl $CR0_PE,%eax
+ movl %eax,%cr0
+ ljmpl $0x8,$mp_startup
_TRMP_LABEL(mp_startup)
.code32
- movl $0x10, %eax /* data segment */
- movw %ax, %ds
- movw %ax, %ss
- movw %ax, %es
- movw %ax, %fs
- movw %ax, %gs
+ movl $0x10,%eax /* data segment */
+ movw %ax,%ds
+ movw %ax,%ss
+ movw %ax,%es
+ movw %ax,%fs
+ movw %ax,%gs
/* bootstrap stack end, with scratch space.. */
movl $(MP_TRAMPOLINE+PAGE_SIZE-16),%esp
-#ifdef MPDEBUG
- leal RELOC(cpu_trace),%edi
-#endif
-
- HALT(0x1)
/* First, reset the PSL. */
pushl $PSL_MBO
popfl
@@ -236,11 +210,11 @@
_C_LABEL(cpu_spinup_trampoline_end): /* end of code copied to MP_TRAMPOLINE */
- /* Don't touch lapic until BP has done init sequence. */
+ /* Wait until BP has done init sequence. */
1:
movq _C_LABEL(cpu_starting),%rdi
pause
- testq %rdi, %rdi
+ testq %rdi,%rdi
jz 1b
movq CPU_INFO_IDLELWP(%rdi),%rsi
@@ -257,8 +231,10 @@
/* Switch address space. */
movq PCB_CR3(%rsi),%rax
movq %rax,%cr3
+
movl PCB_CR0(%rsi),%eax
movq %rax,%cr0
+
call _C_LABEL(cpu_hatch)
END(cpu_spinup_trampoline)
@@ -266,10 +242,4 @@
LABEL(mp_pdirpa)
.quad 0
END(mp_pdirpa)
-#ifdef MPDEBUG
-LABEL(cpu_trace)
- .quad 0x40
- .quad 0xff
- .quad 0xff
-END(cpu_trace)
-#endif
+
diff -r c246960acbce -r d587cfc100f4 sys/arch/i386/i386/mptramp.S
--- a/sys/arch/i386/i386/mptramp.S Fri Jul 21 21:01:13 2017 +0000
+++ b/sys/arch/i386/i386/mptramp.S Sat Jul 22 08:01:35 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mptramp.S,v 1.30 2017/07/02 09:02:06 maxv Exp $ */
+/* $NetBSD: mptramp.S,v 1.31 2017/07/22 08:01:35 maxv Exp $ */
/*
* Copyright (c) 2000, 2016 The NetBSD Foundation, Inc.
@@ -42,11 +42,11 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -75,9 +75,7 @@
*/
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: mptramp.S,v 1.30 2017/07/02 09:02:06 maxv Exp $");
-
-#include "opt_mpbios.h" /* for MPDEBUG */
+__KERNEL_RCSID(0, "$NetBSD: mptramp.S,v 1.31 2017/07/22 08:01:35 maxv Exp $");
#include "assym.h"
#include <machine/specialreg.h>
@@ -92,29 +90,6 @@
#define _TRMP_LABEL(a) a = . - _C_LABEL(cpu_spinup_trampoline) + MP_TRAMPOLINE
-#ifdef MPDEBUG
-/*
- * Debug code to stop aux. processors in various stages based on the
- * value in cpu_trace.
- *
- * %edi points at cpu_trace;
- * cpu_trace[0] is the "hold point";
- * cpu_trace[1] is the point which the CPU has reached;
- * cpu_trace[2] is the last value stored by HALTT.
- */
-#define HALT(x) \
-1: movl (%edi),%ebx ; \
- cmpl $x,%ebx ; \
- jle 1b ; \
- movl $x,4(%edi) ;
-#define HALTT(x,y) \
- movl y,8(%edi) ; \
- HALT(x) ;
-#else
-#define HALT(x)
-#define HALTT(x,y)
-#endif /* MPDEBUG */
-
.global _C_LABEL(cpu_spinup_trampoline)
.global _C_LABEL(cpu_spinup_trampoline_end)
.global _C_LABEL(mp_pdirpa)
@@ -129,34 +104,33 @@
movw %ax,%ds
movw %ax,%es
movw %ax,%ss
+
+ /* load flat descriptor table */
#ifdef __clang__
- lgdt (gdt_desc) /* load flat descriptor table */
+ lgdt (gdt_desc)
#else
- data32 addr32 lgdt (gdt_desc) /* load flat descriptor table */
+ data32 addr32 lgdt (gdt_desc)
#endif
- movl %cr0, %eax /* get cr0 */
- orl $CR0_PE, %eax /* enable protected mode */
- movl %eax, %cr0 /* doit */
- ljmpl $0x8, $mp_startup
+
+ /* enable protected mode */
+ movl %cr0,%eax
+ orl $CR0_PE,%eax
+ movl %eax,%cr0
+ ljmpl $0x8,$mp_startup
_TRMP_LABEL(mp_startup)
.code32
- movl $0x10, %eax /* data segment */
- movw %ax, %ds
- movw %ax, %ss
- movw %ax, %es
- movw %ax, %fs
- movw %ax, %gs
+ movl $0x10,%eax /* data segment */
+ movw %ax,%ds
+ movw %ax,%ss
+ movw %ax,%es
+ movw %ax,%fs
+ movw %ax,%gs
/* bootstrap stack end, with scratch space.. */
movl $(MP_TRAMPOLINE+PAGE_SIZE-16),%esp
-#ifdef MPDEBUG
- leal RELOC(cpu_trace),%edi
-#endif
-
- HALT(0x1)
/* First, reset the PSL. */
pushl $PSL_MBO
popfl
@@ -192,7 +166,6 @@
/* Load %cr3. */
movl RELOC(mp_pdirpa),%ecx
- HALTT(0x5,%ecx)
movl %ecx,%cr3 /* load PTD addr into MMU */
/* Enable paging and the rest of it. */
@@ -200,46 +173,26 @@
orl $(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_MP|CR0_WP|CR0_AM),%eax
movl %eax,%cr0
-#ifdef MPDEBUG
- leal _C_LABEL(cpu_trace),%edi
-#endif
- HALT(0x6)
-
-
-/*
- * ok, we are now running with paging enabled and sharing page tables
- * with cpu0. figure out which processor we really are, what stack we
- * should be on, etc.
- */
-
- /* Don't touch lapic until BP has done init sequence. */
+ /* Wait until BP has done init sequence. */
1:
movl _C_LABEL(cpu_starting),%ecx
pause
Home |
Main Index |
Thread Index |
Old Index