summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2007-09-08 17:13:19 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2007-09-08 17:13:19 +0000
commit6cf939d9e97dbdf3fb06aaeb4b5c3fd6f5155273 (patch)
treeccd76a0a63a473e43609e185b0b70a345911a8b0 /sys/arch
parentdc0ceca9187cac5e52e3cf0115b5b60caba6a998 (diff)
Make the ast on sparc64 per-process instead of global. Necessary to make
signal delivery more reliable once we go smp (although the code for that is still missing). "in principle, this looks good" art@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sparc64/include/cpu.h14
-rw-r--r--sys/arch/sparc64/include/proc.h1
-rw-r--r--sys/arch/sparc64/sparc64/cpu.c12
-rw-r--r--sys/arch/sparc64/sparc64/genassym.cf3
-rw-r--r--sys/arch/sparc64/sparc64/locore.s11
-rw-r--r--sys/arch/sparc64/sparc64/machdep.c15
-rw-r--r--sys/arch/sparc64/sparc64/trap.c4
7 files changed, 39 insertions, 21 deletions
diff --git a/sys/arch/sparc64/include/cpu.h b/sys/arch/sparc64/include/cpu.h
index 25ecdad817a..6331ae2761e 100644
--- a/sys/arch/sparc64/include/cpu.h
+++ b/sys/arch/sparc64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.41 2007/09/04 20:36:52 kettenis Exp $ */
+/* $OpenBSD: cpu.h,v 1.42 2007/09/08 17:13:17 kettenis Exp $ */
/* $NetBSD: cpu.h,v 1.28 2001/06/14 22:56:58 thorpej Exp $ */
/*
@@ -159,13 +159,13 @@ struct clockframe {
void setsoftnet(void);
-extern int want_ast;
+#define aston(p) ((p)->p_md.md_astpending = 1)
/*
* Preempt the current process if in interrupt from user mode,
* or after the current trap/syscall if in system mode.
*/
-#define need_resched(ci) (ci->ci_want_resched = 1, want_ast = 1)
+extern void need_resched(struct cpu_info *);
/*
* This is used during profiling to integrate system time.
@@ -177,13 +177,9 @@ extern int want_ast;
* buffer pages are invalid. On the sparc, request an ast to send us
* through trap(), marking the proc as needing a profiling tick.
*/
-#define need_proftick(p) do { want_ast = 1; } while (0)
+#define need_proftick(p) aston(p)
-/*
- * Notify the current process (p) that it has a signal pending,
- * process as soon as possible.
- */
-#define signotify(p) (want_ast = 1)
+void signotify(struct proc *);
/*
* Only one process may own the FPU state.
diff --git a/sys/arch/sparc64/include/proc.h b/sys/arch/sparc64/include/proc.h
index a39c6f04f61..84d8a86f7ac 100644
--- a/sys/arch/sparc64/include/proc.h
+++ b/sys/arch/sparc64/include/proc.h
@@ -47,6 +47,7 @@ struct mdproc {
struct trapframe64 *md_tf; /* trap/syscall registers */
struct fpstate64 *md_fpstate; /* fpu state, if any; always resident */
u_long md_flags;
+ __volatile int md_astpending;
};
/* md_flags */
diff --git a/sys/arch/sparc64/sparc64/cpu.c b/sys/arch/sparc64/sparc64/cpu.c
index 374b8ae1bec..5e773e0b385 100644
--- a/sys/arch/sparc64/sparc64/cpu.c
+++ b/sys/arch/sparc64/sparc64/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.21 2007/09/04 20:36:52 kettenis Exp $ */
+/* $OpenBSD: cpu.c,v 1.22 2007/09/08 17:13:17 kettenis Exp $ */
/* $NetBSD: cpu.c,v 1.13 2001/05/26 21:27:15 chs Exp $ */
/*
@@ -79,8 +79,6 @@ char machine[] = MACHINE; /* from <machine/param.h> */
char cpu_model[100];
struct proc *fpproc;
-int want_ast;
-extern int want_resched;
/* The CPU configuration driver. */
static void cpu_attach(struct device *, struct device *, void *);
@@ -283,3 +281,11 @@ cpu_attach(parent, dev, aux)
struct cfdriver cpu_cd = {
NULL, "cpu", DV_DULL
};
+
+void
+need_resched(struct cpu_info *ci)
+{
+ ci->ci_want_resched = 1;
+ if (ci->ci_curproc != NULL)
+ aston(ci->ci_curproc);
+}
diff --git a/sys/arch/sparc64/sparc64/genassym.cf b/sys/arch/sparc64/sparc64/genassym.cf
index 881533a9a82..9c7268a3dc4 100644
--- a/sys/arch/sparc64/sparc64/genassym.cf
+++ b/sys/arch/sparc64/sparc64/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.17 2007/08/25 22:09:03 kettenis Exp $
+# $OpenBSD: genassym.cf,v 1.18 2007/09/08 17:13:18 kettenis Exp $
# $NetBSD: genassym.cf,v 1.23 2001/08/08 00:09:30 eeh Exp $
#
@@ -118,6 +118,7 @@ member p_wchan
member p_vmspace
member p_pid
member P_FPSTATE p_md.md_fpstate
+member P_MD_ASTPENDING p_md.md_astpending
export SRUN
export SONPROC
diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s
index d0e4342a3ec..283dda72c7e 100644
--- a/sys/arch/sparc64/sparc64/locore.s
+++ b/sys/arch/sparc64/sparc64/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.78 2007/05/28 23:10:10 beck Exp $ */
+/* $OpenBSD: locore.s,v 1.79 2007/09/08 17:13:18 kettenis Exp $ */
/* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */
/*
@@ -3628,7 +3628,7 @@ return_from_trap:
btst TSTATE_PRIV, %g1 ! returning to userland?
CHKPT %g4, %g7, 6
bz,pt %icc, rft_user
- sethi %hi(_C_LABEL(want_ast)), %g7 ! first instr of rft_user
+ sethi %hi(CURPROC), %g7 ! first instr of rft_user
/*
* Return from trap, to kernel.
@@ -3672,8 +3672,9 @@ rft_wcnt: .word 0
.text
rft_user:
-! sethi %hi(_C_LABEL(want_ast)), %g7 ! (done above)
- lduw [%g7 + %lo(_C_LABEL(want_ast))], %g7! want AST trap?
+! sethi %hi(CURPROC), %g7 ! (done above)
+ ldx [%g7 + %lo(CURPROC)], %g7
+ lduw [%g7 + %lo(P_MD_ASTPENDING)], %g7! want AST trap?
brnz,pn %g7, softtrap ! yes, re-enter trap with type T_AST
mov T_AST, %g4
@@ -3805,7 +3806,7 @@ rft_user:
tst %g5
tnz %icc, 1; nop ! Debugger if we still have saved windows
bne,a rft_user ! Try starting over again
- sethi %hi(_C_LABEL(want_ast)), %g7
+ sethi %hi(CURPROC), %g7
#endif /* DEBUG */
/*
* Set up our return trapframe so we can recover if we trap from here
diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c
index 5eba5e676d3..a955287adcd 100644
--- a/sys/arch/sparc64/sparc64/machdep.c
+++ b/sys/arch/sparc64/sparc64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.95 2007/09/03 01:09:09 krw Exp $ */
+/* $OpenBSD: machdep.c,v 1.96 2007/09/08 17:13:18 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */
/*-
@@ -671,6 +671,19 @@ sys_sigreturn(p, v, retval)
return (EJUSTRETURN);
}
+/*
+ * Notify the current process (p) that it has a signal pending,
+ * process as soon as possible.
+ */
+void
+signotify(struct proc *p)
+{
+ aston(p);
+#ifdef MULTIPROCESSOR
+ /* XXX Send IPI if necessary. */
+#endif
+}
+
int waittime = -1;
struct pcb dumppcb;
diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c
index 4ef5c0c9e2b..48680a60d22 100644
--- a/sys/arch/sparc64/sparc64/trap.c
+++ b/sys/arch/sparc64/sparc64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.52 2007/09/04 20:36:52 kettenis Exp $ */
+/* $OpenBSD: trap.c,v 1.53 2007/09/08 17:13:18 kettenis Exp $ */
/* $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */
/*
@@ -491,7 +491,7 @@ badtrap:
#endif
case T_AST:
- want_ast = 0;
+ p->p_md.md_astpending = 0;
if (p->p_flag & P_OWEUPC) {
ADDUPROF(p);
}