🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #798

further fixes for GDB's ns32k disassembler

#798
From: taylor
Date: Sat, 10 Jun 1989 04:52
218 lines
6526 bytes
Here are some changes for GDB's disassembler for the ns32k.

The changes cause GDB

. to print the names of the cpu registers for the lpr and spr
instructions 

. to print the names of the mmu registers for the lmr and smr
instructions

. to properly print the 3rd and 4th arguments to the exts and inss
instructions

These changes bring it more in line with what GAS configured for the
ns32k will accept as input, but there are still some discrepancies.

RCS file: RCS/ns32k-opcode.h,v
retrieving revision 1.3
diff -c1 -r1.3 ns32k-opcode.h
*** /tmp/,RCSt1022486	Sat Jun 10 00:34:29 1989
--- ns32k-opcode.h	Sat Jun 10 00:33:36 1989
***************
*** 49,51 ****
   * p : displacement - pc relative addressing
! */
  static struct not
--- 49,60 ----
   * p : displacement - pc relative addressing
!  * O : setcfg instruction options list
!  * C : cinv instruction options list
!  * S : string instruction options list
!  * U : save/enter register list
!  * u : restore/exit register list
!  * M : mmu register
!  * P : cpu register
!  * g : 3rd operand of inss or exts instruction
!  * G : 4th operand of inss or exts instruction
!  */
  static struct not
***************
*** 157,161 ****
    { "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" },
--- 166,170 ----
    { "extd",	11,24,	0x32e,	"2A3D1r4d" },
!   { "extsb",	14,24,	0x0cce,	"1A2B4G3g" },
!   { "extsw",	14,24,	0x0dce,	"1A2W4G3g" },
!   { "extsd",	14,24,	0x0fce,	"1A2D4G3g" },
    { "ffsb",	14,24,	0x046e,	"1B2B" },
***************
*** 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" },
--- 188,192 ----
    { "insd",	11,24,	0x3ae,	"2D3D1r4d" },
!   { "inssb",	14,24,	0x08ce,	"1B2A4G3g" },
!   { "inssw",	14,24,	0x09ce,	"1W2A4G3g" },
!   { "inssd",	14,24,	0x0bce,	"1D2A4G3g" },
    { "jsr",	11,16,	0x67f,	"1A" },
***************
*** 185,190 ****
    { "lfsr",	19,24,	0x00f3e,"1D" },
!   { "lmr",	15,24,	0x0b1e,	"2D1q" },
!   { "lprb",	 7,16,	0x6c,	"2B1q" },
!   { "lprw",	 7,16,	0x6d,	"2W1q" },
!   { "lprd",	 7,16,	0x6f,	"2D1q" },
    { "lshb",	14,24,	0x144e,	"1B2B" },
--- 194,199 ----
    { "lfsr",	19,24,	0x00f3e,"1D" },
!   { "lmr",	15,24,	0x0b1e,	"2D1M" },
!   { "lprb",	 7,16,	0x6c,	"2B1P" },
!   { "lprw",	 7,16,	0x6d,	"2W1P" },
!   { "lprd",	 7,16,	0x6f,	"2D1P" },
    { "lshb",	14,24,	0x144e,	"1B2B" },
***************
*** 332,337 ****
    { "skpst",	16,16,	0x8c0e,	"1S" },
!   { "smr",	15,24,	0x0f1e,	"2D1q" },
!   { "sprb",	 7,16,	0x2c,	"2B1q" },
!   { "sprw",	 7,16,	0x2d,	"2W1q" },
!   { "sprd",	 7,16,	0x2f,	"2D1q" },
    { "subf",	14,24,	0x11be,	"1F2F" },
--- 341,346 ----
    { "skpst",	16,16,	0x8c0e,	"1S" },
!   { "smr",	15,24,	0x0f1e,	"2D1M" },
!   { "sprb",	 7,16,	0x2c,	"2B1P" },
!   { "sprw",	 7,16,	0x2d,	"2W1P" },
!   { "sprd",	 7,16,	0x2f,	"2D1P" },
    { "subf",	14,24,	0x11be,	"1F2F" },
===================================================================
RCS file: RCS/ns32k-pinsn.c,v
retrieving revision 1.2
diff -c1 -r1.2 ns32k-pinsn.c
*** /tmp/,RCSt1022486	Sat Jun 10 00:34:30 1989
--- ns32k-pinsn.c	Fri Jun  9 22:59:20 1989
***************
*** 95,96 ****
--- 95,165 ----
  
