|
|
1.1 root 1:
2: /*++
3:
4: Copyright (c) 1993 Digital Equipment Corporation
5:
6: Module Name:
7:
8: optable.h
9:
10: Abstract:
11:
12: Definitions for -
13: Table of operations, their names and charactersitics
14: Used by ntsd, windbg and acc's dissassembler
15:
16: Author:
17:
18: Miche Baker-Harvey (mbh) 10-Jan-1993
19:
20: Revision History:
21:
22: --*/
23:
24: #ifndef _OPTABLE_
25: #define _OPTABLE_
26:
27: //
28: // Each entry in the opTable is either for a
29: // + function - one option on a particular opcode
30: // + terminal opcode - an opcode without a function field
31: // the above two can both appear directly in disassembly
32: //
33: // + non terminal opcode - an opcode with a function field:
34: // these entries do not represent values which can be
35: // executed directly: they require a function entry.
36: //
37: // + invalid opcode - this is an opcode reserved to digital
38: //
39:
40: typedef enum ENTRY_TYPE {
41:
42: INVALID_ETYPE,
43: NON_TERMINAL_ETYPE,
44: TERMINAL_ETYPE,
45: FUNCTION_ETYPE,
46: NOT_AN_ETYPE
47:
48: } ENTRY_TYPE;
49:
50:
51: #define NO_FUNC (ULONG)-1
52:
53: typedef ULONG (* PFOPPARSE)();
54:
55: typedef struct _OPTBLENTRY {
56:
57: union {
58:
59: struct {
60:
61: PUCHAR _pszName; // Name of the instruction
62: PFOPPARSE _parsFunc; // Function to parse operands
63:
64: } s0; // functions and terminal opcodes
65:
66: struct {
67:
68: struct _OPTBLENTRY * _funcTable; // Describes funcs for opcode
69: ULONG _funcTableSize; // Number of possible funcs
70:
71: } s1; // non-terminal opcodes
72:
73: } u;
74:
75: //
76: // These fields describe the instruction
77: //
78:
79: ULONG opCode; // Top 6 bits of a 32-bit alpha instr
80: ULONG funcCode; // Function; meaning is opcode dependent
81: ULONG iType; // type of the instr: branch, fp, mem...
82: // values are ALPHA_* in alphaops.h
83:
84: ENTRY_TYPE eType; // type of this entry in the opTable
85:
86: } OPTBLENTRY, * POPTBLENTRY;
87:
88: //
89: // MBH - hack workaround:
90: // I tried to do this with nameless functions and structures;
91: // it works just fine on ALPHA, but dies on 386, so use this
92: // ugly hack instead.
93: // The name "pszAlphaName" is used instead of the more obvious
94: // "pszName" because other structures contain pszName.
95: //
96: #define pszAlphaName u.s0._pszName
97: #define parsFunc u.s0._parsFunc
98: #define funcTable u.s1._funcTable
99: #define funcTableSize u.s1._funcTableSize
100:
101: POPTBLENTRY findNonTerminalEntry(ULONG);
102: POPTBLENTRY findStringEntry(PUCHAR);
103: POPTBLENTRY findOpCodeEntry(ULONG);
104: char * findFuncName(POPTBLENTRY, ULONG);
105: char * findFlagName(ULONG, ULONG);
106: void printTable();
107: void opTableInit();
108:
109: //
110: // This structure is used for the floating point flag names.
111: //
112:
113: #define FPFLAGS_NOT_AN_ENTRY 0xffffffff
114:
115: typedef struct _FPFLAGS {
116:
117: ULONG flags; // the flags on the opcode
118: PUCHAR flagname; // the string mnemonic for the flags
119:
120: } FPFLAGS, * PFPFLAGS;
121:
122:
123: #endif // _OPTABLE_
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.