summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2006-12-14 14:56:24 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2006-12-14 14:56:24 +0000
commit34012bb911e7f2da22971932eb993e5dcd603a19 (patch)
tree335ad42d2795b196d7b440a4c30e477e7862ef1b /sys
parenta67c0fe05d45cfb5d508376ffe6c104be9d78393 (diff)
Reset BBRB if we exit from a process that was single-stepping. Prevents a
process that re-uses its ASID from getting random SIGTRAPs. ok miod@, mickey@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sh/sh/locore_c.c12
-rw-r--r--sys/arch/sh/sh/locore_subr.S13
2 files changed, 12 insertions, 13 deletions
diff --git a/sys/arch/sh/sh/locore_c.c b/sys/arch/sh/sh/locore_c.c
index 8374ada9b0e..f90d554bde8 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.2 2006/11/28 18:52:23 kettenis Exp $ */
+/* $OpenBSD: locore_c.c,v 1.3 2006/12/14 14:56:23 kettenis Exp $ */
/* $NetBSD: locore_c.c,v 1.13 2006/03/04 01:13:35 uwe Exp $ */
/*-
@@ -129,6 +129,7 @@
void (*__sh_switch_resume)(struct proc *);
struct proc *cpu_switch_search(struct proc *);
struct proc *cpu_switch_prepare(struct proc *, struct proc *);
+void switch_exit(struct proc *, void (*)(struct proc *));
void idle(void);
int want_resched;
@@ -200,6 +201,15 @@ cpu_switch_search(struct proc *oproc)
return (cpu_switch_prepare(oproc, p));
}
+void
+cpu_exit(struct proc *p)
+{
+ if (p->p_md.md_flags & MDP_STEP)
+ _reg_write_2(SH_(BBRB), 0);
+
+ switch_exit(p, exit2);
+}
+
/*
* void idle(void):
* When no processes are on the run queue, wait for something to come
diff --git a/sys/arch/sh/sh/locore_subr.S b/sys/arch/sh/sh/locore_subr.S
index 2ad7d951ffd..7e54ed205ed 100644
--- a/sys/arch/sh/sh/locore_subr.S
+++ b/sys/arch/sh/sh/locore_subr.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore_subr.S,v 1.4 2006/11/10 07:02:55 miod Exp $ */
+/* $OpenBSD: locore_subr.S,v 1.5 2006/12/14 14:56:23 kettenis Exp $ */
/* $NetBSD: locore_subr.S,v 1.28 2006/01/23 22:52:09 uwe Exp $ */
/*-
@@ -132,15 +132,6 @@ ENTRY(cpu_switch)
FUNC_SYMBOL(switch_resume)
-
-/*
- * LINTSTUB: Func: void cpu_exit(struct proc *p)
- * Just fall-through to the switch_exit below.
- */
-ENTRY(cpu_exit)
- mov.l .L_switch_exit_proc_exit2, r5 /* exit_func to call */
- /* FALLTHROUGH */
-
/*
* LINTSTUB: Func: void switch_exit(struct proc *p, void (*exit_func)(struct proc *))
* Called only from cpu_exit(p). Before we call exit_func to
@@ -174,8 +165,6 @@ ALTENTRY(switch_exit)
mov #0, r4 /* no "previous" proc */
.align 2
-.L_switch_exit_proc_exit2:
- .long _C_LABEL(exit2)
.L_switch_exit_proc0_pcb:
.long _C_LABEL(proc0) + P_MD_PCB
.L_switch_exit_curpcb: