Source-Changes-HG archive

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

[src/netbsd-7]: src/sys/arch Pull up following revision(s) (requested by msai...



details:   https://anonhg.NetBSD.org/src/rev/5c7927d9a00a
branches:  netbsd-7
changeset: 798695:5c7927d9a00a
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Dec 12 19:07:46 2014 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #313):
        sys/arch/amd64/amd64/db_disasm.c: revision 1.20
        sys/arch/i386/i386/db_disasm.c: revision 1.41
        sys/arch/i386/i386/db_disasm.c: revision 1.42
        sys/arch/i386/i386/db_disasm.c: revision 1.43
        sys/arch/i386/i386/db_disasm.c: revision 1.44
        sys/arch/amd64/amd64/db_disasm.c: revision 1.17
        sys/arch/amd64/amd64/db_disasm.c: revision 1.18
        sys/arch/amd64/amd64/db_disasm.c: revision 1.19
KNF. No binary change.
No functional change.
- 0 -> NULL
- Don't use cast.
- Style fix.
- Fix typos in comment.
Fix bugs:
- aaa and daa were reversed. Same as *BSDs.
- fix operand order of shld and shrd. Same as *BSDs.
Add support for sysenter, sysexit, vmptrld, vmptrst and getsec.

diffstat:

 sys/arch/amd64/amd64/db_disasm.c |  347 +++++++++++++++++++-------------------
 sys/arch/i386/i386/db_disasm.c   |  273 +++++++++++++++---------------
 2 files changed, 312 insertions(+), 308 deletions(-)

diffs (truncated from 1571 to 300 lines):

diff -r 0ba32a3ac164 -r 5c7927d9a00a sys/arch/amd64/amd64/db_disasm.c
--- a/sys/arch/amd64/amd64/db_disasm.c  Fri Dec 12 19:03:17 2014 +0000
+++ b/sys/arch/amd64/amd64/db_disasm.c  Fri Dec 12 19:07:46 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_disasm.c,v 1.16 2011/07/17 20:54:36 joerg Exp $     */
+/*     $NetBSD: db_disasm.c,v 1.16.28.1 2014/12/12 19:07:46 martin Exp $       */
 
 /* 
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.16 2011/07/17 20:54:36 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.16.28.1 2014/12/12 19:07:46 martin Exp $");
 
 #ifndef _KERNEL
 #include <sys/types.h>
@@ -108,11 +108,11 @@
 #define        Iq      36                      /* word immediate, maybe 64bits */
 
 struct inst {
-       const char *i_name;                     /* name */
+       const char *i_name;             /* name */
        short   i_has_modrm;            /* has regmodrm byte */
        short   i_size;                 /* operand size */
        int     i_mode;                 /* addressing modes */
-       const char *i_extra;            /* pointer to extra opcode table */
+       const void *i_extra;            /* pointer to extra opcode table */
 };
 
 #define        op1(x)          (x)
@@ -123,7 +123,7 @@
        const char *f_name;             /* name for memory instruction */
        int     f_size;                 /* size for memory instruction */
        int     f_rrmode;               /* mode for rr instruction */
-       const char *f_rrname;           /* name for rr instruction
+       const void *f_rrname;           /* name for rr instruction
                                           (or pointer to table) */
 };
 
@@ -167,13 +167,13 @@
        "",
        "",
        "",
-       "",
-       "",
+       "vmptrld",
+       "vmptrst"
 };
 
 const struct inst db_inst_0f0x[] = {
-/*00*/ { "",      true,  NONE,  op1(Ew),     (const char *)db_Grp6 },
-/*01*/ { "",      true,  NONE,  op1(Ew),     (const char *)db_Grp7 },
+/*00*/ { "",      true,  NONE,  op1(Ew),     db_Grp6 },
+/*01*/ { "",      true,  NONE,  op1(Ew),     db_Grp7 },
 /*02*/ { "lar",   true,  LONG,  op2(E,R),    0 },
 /*03*/ { "lsl",   true,  LONG,  op2(E,R),    0 },
 /*04*/ { "",      false, NONE,  0,           0 },
@@ -191,7 +191,7 @@
 /*0f*/ { "",      false, NONE,  0,           0 },  /* 3DNow */
 };
 