+ #if !defined(NS32032) && !defined(NS32532)
+ #define NS32032
+ #endif
+ 
+ #if defined(NS32532)
+ struct option cpureg[]= /* lpr spr */
+ {
+   { "us",	0x0,	0xf	},
+   { "dcr",	0x1,	0xf	},
+   { "bpc",	0x2,	0xf	},
+   { "dsr",	0x3,	0xf	},
+   { "car",	0x4,	0xf	},
+   { "fp",	0x8,	0xf	},
+   { "sp",	0x9,	0xf	},
+   { "sb",	0xa,	0xf	},
+   { "usp",	0xb,	0xf	},
+   { "cfg",	0xc,	0xf	},
+   { "psr",	0xd,	0xf	},
+   { "intbase",	0xe,	0xf	},
+   { "mod",	0xf,	0xf	},
+   {  0 ,	0x00,	0xf	}
+ };
+ #endif
+ 
+ #if defined(NS32532) || defined(NS32382)
+ struct option mmureg[]= /* lmr smr */
+ {
+   { "mcr",	0x9,	0xf	},
+   { "msr",	0xa,	0xf	},
+   { "tear",	0xb,	0xf	},
+   { "ptb0",	0xc,	0xf	},
+   { "ptb1",	0xd,	0xf	},
+   { "ivar0",	0xe,	0xf	},
+   { "ivar1",	0xf,	0xf	},
+   {  0 ,	0x0,	0xf	}
+ };
+ #endif
+ 
+ #if defined(NS32032)
+ struct option cpureg[]= /* lpr spr */
+ {
+   { "upsr",	0x0,	0xf	},
+   { "fp",	0x8,	0xf	},
+   { "sp",	0x9,	0xf	},
+   { "sb",	0xa,	0xf	},
+   { "psr",	0xb,	0xf	},
+   { "intbase",	0xe,	0xf	},
+   { "mod",	0xf,	0xf	},
+   {  0 ,	0x0,	0xf	}
+ };
+ #endif
+ 
+ #if !defined(NS32532) && !defined(NS32382)
+ struct option mmureg[]= /* lmr smr */
+ {
+   { "bpr0",	0x0,	0xf	},
+   { "bpr1",	0x1,	0xf	},
+   { "pf0",	0x4,	0xf	},
+   { "pf1",	0x5,	0xf	},
+   { "sc",	0x8,	0xf	},
+   { "msr",	0xa,	0xf	},
+   { "bcnt",	0xb,	0xf	},
+   { "ptb0",	0xc,	0xf	},
+   { "ptb1",	0xd,	0xf	},
+   { "eia",	0xf,	0xf	},
+   {  0 ,	0x0,	0xf	}
+ };
+ #endif
+ 
  /*
***************
*** 125,126 ****
--- 194,208 ----
  
+ list_search(reg_value, optionP, result)
+     int reg_value;
+     struct option *optionP;
+     char *result;
+ {
+     for (; optionP->pattern; optionP++) {
+ 	if ((reg_value & optionP->match) == optionP->value) {
+ 	    sprintf(result, "%s", optionP->pattern);
+ 	    return;
+ 	}
+     }
+     sprintf(result, "undefined");
+ }
  
***************
*** 482,483 ****
--- 564,585 ----
        *aoffsetp += 8;
+       break;
+     case 'M':
+       Ivalue = bit_extract(buffer, ioffset-4, 4);
+       list_search(Ivalue, mmureg, result);
+       ioffset -= 4;
+       break;
+     case 'P':
+       Ivalue = bit_extract(buffer, ioffset-4, 4);
+       list_search(Ivalue, cpureg, result);
+       ioffset -= 4;
+       break;
+     case 'g':
+       Ivalue = bit_extract(buffer, *aoffsetp, 3);
+       sprintf(result, "%d", Ivalue);
+       *aoffsetp += 3;
+       break;
+     case 'G':
+       Ivalue = bit_extract(buffer, *aoffsetp, 5);
+       sprintf(result, "%d", Ivalue + 1);
+       *aoffsetp += 5;
        break;
Technical Details
Message-ID: <8906100452.AA22534@pozzo>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!THINK.COM!taylor

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!THINK.COM!taylor
From: taylor@THINK.COM
Newsgroups: gnu.gdb.bug
Subject: further fixes for GDB's ns32k disassembler
Message-ID: <8906100452.AA22534@pozzo>
Date: 10 Jun 89 04:52:51 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 218