21 #ifndef __CPUI_TRANSLATE__ 22 #define __CPUI_TRANSLATE__ 67 void restoreXml(
const Element *el);
68 const string &
getName(
void)
const {
return spaceName; }
69 uint4
getSize(
void)
const {
return size; }
107 static const uint1 *unpackOffset(
const uint1 *ptr,uintb &off);
131 virtual void dump(
const Address &addr,
const string &mnem,
const string &body)=0;
156 virtual Address resolve(uintb val,int4 sz,
const Address &point,uintb &fullEncoding)=0;
173 bool hasbaseregister;
174 bool isNegativeStack;
177 void setBaseRegister(
const VarnodeData &data,int4 origSize,
bool stackGrowth);
181 virtual int4 numSpacebase(
void)
const;
182 virtual const VarnodeData &getSpacebase(int4 i)
const;
183 virtual const VarnodeData &getSpacebaseFull(int4 i)
const;
186 virtual void saveXml(ostream &s)
const;
187 virtual void restoreXml(
const Element *el);
197 vector<VarnodeData> pieces;
204 Address getEquivalentAddress(uintb offset,int4 &pos)
const;
219 vector<AddrSpace *> baselist;
220 vector<AddressResolver *> resolvelist;
221 map<string,AddrSpace *> name2Space;
222 map<int4,AddrSpace *> shortcut2Space;
232 set<JoinRecord *,JoinRecordCompare> splitset;
233 vector<JoinRecord *> splitlist;
237 void setDefaultCodeSpace(int4 index);
238 void setDefaultDataSpace(int4 index);
239 void setReverseJustified(
AddrSpace *spc);
241 void markNearPointers(
AddrSpace *spc,int4 size);
246 JoinRecord *findJoinInternal(uintb offset)
const;
250 int4 getDefaultSize(
void)
const;
251 AddrSpace *getSpaceByName(
const string &nm)
const;
252 AddrSpace *getSpaceByShortcut(
char sc)
const;
258 AddrSpace *getDefaultCodeSpace(
void)
const;
259 AddrSpace *getDefaultDataSpace(
void)
const;
261 Address getConstant(uintb val)
const;
264 int4 numSpaces(
void)
const;
267 JoinRecord *findAddJoin(
const vector<VarnodeData> &pieces,uint4 logicalsize);
269 void setDeadcodeDelay(
AddrSpace *spc,int4 delaydelta);
273 Address constructFloatExtensionAddress(
const Address &realaddr,int4 realsize,int4 logicalsize);
279 void renormalizeJoinAddress(
Address &addr,int4 size);
294 bool target_isbigendian;
300 void setBigEndian(
bool val);
301 void setUniqueBase(uintm val);
304 void setDefaultFloatFormats(
void);
305 bool isBigEndian(
void)
const;
306 const FloatFormat *getFloatFormat(int4 size)
const;
307 int4 getAlignment(
void)
const;
308 uintm getUniqueBase(
void)
const;
356 virtual void addRegister(
const string &nm,
AddrSpace *base,uintb offset,int4 size)=0;
363 virtual const VarnodeData &getRegister(
const string &nm)
const=0;
375 virtual string getRegisterName(
AddrSpace *base,uintb off,int4 size)
const=0;
383 virtual void getAllRegisters(map<VarnodeData,string> ®list)
const=0;
393 virtual void getUserOpNames(vector<string> &res)
const=0;
402 virtual int4 instructionLength(
const Address &baseaddr)
const=0;
417 virtual int4 oneInstruction(
PcodeEmit &emit,
const Address &baseaddr)
const=0;
434 return defaultcodespace->getAddrSize();
491 return defaultcodespace;
500 return defaultdataspace;
508 return constantspace;
518 return Address(constantspace,val);
528 return Address(constantspace,(uintb)(uintp)spc);
536 return baselist.size();
553 target_isbigendian = val;
564 if (val>unique_base) unique_base = val;
572 return target_isbigendian;
A container for parsed XML documents.
Definition: xml.hh:249
int4 getAlignment(void) const
Get the instruction alignment for the processor.
Definition: translate.hh:581
A region where processor data is stored.
Definition: space.hh:73
int4 numPieces(void) const
Get number of pieces in this record.
Definition: translate.hh:200
AddrSpace * getJoinSpace(void) const
Get the joining space.
Definition: translate.hh:460
OpCode
The op-code defining a specific p-code operation (PcodeOp)
Definition: opcodes.hh:35
A manager for different address spaces.
Definition: translate.hh:218
virtual ~PcodeEmit(void)
Virtual destructor.
Definition: translate.hh:78
Abstract class for emitting pcode to an application.
Definition: translate.hh:76
Raw descriptions of varnodes and p-code ops.
int4 instruction_length
Definition: translate.hh:36
void setBigEndian(bool val)
Set general endianness to big if val is true.
Definition: translate.hh:552
AddrSpace * getSpace(int4 i) const
Get an address space via its index.
Definition: translate.hh:544
A virtual space stack space.
Definition: translate.hh:170
void setUniqueBase(uintm val)
Set the base offset for new temporary registers.
Definition: translate.hh:563
AddrSpace * getConstantSpace(void) const
Get the constant space.
Definition: translate.hh:507
const string & getName(void) const
Get name of address space being truncated.
Definition: translate.hh:68
virtual ~AssemblyEmit(void)
Virtual destructor.
Definition: translate.hh:120
uintm getUniqueBase(void) const
Get the base offset for new temporary registers.
Definition: translate.hh:591
AddrSpace * getStackSpace(void) const
Get the stack space for this processor.
Definition: translate.hh:469
AddrSpace * getIopSpace(void) const
Get the internal pcode op space.
Definition: translate.hh:442
Exception for encountering unimplemented pcode.
Definition: translate.hh:35
virtual void setContextDefault(const string &name, uintm val)
Set the default value for a particular context variable.
Definition: translate.hh:336
const VarnodeData & getUnified(void) const
Get the Varnode whole.
Definition: translate.hh:203
Abstract class for converting native constants to addresses.
Definition: translate.hh:140
int4 alignment
Byte modulo on which instructions are aligned.
Definition: translate.hh:297
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
The interface to a translation engine for a processor.
Definition: translate.hh:293
vector< FloatFormat > floatformats
Floating point formats utilized by the processor.
Definition: translate.hh:298
virtual void registerContext(const string &name, int4 sbit, int4 ebit)
Add a new context variable to the model for this processor.
Definition: translate.hh:327
The lowest level error generated by the decompiler.
Definition: error.hh:44
A record describing how logical values are split.
Definition: translate.hh:195
Object for describing how a space should be truncated.
Definition: translate.hh:63
An XML element. A node in the DOM tree.
Definition: xml.hh:150
uint4 getSize(void) const
Size (of pointers) for new truncated space.
Definition: translate.hh:69
AddrSpace * getDefaultCodeSpace(void) const
Get the default address space of this processor.
Definition: translate.hh:490
int4 numSpaces(void) const
Get the number of address spaces for this processor.
Definition: translate.hh:535
AddrSpace * getUniqueSpace(void) const
Get the temporary register space for this processor.
Definition: translate.hh:481
UnimplError(const string &s, int4 l)
Constructor.
Definition: translate.hh:41
const VarnodeData & getPiece(int4 i) const
Get the i-th piece.
Definition: translate.hh:202
int4 getDefaultSize(void) const
Get size of addresses for the default space.
Definition: translate.hh:433
Address getConstant(uintb val) const
Get a constant encoded as an Address.
Definition: translate.hh:517
Address createConstFromSpace(AddrSpace *spc) const
Create a constant address encoding an address space.
Definition: translate.hh:527
bool isBigEndian(void) const
Is the processor big endian?
Definition: translate.hh:571
virtual bool stackGrowsNegative(void) const
Return true if a stack in this space grows negative.
Definition: translate.hh:184
bool isFloatExtension(void) const
Does this record extend a float varnode.
Definition: translate.hh:201
Support for decoding different floating-point formats.
BadDataError(const string &s)
Constructor.
Definition: translate.hh:54
bool operator()(const JoinRecord *a, const JoinRecord *b) const
Compare to JoinRecords using their built-in comparison.
Definition: translate.hh:210
Comparator for JoinRecord objects.
Definition: translate.hh:209
Abstract class for emitting disassembly to an application.
Definition: translate.hh:118
Exception for bad instruction data.
Definition: translate.hh:50
virtual AddrSpace * getContain(void) const
Return containing space.
Definition: translate.hh:185
virtual void allowContextSet(bool val) const
Toggle whether disassembly is allowed to affect context.
Definition: translate.hh:346
AddrSpace * getDefaultDataSpace(void) const
Get the default address space where data is stored.
Definition: translate.hh:499
Data defining a specific memory location.
Definition: pcoderaw.hh:33
AddrSpace * getFspecSpace(void) const
Get the internal callspec space.
Definition: translate.hh:451