Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64 Also handle FPU registers.



details:   https://anonhg.NetBSD.org/src/rev/50804f83dedb
branches:  trunk
changeset: 512182:50804f83dedb
user:      eeh <eeh%NetBSD.org@localhost>
date:      Sat Jul 07 15:16:13 2001 +0000

description:
Also handle FPU registers.

diffstat:

 sys/arch/sparc64/include/db_machdep.h   |   4 +-
 sys/arch/sparc64/sparc64/db_interface.c |  64 +++++++++++++++++++--
 sys/arch/sparc64/sparc64/db_trace.c     |  94 ++++++++++++++++++++++++++++++++-
 3 files changed, 152 insertions(+), 10 deletions(-)

diffs (267 lines):

diff -r 7806bdcc3ade -r 50804f83dedb sys/arch/sparc64/include/db_machdep.h
--- a/sys/arch/sparc64/include/db_machdep.h     Sat Jul 07 14:53:55 2001 +0000
+++ b/sys/arch/sparc64/include/db_machdep.h     Sat Jul 07 15:16:13 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_machdep.h,v 1.11 2000/06/29 07:37:56 mrg Exp $ */
+/*     $NetBSD: db_machdep.h,v 1.12 2001/07/07 15:16:13 eeh Exp $ */
 
 /*
  * Mach Operating System
@@ -57,6 +57,7 @@
        struct frame64          ddb_fr;
        struct trapstate        ddb_ts[5];
        int                     ddb_tl;
+       struct fpstate64        ddb_fpstate;
 } db_regs_t;
 #else
 typedef struct db_regs {
@@ -82,6 +83,7 @@
 #define        DDB_REGS        (&ddb_regs)
 #define        DDB_TF          (&ddb_regs.ddb_tf)
 #define        DDB_FR          (&ddb_regs.ddb_fr)
+#define        DDB_FP          (&ddb_regs.ddb_fpstate)
 
 #if defined(lint)
 #define        PC_REGS(regs)   ((regs)->ddb_tf.tf_pc)
diff -r 7806bdcc3ade -r 50804f83dedb sys/arch/sparc64/sparc64/db_interface.c
--- a/sys/arch/sparc64/sparc64/db_interface.c   Sat Jul 07 14:53:55 2001 +0000
+++ b/sys/arch/sparc64/sparc64/db_interface.c   Sat Jul 07 15:16:13 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.c,v 1.59 2001/06/04 20:56:52 mrg Exp $ */
+/*     $NetBSD: db_interface.c,v 1.60 2001/07/07 15:16:14 eeh Exp $ */
 
 /*
  * Mach Operating System
@@ -179,6 +179,41 @@
        { "i5", (long *)&DDB_FR->fr_arg[5], FCN_NULL, },
        { "i6", (long *)&DDB_FR->fr_arg[6], FCN_NULL, },
        { "i7", (long *)&DDB_FR->fr_arg[7], FCN_NULL, },
+       { "f0", (long *)&DDB_FP->fs_regs[0], FCN_NULL, },
+       { "f2", (long *)&DDB_FP->fs_regs[2], FCN_NULL, },
+       { "f4", (long *)&DDB_FP->fs_regs[4], FCN_NULL, },
+       { "f6", (long *)&DDB_FP->fs_regs[6], FCN_NULL, },
+       { "f8", (long *)&DDB_FP->fs_regs[8], FCN_NULL, },
+       { "f10", (long *)&DDB_FP->fs_regs[10], FCN_NULL, },
+       { "f12", (long *)&DDB_FP->fs_regs[12], FCN_NULL, },
+       { "f14", (long *)&DDB_FP->fs_regs[14], FCN_NULL, },
+       { "f16", (long *)&DDB_FP->fs_regs[16], FCN_NULL, },
+       { "f18", (long *)&DDB_FP->fs_regs[18], FCN_NULL, },
+       { "f20", (long *)&DDB_FP->fs_regs[20], FCN_NULL, },
+       { "f22", (long *)&DDB_FP->fs_regs[22], FCN_NULL, },
+       { "f24", (long *)&DDB_FP->fs_regs[24], FCN_NULL, },
+       { "f26", (long *)&DDB_FP->fs_regs[26], FCN_NULL, },
+       { "f28", (long *)&DDB_FP->fs_regs[28], FCN_NULL, },
+       { "f30", (long *)&DDB_FP->fs_regs[30], FCN_NULL, },
+       { "f32", (long *)&DDB_FP->fs_regs[32], FCN_NULL, },
+       { "f34", (long *)&DDB_FP->fs_regs[34], FCN_NULL, },
+       { "f36", (long *)&DDB_FP->fs_regs[36], FCN_NULL, },
+       { "f38", (long *)&DDB_FP->fs_regs[38], FCN_NULL, },
+       { "f40", (long *)&DDB_FP->fs_regs[40], FCN_NULL, },
+       { "f42", (long *)&DDB_FP->fs_regs[42], FCN_NULL, },
+       { "f44", (long *)&DDB_FP->fs_regs[44], FCN_NULL, },
+       { "f46", (long *)&DDB_FP->fs_regs[46], FCN_NULL, },
+       { "f48", (long *)&DDB_FP->fs_regs[48], FCN_NULL, },
+       { "f50", (long *)&DDB_FP->fs_regs[50], FCN_NULL, },
+       { "f52", (long *)&DDB_FP->fs_regs[52], FCN_NULL, },
+       { "f54", (long *)&DDB_FP->fs_regs[54], FCN_NULL, },
+       { "f56", (long *)&DDB_FP->fs_regs[56], FCN_NULL, },
+       { "f58", (long *)&DDB_FP->fs_regs[58], FCN_NULL, },
+       { "f60", (long *)&DDB_FP->fs_regs[60], FCN_NULL, },
+       { "f62", (long *)&DDB_FP->fs_regs[62], FCN_NULL, },
+       { "fsr", (long *)&DDB_FP->fs_fsr, FCN_NULL, },
+       { "gsr", (long *)&DDB_FP->fs_gsr, FCN_NULL, },
+
 };
 const struct db_variable * const db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
 
@@ -195,6 +230,7 @@
 void db_dump_window __P((db_expr_t, int, db_expr_t, char *));
 void db_dump_stack __P((db_expr_t, int, db_expr_t, char *));
 void db_dump_trap __P((db_expr_t, int, db_expr_t, char *));
+void db_dump_fpstate __P((db_expr_t, int, db_expr_t, char *));
 void db_dump_ts __P((db_expr_t, int, db_expr_t, char *));
 void db_dump_pcb __P((db_expr_t, int, db_expr_t, char *));
 void db_dump_pv __P((db_expr_t, int, db_expr_t, char *));
@@ -247,7 +283,6 @@
 #if NFB > 0
        fb_unblank();
 #endif
-
        switch (type) {
        case T_BREAKPOINT:      /* breakpoint */
                printf("kdb breakpoint at %llx\n",
@@ -271,6 +306,11 @@
        write_all_windows();
 
        ddb_regs.ddb_tf = *tf;
+       if (fpproc) {
+               savefpstate(fpproc->p_md.md_fpstate);
+               ddb_regs.ddb_fpstate = *fpproc->p_md.md_fpstate;
+               loadfpstate(fpproc->p_md.md_fpstate);
+       }
        /* We should do a proper copyin and xlate 64-bit stack frames, but... */
 /*     if (tf->tf_tstate & TSTATE_PRIV) { */
        
@@ -311,6 +351,10 @@
        db_active--;
        splx(s);
 
+       if (fpproc) {   
+               *fpproc->p_md.md_fpstate = ddb_regs.ddb_fpstate;
+               loadfpstate(fpproc->p_md.md_fpstate);
+       }
 #if 0
        /* We will not alter the machine's running state until we get everything else working */
        *(struct frame *)tf->tf_out[6] = ddb_regs.ddb_fr;
@@ -685,7 +729,8 @@
        db_printf("profile timer: %ld sec %ld usec\n",
                  p->p_stats->p_timer[ITIMER_PROF].it_value.tv_sec,
                  p->p_stats->p_timer[ITIMER_PROF].it_value.tv_usec);
-       db_printf("pcb: %p\n", &p->p_addr->u_pcb);
+       db_printf("pcb: %p fpstate: %p\n", &p->p_addr->u_pcb, 
+               p->p_md.md_fpstate);
        return;
 }
 
