summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/sh/include/proc.h3
-rw-r--r--sys/arch/sh/sh/locore_c.c17
-rw-r--r--sys/arch/sh/sh/process_machdep.c6
3 files changed, 22 insertions, 4 deletions
diff --git a/sys/arch/sh/include/proc.h b/sys/arch/sh/include/proc.h
index a308274bf3e..3ca55e97ad0 100644
--- a/sys/arch/sh/include/proc.h
+++ b/sys/arch/sh/include/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.1 2006/10/06 21:02:55 miod Exp $ */
+/* $OpenBSD: proc.h,v 1.2 2006/11/28 18:52:23 kettenis Exp $ */
/* $NetBSD: proc.h,v 1.10 2005/12/11 12:18:58 christos Exp $ */
/*
@@ -59,6 +59,7 @@ struct mdproc {
/* md_flags */
#define MDP_USEDFPU 0x0001 /* has used the FPU */
+#define MDP_STEP 0x0002 /* single step */
#ifdef _KERNEL
#ifndef _LOCORE
diff --git a/sys/arch/sh/sh/locore_c.c b/sys/arch/sh/sh/locore_c.c
index f034e45846c..8374ada9b0e 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.1 2006/10/06 21:02:55 miod Exp $ */
+/* $OpenBSD: locore_c.c,v 1.2 2006/11/28 18:52:23 kettenis Exp $ */
/* $NetBSD: locore_c.c,v 1.13 2006/03/04 01:13:35 uwe Exp $ */
/*-
@@ -124,6 +124,7 @@
#include <sh/pmap.h>
#include <sh/mmu_sh3.h>
#include <sh/mmu_sh4.h>
+#include <sh/ubcreg.h>
void (*__sh_switch_resume)(struct proc *);
struct proc *cpu_switch_search(struct proc *);
@@ -149,11 +150,25 @@ cpu_switch_prepare(struct proc *oproc, struct proc *nproc)
{
nproc->p_stat = SONPROC;
+ if (oproc && (oproc->p_md.md_flags & MDP_STEP))
+ _reg_write_2(SH_(BBRB), 0);
+
if (nproc != oproc) {
curpcb = nproc->p_md.md_pcb;
pmap_activate(nproc);
}
+ if (nproc->p_md.md_flags & MDP_STEP) {
+ int pm_asid = nproc->p_vmspace->vm_map.pmap->pm_asid;
+
+ _reg_write_2(SH_(BBRB), 0);
+ _reg_write_4(SH_(BARB), nproc->p_md.md_regs->tf_spc);
+ _reg_write_1(SH_(BASRB), pm_asid);
+ _reg_write_1(SH_(BAMRB), 0);
+ _reg_write_2(SH_(BRCR), 0x0040);
+ _reg_write_2(SH_(BBRB), 0x0014);
+ }
+
curproc = nproc;
return (nproc);
}
diff --git a/sys/arch/sh/sh/process_machdep.c b/sys/arch/sh/sh/process_machdep.c
index 9f82c48527a..cc5f5ac8bc3 100644
--- a/sys/arch/sh/sh/process_machdep.c
+++ b/sys/arch/sh/sh/process_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: process_machdep.c,v 1.1 2006/10/06 21:02:55 miod Exp $ */
+/* $OpenBSD: process_machdep.c,v 1.2 2006/11/28 18:52:23 kettenis Exp $ */
/* $NetBSD: process_machdep.c,v 1.12 2006/01/21 04:12:22 uwe Exp $ */
/*
@@ -192,7 +192,9 @@ int
process_sstep(struct proc *p, int sstep)
{
if (sstep)
- return (EINVAL);
+ p->p_md.md_flags |= MDP_STEP;
+ else
+ p->p_md.md_flags &= ~MDP_STEP;
return (0);
}