Ghidra Decompiler Analysis Engine
|
16 #ifndef __CPUI_RULE_COMPILE__
17 #define __CPUI_RULE_COMPILE__
22 static int4 identlist[256];
23 map<string,int4> keywordmap;
31 int4 getNextChar(
void) {
33 int4 ret = lookahead[pos];
36 if ((*s).eof()||(c==
'\0')) {
38 lookahead[pos] =
'\n';
48 int4 next(int4 i) {
return lookahead[(pos+i)&3]; }
49 int4 scanIdentifier(
void);
50 int4 scanNumber(
void);
51 int4 buildString(int4 tokentype);
52 int4 otherIdentifiers(
void);
53 void initKeywords(
void);
56 void initialize(istream &t);
57 int4 getLineNo(
void) {
return lineno; }
75 ostream *error_stream;
78 map<string,int4> namemap;
80 vector<OpBehavior *> inst;
84 void ruleError(
const char *s);
85 int4 numErrors(
void)
const {
return errors; }
86 int4 getLineNo(
void) {
return lexer.getLineNo(); }
90 const map<string,int4> &getNameMap(
void)
const {
return namemap; }
92 int4 findIdentifier(
string *nm);
134 int4 nextToken(
void) {
return lexer.nextToken(); }
136 void setErrorStream(ostream &t) { error_stream = &t; }
137 void run(istream &s,
bool debug);
138 void postProcess(
void);
139 int4 postProcessRule(vector<OpCode> &opcodelist);
140 static ConstraintGroup *buildUnifyer(
const string &rule,
const vector<string> &idlist,vector<int4> &res);
144 vector<OpCode> starterops;
153 virtual void getOpList(vector<uint4> &oplist)
const;
155 static RuleGeneric *build(
const string &nm,
const string &gp,
const string &content);
Abstract class for emitting pcode to an application.
Definition: translate.hh:76
Definition: rulecompile.hh:143
A region where processor data is stored.
Definition: space.hh:73
The lowest level error generated by the decompiler.
Definition: error.hh:44
Class for performing a single transformation on a PcodeOp or Varnode.
Definition: action.hh:194
Abstract class for emitting disassembly to an application.
Definition: translate.hh:118
virtual string getRegisterName(AddrSpace *base, uintb off, int4 size) const
Get the name of a register given its location.
Definition: rulecompile.hh:66
virtual int4 instructionLength(const Address &baseaddr) const
Get the length of a machine instruction.
Definition: rulecompile.hh:69
virtual void getAllRegisters(map< VarnodeData, string > ®list) const
Get a list of all register names and the corresponding location.
Definition: rulecompile.hh:67
The list of groups defining a root Action.
Definition: action.hh:29
virtual const VarnodeData & getRegister(const string &nm) const
Get a register as VarnodeData given its name.
Definition: rulecompile.hh:65
virtual void addRegister(const string &nm, AddrSpace *base, uintb offset, int4 size)
Add a named register to the model for this processor.
Definition: rulecompile.hh:64
virtual void initialize(DocumentStorage &store)
Initialize the translator given XML configuration documents.
Definition: rulecompile.hh:63
Lowest level operation of the p-code language.
Definition: op.hh:58
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
bool contains(const string &nm) const
Check if this ActionGroupList contains a given group.
Definition: action.hh:37
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
virtual int4 printAssembly(AssemblyEmit &emit, const Address &baseaddr) const
Disassemble a single machine instruction.
Definition: rulecompile.hh:71
Container for data structures associated with a single function.
Definition: funcdata.hh:45
virtual Rule * clone(const ActionGroupList &grouplist) const
Clone the Rule.
Definition: rulecompile.hh:151
The interface to a translation engine for a processor.
Definition: translate.hh:294
OpCode
The op-code defining a specific p-code operation (PcodeOp)
Definition: opcodes.hh:35
Definition: rulecompile.hh:74
Data defining a specific memory location.
Definition: pcoderaw.hh:33
A container for parsed XML documents.
Definition: xml.hh:249
virtual void getUserOpNames(vector< string > &res) const
Get a list of all user-defined pcode ops.
Definition: rulecompile.hh:68
Definition: rulecompile.hh:21
virtual int4 oneInstruction(PcodeEmit &emit, const Address &baseaddr) const
Transform a single machine instruction into pcode.
Definition: rulecompile.hh:70
virtual void getOpList(vector< uint4 > &oplist) const
List of op codes this rule operates on.
Definition: rulecompile.hh:61