-const struct inst      db_inst_0f2x[] = {
+const struct inst db_inst_0f2x[] = {
 /*20*/ { "mov",   true,  LONG,  op2(CR,E),   0 }, /* use E for reg */
 /*21*/ { "mov",   true,  LONG,  op2(DR,E),   0 }, /* since mod == 11 */
 /*22*/ { "mov",   true,  LONG,  op2(E,CR),   0 },
@@ -211,7 +211,7 @@
 /*2f*/ { "",      false, NONE,  0,           0 },
 };
 
-const struct inst      db_inst_0f3x[] = {
+const struct inst db_inst_0f3x[] = {
 /*30*/ { "wrmsr", false, NONE,  0,           0 },
 /*31*/ { "rdtsc", false, NONE,  0,           0 },
 /*32*/ { "rdmsr", false, NONE,  0,           0 },
@@ -219,19 +219,19 @@
 /*34*/ { "sysenter",false,NONE, 0,           0 },
 /*35*/ { "sysexit",false, NONE, 0,           0 },
 /*36*/ { "",      false, NONE,  0,           0 },
-/*37*/ { "",      false, NONE,  0,           0 },
+/*37*/ { "getsec",false, NONE,  0,           0 },
 
 /*38*/ { "",      false, NONE,  0,           0 },
 /*39*/ { "",      false, NONE,  0,           0 },
 /*3a*/ { "",      false, NONE,  0,           0 },
-/*3v*/ { "",      false, NONE,  0,           0 },
+/*3b*/ { "",      false, NONE,  0,           0 },
 /*3c*/ { "",      false, NONE,  0,           0 },
 /*3d*/ { "",      false, NONE,  0,           0 },
 /*3e*/ { "",      false, NONE,  0,           0 },
 /*3f*/ { "",      false, NONE,  0,           0 },
 };
 
-const struct inst      db_inst_0f4x[] = {
+const struct inst db_inst_0f4x[] = {
 /*40*/ { "cmovo",  true,  LONG,  op2(E,R),    0 },
 /*41*/ { "cmovno", true,  LONG,  op2(E,R),    0 },
 /*42*/ { "cmovc",  true,  LONG,  op2(E,R),    0 },
@@ -250,7 +250,7 @@
 /*4f*/ { "cmovnle",true,  LONG,  op2(E,R),    0 },
 };
 
-const struct inst      db_inst_0f8x[] = {
+const struct inst db_inst_0f8x[] = {
 /*80*/ { "jo",    false, NONE,  op1(Dl),     0 },
 /*81*/ { "jno",   false, NONE,  op1(Dl),     0 },
 /*82*/ { "jb",    false, NONE,  op1(Dl),     0 },
@@ -270,7 +270,7 @@
 /*8f*/ { "jnle",  false, NONE,  op1(Dl),     0 },
 };
 
-const struct inst      db_inst_0f9x[] = {
+const struct inst db_inst_0f9x[] = {
 /*90*/ { "seto",  true,  NONE,  op1(Eb),     0 },
 /*91*/ { "setno", true,  NONE,  op1(Eb),     0 },
 /*92*/ { "setb",  true,  NONE,  op1(Eb),     0 },
@@ -290,13 +290,13 @@
 /*9f*/ { "setnle",true,  NONE,  op1(Eb),     0 },
 };
 
-const struct inst      db_inst_0fax[] = {
+const struct inst db_inst_0fax[] = {
 /*a0*/ { "push",  false, NONE,  op1(Si),     0 },
 /*a1*/ { "pop",   false, NONE,  op1(Si),     0 },
 /*a2*/ { "cpuid", false, NONE,  0,           0 },
 /*a3*/ { "bt",    true,  LONG,  op2(R,E),    0 },
-/*a4*/ { "shld",  true,  LONG,  op3(Ib,E,R), 0 },
-/*a5*/ { "shld",  true,  LONG,  op3(CL,E,R), 0 },
+/*a4*/ { "shld",  true,  LONG,  op3(Ib,R,E), 0 },
+/*a5*/ { "shld",  true,  LONG,  op3(CL,R,E), 0 },
 /*a6*/ { "",      false, NONE,  0,           0 },
 /*a7*/ { "",      false, NONE,  0,           0 },
 
@@ -304,15 +304,15 @@
 /*a9*/ { "pop",   false, NONE,  op1(Si),     0 },
 /*aa*/ { "rsm",   false, NONE,  0,           0 },
 /*ab*/ { "bts",   true,  LONG,  op2(R,E),    0 },
-/*ac*/ { "shrd",  true,  LONG,  op3(Ib,E,R), 0 },
-/*ad*/ { "shrd",  true,  LONG,  op3(CL,E,R), 0 },
+/*ac*/ { "shrd",  true,  LONG,  op3(Ib,R,E), 0 },
+/*ad*/ { "shrd",  true,  LONG,  op3(CL,R,E), 0 },
 /*ae*/ { "fxsave",true,  LONG,  0,           0 },
 /*af*/ { "imul",  true,  LONG,  op2(E,R),    0 },
 };
 
-const struct inst      db_inst_0fbx[] = {
-/*b0*/ { "cmpxchg",true, BYTE, op2(R, E),   0 },
-/*b1*/ { "cmpxchg",true, LONG, op2(R, E),   0 },
+const struct inst db_inst_0fbx[] = {
+/*b0*/ { "cmpxchg",true, BYTE,  op2(R, E),   0 },
+/*b1*/ { "cmpxchg",true, LONG,  op2(R, E),   0 },
 /*b2*/ { "lss",   true,  LONG,  op2(E, R),   0 },
 /*b3*/ { "btr",   true,  LONG,  op2(R, E),   0 },
 /*b4*/ { "lfs",   true,  LONG,  op2(E, R),   0 },
@@ -322,7 +322,7 @@
 
 /*b8*/ { "",      false, NONE,  0,           0 },
 /*b9*/ { "",      false, NONE,  0,           0 },
-/*ba*/ { "",      true,  LONG,  op2(Ib, E),  (const char *)db_Grp8 },
+/*ba*/ { "",      true,  LONG,  op2(Ib, E),  db_Grp8 },
 /*bb*/ { "btc",   true,  LONG,  op2(R, E),   0 },
 /*bc*/ { "bsf",   true,  LONG,  op2(E, R),   0 },
 /*bd*/ { "bsr",   true,  LONG,  op2(E, R),   0 },
@@ -330,15 +330,16 @@
 /*bf*/ { "movsw", true,  LONG,  op2(E, R),   0 },
 };
 
-const struct inst      db_inst_0fcx[] = {
-/*c0*/ { "xadd",  true,  BYTE, op2(R, E),   0 },
-/*c1*/ { "xadd",  true,  LONG, op2(R, E),   0 },
-/*c2*/ { "",      false, NONE, 0,            0 },
-/*c3*/ { "",      false, NONE, 0,            0 },
-/*c4*/ { "",      false, NONE, 0,            0 },
-/*c5*/ { "",      false, NONE, 0,            0 },
-/*c6*/ { "",      false, NONE, 0,            0 },
-/*c7*/ { "",      true,  NONE, op1(E),      (const char *)db_Grp9 },
+const struct inst db_inst_0fcx[] = {
+/*c0*/ { "xadd",  true,  BYTE,  op2(R, E),   0 },
+/*c1*/ { "xadd",  true,  LONG,  op2(R, E),   0 },
+/*c2*/ { "",      false, NONE,  0,           0 },
+/*c3*/ { "",      false, NONE,  0,           0 },
+/*c4*/ { "",      false, NONE,  0,           0 },
+/*c5*/ { "",      false, NONE,  0,           0 },
+/*c6*/ { "",      false, NONE,  0,           0 },
+/*c7*/ { "",      true,  NONE,  op1(E),      db_Grp9 },
+
 /*c8*/ { "bswap", false, LONG,  op1(Ri),     0 },
 /*c9*/ { "bswap", false, LONG,  op1(Ri),     0 },
 /*ca*/ { "bswap", false, LONG,  op1(Ri),     0 },
@@ -351,21 +352,21 @@
 
 const struct inst * const db_inst_0f[] = {
        db_inst_0f0x,
-       0,
+       NULL,
        db_inst_0f2x,
        db_inst_0f3x,
        db_inst_0f4x,
-       0,
-       0,
-       0,
+       NULL,
+       NULL,
+       NULL,
        db_inst_0f8x,
        db_inst_0f9x,
        db_inst_0fax,
        db_inst_0fbx,
        db_inst_0fcx,
-       0,
-       0,
-       0
+       NULL,
+       NULL,
+       NULL
 };
 
 const char * const db_Esc92[] = {
@@ -418,12 +419,12 @@
 const struct finst db_Esc9[] = {
 /*0*/  { "fld",    SNGL,  op1(STI),    0 },
 /*1*/  { "",       NONE,  op1(STI),    "fxch" },
-/*2*/  { "fst",    SNGL,  op1(X),      (const char *)db_Esc92 },
-/*3*/  { "fstp",   SNGL,  op1(X),      (const char *)db_Esc93 },
-/*4*/  { "fldenv", NONE,  op1(X),      (const char *)db_Esc94 },
-/*5*/  { "fldcw",  NONE,  op1(X),      (const char *)db_Esc95 },
-/*6*/  { "fnstenv",NONE,  op1(X),      (const char *)db_Esc96 },
-/*7*/  { "fnstcw", NONE,  op1(X),      (const char *)db_Esc97 },
+/*2*/  { "fst",    SNGL,  op1(X),      db_Esc92 },
+/*3*/  { "fstp",   SNGL,  op1(X),      db_Esc93 },
+/*4*/  { "fldenv", NONE,  op1(X),      db_Esc94 },
+/*5*/  { "fldcw",  NONE,  op1(X),      db_Esc95 },
+/*6*/  { "fnstenv",NONE,  op1(X),      db_Esc96 },
+/*7*/  { "fnstcw", NONE,  op1(X),      db_Esc97 },
 };
 
 const struct finst db_Esca[] = {
@@ -431,7 +432,7 @@
 /*1*/  { "fimul",  WORD,  0,           0 },
 /*2*/  { "ficom",  WORD,  0,           0 },
 /*3*/  { "ficomp", WORD,  0,           0 },
-/*4*/  { "fisub",  WORD,  op1(X),      (const char *)db_Esca4 },
+/*4*/  { "fisub",  WORD,  op1(X),      db_Esca4 },
 /*5*/  { "fisubr", WORD,  0,           0 },
 /*6*/  { "fidiv",  WORD,  0,           0 },
 /*7*/  { "fidivr", WORD,  0,           0 }
@@ -442,7 +443,7 @@
 /*1*/  { "",       NONE,  0,           0 },
 /*2*/  { "fist",   WORD,  0,           0 },
 /*3*/  { "fistp",  WORD,  0,           0 },
-/*4*/  { "",       WORD,  op1(X),      (const char *)db_Escb4 },
+/*4*/  { "",       WORD,  op1(X),      db_Escb4 },
 /*5*/  { "fld",    EXTR,  0,           0 },
 /*6*/  { "",       WORD,  0,           0 },
 /*7*/  { "fstp",   EXTR,  0,           0 },
@@ -474,7 +475,7 @@
 /*0*/  { "fiadd",  LONG,  op2(ST,STI), "faddp" },
 /*1*/  { "fimul",  LONG,  op2(ST,STI), "fmulp" },
 /*2*/  { "ficom",  LONG,  0,           0 },
-/*3*/  { "ficomp", LONG,  op1(X),      (const char *)db_Esce3 },
+/*3*/  { "ficomp", LONG,  op1(X),      db_Esce3 },
 /*4*/  { "fisub",  LONG,  op2(ST,STI), "fsubrp" },
 /*5*/  { "fisubr", LONG,  op2(ST,STI), "fsubp" },
 /*6*/  { "fidiv",  LONG,  op2(ST,STI), "fdivrp" },
@@ -486,7 +487,7 @@
 /*1*/  { "",       LONG,  0,           0 },
 /*2*/  { "fist",   LONG,  0,           0 },
 /*3*/  { "fistp",  LONG,  0,           0 },
-/*4*/  { "fbld",   NONE,  op1(XA),     (const char *)db_Escf4 },
+/*4*/  { "fbld",   NONE,  op1(XA),     db_Escf4 },
 /*5*/  { "fld",    QUAD,  0,           0 },
 /*6*/  { "fbstp",  NONE,  0,           0 },
 /*7*/  { "fstp",   QUAD,  0,           0 },
@@ -530,18 +531,18 @@
        { "idiv",  true, NONE, op2(E,A), 0 },
 };
 
-const struct inst      db_Grp4[] = {
+const struct inst db_Grp4[] = {
        { "inc",   true, BYTE, op1(E),   0 },
        { "dec",   true, BYTE, op1(E),   0 },
-       { "",      true, NONE, 0,       0 },
-       { "",      true, NONE, 0,       0 },
-       { "",      true, NONE, 0,       0 },
-       { "",      true, NONE, 0,       0 },
-       { "",      true, NONE, 0,       0 },
-       { "",      true, NONE, 0,       0 }
+       { "",      true, NONE, 0,        0 },
+       { "",      true, NONE, 0,        0 },
+       { "",      true, NONE, 0,        0 },
+       { "",      true, NONE, 0,        0 },
+       { "",      true, NONE, 0,        0 },
+       { "",      true, NONE, 0,        0 }
 };
 
-const struct inst      db_Grp5[] = {
+const struct inst db_Grp5[] = {
        { "inc",   true, LONG, op1(E),   0 },



Home | Main Index | Thread Index | Old Index