summaryrefslogtreecommitdiff
path: root/sys/arch/sh
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2007-05-14 07:05:50 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2007-05-14 07:05:50 +0000
commit150a39c85f36cf1ddb9293785762f056bcde0d12 (patch)
tree649339d6b96742daac0f88ced1f475677bc23e66 /sys/arch/sh
parentb1bf4a49558aad5e868d4c90624c5aa5d5735819 (diff)
Switch sh to __HAVE_CPUINFO. The least possible effort for now.
deraadt@ ok
Diffstat (limited to 'sys/arch/sh')
-rw-r--r--sys/arch/sh/include/_types.h3
-rw-r--r--sys/arch/sh/include/cpu.h22
-rw-r--r--sys/arch/sh/include/userret.h4
-rw-r--r--sys/arch/sh/sh/cpu.c4
-rw-r--r--sys/arch/sh/sh/genassym.cf5
-rw-r--r--sys/arch/sh/sh/vectors.S10
6 files changed, 37 insertions, 11 deletions
diff --git a/sys/arch/sh/include/_types.h b/sys/arch/sh/include/_types.h
index f01260841f8..01a8bf457cd 100644
--- a/sys/arch/sh/include/_types.h
+++ b/sys/arch/sh/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.2 2007/05/01 18:59:40 miod Exp $ */
+/* $OpenBSD: _types.h,v 1.3 2007/05/14 07:05:49 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -118,5 +118,6 @@ typedef void * __wctype_t;
/* Feature test macros */
#define __HAVE_GENERIC_SOFT_INTERRUPTS
#define __HAVE_MUTEX
+#define __HAVE_CPUINFO
#endif /* _SH__TYPES_H_ */
diff --git a/sys/arch/sh/include/cpu.h b/sys/arch/sh/include/cpu.h
index 5b3478eed30..7d2fa1a539e 100644
--- a/sys/arch/sh/include/cpu.h
+++ b/sys/arch/sh/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.8 2007/04/29 17:53:37 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.9 2007/05/14 07:05:49 art Exp $ */
/* $NetBSD: cpu.h,v 1.41 2006/01/21 04:24:12 uwe Exp $ */
/*-
@@ -51,6 +51,26 @@
#ifdef _KERNEL
/*
+ * Per-CPU information.
+ */
+
+#include <sys/sched.h>
+struct cpu_info {
+ struct proc *ci_curproc;
+
+ struct schedstate_percpu ci_schedstate; /* scheduler state */
+};
+
+extern struct cpu_info cpu_info_store;
+#define curcpu() (&cpu_info_store)
+#define cpu_number() 0
+#define CPU_IS_PRIMARY(ci) 1
+#define CPU_INFO_ITERATOR int
+#define CPU_INFO_FOREACH(cii, ci) \
+ for (cii = 0, ci = curcpu(); ci != NULL; ci = NULL)
+
+
+/*
* Arguments to hardclock and gatherstats encapsulate the previous
* machine state in an opaque clockframe.
*/
diff --git a/sys/arch/sh/include/userret.h b/sys/arch/sh/include/userret.h
index 07db83959a2..f67a2a22d63 100644
--- a/sys/arch/sh/include/userret.h
+++ b/sys/arch/sh/include/userret.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: userret.h,v 1.1 2006/10/06 21:02:55 miod Exp $ */
+/* $OpenBSD: userret.h,v 1.2 2007/05/14 07:05:49 art Exp $ */
/* $NetBSD: userret.h,v 1.9 2006/02/16 20:17:15 perry Exp $ */
/*
@@ -90,5 +90,5 @@ 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;
}
diff --git a/sys/arch/sh/sh/cpu.c b/sys/arch/sh/sh/cpu.c
index a3c5b98f83f..a5b50b5ebfe 100644
--- a/sys/arch/sh/sh/cpu.c
+++ b/sys/arch/sh/sh/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.1 2006/10/06 21:02:55 miod Exp $ */
+/* $OpenBSD: cpu.c,v 1.2 2007/05/14 07:05:49 art Exp $ */
/* $NetBSD: cpu.c,v 1.8 2006/01/02 23:16:20 uwe Exp $ */
/*-
@@ -55,6 +55,8 @@ struct cfdriver cpu_cd = {
0, "cpu", DV_DULL
};
+struct cpu_info cpu_info_store;
+
int
cpu_match(struct device *parent, void *vcf, void *aux)
{
diff --git a/sys/arch/sh/sh/genassym.cf b/sys/arch/sh/sh/genassym.cf
index 04df820b33f..9227338a9a3 100644
--- a/sys/arch/sh/sh/genassym.cf
+++ b/sys/arch/sh/sh/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.2 2007/03/02 06:11:54 miod Exp $
+# $OpenBSD: genassym.cf,v 1.3 2007/05/14 07:05:49 art Exp $
# $NetBSD: genassym.cf,v 1.10 2005/12/11 12:19:00 christos Exp $
#-
@@ -92,3 +92,6 @@ struct mbuf
member m_data
member m_len
member m_next
+
+struct cpu_info
+member ci_curproc
diff --git a/sys/arch/sh/sh/vectors.S b/sys/arch/sh/sh/vectors.S
index 26c7d1d235e..0d1c5da72e5 100644
--- a/sys/arch/sh/sh/vectors.S
+++ b/sys/arch/sh/sh/vectors.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: vectors.S,v 1.1 2006/10/06 21:02:55 miod Exp $ */
+/* $OpenBSD: vectors.S,v 1.2 2007/05/14 07:05:49 art Exp $ */
/* $NetBSD: exception_vector.S,v 1.19 2006/08/22 21:47:57 uwe Exp $ */
/*-
@@ -118,7 +118,7 @@ NENTRY(sh_vector_generic)
2: __EXCEPTION_RETURN
/* NOTREACHED */
.align 2
-_L.curproc: .long _C_LABEL(curproc)
+_L.curproc: .long _C_LABEL(cpu_info_store) + CI_CURPROC
REG_SYMBOL(EXPEVT)
REG_SYMBOL(BBRA)
REG_SYMBOL(TEA)
@@ -188,7 +188,7 @@ NENTRY(sh3_vector_tlbmiss)
mov r14, r5 /* 2nd arg */
3: __EXCEPTION_RETURN
.align 2
-2: .long _C_LABEL(curproc)
+2: .long _C_LABEL(cpu_info_store) + CI_CURPROC
1: .long _C_LABEL(tlb_exception)
__L.VPN_MASK: .long 0xfffff000
_L.CURUPTE: .long _C_LABEL(curupte)
@@ -224,7 +224,7 @@ NENTRY(sh4_vector_tlbmiss)
__EXCEPTION_RETURN
.align 2
1: .long _C_LABEL(tlb_exception)
-2: .long _C_LABEL(curproc)
+2: .long _C_LABEL(cpu_info_store) + CI_CURPROC
_L.EXPEVT4: .long SH4_EXPEVT
_L.TEA4: .long SH4_TEA
@@ -265,7 +265,7 @@ NENTRY(sh_vector_interrupt)
mov r14, r5 /* 2nd arg */
__EXCEPTION_RETURN
.align 2
-1: .long _C_LABEL(curproc)
+1: .long _C_LABEL(cpu_info_store) + CI_CURPROC
__L.intc_intr: .long _C_LABEL(intc_intr)
__L.ast: .long _C_LABEL(ast)
__L.uvmexp.intrs: .long _C_LABEL(uvmexp) + UVMEXP_INTRS