Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc PT_{STEP,GETREGS,SETREGS} support.



details:   https://anonhg.NetBSD.org/src/rev/5329bd489fb7
branches:  trunk
changeset: 472593:5329bd489fb7
user:      tsubai <tsubai%NetBSD.org@localhost>
date:      Mon May 03 10:02:19 1999 +0000

description:
PT_{STEP,GETREGS,SETREGS} support.

diffstat:

 sys/arch/powerpc/include/ptrace.h          |   5 +++-
 sys/arch/powerpc/include/reg.h             |  10 ++++++-
 sys/arch/powerpc/powerpc/process_machdep.c |  40 +++++++++++++++++++++++++++++-
 sys/arch/powerpc/powerpc/trap.c            |   7 +++--
 4 files changed, 56 insertions(+), 6 deletions(-)

diffs (102 lines):

diff -r 7b369b928bd7 -r 5329bd489fb7 sys/arch/powerpc/include/ptrace.h
--- a/sys/arch/powerpc/include/ptrace.h Mon May 03 09:49:55 1999 +0000
+++ b/sys/arch/powerpc/include/ptrace.h Mon May 03 10:02:19 1999 +0000
@@ -1,2 +1,5 @@
-/*     $NetBSD: ptrace.h,v 1.2 1998/01/05 07:03:17 perry Exp $ */
+/*     $NetBSD: ptrace.h,v 1.3 1999/05/03 10:02:19 tsubai Exp $        */
 
+#define        PT_STEP         (PT_FIRSTMACH + 0)
+#define        PT_GETREGS      (PT_FIRSTMACH + 1)
+#define        PT_SETREGS      (PT_FIRSTMACH + 2)
diff -r 7b369b928bd7 -r 5329bd489fb7 sys/arch/powerpc/include/reg.h
--- a/sys/arch/powerpc/include/reg.h    Mon May 03 09:49:55 1999 +0000
+++ b/sys/arch/powerpc/include/reg.h    Mon May 03 10:02:19 1999 +0000
@@ -1,2 +1,10 @@
-/*     $NetBSD: reg.h,v 1.2 1998/01/05 07:03:18 perry Exp $    */
+/*     $NetBSD: reg.h,v 1.3 1999/05/03 10:02:19 tsubai Exp $   */
 
+struct reg {
+       register_t fixreg[32];
+       register_t lr;
+       int cr;
+       int xer;
+       register_t ctr;
+       register_t pc;
+};
diff -r 7b369b928bd7 -r 5329bd489fb7 sys/arch/powerpc/powerpc/process_machdep.c
--- a/sys/arch/powerpc/powerpc/process_machdep.c        Mon May 03 09:49:55 1999 +0000
+++ b/sys/arch/powerpc/powerpc/process_machdep.c        Mon May 03 10:02:19 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: process_machdep.c,v 1.1 1996/09/30 16:34:53 ws Exp $   */
+/*     $NetBSD: process_machdep.c,v 1.2 1999/05/03 10:02:19 tsubai Exp $       */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -30,8 +30,46 @@
  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
 #include <sys/param.h>
 #include <sys/proc.h>
+#include <sys/systm.h>
+
+#include <machine/reg.h>
+
+int
+process_read_regs(p, regs)
+       struct proc *p;
+       struct reg *regs;
+{
+       struct trapframe *tf = trapframe(p);
+
+       bcopy(tf->fixreg, regs->fixreg, sizeof(regs->fixreg));
+       regs->lr = tf->lr;
+       regs->cr = tf->cr;
+       regs->xer = tf->xer;
+       regs->ctr = tf->ctr;
+       regs->pc = tf->srr0;
+
+       return 0;
+}
+
+int
+process_write_regs(p, regs)
+       struct proc *p;
+       struct reg *regs;
+{
+       struct trapframe *tf = trapframe(p);
+
+       bcopy(regs->fixreg, tf->fixreg, sizeof(regs->fixreg));
+       tf->lr = regs->lr;
+       tf->cr = regs->cr;
+       tf->xer = regs->xer;
+       tf->ctr = regs->ctr;
+       tf->srr0 = regs->pc;
+
+       return 0;
+}
 
 /*
  * Set the process's program counter.
diff -r 7b369b928bd7 -r 5329bd489fb7 sys/arch/powerpc/powerpc/trap.c
--- a/sys/arch/powerpc/powerpc/trap.c   Mon May 03 09:49:55 1999 +0000
+++ b/sys/arch/powerpc/powerpc/trap.c   Mon May 03 10:02:19 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.21 1999/03/26 08:32:15 tsubai Exp $ */
+/*     $NetBSD: trap.c,v 1.22 1999/05/03 10:02:20 tsubai Exp $ */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -76,8 +76,9 @@
        }
 
        switch (type) {
-       case EXC_TRC|EXC_USER:          /* Temporarily!                                 XXX */
-               printf("TRC: %x\n", frame->srr0);
+       case EXC_TRC|EXC_USER:
+               frame->srr1 &= ~PSL_SE;
+               trapsignal(p, SIGTRAP, EXC_TRC);
                break;
        case EXC_DSI:
                {



Home | Main Index | Thread Index | Old Index