Remove INITSTACK completely - at the time we used to switch to it, we
already have access to all of lwp0 and it's uarea - so we can switch to the correct lwp0 stack easily before calling main.
This commit is contained in:
parent
3f79b658b2
commit
782448944c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cpu.h,v 1.63 2007/05/17 14:51:31 yamt Exp $ */
|
||||
/* $NetBSD: cpu.h,v 1.64 2007/08/25 19:16:10 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -120,7 +120,6 @@ struct cpu_info {
|
||||
|
||||
/* Spinning up the CPU */
|
||||
void (*ci_spinup)(void);
|
||||
void *ci_initstack;
|
||||
paddr_t ci_paddr;
|
||||
|
||||
int ci_number;
|
||||
@ -157,8 +156,6 @@ struct cpu_bootargs {
|
||||
vaddr_t cb_ekdata;
|
||||
|
||||
paddr_t cb_cpuinfo;
|
||||
|
||||
void *cb_initstack;
|
||||
};
|
||||
|
||||
extern struct cpu_bootargs *cpu_args;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: param.h,v 1.39 2007/05/17 14:51:31 yamt Exp $ */
|
||||
/* $NetBSD: param.h,v 1.40 2007/08/25 19:16:10 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -191,8 +191,8 @@ extern int nbpg, pgofset, pgshift;
|
||||
#define CPUINFO_VA ( EINTSTACK )
|
||||
#define PANICSTACK ( INTSTACK + 8*_MAXNBPG)
|
||||
#define KSTACK_VA ( INTSTACK + 16*_MAXNBPG) /* make this 16 to have a redzone */
|
||||
#define INITSTACK_VA ( KSTACK_VA + 8*_MAXNBPG)
|
||||
#define IODEV_BASE ( INITSTACK_VA + 0*_MAXNBPG)
|
||||
/* #define INITSTACK_VA ( KSTACK_VA + 8*_MAXNBPG) */
|
||||
#define IODEV_BASE ( KSTACK_VA + 8*_MAXNBPG)
|
||||
#define IODEV_END 0x0f0000000UL /* 16 MB of iospace */
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cpu.c,v 1.59 2007/05/25 12:42:07 martin Exp $ */
|
||||
/* $NetBSD: cpu.c,v 1.60 2007/08/25 19:16:10 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
@ -52,7 +52,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.59 2007/05/25 12:42:07 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.60 2007/08/25 19:16:10 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -149,7 +149,6 @@ alloc_cpuinfo(u_int cpu_node)
|
||||
cpi->ci_upaid = portid;
|
||||
cpi->ci_fplwp = NULL;
|
||||
cpi->ci_spinup = NULL; /* XXX */
|
||||
cpi->ci_initstack = (void *)INITSTACK_VA;
|
||||
cpi->ci_paddr = pa0;
|
||||
cpi->ci_self = cpi;
|
||||
cpi->ci_node = cpu_node;
|
||||
@ -364,7 +363,6 @@ cpu_boot_secondary_processors()
|
||||
|
||||
cpu_args->cb_node = ci->ci_node;
|
||||
cpu_args->cb_cpuinfo = ci->ci_paddr;
|
||||
cpu_args->cb_initstack = ci->ci_initstack;
|
||||
membar_sync();
|
||||
|
||||
/* Disable interrupts and start another CPU. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: genassym.cf,v 1.45 2007/05/20 21:51:01 martin Exp $
|
||||
# $NetBSD: genassym.cf,v 1.46 2007/08/25 19:16:10 martin Exp $
|
||||
|
||||
#
|
||||
# Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@ -168,15 +168,14 @@ define CI_FPLWP offsetof(struct cpu_info, ci_fplwp)
|
||||
define CI_NUMBER offsetof(struct cpu_info, ci_number)
|
||||
define CI_UPAID offsetof(struct cpu_info, ci_upaid)
|
||||
define CI_SPINUP offsetof(struct cpu_info, ci_spinup)
|
||||
define CI_INITSTACK offsetof(struct cpu_info, ci_initstack)
|
||||
define CI_PADDR offsetof(struct cpu_info, ci_paddr)
|
||||
define CI_WANT_AST offsetof(struct cpu_info, ci_want_ast)
|
||||
define CI_WANT_RESCHED offsetof(struct cpu_info, ci_want_resched)
|
||||
define CI_EINTRSTACK offsetof(struct cpu_info, ci_eintstack)
|
||||
define CI_IDLELWP offsetof(struct cpu_info, ci_data.cpu_idlelwp)
|
||||
|
||||
# CPU boot arguments structure
|
||||
define CBA_NODE offsetof(struct cpu_bootargs, cb_node)
|
||||
define CBA_INITSTACK offsetof(struct cpu_bootargs, cb_initstack)
|
||||
define CBA_KTEXT offsetof(struct cpu_bootargs, cb_ktext)
|
||||
define CBA_KTEXTP offsetof(struct cpu_bootargs, cb_ktextp)
|
||||
define CBA_EKTEXT offsetof(struct cpu_bootargs, cb_ektext)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.255 2007/08/25 15:52:41 martin Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.256 2007/08/25 19:16:10 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-2002 Eduardo Horvath
|
||||
@ -4933,7 +4933,7 @@ dostart:
|
||||
#endif
|
||||
|
||||
|
||||
_C_LABEL(cpu_initialize):
|
||||
ENTRY_NOPROFILE(cpu_initialize) /* for cosmetic reasons - nicer backtrace */
|
||||
/*
|
||||
* Step 5: is no more.
|
||||
*/
|
||||
@ -4994,11 +4994,15 @@ _C_LABEL(cpu_initialize):
|
||||
membar #Sync
|
||||
flush %o5
|
||||
|
||||
!!! Make sure our stack's OK.
|
||||
!! Setup kernel stack (we rely on curlwp on this cpu
|
||||
!! being lwp0 here and it's uarea is mapped special
|
||||
!! and already accessible here)
|
||||
flushw
|
||||
sethi %hi(CPUINFO_VA+CI_INITSTACK), %l0
|
||||
LDPTR [%l0 + %lo(CPUINFO_VA+CI_INITSTACK)], %l0
|
||||
add %l0, - CC64FSZ - 80, %l0 ! via syscall(boot_me_up) or somesuch
|
||||
sethi %hi(CPUINFO_VA+CI_CURLWP), %l0
|
||||
LDPTR [%l0 + %lo(CPUINFO_VA+CI_CURLWP)], %l0
|
||||
set USPACE - TF_SIZE - CC64FSZ, %l1
|
||||
LDPTR [%l0 + L_ADDR], %l0
|
||||
add %l1, %l0, %l0
|
||||
#ifdef _LP64
|
||||
andn %l0, 0x0f, %l0 ! Needs to be 16-byte aligned
|
||||
sub %l0, BIAS, %l0 ! and biased
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap.c,v 1.192 2007/08/16 18:42:09 rjs Exp $ */
|
||||
/* $NetBSD: pmap.c,v 1.193 2007/08/25 19:16:11 martin Exp $ */
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 1996-1999 Eduardo Horvath.
|
||||
@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.192 2007/08/16 18:42:09 rjs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.193 2007/08/25 19:16:11 martin Exp $");
|
||||
|
||||
#undef NO_VCACHE /* Don't forget the locked TLB in dostart */
|
||||
#define HWREF
|
||||
@ -407,8 +407,6 @@ static void pmap_alloc_bootargs(void)
|
||||
memset(v, 0, 2*PAGE_SIZE);
|
||||
|
||||
cpu_args = (struct cpu_bootargs*)v;
|
||||
|
||||
cpu_args->cb_initstack = v + 2*PAGE_SIZE;
|
||||
}
|
||||
|
||||
#if defined(MULTIPROCESSOR)
|
||||
@ -1098,7 +1096,6 @@ pmap_bootstrap(u_long kernelstart, u_long kernelend)
|
||||
cpus->ci_spinup = main; /* Call main when we're running. */
|
||||
cpus->ci_paddr = cpu0paddr;
|
||||
cpus->ci_cpcb = (struct pcb *)u0va;
|
||||
cpus->ci_initstack = (void *)INITSTACK_VA;
|
||||
proc0paddr = cpus->ci_cpcb;
|
||||
|
||||
lwp0.l_addr = (struct user*)u0va;
|
||||
|
Loading…
Reference in New Issue
Block a user