Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/powerpc/powerpc Reverted last commit for db_disasm....
details: https://anonhg.NetBSD.org/src/rev/ea7e7f1df55a
branches: trunk
changeset: 751218:ea7e7f1df55a
user: phx <phx%NetBSD.org@localhost>
date: Thu Jan 28 12:45:01 2010 +0000
description:
Reverted last commit for db_disasm.c and db_inteface.c.
Sorry, erroneously commited them...
diffstat:
sys/arch/powerpc/powerpc/db_disasm.c | 302 +++++++++++--------------------
sys/arch/powerpc/powerpc/db_interface.c | 94 +++------
2 files changed, 145 insertions(+), 251 deletions(-)
diffs (truncated from 661 to 300 lines):
diff -r dc55ab613ec7 -r ea7e7f1df55a sys/arch/powerpc/powerpc/db_disasm.c
--- a/sys/arch/powerpc/powerpc/db_disasm.c Thu Jan 28 12:37:45 2010 +0000
+++ b/sys/arch/powerpc/powerpc/db_disasm.c Thu Jan 28 12:45:01 2010 +0000
@@ -1,8 +1,8 @@
-/* $NetBSD: db_disasm.c,v 1.24 2010/01/28 12:37:45 phx Exp $ */
+/* $NetBSD: db_disasm.c,v 1.25 2010/01/28 12:45:01 phx Exp $ */
/* $OpenBSD: db_disasm.c,v 1.2 1996/12/28 06:21:48 rahnds Exp $ */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.24 2010/01/28 12:37:45 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.25 2010/01/28 12:45:01 phx Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -21,13 +21,12 @@
Op_B = 0x00000002,
Op_BI = 0x00000004,
Op_BO = 0x00000008,
- Op_BC = Op_BI | Op_BO,
Op_CRM = 0x00000010,
Op_D = 0x00000020,
Op_ST = 0x00000020, /* Op_S for store-operations, same as D */
Op_S = 0x00000040, /* S-field is swapped with A-field */
Op_FM = Op_D | Op_S, /* kludge (reduce Op_s) */
- Op_dA = 0x00000080,
+ Op_IMM = 0x00000080,
Op_LK = 0x00000100,
Op_Rc = 0x00000200,
Op_AA = Op_LK | Op_Rc, /* kludge (reduce Op_s) */
@@ -40,6 +39,7 @@
Op_const = 0x00004000,
Op_SIMM = Op_const | Op_sign,
Op_UIMM = Op_const,
+ Op_d = Op_const | Op_sign,
Op_crbA = 0x00008000,
Op_crbB = 0x00010000,
Op_WS = Op_crbB, /* kludge, same field as crbB */
@@ -53,7 +53,7 @@
Op_dcr = Op_spr, /* out of bits - cheat with Op_spr */
Op_tbr = 0x00800000,
- Op_BP = 0x01000000,
+ Op_L = 0x01000000,
Op_BD = 0x02000000,
Op_LI = 0x04000000,
Op_C = 0x08000000,
@@ -121,16 +121,14 @@
{ "twi", 0xfc000000, 0x0c000000, Op_TO | Op_A | Op_SIMM },
{ "mulli", 0xfc000000, 0x1c000000, Op_D | Op_A | Op_SIMM },
{ "subfic", 0xfc000000, 0x20000000, Op_D | Op_A | Op_SIMM },
- { "cmplwi", 0xfc200000, 0x28000000, Op_crfD | Op_A | Op_SIMM },
- { "cmpldi", 0xfc200000, 0x28200000, Op_crfD | Op_A | Op_SIMM },
- { "cmpwi", 0xfc200000, 0x2c000000, Op_crfD | Op_A | Op_SIMM },
- { "cmpdi", 0xfc200000, 0x2c200000, Op_crfD | Op_A | Op_SIMM },
+ { "cmpli", 0xfc000000, 0x28000000, Op_crfD | Op_L | Op_A | Op_SIMM },
+ { "cmpi", 0xfc000000, 0x2c000000, Op_crfD | Op_L | Op_A | Op_SIMM },
{ "addic", 0xfc000000, 0x30000000, Op_D | Op_A | Op_SIMM },
{ "addic.", 0xfc000000, 0x34000000, Op_D | Op_A | Op_SIMM },
{ "addi", 0xfc000000, 0x38000000, Op_D | Op_A | Op_SIMM },
{ "addis", 0xfc000000, 0x3c000000, Op_D | Op_A | Op_SIMM },
- { "b", 0xfc000000, 0x40000000, Op_BC | Op_BD | Op_AA | Op_LK }, /* bc */
- { "sc", 0xffffffff, 0x44000002, 0 },
+ { "bc", 0xfc000000, 0x40000000, Op_BO | Op_BI | Op_BD | Op_AA | Op_LK },
+ { "sc", 0xffffffff, 0x44000002, Op_BO | Op_BI | Op_BD | Op_AA | Op_LK },
{ "b", 0xfc000000, 0x48000000, Op_LI | Op_AA | Op_LK },
{ "rlwimi", 0xfc000000, 0x50000000, Op_S | Op_A | Op_SH | Op_MB | Op_ME | Op_Rc },
@@ -145,33 +143,33 @@
{ "andi.", 0xfc000000, 0x70000000, Op_S | Op_A | Op_UIMM },
{ "andis.", 0xfc000000, 0x74000000, Op_S | Op_A | Op_UIMM },
- { "lwz", 0xfc000000, 0x80000000, Op_D | Op_dA },
- { "lwzu", 0xfc000000, 0x84000000, Op_D | Op_dA },
- { "lbz", 0xfc000000, 0x88000000, Op_D | Op_dA },
- { "lbzu", 0xfc000000, 0x8c000000, Op_D | Op_dA },
- { "stw", 0xfc000000, 0x90000000, Op_ST | Op_dA },
- { "stwu", 0xfc000000, 0x94000000, Op_ST | Op_dA },
- { "stb", 0xfc000000, 0x98000000, Op_ST | Op_dA },
- { "stbu", 0xfc000000, 0x9c000000, Op_ST | Op_dA },
+ { "lwz", 0xfc000000, 0x80000000, Op_D | Op_A | Op_d },
+ { "lwzu", 0xfc000000, 0x84000000, Op_D | Op_A | Op_d },
+ { "lbz", 0xfc000000, 0x88000000, Op_D | Op_A | Op_d },
+ { "lbzu", 0xfc000000, 0x8c000000, Op_D | Op_A | Op_d },
+ { "stw", 0xfc000000, 0x90000000, Op_ST | Op_A | Op_d },
+ { "stwu", 0xfc000000, 0x94000000, Op_ST | Op_A | Op_d },
+ { "stb", 0xfc000000, 0x98000000, Op_ST | Op_A | Op_d },
+ { "stbu", 0xfc000000, 0x9c000000, Op_ST | Op_A | Op_d },
- { "lhz", 0xfc000000, 0xa0000000, Op_D | Op_dA },
- { "lhzu", 0xfc000000, 0xa4000000, Op_D | Op_dA },
- { "lha", 0xfc000000, 0xa8000000, Op_D | Op_dA },
- { "lhau", 0xfc000000, 0xac000000, Op_D | Op_dA },
- { "sth", 0xfc000000, 0xb0000000, Op_ST | Op_dA },
- { "sthu", 0xfc000000, 0xb4000000, Op_ST | Op_dA },
- { "lmw", 0xfc000000, 0xb8000000, Op_D | Op_dA },
- { "stmw", 0xfc000000, 0xbc000000, Op_ST | Op_dA },
+ { "lhz", 0xfc000000, 0xa0000000, Op_D | Op_A | Op_d },
+ { "lhzu", 0xfc000000, 0xa4000000, Op_D | Op_A | Op_d },
+ { "lha", 0xfc000000, 0xa8000000, Op_D | Op_A | Op_d },
+ { "lhau", 0xfc000000, 0xac000000, Op_D | Op_A | Op_d },
+ { "sth", 0xfc000000, 0xb0000000, Op_ST | Op_A | Op_d },
+ { "sthu", 0xfc000000, 0xb4000000, Op_ST | Op_A | Op_d },
+ { "lmw", 0xfc000000, 0xb8000000, Op_D | Op_A | Op_d },
+ { "stmw", 0xfc000000, 0xbc000000, Op_S | Op_A | Op_d },
- { "lfs", 0xfc000000, 0xc0000000, Op_D | Op_dA },
- { "lfsu", 0xfc000000, 0xc4000000, Op_D | Op_dA },
- { "lfd", 0xfc000000, 0xc8000000, Op_D | Op_dA },
- { "lfdu", 0xfc000000, 0xcc000000, Op_D | Op_dA },
+ { "lfs", 0xfc000000, 0xc0000000, Op_D | Op_A | Op_d },
+ { "lfsu", 0xfc000000, 0xc4000000, Op_D | Op_A | Op_d },
+ { "lfd", 0xfc000000, 0xc8000000, Op_D | Op_A | Op_d },
+ { "lfdu", 0xfc000000, 0xcc000000, Op_D | Op_A | Op_d },
- { "stfs", 0xfc000000, 0xd0000000, Op_ST | Op_dA },
- { "stfsu", 0xfc000000, 0xd4000000, Op_ST | Op_dA },
- { "stfd", 0xfc000000, 0xd8000000, Op_ST | Op_dA },
- { "stfdu", 0xfc000000, 0xdc000000, Op_ST | Op_dA },
+ { "stfs", 0xfc000000, 0xd0000000, Op_ST | Op_A | Op_d },
+ { "stfsu", 0xfc000000, 0xd4000000, Op_ST | Op_A | Op_d },
+ { "stfd", 0xfc000000, 0xd8000000, Op_ST | Op_A | Op_d },
+ { "stfdu", 0xfc000000, 0xdc000000, Op_ST | Op_A | Op_d },
{ "", 0x0, 0x0, 0 }
};
@@ -179,10 +177,10 @@
const struct opcode opcodes_13[] = {
/* 0x13 << 2 */
{ "mcrf", 0xfc0007fe, 0x4c000000, Op_crfD | Op_crfS },
- { "b", 0xfc0007fe, 0x4c000020, Op_BC | Op_LK }, /* bclr */
+ { "bclr", 0xfc0007fe, 0x4c000020, Op_BO | Op_BI | Op_LK },
{ "crnor", 0xfc0007fe, 0x4c000042, Op_crbD | Op_crbA | Op_crbB },
{ "rfi", 0xfc0007fe, 0x4c000064, 0 },
- { "crandc", 0xfc0007fe, 0x4c000102, Op_crbD | Op_crbA | Op_crbB },
+ { "crandc", 0xfc0007fe, 0x4c000102, Op_BO | Op_BI | Op_LK },
{ "isync", 0xfc0007fe, 0x4c00012c, 0 },
{ "crxor", 0xfc0007fe, 0x4c000182, Op_crbD | Op_crbA | Op_crbB },
{ "crnand", 0xfc0007fe, 0x4c0001c2, Op_crbD | Op_crbA | Op_crbB },
@@ -190,7 +188,7 @@
{ "creqv", 0xfc0007fe, 0x4c000242, Op_crbD | Op_crbA | Op_crbB },
{ "crorc", 0xfc0007fe, 0x4c000342, Op_crbD | Op_crbA | Op_crbB },
{ "cror", 0xfc0007fe, 0x4c000382, Op_crbD | Op_crbA | Op_crbB },
- { "b", 0xfc0007fe, 0x4c000420, Op_BC | Op_LK }, /* bcctr */
+ { "bcctr", 0xfc0007fe, 0x4c000420, Op_BO | Op_BI | Op_LK },
{ "", 0x0, 0x0, 0 }
};
@@ -208,8 +206,7 @@
/* 1f * 4 = 7c */
const struct opcode opcodes_1f[] = {
/* 1f << 2 */
- { "cmpw", 0xfc2007fe, 0x7c000000, Op_crfD | Op_A | Op_B },
- { "cmpd", 0xfc2007fe, 0x7c200000, Op_crfD | Op_A | Op_B },
+ { "cmp", 0xfc0007fe, 0x7c000000, Op_crfD | Op_A | Op_B },
{ "tw", 0xfc0007fe, 0x7c000008, Op_TO | Op_A | Op_B },
{ "subfc", 0xfc0003fe, 0x7c000010, Op_D | Op_A | Op_B | Op_OE | Op_Rc },
{ "mulhdu", 0xfc0007fe, 0x7c000012, Op_D | Op_A | Op_B | Op_Rc },
@@ -224,8 +221,7 @@
{ "cntlzw", 0xfc0007fe, 0x7c000034, Op_D | Op_A | Op_Rc },
{ "sld", 0xfc0007fe, 0x7c000036, Op_D | Op_A | Op_B | Op_Rc },
{ "and", 0xfc0007fe, 0x7c000038, Op_D | Op_A | Op_B | Op_Rc },
- { "cmplw", 0xfc2007fe, 0x7c000040, Op_crfD | Op_A | Op_B },
- { "cmpld", 0xfc2007fe, 0x7c200040, Op_crfD | Op_A | Op_B },
+ { "cmpl", 0xfc0007fe, 0x7c000040, Op_crfD | Op_L | Op_A | Op_B },
{ "subf", 0xfc0003fe, 0x7c000050, Op_D | Op_A | Op_B | Op_OE | Op_Rc },
{ "ldux", 0xfc0007fe, 0x7c00006a, Op_D | Op_A | Op_B },
{ "dcbst", 0xfc0007fe, 0x7c00006c, Op_A | Op_B },
@@ -391,7 +387,7 @@
{ "mcrfs", 0xfc0007fe, 0xfc000080, Op_D | Op_B | Op_Rc },
{ "mtfsb0", 0xfc0007fe, 0xfc00008c, Op_crfD | Op_Rc },
{ "fmr", 0xfc0007fe, 0xfc000090, Op_D | Op_B | Op_Rc },
- { "mtfsfi", 0xfc0007fe, 0xfc00010c, 0 }, /* XXX: out of flags! */
+ { "mtfsfi", 0xfc0007fe, 0xfc00010c, Op_crfD | Op_IMM | Op_Rc },
{ "fnabs", 0xfc0007fe, 0xfc000110, Op_D | Op_B | Op_Rc },
{ "fabs", 0xfc0007fe, 0xfc000210, Op_D | Op_B | Op_Rc },
@@ -591,11 +587,6 @@
{ 0, NULL }
};
-static const char *condstr[8] = {
- "ge", "le", "ne", "ns", "lt", "gt", "eq", "so"
-};
-
-
void
op_ill(instr_t instr, vaddr_t loc)
{
@@ -630,45 +621,6 @@
pstr = disasm_str;
func = popcode->func;
- if (func & Op_BC) {
- u_int BO, BI;
- BO = extract_field(instr, 31 - 10, 5);
- BI = extract_field(instr, 31 - 15, 5);
- func &= ~Op_BC;
- if (BO & 4) {
- /* standard, no decrement */
- if (BO & 16) {
- if (popcode->code == 0x40000000) {
- APP_PSTRS("c");
- func |= Op_BO | Op_BI;
- }
- }
- else {
- APP_PSTRS(condstr[((BO & 8) >> 1) + (BI & 3)]);
- if (BI >= 4)
- func |= Op_crfS;
- }
- }
- else {
- /* decrement and branch */
- if (BO & 2)
- APP_PSTRS("dz");
- else
- APP_PSTRS("dnz");
- if ((BO & 24) == 0)
- APP_PSTRS("f");
- else if ((BO & 24) == 8)
- APP_PSTRS("t");
- else
- func |= Op_BI;
- }
- if (popcode->code == 0x4c000020)
- APP_PSTRS("lr");
- else if (popcode->code == 0x4c000420)
- APP_PSTRS("ctr");
- if ((BO & 20) != 20 && (func & Op_BO) == 0)
- func |= Op_BP; /* branch prediction hint */
- }
if (func & Op_OE) {
u_int OE;
OE = extract_field(instr, 31 - 21, 1);
@@ -679,39 +631,23 @@
}
switch (func & Op_LKM) {
case Op_Rc:
- if (instr & 0x1)
+ if (instr & 0x1) {
APP_PSTRS(".");
+ }
break;
case Op_AA:
- if (instr & 0x1)
- APP_PSTRS("l");
if (instr & 0x2) {
APP_PSTRS("a");
loc = 0; /* Absolute address */
}
- break;
case Op_LK:
- if (instr & 0x1)
+ if (instr & 0x1) {
APP_PSTRS("l");
+ }
break;
default:
func &= ~Op_LKM;
}
- if (func & Op_BP) {
- int y;
- y = (instr & 0x200000) != 0;
- if (popcode->code == 0x40000000) {
- int BD;
- BD = extract_field(instr, 31 - 29, 14);
- BD = BD << 18;
- BD = BD >> 16;
- BD += loc;
- if ((vaddr_t)BD < loc)
- y ^= 1;
- }
- APP_PSTR("%c", y ? '+' : '-');
- func &= ~Op_BP;
- }
APP_PSTRS("\t");
/* XXX: special cases here, out of flags in a 32bit word. */
@@ -721,19 +657,12 @@
APP_PSTR("%d", E);
return;
}
- else if (strcmp(popcode->name, "mtfsfi") == 0) {
- u_int UI;
- UI = extract_field(instr, 31 - 8, 3);
- APP_PSTR("crf%u, ", UI);
- UI = extract_field(instr, 31 - 19, 4);
- APP_PSTR("0x%x", UI);
- }
/* XXX: end of special cases here. */
if ((func & Op_FM) == Op_FM) {
u_int FM;
- FM = extract_field(instr, 31 - 14, 8);
- APP_PSTR("0x%x, ", FM);
+ FM = extract_field(instr, 31 - 10, 8);
+ APP_PSTR("%d, ", FM);
func &= ~Op_FM;
}
if (func & Op_D) { /* Op_ST is the same */
Home |
Main Index |
Thread Index |
Old Index