summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/sparc/conf/Makefile.sparc6
-rw-r--r--sys/arch/sparc/include/_types.h3
-rw-r--r--sys/arch/sparc/include/cpu.h4
-rw-r--r--sys/arch/sparc/include/psl.h4
-rw-r--r--sys/arch/sparc/sparc/cpu.c5
-rw-r--r--sys/arch/sparc/sparc/cpuvar.h22
-rw-r--r--sys/arch/sparc/sparc/genassym.cf3
-rw-r--r--sys/arch/sparc/sparc/locore.s4
-rw-r--r--sys/arch/sparc/sparc/trap.c4
9 files changed, 42 insertions, 13 deletions
diff --git a/sys/arch/sparc/conf/Makefile.sparc b/sys/arch/sparc/conf/Makefile.sparc
index e27b9742c8a..c7eb2211287 100644
--- a/sys/arch/sparc/conf/Makefile.sparc
+++ b/sys/arch/sparc/conf/Makefile.sparc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.sparc,v 1.36 2006/07/27 05:58:12 miod Exp $
+# $OpenBSD: Makefile.sparc,v 1.37 2007/05/08 07:23:18 art Exp $
# $NetBSD: Makefile.sparc,v 1.32.4.1 1996/06/12 20:26:32 pk Exp $
# Makefile for OpenBSD
@@ -58,7 +58,7 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE
LINKFLAGS= -N -e start -Ttext F8004000
STRIPFLAGS= -g -X -x
-HOSTCC= ${CC}
+HOSTCC?= ${CC}
HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
HOSTED_CFLAGS= ${CFLAGS}
@@ -127,7 +127,7 @@ LINKFLAGS+= -S -x
%LOAD
assym.h: $S/kern/genassym.sh ${SPARC}/sparc/genassym.cf Makefile
- sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} \
+ sh $S/kern/genassym.sh ${HOSTCC} ${CPPFLAGS} \
${PARAM} < ${SPARC}/sparc/genassym.cf > assym.h.tmp && \
mv -f assym.h.tmp assym.h
diff --git a/sys/arch/sparc/include/_types.h b/sys/arch/sparc/include/_types.h
index bbc73389c41..4de839f5177 100644
--- a/sys/arch/sparc/include/_types.h
+++ b/sys/arch/sparc/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.4 2007/02/03 20:08:50 miod Exp $ */
+/* $OpenBSD: _types.h,v 1.5 2007/05/08 07:23:18 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -116,5 +116,6 @@ typedef void * __wctype_t;
#define __HAVE_DEVICE_REGISTER
#define __HAVE_MUTEX
+#define __HAVE_CPUINFO
#endif /* _SPARC__TYPES_H_ */
diff --git a/sys/arch/sparc/include/cpu.h b/sys/arch/sparc/include/cpu.h
index c866f1d4803..44686965093 100644
--- a/sys/arch/sparc/include/cpu.h
+++ b/sys/arch/sparc/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.28 2007/03/15 10:22:29 art Exp $ */
+/* $OpenBSD: cpu.h,v 1.29 2007/05/08 07:23:18 art Exp $ */
/* $NetBSD: cpu.h,v 1.24 1997/03/15 22:25:15 pk Exp $ */
/*
@@ -68,7 +68,9 @@
#include <sys/evcount.h>
#include <machine/psl.h>
+#include <machine/reg.h>
#include <sparc/sparc/intreg.h>
+#include <sparc/sparc/cpuvar.h>
/*
* definitions of cpu-dependent requirements
diff --git a/sys/arch/sparc/include/psl.h b/sys/arch/sparc/include/psl.h
index 8454ad65e57..96418442bc9 100644
--- a/sys/arch/sparc/include/psl.h
+++ b/sys/arch/sparc/include/psl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: psl.h,v 1.21 2006/03/12 03:14:37 brad Exp $ */
+/* $OpenBSD: psl.h,v 1.22 2007/05/08 07:23:18 art Exp $ */
/* $NetBSD: psl.h,v 1.12 1997/03/10 21:49:11 pk Exp $ */
/*
@@ -95,6 +95,7 @@
*/
#define IPL_AUHARD 13 /* hard audio interrupts */
#define IPL_STATCLOCK 14 /* statclock() */
+#define IPL_SCHED IPL_STATCLOCK
#define IPL_HIGH 15 /* splhigh() */
#if defined(_KERNEL) && !defined(_LOCORE)
@@ -226,6 +227,7 @@ SPLHOLD(splclock, IPL_CLOCK)
SPLHOLD(splfd, IPL_FD)
SPLHOLD(splzs, IPL_ZS)
SPLHOLD(splaudio, IPL_AUHARD)
+SPLHOLD(splsched, IPL_SCHED)
SPLHOLD(splstatclock, IPL_STATCLOCK)
static __inline int splhigh()
diff --git a/sys/arch/sparc/sparc/cpu.c b/sys/arch/sparc/sparc/cpu.c
index bae96f10900..e535c920705 100644
--- a/sys/arch/sparc/sparc/cpu.c
+++ b/sys/arch/sparc/sparc/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.41 2005/08/06 14:26:52 miod Exp $ */
+/* $OpenBSD: cpu.c,v 1.42 2007/05/08 07:23:18 art Exp $ */
/* $NetBSD: cpu.c,v 1.56 1997/09/15 20:52:36 pk Exp $ */
/*
@@ -244,6 +244,9 @@ cpu_attach(parent, self, aux)
if (sc->cacheinfo.c_totalsize != 0)
cache_print(sc);
+ memset(&sc->ci, 0, sizeof(sc->ci));
+ sc->ci.ci_softc = sc;
+
if (sc->master) {
int s;
diff --git a/sys/arch/sparc/sparc/cpuvar.h b/sys/arch/sparc/sparc/cpuvar.h
index 594b7d888fc..29147240aec 100644
--- a/sys/arch/sparc/sparc/cpuvar.h
+++ b/sys/arch/sparc/sparc/cpuvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpuvar.h,v 1.9 2003/11/03 07:01:33 david Exp $ */
+/* $OpenBSD: cpuvar.h,v 1.10 2007/05/08 07:23:18 art Exp $ */
/* $NetBSD: cpuvar.h,v 1.4 1997/07/06 21:14:25 pk Exp $ */
/*
@@ -41,6 +41,7 @@
#define _SPARC_CPUVAR_H
#include <sys/device.h>
+#include <sys/sched.h>
#include <sparc/sparc/cache.h> /* for cacheinfo */
@@ -77,6 +78,23 @@ struct module_info {
};
+struct cpu_softc;
+struct cpu_info {
+ struct cpu_softc *ci_softc;
+
+ struct proc *ci_curproc;
+ struct cpu_info *ci_next;
+
+ struct schedstate_percpu ci_schedstate;
+};
+
+#define curcpu() (&cpuinfo.ci)
+#define cpu_number() (cpuinfo.mid)
+#define CPU_IS_PRIMARY(ci) ((ci)->ci_softc->master)
+#define CPU_INFO_ITERATOR int
+#define CPU_INFO_FOREACH(cii, ci) \
+ for (cii = 0, ci = curcpu(); ci != NULL; ci = ci->ci_next)
+
/*
* The cpu_softc structure. This structure maintains information about one
* currently installed CPU (there may be several of these if the machine
@@ -88,6 +106,8 @@ struct module_info {
struct cpu_softc {
struct device dv; /* generic device info */
+ struct cpu_info ci;
+
int node; /* PROM node for this CPU */
/* CPU information */
diff --git a/sys/arch/sparc/sparc/genassym.cf b/sys/arch/sparc/sparc/genassym.cf
index 1dbf11cc5d5..8b2286e5ebf 100644
--- a/sys/arch/sparc/sparc/genassym.cf
+++ b/sys/arch/sparc/sparc/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.19 2005/04/17 18:47:50 miod Exp $
+# $OpenBSD: genassym.cf,v 1.20 2007/05/08 07:23:18 art Exp $
# $NetBSD: genassym.cf,v 1.2 1997/06/28 19:59:04 pk Exp $
#
@@ -104,6 +104,7 @@ member CPUINFO_GETSYNCFLT get_syncflt
member CPUINFO_GETASYNCFLT get_asyncflt
member CPUINFO_SYNCFLTDUMP syncfltdump
member CPUINFO_PURE_VCACHE_FLS pure_vcache_flush
+member CPUINFO_CURPROC ci.ci_curproc
# PTE bits and related information
export PG_W
diff --git a/sys/arch/sparc/sparc/locore.s b/sys/arch/sparc/sparc/locore.s
index b40eda32e84..0a29c31ae49 100644
--- a/sys/arch/sparc/sparc/locore.s
+++ b/sys/arch/sparc/sparc/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.70 2006/06/09 06:41:44 miod Exp $ */
+/* $OpenBSD: locore.s,v 1.71 2007/05/08 07:23:18 art Exp $ */
/* $NetBSD: locore.s,v 1.73 1997/09/13 20:36:48 pk Exp $ */
/*
@@ -183,6 +183,7 @@ _C_LABEL(kgdb_stack):
.globl _C_LABEL(cpcb)
_C_LABEL(cpcb): .word _C_LABEL(u0)
+curproc = CPUINFO_VA + CPUINFO_CURPROC
/*
* cputyp is the current cpu type, used to distinguish between
* the many variations of different sun4* machines. It contains
@@ -6401,6 +6402,5 @@ _C_LABEL(proc0paddr):
.comm _C_LABEL(nwindows), 4
.comm _C_LABEL(promvec), 4
- .comm _C_LABEL(curproc), 4
.comm _C_LABEL(qs), 32 * 8
.comm _C_LABEL(whichqs), 4
diff --git a/sys/arch/sparc/sparc/trap.c b/sys/arch/sparc/sparc/trap.c
index 01aa8002472..a7b059b80a7 100644
--- a/sys/arch/sparc/sparc/trap.c
+++ b/sys/arch/sparc/sparc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.51 2007/03/15 10:22:30 art Exp $ */
+/* $OpenBSD: trap.c,v 1.52 2007/05/08 07:23:18 art Exp $ */
/* $NetBSD: trap.c,v 1.58 1997/09/12 08:55:01 pk Exp $ */
/*
@@ -222,7 +222,7 @@ userret(struct proc *p)
while ((sig = CURSIG(p)) != 0)
postsig(sig);
- curpriority = p->p_priority = p->p_usrpri;
+ p->p_cpu->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
}
/*