diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-11-15 21:23:17 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-11-15 21:23:17 +0000 |
commit | 8ca8bc22d3b776d69bd7ce8622136de5cb8ee376 (patch) | |
tree | 08a9ebc32a67886ed5c43c4640c4bfd7e3ac872c | |
parent | 42b7e5295160dddf04004f36ba2cb8756e87fe7c (diff) |
Stop referring the initial kernel stack as the ``interrupt stack''. It's
been years since it has last been used for that purpose, so name it the
initialization/startup stack.
While there, do not store the initialization stack in cpu_info, and have
secondary_pre_main() return its value so that the bootstrap code does not
need to fetch it from cpu_info.
This might be reconsidered when the startup stacks will be freed after they
are not used anymore, but there are more things to do first.
-rw-r--r-- | sys/arch/aviion/aviion/locore.S | 25 | ||||
-rw-r--r-- | sys/arch/aviion/aviion/machdep.c | 16 | ||||
-rw-r--r-- | sys/arch/luna88k/luna88k/locore.S | 17 | ||||
-rw-r--r-- | sys/arch/luna88k/luna88k/machdep.c | 16 | ||||
-rw-r--r-- | sys/arch/m88k/include/cpu.h | 4 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/eh_common.S | 18 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/genassym.cf | 5 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/locore.S | 21 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 17 |
9 files changed, 67 insertions, 72 deletions
diff --git a/sys/arch/aviion/aviion/locore.S b/sys/arch/aviion/aviion/locore.S index 0bfe3e69713..69f7dbde091 100644 --- a/sys/arch/aviion/aviion/locore.S +++ b/sys/arch/aviion/aviion/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.5 2007/11/06 21:42:55 miod Exp $ */ +/* $OpenBSD: locore.S,v 1.6 2007/11/15 21:23:14 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat. * Copyright (c) 1998 Steve Murphree, Jr. @@ -207,9 +207,9 @@ ASLOCAL(main_start) */ #endif /* MULTIPROCESSOR */ - /* Switch to interrupt stack */ - or.u r31, r0, hi16(_ASM_LABEL(intstack_end)) - or r31, r31, lo16(_ASM_LABEL(intstack_end)) + /* Switch to startup stack */ + or.u r31, r0, hi16(_ASM_LABEL(initstack_end)) + or r31, r31, lo16(_ASM_LABEL(initstack_end)) #ifdef M88110 #ifdef M88100 @@ -337,11 +337,8 @@ GLOBAL(secondary_start) */ bsr _C_LABEL(secondary_pre_main) /* set cpu number */ - - ldcr r2, CPU - ld r3, r2, CI_INIT_STACK bsr.n _C_LABEL(secondary_main) - addu r31, r3, USIZE /* switch to startup stack */ + or r31, r2, r0 /* switch to startup stack */ #endif /* MULTIPROCESSOR */ @@ -373,9 +370,9 @@ GLOBAL(kernel_sdt) /* SDT (segment descriptor table */ space 0x2000 /* 8K - 4K phys, 4K virt*/ .align PAGE_SIZE -ASGLOBAL(intstack) +ASGLOBAL(initstack) space USIZE -ASGLOBAL(intstack_end) +ASGLOBAL(initstack_end) #ifdef MULTIPROCESSOR space PAGE_SIZE /* 4K, small, interim stack */ @@ -395,10 +392,10 @@ GLOBAL(proc0paddr) #ifdef MULTIPROCESSOR /* Dummy cpuinfo structure, for cpu_number() to work early. */ ASLOCAL(dummy_cpu) - word 1 /* ci_alive */ - word 0 /* ci_curproc */ - word 0 /* ci_curpcb */ - word 0 /* ci_cpuid */ + word 3 /* CIF_PRIMARY | CIF_ALIVE */ /* ci_alive */ + word 0 /* ci_curproc */ + word 0 /* ci_curpcb */ + word 0 /* ci_cpuid */ #endif /* MULTIPROCESSOR */ #if defined(DDB) || NKSYMS > 0 diff --git a/sys/arch/aviion/aviion/machdep.c b/sys/arch/aviion/aviion/machdep.c index 6beb6d78b53..84478d177f0 100644 --- a/sys/arch/aviion/aviion/machdep.c +++ b/sys/arch/aviion/aviion/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.14 2007/11/14 23:12:44 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.15 2007/11/15 21:23:14 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -100,7 +100,7 @@ u_int getipl(void); void identifycpu(void); void savectx(struct pcb *); void secondary_main(void); -void secondary_pre_main(void); +vaddr_t secondary_pre_main(void); intrhand_t intr_handlers[NVMEINTR]; @@ -564,11 +564,11 @@ abort: /* * Secondary CPU early initialization routine. - * Determine CPU number and set it, then allocate the idle pcb (and stack). + * Determine CPU number and set it, then allocate its startup stack. * * Running on a minimal stack here, with interrupts disabled; do nothing fancy. */ -void +vaddr_t secondary_pre_main() { struct cpu_info *ci; @@ -587,18 +587,20 @@ secondary_pre_main() /* * Allocate UPAGES contiguous pages for the startup stack. */ - ci->ci_init_stack = uvm_km_zalloc(kernel_map, USPACE); - if (ci->ci_init_stack == (vaddr_t)NULL) { + init_stack = uvm_km_zalloc(kernel_map, USPACE); + if (init_stack == (vaddr_t)NULL) { printf("cpu%d: unable to allocate startup stack\n", ci->ci_cpuid); for (;;) ; } + + return (init_stack); } /* * Further secondary CPU initialization. * - * We are now running on our idle stack, with proper page tables. + * We are now running on our startup stack, with proper page tables. * There is nothing to do but display some details about the CPU and its CMMUs. */ void diff --git a/sys/arch/luna88k/luna88k/locore.S b/sys/arch/luna88k/luna88k/locore.S index cf53da516a9..9c454a50d52 100644 --- a/sys/arch/luna88k/luna88k/locore.S +++ b/sys/arch/luna88k/luna88k/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.15 2007/11/06 21:42:56 miod Exp $ */ +/* $OpenBSD: locore.S,v 1.16 2007/11/15 21:23:15 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -189,9 +189,9 @@ ASLOCAL(main_start) * Main processor specific initialization (with cpu_mutex held). */ ASLOCAL(main_init) - /* Switch to interrupt stack */ - or.u r31, r0, hi16(_ASM_LABEL(intstack_end)) - or r31, r31, lo16(_ASM_LABEL(intstack_end)) + /* Switch to startup stack */ + or.u r31, r0, hi16(_ASM_LABEL(initstack_end)) + or r31, r31, lo16(_ASM_LABEL(initstack_end)) or.u r3, r0, hi16(_C_LABEL(vector_list)) or r3, r3, lo16(_C_LABEL(vector_list)) @@ -281,11 +281,8 @@ ASLOCAL(secondary_init) or.u r31, r0, hi16(_ASM_LABEL(slavestack_end)) bsr.n _C_LABEL(secondary_pre_main) /* set cpu number */ or r31, r31, lo16(_ASM_LABEL(slavestack_end)) - - ldcr r2, CPU - ld r3, r2, CI_INIT_STACK bsr.n _C_LABEL(secondary_main) - addu r31, r3, USIZE /* switch to startup stack */ + or r31, r2, r0 /* switch to startup stack */ #else @@ -325,9 +322,9 @@ GLOBAL(kernel_sdt) /* SDT (segment descriptor table */ space 0x2000 /* 8K - 4K phys, 4K virt*/ .align PAGE_SIZE -ASGLOBAL(intstack) +ASGLOBAL(initstack) space USIZE -ASGLOBAL(intstack_end) +ASGLOBAL(initstack_end) #ifdef MULTIPROCESSOR space PAGE_SIZE /* 4K, small, interim stack */ diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c index 261fd1b2167..2d1cc5d6ba5 100644 --- a/sys/arch/luna88k/luna88k/machdep.c +++ b/sys/arch/luna88k/luna88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.48 2007/11/14 23:12:45 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.49 2007/11/15 21:23:15 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -115,7 +115,7 @@ void identifycpu(void); void luna88k_bootstrap(void); void savectx(struct pcb *); void secondary_main(void); -void secondary_pre_main(void); +vaddr_t secondary_pre_main(void); void setlevel(unsigned int); vaddr_t size_memory(void); @@ -771,11 +771,11 @@ cpu_boot_secondary_processors() /* * Secondary CPU early initialization routine. - * Determine CPU number and set it, then allocate the idle pcb (and stack). + * Determine CPU number and set it, then allocate the startup stack. * * Running on a minimal stack here, with interrupts disabled; do nothing fancy. */ -void +vaddr_t secondary_pre_main() { struct cpu_info *ci; @@ -791,18 +791,20 @@ secondary_pre_main() /* * Allocate UPAGES contiguous pages for the idle PCB and stack. */ - ci->ci_init_stack = uvm_km_zalloc(kernel_map, USPACE); - if (ci->ci_init_stack == (vaddr_t)NULL) { + init_stack = uvm_km_zalloc(kernel_map, USPACE); + if (init_stack == (vaddr_t)NULL) { printf("cpu%d: unable to allocate startup stack\n", ci->ci_cpuid); for (;;) ; } + + return (init_stack); } /* * Further secondary CPU initialization. * - * We are now running on our idle stack, with proper page tables. + * We are now running on our startup stack, with proper page tables. * There is nothing to do but display some details about the CPU and its CMMUs. */ void diff --git a/sys/arch/m88k/include/cpu.h b/sys/arch/m88k/include/cpu.h index 97b691f082b..4ffac7f6892 100644 --- a/sys/arch/m88k/include/cpu.h +++ b/sys/arch/m88k/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.30 2007/11/14 23:12:45 miod Exp $ */ +/* $OpenBSD: cpu.h,v 1.31 2007/11/15 21:23:16 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * Copyright (c) 1992, 1993 @@ -97,8 +97,6 @@ struct cpu_info { struct schedstate_percpu ci_schedstate; /* scheduling state */ int ci_want_resched; /* need_resched() invoked */ - vaddr_t ci_init_stack; /* startup stack */ - u_int ci_intrdepth; /* interrupt depth */ u_long ci_spin_locks; /* spin locks counter */ diff --git a/sys/arch/m88k/m88k/eh_common.S b/sys/arch/m88k/m88k/eh_common.S index 08396a075b7..98897a9c358 100644 --- a/sys/arch/m88k/m88k/eh_common.S +++ b/sys/arch/m88k/m88k/eh_common.S @@ -1,4 +1,4 @@ -/* $OpenBSD: eh_common.S,v 1.28 2007/11/14 22:55:50 miod Exp $ */ +/* $OpenBSD: eh_common.S,v 1.29 2007/11/15 21:23:16 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -600,13 +600,13 @@ GLOBAL(reset_handler) or r29, r0, 0 1: or r26, r0, r31 /* save old stack */ - or.u r31, r0, hi16(_ASM_LABEL(intstack_end)) - or r31, r31, lo16(_ASM_LABEL(intstack_end)) + or.u r31, r0, hi16(_ASM_LABEL(initstack_end)) + or r31, r31, lo16(_ASM_LABEL(initstack_end)) #ifdef DEBUG /* zero the stack, so we'll know what we're lookin' at */ - or.u r27, r0, hi16(_ASM_LABEL(intstack)) - or r27, r27, lo16(_ASM_LABEL(intstack)) + or.u r27, r0, hi16(_ASM_LABEL(initstack)) + or r27, r27, lo16(_ASM_LABEL(initstack)) 1: cmp r28, r27, r31 bb1 ge, r28, 2f /* branch if at the end of the stack */ st r0, r0, r27 @@ -1764,13 +1764,13 @@ GLOBAL(m88110_reset_handler) or r29, r0, 0 1: or r26, r0, r31 /* save old stack */ - or.u r31, r0, hi16(_ASM_LABEL(intstack_end)) - or r31, r31, lo16(_ASM_LABEL(intstack_end)) + or.u r31, r0, hi16(_ASM_LABEL(initstack_end)) + or r31, r31, lo16(_ASM_LABEL(initstack_end)) #ifdef DEBUG /* zero the stack, so we'll know what we're lookin' at */ - or.u r27, r0, hi16(_ASM_LABEL(intstack)) - or r27, r27, lo16(_ASM_LABEL(intstack)) + or.u r27, r0, hi16(_ASM_LABEL(initstack)) + or r27, r27, lo16(_ASM_LABEL(initstack)) 1: cmp r28, r27, r31 bb1 ge, r28, 2f /* branch if at the end of the stack */ st r0, r0, r27 diff --git a/sys/arch/m88k/m88k/genassym.cf b/sys/arch/m88k/m88k/genassym.cf index af886904abf..054e1787493 100644 --- a/sys/arch/m88k/m88k/genassym.cf +++ b/sys/arch/m88k/m88k/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.11 2007/11/14 23:12:46 miod Exp $ +# $OpenBSD: genassym.cf,v 1.12 2007/11/15 21:23:16 miod Exp $ # # Copyright (c) 1982, 1990 The Regents of the University of California. # All rights reserved. @@ -28,7 +28,7 @@ # SUCH DAMAGE. # # @(#)genassym.c 7.8 (Berkeley) 5/7/91 -# $Id: genassym.cf,v 1.11 2007/11/14 23:12:46 miod Exp $ +# $Id: genassym.cf,v 1.12 2007/11/15 21:23:16 miod Exp $ # include <sys/param.h> @@ -64,7 +64,6 @@ member ci_pfsr_i0 member ci_pfsr_i1 member ci_pfsr_d0 member ci_pfsr_d1 -member ci_init_stack member ci_want_resched # general constants diff --git a/sys/arch/mvme88k/mvme88k/locore.S b/sys/arch/mvme88k/mvme88k/locore.S index 558b1da00b9..33ea4ad78dc 100644 --- a/sys/arch/mvme88k/mvme88k/locore.S +++ b/sys/arch/mvme88k/mvme88k/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.53 2007/11/14 23:12:46 miod Exp $ */ +/* $OpenBSD: locore.S,v 1.54 2007/11/15 21:23:16 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat. * Copyright (c) 1998 Steve Murphree, Jr. @@ -210,9 +210,9 @@ ASLOCAL(main_start) */ #endif /* MULTIPROCESSOR */ - /* Switch to interrupt stack */ - or.u r31, r0, hi16(_ASM_LABEL(intstack_end)) - or r31, r31, lo16(_ASM_LABEL(intstack_end)) + /* Switch to startup stack */ + or.u r31, r0, hi16(_ASM_LABEL(initstack_end)) + or r31, r31, lo16(_ASM_LABEL(initstack_end)) #ifdef M88110 #ifdef M88100 @@ -317,11 +317,8 @@ GLOBAL(secondary_start) */ bsr _C_LABEL(secondary_pre_main) /* set cpu number */ - - ldcr r2, CPU - ld r3, r2, CI_INIT_STACK bsr.n _C_LABEL(secondary_main) - addu r31, r3, USIZE /* switch to startup stack */ + or r31, r2, r0 /* switch to startup stack */ #endif /* MULTIPROCESSOR */ @@ -364,9 +361,9 @@ GLOBAL(doboot) */ 8: - or.u r31, r0, hi16(_ASM_LABEL(intstack_end)) + or.u r31, r0, hi16(_ASM_LABEL(initstack_end)) bsr.n _C_LABEL(_doboot) - or r31, r31, lo16(_ASM_LABEL(intstack_end)) + or r31, r31, lo16(_ASM_LABEL(initstack_end)) /*NOTREACHED*/ /* @@ -403,9 +400,9 @@ GLOBAL(kernel_sdt) /* SDT (segment descriptor table */ space 0x2000 /* 8K - 4K phys, 4K virt*/ .align PAGE_SIZE -ASGLOBAL(intstack) +ASGLOBAL(initstack) space USIZE -ASGLOBAL(intstack_end) +ASGLOBAL(initstack_end) #ifdef MULTIPROCESSOR space PAGE_SIZE /* 4K, small, interim stack */ diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index a3d3d336b9d..d364c9a94b8 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.200 2007/11/14 23:15:07 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.201 2007/11/15 21:23:16 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -102,7 +102,7 @@ void mvme88k_vector_init(u_int32_t *, u_int32_t *); void myetheraddr(u_char *); void savectx(struct pcb *); void secondary_main(void); -void secondary_pre_main(void); +vaddr_t secondary_pre_main(void); void _doboot(void); extern void setlevel(unsigned int); @@ -680,14 +680,15 @@ abort: /* * Secondary CPU early initialization routine. - * Determine CPU number and set it, then allocate the idle pcb (and stack). + * Determine CPU number and set it, then allocate the startup stack. * * Running on a minimal stack here, with interrupts disabled; do nothing fancy. */ -void +vaddr_t secondary_pre_main() { struct cpu_info *ci; + vaddr_t init_stack; set_cpu_number(cmmu_cpu_number()); /* Determine cpu number by CMMU */ ci = curcpu(); @@ -703,19 +704,21 @@ secondary_pre_main() /* * Allocate UPAGES contiguous pages for the startup stack. */ - ci->ci_init_stack = uvm_km_zalloc(kernel_map, USPACE); - if (ci->ci_init_stack == (vaddr_t)NULL) { + init_stack = uvm_km_zalloc(kernel_map, USPACE); + if (init_stack == (vaddr_t)NULL) { printf("cpu%d: unable to allocate startup stack\n", ci->ci_cpuid); __cpu_simple_unlock(&cpu_boot_mutex); for (;;) ; } + + return (init_stack); } /* * Further secondary CPU initialization. * - * We are now running on our idle stack, with proper page tables. + * We are now running on our startup stack, with proper page tables. * There is nothing to do but display some details about the CPU and its CMMUs. */ void |