@@ -702,11 +747,13 @@
        for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
                if (p->p_stat) {
                        db_printf("process %p:", p);
-                       db_printf("pid:%d pmap:%p ctx:%x tf:%p lastcall:%s\n",
-                                 p->p_pid, p->p_vmspace->vm_map.pmap, 
-                                 p->p_vmspace->vm_map.pmap->pm_ctx,
-                                 p->p_md.md_tf, 
-                                 (p->p_addr->u_pcb.lastcall)?p->p_addr->u_pcb.lastcall:"Null");
+                       db_printf("pid:%d pmap:%p ctx:%x tf:%p fpstate %p "
+                               "lastcall:%s\n",
+                               p->p_pid, p->p_vmspace->vm_map.pmap,
+                               p->p_vmspace->vm_map.pmap->pm_ctx,
+                               p->p_md.md_tf, p->p_md.md_fpstate,
+                               (p->p_addr->u_pcb.lastcall)?
+                               p->p_addr->u_pcb.lastcall : "Null");
                }
        }
        return;
@@ -940,6 +987,7 @@
 #if NESP_SBUS
        { "esp",        db_esp,         0,      0 },
 #endif
+       { "fpstate",    db_dump_fpstate,0,      0 },
        { "kmap",       db_pmap_kernel, 0,      0 },
        { "lock",       db_lock,        0,      0 },
        { "pcb",        db_dump_pcb,    0,      0 },
