Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/alpha - In the MULTIPROCESSOR case, initialize p_cp...
details: https://anonhg.NetBSD.org/src/rev/67268aa25172
branches: trunk
changeset: 486944:67268aa25172
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed May 31 05:14:26 2000 +0000
description:
- In the MULTIPROCESSOR case, initialize p_cpu before a process is
marked SONPROC.
- Always make curproc, fpcurproc, astpending, and want_resched per-CPU
variables in struct cpu_info. Restructure code accordingly, and trim
a few instructions from a few spots in various places in locore.
diffstat:
sys/arch/alpha/alpha/cpu.c | 18 ++-
sys/arch/alpha/alpha/genassym.c | 11 +-
sys/arch/alpha/alpha/ipifuncs.c | 6 +-
sys/arch/alpha/alpha/locore.s | 162 ++++++++++++++++++++++-----------------
sys/arch/alpha/alpha/machdep.c | 14 +-
sys/arch/alpha/alpha/trap.c | 27 +++++-
sys/arch/alpha/include/cpu.h | 54 ++++++++-----
7 files changed, 174 insertions(+), 118 deletions(-)
diffs (truncated from 749 to 300 lines):
diff -r 47e8925f6999 -r 67268aa25172 sys/arch/alpha/alpha/cpu.c
--- a/sys/arch/alpha/alpha/cpu.c Wed May 31 05:10:54 2000 +0000
+++ b/sys/arch/alpha/alpha/cpu.c Wed May 31 05:14:26 2000 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: cpu.c,v 1.45 2000/05/26 21:19:19 thorpej Exp $ */
+/* $NetBSD: cpu.c,v 1.46 2000/05/31 05:14:26 thorpej Exp $ */
/*-
- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -66,7 +66,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.45 2000/05/26 21:19:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.46 2000/05/31 05:14:26 thorpej Exp $");
#include "opt_multiprocessor.h"
@@ -100,8 +100,6 @@
void cpu_boot_secondary __P((struct cpu_info *));
#else
-paddr_t curpcb; /* PA of our current context */
-struct proc *fpcurproc; /* current owner of FPU */
struct cpu_info cpu_info_store;
#endif /* MULTIPROCESSOR */
@@ -219,10 +217,10 @@
int needcomma;
#endif
u_int32_t major, minor;
+ struct cpu_info *ci;
#if defined(MULTIPROCESSOR)
extern paddr_t avail_start, avail_end;
struct pcb *pcb;
- struct cpu_info *ci;
struct pglist mlist;
int error;
#endif
@@ -290,16 +288,20 @@
}
#endif
-#if defined(MULTIPROCESSOR)
if (ma->ma_slot > ALPHA_WHAMI_MAXID) {
+ if (ma->ma_slot == hwrpb->rpb_primary_cpu_id)
+ panic("cpu_attach: primary CPU ID too large");
printf("%s: procssor ID too large, ignoring\n", dev->dv_xname);
return;
}
+#if defined(MULTIPROCESSOR)
ci = &cpu_info[ma->ma_slot];
+#else
+ ci = &cpu_info_store;
+#endif
ci->ci_cpuid = ma->ma_slot;
ci->ci_dev = dev;
-#endif /* MULTIPROCESSOR */
/*
* Though we could (should?) attach the LCA cpus' PCI
diff -r 47e8925f6999 -r 67268aa25172 sys/arch/alpha/alpha/genassym.c
--- a/sys/arch/alpha/alpha/genassym.c Wed May 31 05:10:54 2000 +0000
+++ b/sys/arch/alpha/alpha/genassym.c Wed May 31 05:14:26 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genassym.c,v 1.28 2000/05/26 21:19:21 thorpej Exp $ */
+/* $NetBSD: genassym.c,v 1.29 2000/05/31 05:14:27 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Gordon W. Ross
@@ -62,7 +62,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__RCSID("$NetBSD: genassym.c,v 1.28 2000/05/26 21:19:21 thorpej Exp $");
+__RCSID("$NetBSD: genassym.c,v 1.29 2000/05/31 05:14:27 thorpej Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -173,6 +173,7 @@
off(P_ADDR, struct proc, p_addr),
off(P_VMSPACE, struct proc, p_vmspace),
off(P_STAT, struct proc, p_stat),
+ off(P_CPU, struct proc, p_cpu),
off(P_MD_FLAGS, struct proc, p_md.md_flags),
off(P_MD_PCBPADDR, struct proc, p_md.md_pcbpaddr),
off(PH_LINK, struct prochd, ph_link),
@@ -218,14 +219,14 @@
def1(SYS___sigreturn14),
def1(SYS_exit),
-#if defined(MULTIPROCESSOR)
/* CPU info */
- def1(ALPHA_MAXPROCS),
off(CPU_INFO_CURPROC, struct cpu_info, ci_curproc),
off(CPU_INFO_FPCURPROC, struct cpu_info, ci_fpcurproc),
off(CPU_INFO_CURPCB, struct cpu_info, ci_curpcb),
off(CPU_INFO_IDLE_PCB_PADDR, struct cpu_info, ci_idle_pcb_paddr),
-#endif
+ off(CPU_INFO_WANT_RESCHED, struct cpu_info, ci_want_resched),
+ off(CPU_INFO_ASTPENDING, struct cpu_info, ci_astpending),
+ def(CPU_INFO_SIZEOF, sizeof(struct cpu_info)),
};
int nassyms = sizeof(assyms)/sizeof(assyms[0]);
diff -r 47e8925f6999 -r 67268aa25172 sys/arch/alpha/alpha/ipifuncs.c
--- a/sys/arch/alpha/alpha/ipifuncs.c Wed May 31 05:10:54 2000 +0000
+++ b/sys/arch/alpha/alpha/ipifuncs.c Wed May 31 05:14:26 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipifuncs.c,v 1.10 2000/05/23 05:12:54 thorpej Exp $ */
+/* $NetBSD: ipifuncs.c,v 1.11 2000/05/31 05:14:28 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.10 2000/05/23 05:12:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.11 2000/05/31 05:14:28 thorpej Exp $");
/*
* Interprocessor interrupt handlers.
@@ -162,5 +162,5 @@
alpha_ipi_ast()
{
- aston();
+ aston(curcpu());
}
diff -r 47e8925f6999 -r 67268aa25172 sys/arch/alpha/alpha/locore.s
--- a/sys/arch/alpha/alpha/locore.s Wed May 31 05:10:54 2000 +0000
+++ b/sys/arch/alpha/alpha/locore.s Wed May 31 05:14:26 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.74 2000/05/26 21:19:22 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.75 2000/05/31 05:14:28 thorpej Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.74 2000/05/26 21:19:22 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.75 2000/05/31 05:14:28 thorpej Exp $");
#ifndef EVCNT_COUNTERS
#include <machine/intrcnt.h>
@@ -94,18 +94,22 @@
/*
* Get various per-cpu values. A pointer to our cpu_info structure
* is stored in SysValue. These macros clobber v0, t0, t8..t11.
+ *
+ * All return values are in v0.
*/
-#define GET_CURPROC(reg) \
- call_pal PAL_OSF1_rdval ; \
- addq v0, CPU_INFO_CURPROC, reg
+#define GET_CPUINFO call_pal PAL_OSF1_rdval
-#define GET_FPCURPROC(reg) \
+#define GET_CURPROC \
call_pal PAL_OSF1_rdval ; \
- addq v0, CPU_INFO_FPCURPROC, reg
+ addq v0, CPU_INFO_CURPROC, v0
-#define GET_CURPCB(reg) \
+#define GET_FPCURPROC \
call_pal PAL_OSF1_rdval ; \
- addq v0, CPU_INFO_CURPCB, reg
+ addq v0, CPU_INFO_FPCURPROC, v0
+
+#define GET_CURPCB \
+ call_pal PAL_OSF1_rdval ; \
+ addq v0, CPU_INFO_CURPCB, v0
#define GET_IDLE_PCB(reg) \
call_pal PAL_OSF1_rdval ; \
@@ -118,19 +122,19 @@
#define SPLRAISE splraise
#endif
-IMPORT(curproc, 8)
-IMPORT(fpcurproc, 8)
-IMPORT(curpcb, 8)
+IMPORT(cpu_info_store, CPU_INFO_SIZEOF)
+
+#define GET_CPUINFO lda v0, cpu_info_store
-#define GET_CURPROC(reg) lda reg, curproc
+#define GET_CURPROC lda v0, cpu_info_store + CPU_INFO_CURPROC
-#define GET_FPCURPROC(reg) lda reg, fpcurproc
+#define GET_FPCURPROC lda v0, cpu_info_store + CPU_INFO_FPCURPROC
-#define GET_CURPCB(reg) lda reg, curpcb
+#define GET_CURPCB lda v0, cpu_info_store + CPU_INFO_CURPCB
#define GET_IDLE_PCB(reg) \
- lda reg, proc0 ; \
- ldq reg, P_MD_PCBPADDR(reg)
+ lda reg, cpu_info_store ; \
+ ldq reg, CPU_INFO_IDLE_PCB_PADDR(reg)
#endif
/*
@@ -139,8 +143,8 @@
*/
#define SWITCH_CONTEXT \
/* Make a note of the context we're running on. */ \
- GET_CURPCB(t0) ; \
- stq a0, 0(t0) ; \
+ GET_CURPCB ; \
+ stq a0, 0(v0) ; \
\
/* Swap in the new context. */ \
call_pal PAL_OSF1_swpctx
@@ -348,7 +352,6 @@
*/
BSS(ssir, 8)
-IMPORT(astpending, 8)
LEAF(exception_return, 1) /* XXX should be NESTED */
br pv, 1f
@@ -382,19 +385,19 @@
beq t0, 4f /* no: just return */
/* yes */
- ldq t2, astpending /* AST pending? */
+ /* GET_CPUINFO clobbers v0, t0, t8...t11. */
+ GET_CPUINFO
+ ldq t2, CPU_INFO_ASTPENDING(v0) /* AST pending? */
bne t2, 6f /* yes */
/* no: return & deal with FP */
/*
* We are going back to usermode. Enable the FPU based on whether
- * the current proc is fpcurproc. Note: GET_*() clobbers v0, t0,
- * t8...t11.
+ * the current proc is fpcurproc. v0 already contains the cpu_info
+ * pointer from above.
*/
- GET_CURPROC(t1)
- ldq t1, 0(t1)
- GET_FPCURPROC(t2)
- ldq t2, 0(t2)
+ ldq t1, CPU_INFO_CURPROC(v0)
+ ldq t2, CPU_INFO_FPCURPROC(v0)
cmpeq t1, t2, t1
mov zero, a0
cmovne t1, 1, a0
@@ -767,7 +770,6 @@
/**************************************************************************/
IMPORT(sched_whichqs, 4)
-IMPORT(want_resched, 8)
IMPORT(kernel_lev1map, 8)
/*
@@ -779,9 +781,9 @@
LEAF(idle, 0)
br pv, 1f
1: LDGP(pv)
- /* Note: GET_CURPROC() clobbers v0, t0, t8...t11. */
- GET_CURPROC(t1)
- stq zero, 0(t1) /* curproc <- NULL for stats */
+ /* Note: GET_CURPROC clobbers v0, t0, t8...t11. */
+ GET_CURPROC
+ stq zero, 0(v0) /* curproc <- NULL for stats */
mov zero, a0 /* enable all interrupts */
call_pal PAL_OSF1_swpipl
2: ldl t0, sched_whichqs /* look for non-empty queue */
@@ -799,10 +801,10 @@
LDGP(pv)
/*
* do an inline savectx(), to save old context
- * Note: GET_CURPROC() clobbers v0, t0, t8...t11.
+ * Note: GET_CURPROC clobbers v0, t0, t8...t11.
*/
- GET_CURPROC(a0)
- ldq a0, 0(a0)
+ GET_CURPROC
+ ldq a0, 0(v0)
ldq a1, P_ADDR(a0)
/* NOTE: ksp is stored by the swpctx */
stq s0, U_PCB_CONTEXT+(0 * 8)(a1) /* store s0 - s6 */
@@ -914,7 +916,7 @@
* because we might have re-entered cpu_switch() from idle(),
* in which case curproc would be NULL.
*
- * Note: GET_CURPROC() clobbers v0, t0, t8...t11.
+ * Note: GET_CPUINFO clobbers v0, t0, t8...t11.
*/
#ifdef __alpha_bwx__
Home |
Main Index |
Thread Index |
Old Index