taylor@THINK.COM (06/04/89)
Here are some additional changes for the ns32k versions of gdb.
The opcode table used by the disassembler has a number of errors. This
fixes a number of them.
And I got tired of seeing sCONDb, sCONDw, and sCONDd for the ``save
condition as boolean'' instructions rather than seeing the mnemonic for
the condition, so I decided to add them to the table. (It was just a
little cut and paste from ns32k-opcode.h in the gas directory...)
I also got tired of seeing numbers for the string options, the setcfg
options, the cinv options, and the restore/exit/save/enter options.
Thus, I put in the changes (modeled after the way the ns32k gas does it)
to print them symbolically in a format acceptable to gas.
There remain some instructions, such as lmr, smr, lpr{b,w,d}, and
spr{b,w,d} that should be modified to print the name of the register
rather than printing a number. It's very easily done using the same
mechanism as that used for the setcfg, cinv, restore... instructions.
But, I haven't done it yet. Maybe next weekend...
This message also includes the changes I sent earlier today about the
`movsu', `movus', and `or' instructions. Sorry.
RCS file: RCS/ns32k-opcode.h,v
retrieving revision 1.2
diff -c1 -r1.2 ns32k-opcode.h
*** /tmp/,RCSt1001037 Sun Jun 4 00:39:03 1989
--- ns32k-opcode.h Sun Jun 4 00:37:14 1989
***************
*** 75,77 ****
{ "addqd", 7,16, 0x0f, "2D1q" },
! { "addr", 6,16, 0x27, "1D2D" },
{ "adjspb", 11,16, 0x057c, "1B" },
--- 75,77 ----
{ "addqd", 7,16, 0x0f, "2D1q" },
! { "addr", 6,16, 0x27, "1A2D" },
{ "adjspb", 11,16, 0x057c, "1B" },
***************
*** 112,122 ****
{ "cased", 11,16, 0x77f, "1D" },
! { "cbitb", 14,24, 0x084e, "1B2D" },
! { "cbitw", 14,24, 0x094e, "1W2D" },
! { "cbitd", 14,24, 0x0b4e, "1D2D" },
! { "cbitib", 14,24, 0x0c4e, "1B2D" },
! { "cbitiw", 14,24, 0x0d4e, "1W2D" },
! { "cbitid", 14,24, 0x0f4e, "1D2D" },
{ "checkb", 11,24, 0x0ee, "2A3B1r" },
! { "checkw", 11,24, 0x1ee, "2A3B1r" },
{ "checkd", 11,24, 0x3ee, "2A3D1r" },
{ "cmpf", 14,24, 0x09be, "1F2F" },
--- 112,123 ----
{ "cased", 11,16, 0x77f, "1D" },
! { "cbitb", 14,24, 0x084e, "1B2A" },
! { "cbitw", 14,24, 0x094e, "1W2A" },
! { "cbitd", 14,24, 0x0b4e, "1D2A" },
! { "cbitib", 14,24, 0x0c4e, "1B2A" },
! { "cbitiw", 14,24, 0x0d4e, "1W2A" },
! { "cbitid", 14,24, 0x0f4e, "1D2A" },
{ "checkb", 11,24, 0x0ee, "2A3B1r" },
! { "checkw", 11,24, 0x1ee, "2A3W1r" },
{ "checkd", 11,24, 0x3ee, "2A3D1r" },
+ { "cinv", 15,24, 0x271e, "2D1C" },
{ "cmpf", 14,24, 0x09be, "1F2F" },
***************
*** 126,130 ****
{ "cmpd", 6,16, 0x07, "1D2D" },
! { "cmpmb", 14,24, 0x04ce, "1D2D3d" },
! { "cmpmw", 14,24, 0x05ce, "1D2D3d" },
! { "cmpmd", 14,24, 0x07ce, "1D2D3d" },
{ "cmpqb", 7,16, 0x1c, "2B1q" },
--- 127,131 ----
{ "cmpd", 6,16, 0x07, "1D2D" },
! { "cmpmb", 14,24, 0x04ce, "1A2A3d" },
! { "cmpmw", 14,24, 0x05ce, "1A2A3d" },
! { "cmpmd", 14,24, 0x07ce, "1A2A3d" },
{ "cmpqb", 7,16, 0x1c, "2B1q" },
***************
*** 132,137 ****
{ "cmpqd", 7,16, 0x1f, "2D1q" },
! { "cmpsb", 16,16, 0x040e, "1i" },
! { "cmpsw", 16,16, 0x050e, "1i" },
! { "cmpsd", 16,16, 0x070e, "1i" },
! { "cmpst", 16,16, 0x840e, "1i" },
{ "comb", 14,24, 0x344e, "1B2B" },
--- 133,138 ----
{ "cmpqd", 7,16, 0x1f, "2D1q" },
! { "cmpsb", 16,16, 0x040e, "1S" },
! { "cmpsw", 16,16, 0x050e, "1S" },
! { "cmpsd", 16,16, 0x070e, "1S" },
! { "cmpst", 16,16, 0x840e, "1S" },
{ "comb", 14,24, 0x344e, "1B2B" },
***************
*** 151,160 ****
{ "divd", 14,24, 0x3fce, "1D2D" },
! { "enter", 8,8, 0x82, "1i2d" },
! { "exit", 8,8, 0x92, "1i" },
! { "extb", 11,24, 0x02e, "2D3B1r4d" },
! { "extw", 11,24, 0x12e, "2D3W1r4d" },
! { "extd", 11,24, 0x32e, "2D3D1r4d" },
! { "extsb", 14,24, 0x0cce, "1D2B3i" },
! { "extsw", 14,24, 0x0dce, "1D2W3i" },
! { "extsd", 14,24, 0x0fce, "1D2D3i" },
{ "ffsb", 14,24, 0x046e, "1B2B" },
--- 152,161 ----
{ "divd", 14,24, 0x3fce, "1D2D" },
! { "enter", 8,8, 0x82, "1U2d" },
! { "exit", 8,8, 0x92, "1u" },
! { "extb", 11,24, 0x02e, "2A3B1r4d" },
! { "extw", 11,24, 0x12e, "2A3W1r4d" },
! { "extd", 11,24, 0x32e, "2A3D1r4d" },
! { "extsb", 14,24, 0x0cce, "1A2B3i" },
! { "extsw", 14,24, 0x0dce, "1A2W3i" },
! { "extsd", 14,24, 0x0fce, "1A2D3i" },
{ "ffsb", 14,24, 0x046e, "1B2B" },
***************
*** 178,182 ****
{ "insd", 11,24, 0x3ae, "2D3D1r4d" },
! { "inssb", 14,24, 0x08ce, "1B2D3i" },
! { "inssw", 14,24, 0x09ce, "1W2D3i" },
! { "inssd", 14,24, 0x0bce, "1D2D3i" },
{ "jsr", 11,16, 0x67f, "1A" },
--- 179,183 ----
{ "insd", 11,24, 0x3ae, "2D3D1r4d" },
! { "inssb", 14,24, 0x08ce, "1B2A3i" },
! { "inssw", 14,24, 0x09ce, "1W2A3i" },
! { "inssd", 14,24, 0x0bce, "1D2A3i" },
{ "jsr", 11,16, 0x67f, "1A" },
***************
*** 210,214 ****
{ "movlf", 14,24, 0x163e, "1L2F" },
! { "movmb", 14,24, 0x00ce, "1D2D3d" },
! { "movmw", 14,24, 0x00de, "1D2D3d" },
! { "movmd", 14,24, 0x00fe, "1D2D3d" },
{ "movqb", 7,16, 0x5c, "2B1q" },
--- 211,215 ----
{ "movlf", 14,24, 0x163e, "1L2F" },
! { "movmb", 14,24, 0x00ce, "1A2A3d" },
! { "movmw", 14,24, 0x01ce, "1A2A3d" },
! { "movmd", 14,24, 0x03ce, "1A2A3d" },
{ "movqb", 7,16, 0x5c, "2B1q" },
***************
*** 216,227 ****
{ "movqd", 7,16, 0x5f, "2B1q" },
! { "movsb", 16,16, 0x000e, "1i" },
! { "movsw", 16,16, 0x010e, "1i" },
! { "movsd", 16,16, 0x030e, "1i" },
! { "movst", 16,16, 0x800e, "1i" },
! { "movsub", 14,24, 0x0cae, "1A1A" },
! { "movsuw", 14,24, 0x0dae, "1A1A" },
! { "movsud", 14,24, 0x0fae, "1A1A" },
! { "movusb", 14,24, 0x1cae, "1A1A" },
! { "movusw", 14,24, 0x1dae, "1A1A" },
! { "movusd", 14,24, 0x1fae, "1A1A" },
{ "movxbd", 14,24, 0x1cce, "1B2D" },
--- 217,228 ----
{ "movqd", 7,16, 0x5f, "2B1q" },
! { "movsb", 16,16, 0x000e, "1S" },
! { "movsw", 16,16, 0x010e, "1S" },
! { "movsd", 16,16, 0x030e, "1S" },
! { "movst", 16,16, 0x800e, "1S" },
! { "movsub", 14,24, 0x0cae, "1A2A" },
! { "movsuw", 14,24, 0x0dae, "1A2A" },
! { "movsud", 14,24, 0x0fae, "1A2A" },
! { "movusb", 14,24, 0x1cae, "1A2A" },
! { "movusw", 14,24, 0x1dae, "1A2A" },
! { "movusd", 14,24, 0x1fae, "1A2A" },
{ "movxbd", 14,24, 0x1cce, "1B2D" },
***************
*** 246,250 ****
{ "notd", 14,24, 0x274e, "1D2D" },
! { "orb", 6,16, 0x18, "1B1B" },
! { "orw", 6,16, 0x19, "1W1W" },
! { "ord", 6,16, 0x1b, "1D1D" },
{ "quob", 14,24, 0x30ce, "1B2B" },
--- 247,251 ----
{ "notd", 14,24, 0x274e, "1D2D" },
! { "orb", 6,16, 0x18, "1B2B" },
! { "orw", 6,16, 0x19, "1W2W" },
! { "ord", 6,16, 0x1b, "1D2D" },
{ "quob", 14,24, 0x30ce, "1B2B" },
***************
*** 256,258 ****
{ "remd", 14,24, 0x37ce, "1D2D" },
! { "restore", 8,8, 0x72, "1i" },
{ "ret", 8,8, 0x12, "1d" },
--- 257,259 ----
{ "remd", 14,24, 0x37ce, "1D2D" },
! { "restore", 8,8, 0x72, "1u" },
{ "ret", 8,8, 0x12, "1d" },
***************
*** 259,261 ****
{ "reti", 8,8, 0x52, "" },
! { "rett", 8,8, 0x42, "" },
{ "rotb", 14,24, 0x004e, "1B2B" },
--- 260,262 ----
{ "reti", 8,8, 0x52, "" },
! { "rett", 8,8, 0x42, "1d" },
{ "rotb", 14,24, 0x004e, "1B2B" },
***************
*** 270,275 ****
{ "rxp", 8,8, 0x32, "1d" },
! { "sCONDb", 7,16, 0x3c, "2B1q" },
! { "sCONDw", 7,16, 0x3d, "2D1q" },
! { "sCONDd", 7,16, 0x3f, "2D1q" },
! { "save", 8,8, 0x62, "1i" },
{ "sbitb", 14,24, 0x184e, "1B2A" },
--- 271,321 ----
{ "rxp", 8,8, 0x32, "1d" },
! { "seqb", 11,16, 0x3c, "1B" },
! { "seqw", 11,16, 0x3d, "1W" },
! { "seqd", 11,16, 0x3f, "1D" },
! { "sneb", 11,16, 0xbc, "1B" },
! { "snew", 11,16, 0xbd, "1W" },
! { "sned", 11,16, 0xbf, "1D" },
! { "scsb", 11,16, 0x13c, "1B" },
! { "scsw", 11,16, 0x13d, "1W" },
! { "scsd", 11,16, 0x13f, "1D" },
! { "sccb", 11,16, 0x1bc, "1B" },
! { "sccw", 11,16, 0x1bd, "1W" },
! { "sccd", 11,16, 0x1bf, "1D" },
! { "shib", 11,16, 0x23c, "1B" },
! { "shiw", 11,16, 0x23d, "1W" },
! { "shid", 11,16, 0x23f, "1D" },
! { "slsb", 11,16, 0x2bc, "1B" },
! { "slsw", 11,16, 0x2bd, "1W" },
! { "slsd", 11,16, 0x2bf, "1D" },
! { "sgtb", 11,16, 0x33c, "1B" },
! { "sgtw", 11,16, 0x33d, "1W" },
! { "sgtd", 11,16, 0x33f, "1D" },
! { "sleb", 11,16, 0x3bc, "1B" },
! { "slew", 11,16, 0x3bd, "1W" },
! { "sled", 11,16, 0x3bf, "1D" },
! { "sfsb", 11,16, 0x43c, "1B" },
! { "sfsw", 11,16, 0x43d, "1W" },
! { "sfsd", 11,16, 0x43f, "1D" },
! { "sfcb", 11,16, 0x4bc, "1B" },
! { "sfcw", 11,16, 0x4bd, "1W" },
! { "sfcd", 11,16, 0x4bf, "1D" },
! { "slob", 11,16, 0x53c, "1B" },
! { "slow", 11,16, 0x53d, "1W" },
! { "slod", 11,16, 0x53f, "1D" },
! { "shsb", 11,16, 0x5bc, "1B" },
! { "shsw", 11,16, 0x5bd, "1W" },
! { "shsd", 11,16, 0x5bf, "1D" },
! { "sltb", 11,16, 0x63c, "1B" },
! { "sltw", 11,16, 0x63d, "1W" },
! { "sltd", 11,16, 0x63f, "1D" },
! { "sgeb", 11,16, 0x6bc, "1B" },
! { "sgew", 11,16, 0x6bd, "1W" },
! { "sged", 11,16, 0x6bf, "1D" },
! { "sutb", 11,16, 0x73c, "1B" },
! { "sutw", 11,16, 0x73d, "1W" },
! { "sutd", 11,16, 0x73f, "1D" },
! { "sufb", 11,16, 0x7bc, "1B" },
! { "sufw", 11,16, 0x7bd, "1W" },
! { "sufd", 11,16, 0x7bf, "1D" },
! { "save", 8,8, 0x62, "1U" },
{ "sbitb", 14,24, 0x184e, "1B2A" },
***************
*** 280,287 ****
{ "sbitid", 14,24, 0x1f4e, "1D2A" },
! { "setcfg", 15,24, 0x0b0e, "5D1q" },
! { "sfsr", 14,24, 0x673e, "5D1D" },
! { "skpsb", 16,16, 0x0c0e, "1i" },
! { "skpsw", 16,16, 0x0d0e, "1i" },
! { "skpsd", 16,16, 0x0f0e, "1i" },
! { "skpst", 16,16, 0x8c0e, "1i" },
{ "smr", 15,24, 0x0f1e, "2D1q" },
--- 326,333 ----
{ "sbitid", 14,24, 0x1f4e, "1D2A" },
! { "setcfg", 15,24, 0x0b0e, "5D1O" },
! { "sfsr", 14,24, 0x373e, "5D1D" },
! { "skpsb", 16,16, 0x0c0e, "1S" },
! { "skpsw", 16,16, 0x0d0e, "1S" },
! { "skpsd", 16,16, 0x0f0e, "1S" },
! { "skpst", 16,16, 0x8c0e, "1S" },
{ "smr", 15,24, 0x0f1e, "2D1q" },
***************
*** 320,321 ****
--- 366,378 ----
{ "xord", 6,16, 0x3b, "1D2D" },
+
+ #if defined(NS32381)
+ { "dotf", 14,24, 0x0dfe, "1F2F" },
+ { "dotl", 14,24, 0x0cfe, "1L2L" },
+ { "logbf", 14,24, 0x15fe, "1F2F" },
+ { "logbl", 14,24, 0x14fe, "1L2L" },
+ { "polyf", 14,24, 0x09fe, "1F2F" },
+ { "polyl", 14,24, 0x08fe, "1L2L" },
+ { "scalbf", 14,24, 0x11fe, "1F2F" },
+ { "scalbl", 14,24, 0x10fe, "1L2L" },
+ #endif
}; /* notstrs */
===================================================================
RCS file: RCS/ns32k-pinsn.c,v
retrieving revision 1.1
diff -c1 -r1.1 ns32k-pinsn.c
*** /tmp/,RCSt1001037 Sun Jun 4 00:39:05 1989
--- ns32k-pinsn.c Sun Jun 4 00:13:26 1989
***************
*** 36,38 ****
--- 36,128 ----
+
+ struct option {
+ char *pattern; /* the option itself */
+ unsigned long value; /* binary value of the option */
+ unsigned long match; /* these bits must match */
+ };
+
+
+ struct option opt1[]= /* restore, exit */
+ {
+ { "r0", 0x80, 0x80 },
+ { "r1", 0x40, 0x40 },
+ { "r2", 0x20, 0x20 },
+ { "r3", 0x10, 0x10 },
+ { "r4", 0x08, 0x08 },
+ { "r5", 0x04, 0x04 },
+ { "r6", 0x02, 0x02 },
+ { "r7", 0x01, 0x01 },
+ { 0 , 0x00, 0x00 }
+ };
+
+ struct option opt2[]= /* save, enter */
+ {
+ { "r0", 0x01, 0x01 },
+ { "r1", 0x02, 0x02 },
+ { "r2", 0x04, 0x04 },
+ { "r3", 0x08, 0x08 },
+ { "r4", 0x10, 0x10 },
+ { "r5", 0x20, 0x20 },
+ { "r6", 0x40, 0x40 },
+ { "r7", 0x80, 0x80 },
+ { 0 , 0x00, 0x00 }
+ };
+
+ struct option opt3[]= /* setcfg */
+ {
+ { "c", 0x8, 0x8 },
+ { "m", 0x4, 0x4 },
+ { "f", 0x2, 0x2 },
+ { "i", 0x1, 0x1 },
+ { 0 , 0x0, 0x0 }
+ };
+
+ struct option opt4[]= /* cinv */
+ {
+ { "a", 0x4, 0x4 },
+ { "i", 0x2, 0x2 },
+ { "d", 0x1, 0x1 },
+ { 0 , 0x0, 0x0 }
+ };
+
+ struct option opt5[]= /* string inst */
+ {
+ { "b", 0x1, 0x1 },
+ { "u", 0x6, 0x6 },
+ { "w", 0x2, 0x2 },
+ { 0 , 0x0, 0x0 }
+ };
+
/*
+ * figure out which options are present
+ */
+ void
+ optlist(options, optionP, result)
+ int options;
+ struct option *optionP;
+ char *result;
+ {
+ if (options == 0) {
+ sprintf(result, "[]");
+ return;
+ }
+ sprintf(result, "[");
+
+ for (; (options != 0) && optionP->pattern; optionP++) {
+ if ((options & optionP->match) == optionP->value) {
+ /* we found a match, update result and options */
+ strcat(result, optionP->pattern);
+ options &= ~optionP->value;
+ if (options != 0) /* more options to come */
+ strcat(result, ",");
+ }
+ }
+ if (options != 0)
+ strcat(result, "undefined");
+
+ strcat(result, "]");
+ }
+
+
+ /*
* extract "count" bits starting "offset" bits
***************
*** 367,368 ****
--- 457,483 ----
sprintf (result, "0x%x", Ivalue);
+ break;
+ case 'u':
+ Ivalue = bit_extract (buffer, *aoffsetp, 8);
+ optlist(Ivalue, opt1, result);
+ *aoffsetp += 8;
+ break;
+ case 'U':
+ Ivalue = bit_extract(buffer, *aoffsetp, 8);
+ optlist(Ivalue, opt2, result);
+ *aoffsetp += 8;
+ break;
+ case 'O':
+ Ivalue = bit_extract(buffer, ioffset-4, 4);
+ optlist(Ivalue, opt3, result);
+ ioffset -= 4;
+ break;
+ case 'C':
+ Ivalue = bit_extract(buffer, ioffset-4, 4);
+ optlist(Ivalue, opt4, result);
+ ioffset -= 4;
+ break;
+ case 'S':
+ Ivalue = bit_extract(buffer, *aoffsetp, 8);
+ optlist(Ivalue, opt5, result);
+ *aoffsetp += 8;
break;