Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha/alpha Remove the /I "alternate format" from d...



details:   https://anonhg.NetBSD.org/src/rev/8828b7014a8e
branches:  trunk
changeset: 984072:8828b7014a8e
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Jun 21 02:10:46 2021 +0000

description:
Remove the /I "alternate format" from db_disasm(), which was internally
interpreted as "showregs", whcih would print the values of the registers
at each instruction.  Unfortunately, this was fundamentally broken because
the saved registers accessible to DDB are only valid for the faulting
insn that got us into DDB, and not arbitrary isns that can be examined
from within DDB.

diffstat:

 sys/arch/alpha/alpha/db_disasm.c      |  41 ++--------------------------------
 sys/arch/alpha/alpha/db_instruction.h |   5 +---
 2 files changed, 4 insertions(+), 42 deletions(-)

diffs (117 lines):

diff -r 2f2660cb2979 -r 8828b7014a8e sys/arch/alpha/alpha/db_disasm.c
--- a/sys/arch/alpha/alpha/db_disasm.c  Mon Jun 21 02:01:13 2021 +0000
+++ b/sys/arch/alpha/alpha/db_disasm.c  Mon Jun 21 02:10:46 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_disasm.c,v 1.17 2021/06/21 02:01:13 thorpej Exp $ */
+/* $NetBSD: db_disasm.c,v 1.18 2021/06/21 02:10:46 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -48,7 +48,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.17 2021/06/21 02:01:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.18 2021/06/21 02:10:46 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -784,13 +784,6 @@
 static const char *
 register_name(struct alpha_print_instruction_context *ctx, int ireg)
 {
-       int     i;
-
-       for (i = 0; i < ctx->regcount; i++)
-               if (ctx->regnum[i] == ireg)
-                       break;
-       if (i >= ctx->regcount)
-               ctx->regnum[ctx->regcount++] = ireg;
        return (name_of_register[ireg]);
 }
 
@@ -824,12 +817,10 @@
 alpha_print_instruction(struct alpha_print_instruction_context *ctx)
 {
        const char      *opcode;
-       int             ireg;
        long            signed_immediate;
        bool            fstore;
        pal_instruction p;
 
-       ctx->regcount = 0;
        fstore = false;
        opcode = op_name[ctx->insn.mem_format.opcode];
 
@@ -1038,16 +1029,6 @@
                        insn_printf(ctx, "%s(%s)", tbuf,
                            register_name(ctx, ctx->insn.mem_format.rb));
                }
-               /*
-                * For convenience, do the address computation
-                */
-               if (ctx->showregs) {
-                       if (ctx->insn.mem_format.opcode == op_ldah)
-                               signed_immediate <<= 16;
-                       insn_printf(ctx, " <0x%lx>", signed_immediate +
-                           db_register_value(DDB_REGS,
-                                             ctx->insn.mem_format.rb));
-               }
                break;
        case op_br:
        case op_fbeq:
@@ -1084,21 +1065,6 @@
                insn_printf(ctx, "? 0x%x ?", ctx->insn.bits);
        }
 
-       /*
-        *      Print out the registers used in this instruction
-        */
-       if (ctx->showregs && ctx->regcount > 0) {
-               insn_printf(ctx, "\t<");
-               for (ireg = 0; ireg < ctx->regcount; ireg++) {
-                       if (ireg != 0)
-                               insn_printf(ctx, ",");
-                       insn_printf(ctx, "%s=0x%lx",
-                           name_of_register[ctx->regnum[ireg]],
-                           db_register_value(DDB_REGS, ctx->regnum[ireg]));
-               }
-               insn_printf(ctx, ">");
-       }
-
        /* If printing into a buffer, skip the newline. */
        if (ctx->buf == NULL) {
                insn_printf(ctx, "\n");
@@ -1108,12 +1074,11 @@
 }
 
 db_addr_t
-db_disasm(db_addr_t loc, bool altfmt)
+db_disasm(db_addr_t loc, bool altfmt __unused)
 {
        struct alpha_print_instruction_context ctx = {
                .insn.bits = db_get_value(loc, 4, 0),
                .pc = loc,
-               .showregs = altfmt,
        };
 
        loc += alpha_print_instruction(&ctx);
diff -r 2f2660cb2979 -r 8828b7014a8e sys/arch/alpha/alpha/db_instruction.h
--- a/sys/arch/alpha/alpha/db_instruction.h     Mon Jun 21 02:01:13 2021 +0000
+++ b/sys/arch/alpha/alpha/db_instruction.h     Mon Jun 21 02:10:46 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_instruction.h,v 1.11 2021/06/21 02:01:13 thorpej Exp $ */
+/* $NetBSD: db_instruction.h,v 1.12 2021/06/21 02:10:46 thorpej Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -748,9 +748,6 @@
        char    *buf;           /* output buffer (if not DDB) */
        size_t  bufsize;        /* size of output buffer */
        size_t  cursor;         /* current next output location */
-       int     regcount;       /* how many rebgs used in this insn */
-       int     regnum[3];      /* which regs are used in this insn */
-       bool    showregs;       /* show registers */
 };
 
 int    alpha_print_instruction(struct alpha_print_instruction_context *);



Home | Main Index | Thread Index | Old Index