summaryrefslogtreecommitdiff
path: root/sys/arch/sh
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2020-09-25 14:42:40 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2020-09-25 14:42:40 +0000
commitf88f9d6e95546ec87e6c42631dffe8a923e9e107 (patch)
tree266b65b30e5f53b1746e6c2e5385e0ca342f8ec7 /sys/arch/sh
parent3d5c455178da8aba0966c1c6f5d72accc0bcbfaf (diff)
landisk has legacy global variable want_resched, rather than post-MP
ci->ci_want_resched. convert to the modern style.
Diffstat (limited to 'sys/arch/sh')
-rw-r--r--sys/arch/sh/include/cpu.h15
-rw-r--r--sys/arch/sh/sh/cpu.c13
-rw-r--r--sys/arch/sh/sh/locore_c.c3
-rw-r--r--sys/arch/sh/sh/trap.c4
4 files changed, 20 insertions, 15 deletions
diff --git a/sys/arch/sh/include/cpu.h b/sys/arch/sh/include/cpu.h
index 04384bbe847..0d9e5ea0bfa 100644
--- a/sys/arch/sh/include/cpu.h
+++ b/sys/arch/sh/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.29 2020/05/31 06:23:58 dlg Exp $ */
+/* $OpenBSD: cpu.h,v 1.30 2020/09/25 14:42:39 deraadt Exp $ */
/* $NetBSD: cpu.h,v 1.41 2006/01/21 04:24:12 uwe Exp $ */
/*-
@@ -68,6 +68,8 @@ struct cpu_info {
#ifdef GPROF
struct gmonparam *ci_gmon;
#endif
+
+ int ci_want_resched;
};
extern struct cpu_info cpu_info_store;
@@ -109,13 +111,8 @@ struct clockframe {
* Preempt the current process if in interrupt from user mode,
* or after the current trap/syscall if in system mode.
*/
-#define need_resched(ci) \
-do { \
- want_resched = 1; \
- if (curproc != NULL) \
- aston(curproc); \
-} while (/*CONSTCOND*/0)
-#define clear_resched(ci) want_resched = 0
+void need_resched(struct cpu_info *);
+#define clear_resched(ci) (ci)->ci_want_resched = 0
/*
* Give a profiling tick to the current process when the user profiling
@@ -132,8 +129,6 @@ do { \
#define aston(p) ((p)->p_md.md_astpending = 1)
-extern int want_resched; /* need_resched() was called */
-
/*
* We need a machine-independent name for this.
*/
diff --git a/sys/arch/sh/sh/cpu.c b/sys/arch/sh/sh/cpu.c
index 7b66c313390..680b2cb040f 100644
--- a/sys/arch/sh/sh/cpu.c
+++ b/sys/arch/sh/sh/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.4 2019/07/07 14:41:55 deraadt Exp $ */
+/* $OpenBSD: cpu.c,v 1.5 2020/09/25 14:42:25 deraadt Exp $ */
/* $NetBSD: cpu.c,v 1.8 2006/01/02 23:16:20 uwe Exp $ */
/*-
@@ -29,8 +29,10 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/proc.h>
#include <sys/device.h>
+#include <sh/cpu.h>
#include <sh/clock.h>
#include <sh/cache.h>
#include <sh/mmu.h>
@@ -74,3 +76,12 @@ cpu_attach(struct device *parent, struct device *self, void *aux)
sh_cache_information();
sh_mmu_information();
}
+
+void
+need_resched(struct cpu_info *ci)
+{
+ ci->ci_want_resched = 1;
+
+ if (ci->ci_curproc)
+ aston(ci->ci_curproc);
+}
diff --git a/sys/arch/sh/sh/locore_c.c b/sys/arch/sh/sh/locore_c.c
index b908f5f8169..562b6282ea7 100644
--- a/sys/arch/sh/sh/locore_c.c
+++ b/sys/arch/sh/sh/locore_c.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore_c.c,v 1.12 2014/11/18 20:51:01 krw Exp $ */
+/* $OpenBSD: locore_c.c,v 1.13 2020/09/25 14:42:25 deraadt Exp $ */
/* $NetBSD: locore_c.c,v 1.13 2006/03/04 01:13:35 uwe Exp $ */
/*-
@@ -121,7 +121,6 @@
void (*__sh_switch_resume)(struct proc *);
void cpu_switch_prepare(struct proc *, struct proc *);
-int want_resched;
/*
* Prepare context switch from oproc to nproc.
diff --git a/sys/arch/sh/sh/trap.c b/sys/arch/sh/sh/trap.c
index 0f84e2fe593..be252802363 100644
--- a/sys/arch/sh/sh/trap.c
+++ b/sys/arch/sh/sh/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.43 2020/09/24 17:54:30 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.44 2020/09/25 14:42:25 deraadt Exp $ */
/* $NetBSD: exception.c,v 1.32 2006/09/04 23:57:52 uwe Exp $ */
/* $NetBSD: syscall.c,v 1.6 2006/03/07 07:21:50 thorpej Exp $ */
@@ -486,7 +486,7 @@ ast(struct proc *p, struct trapframe *tf)
p->p_md.md_astpending = 0;
refreshcreds(p);
uvmexp.softs++;
- mi_ast(p, want_resched);
+ mi_ast(p, curcpu()->ci_want_resched);
userret(p);
}
}