diff -r 7806bdcc3ade -r 50804f83dedb sys/arch/sparc64/sparc64/db_trace.c
--- a/sys/arch/sparc64/sparc64/db_trace.c       Sat Jul 07 14:53:55 2001 +0000
+++ b/sys/arch/sparc64/sparc64/db_trace.c       Sat Jul 07 15:16:13 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_trace.c,v 1.21 2001/01/03 15:33:34 pk Exp $ */
+/*     $NetBSD: db_trace.c,v 1.22 2001/07/07 15:16:14 eeh Exp $ */
 
 /*
  * Mach Operating System
@@ -38,6 +38,7 @@
 #include <ddb/db_interface.h>
 #include <ddb/db_output.h>
 
+void db_dump_fpstate __P((db_expr_t, int, db_expr_t, char *));
 void db_dump_window __P((db_expr_t, int, db_expr_t, char *));
 void db_dump_stack __P((db_expr_t, int, db_expr_t, char *));
 void db_dump_trap __P((db_expr_t, int, db_expr_t, char *));
@@ -414,6 +415,97 @@
 #endif
 }
 
+void
+db_dump_fpstate(addr, have_addr, count, modif)
+       db_expr_t addr;
+       int have_addr;
+       db_expr_t count;
+       char *modif;
+{
+       struct fpstate64 *fpstate;
+
+       /* Use our last trapframe? */
+       fpstate = &ddb_regs.ddb_fpstate;
+       /* Or an arbitrary trapframe */
+       if (have_addr)
+               fpstate = (struct fpstate *)addr;
+
+       db_printf("fpstate %p: fsr = %llx gsr = %lx\nfpregs:\n",
+               fpstate, (unsigned long long)fpstate->fs_fsr,
+               (unsigned long)fpstate->fs_gsr);
+       db_printf(" 0: %08x %08x %08x %08x %08x %08x %08x %08x\n",
+               (unsigned int)fpstate->fs_regs[0],
+               (unsigned int)fpstate->fs_regs[1],
+               (unsigned int)fpstate->fs_regs[2],
+               (unsigned int)fpstate->fs_regs[3],
+               (unsigned int)fpstate->fs_regs[4],
+               (unsigned int)fpstate->fs_regs[5],
+               (unsigned int)fpstate->fs_regs[6],
+               (unsigned int)fpstate->fs_regs[7]);
+       db_printf(" 8: %08x %08x %08x %08x %08x %08x %08x %08x\n",
+               (unsigned int)fpstate->fs_regs[8],
+               (unsigned int)fpstate->fs_regs[9],
+               (unsigned int)fpstate->fs_regs[10],
+               (unsigned int)fpstate->fs_regs[11],
+               (unsigned int)fpstate->fs_regs[12],
+               (unsigned int)fpstate->fs_regs[13],
+               (unsigned int)fpstate->fs_regs[14],
+               (unsigned int)fpstate->fs_regs[15]);
+       db_printf("16: %08x %08x %08x %08x %08x %08x %08x %08x\n",
+               (unsigned int)fpstate->fs_regs[16],
+               (unsigned int)fpstate->fs_regs[17],
+               (unsigned int)fpstate->fs_regs[18],
+               (unsigned int)fpstate->fs_regs[19],
+               (unsigned int)fpstate->fs_regs[20],
+               (unsigned int)fpstate->fs_regs[21],
+               (unsigned int)fpstate->fs_regs[22],
+               (unsigned int)fpstate->fs_regs[23]);
+       db_printf("24: %08x %08x %08x %08x %08x %08x %08x %08x\n",
+               (unsigned int)fpstate->fs_regs[24],
+               (unsigned int)fpstate->fs_regs[25],
+               (unsigned int)fpstate->fs_regs[26],
+               (unsigned int)fpstate->fs_regs[27],
+               (unsigned int)fpstate->fs_regs[28],
+               (unsigned int)fpstate->fs_regs[29],
+               (unsigned int)fpstate->fs_regs[30],
+               (unsigned int)fpstate->fs_regs[31]);
+       db_printf("32: %08x%08x %08x%08x %08x%08x %08x%08x\n",
+               (unsigned int)fpstate->fs_regs[32],
+               (unsigned int)fpstate->fs_regs[33],
+               (unsigned int)fpstate->fs_regs[34],
+               (unsigned int)fpstate->fs_regs[35],
+               (unsigned int)fpstate->fs_regs[36],
+               (unsigned int)fpstate->fs_regs[37],
+               (unsigned int)fpstate->fs_regs[38],
+               (unsigned int)fpstate->fs_regs[39]);
+       db_printf("40: %08x%08x %08x%08x %08x%08x %08x%08x\n",
+               (unsigned int)fpstate->fs_regs[40],
+               (unsigned int)fpstate->fs_regs[41],
+               (unsigned int)fpstate->fs_regs[42],
+               (unsigned int)fpstate->fs_regs[43],
+               (unsigned int)fpstate->fs_regs[44],
+               (unsigned int)fpstate->fs_regs[45],
+               (unsigned int)fpstate->fs_regs[46],
+               (unsigned int)fpstate->fs_regs[47]);
+       db_printf("48: %08x%08x %08x%08x %08x%08x %08x%08x\n",
+               (unsigned int)fpstate->fs_regs[48],
+               (unsigned int)fpstate->fs_regs[49],
+               (unsigned int)fpstate->fs_regs[50],
+               (unsigned int)fpstate->fs_regs[51],
+               (unsigned int)fpstate->fs_regs[52],
+               (unsigned int)fpstate->fs_regs[53],
+               (unsigned int)fpstate->fs_regs[54],
+               (unsigned int)fpstate->fs_regs[55]);
+       db_printf("56: %08x%08x %08x%08x %08x%08x %08x%08x\n",
+               (unsigned int)fpstate->fs_regs[56],
+               (unsigned int)fpstate->fs_regs[57],
+               (unsigned int)fpstate->fs_regs[58],
+               (unsigned int)fpstate->fs_regs[59],
+               (unsigned int)fpstate->fs_regs[60],
+               (unsigned int)fpstate->fs_regs[61],
+               (unsigned int)fpstate->fs_regs[62],
+               (unsigned int)fpstate->fs_regs[63]);
+}
 
 void
 db_dump_ts(addr, have_addr, count, modif)



Home | Main Index | Thread Index | Old Index