Ghidra Decompiler Analysis Engine
|
Go to the documentation of this file.
19 #ifndef __CPUI_SPACE__
20 #define __CPUI_SPACE__
100 uintb pointerLowerBound;
101 uintb pointerUpperBound;
120 const string &
getName(
void)
const;
155 virtual void printRaw(ostream &s,uintb offset)
const;
156 virtual uintb
read(
const string &s,int4 &size)
const;
157 virtual void saveXml(ostream &s)
const;
182 virtual void printRaw(ostream &s,uintb offset)
const;
183 virtual void saveXml(ostream &s)
const;
192 virtual void printRaw(ostream &s, uintb offset)
const;
193 virtual void saveXml(ostream &s)
const;
209 virtual void saveXml(ostream &s)
const;
226 virtual void printRaw(ostream &s,uintb offset)
const;
227 virtual uintb
read(
const string &s,int4 &size)
const;
228 virtual void saveXml(ostream &s)
const;
245 virtual void saveXml(ostream &s)
const;
349 return pointerLowerBound;
356 return pointerUpperBound;
373 intb mod = (intb)(highest+1);
374 intb res = (intb)off % mod;
465 throw LowlevelError(
name+
" space is not virtual and has no associated base register");
AddrSpace(AddrSpaceManager *m, const Translate *t, spacetype tp, const string &nm, uint4 size, uint4 ws, int4 ind, uint4 fl, int4 dl)
Definition: space.cc:40
@ reverse_justification
Justification within aligned word is opposite of endianness.
Definition: space.hh:81
@ big_endian
Space is big endian if set, little endian otherwise.
Definition: space.hh:77
int4 index
An integer identifier for the space.
Definition: space.hh:108
int4 getDeadcodeDelay(void) const
Get number of passes before deadcode removal is allowed.
Definition: space.hh:312
static bool compareByIndex(const AddrSpace *a, const AddrSpace *b)
Compare two spaces by their index.
Definition: space.hh:531
static uintb byteToAddress(uintb val, uint4 ws)
Scale from byte units to addressable units.
Definition: space.hh:505
uintb getHighest(void) const
Get the highest byte-scaled address.
Definition: space.hh:341
virtual void saveXml(ostream &s) const
Write the details of this space as XML.
Definition: space.cc:421
virtual void printRaw(ostream &s, uintb offset) const
Write an address in this space to a stream.
Definition: space.cc:189
AddrSpace * getBaseSpace(void) const
Get the address space being overlayed.
Definition: space.cc:657
virtual void saveXml(ostream &s) const
Write the details of this space as XML.
Definition: space.cc:635
string name
Name of this space.
Definition: space.hh:104
A region where processor data is stored.
Definition: space.hh:73
uint4 getWordSize(void) const
Get the addressable unit size.
Definition: space.hh:327
uint4 addressSize
Size of an address into this space in bytes.
Definition: space.hh:105
int4 getMinimumPtrSize(void) const
Get the minimum pointer size for this space.
Definition: space.hh:361
OverlaySpace(AddrSpaceManager *m, const Translate *t)
Constructor.
Definition: space.cc:649
int4 delay
Delay in heritaging this space.
Definition: space.hh:109
virtual const VarnodeData & getSpacebase(int4 i) const
Get a base register that creates this virtual space.
Definition: space.hh:464
The lowest level error generated by the decompiler.
Definition: error.hh:44
@ programspecific
Space is specific to a particular loadimage.
Definition: space.hh:80
uint4 getAddrSize(void) const
Get the size of the space.
Definition: space.hh:335
void setFlags(uint4 fl)
Set a cached attribute.
Definition: space.hh:251
Special AddrSpace for special/user-defined address spaces.
Definition: space.hh:188
An overlay space.
Definition: space.hh:240
Base class for error handling facilities.
bool isOtherSpace(void) const
Return true if this is the other address space.
Definition: space.hh:438
virtual uintb read(const string &s, int4 &size) const
Read in an address (and possible size) from a string.
Definition: space.cc:238
char getShortcut(void) const
Get the shortcut character.
Definition: space.hh:384
@ IPTR_SPACEBASE
addresses = offsets off of base register
Definition: space.hh:31
uintb getPointerUpperBound(void) const
Get upper bound for assuming an offset is a pointer.
Definition: space.hh:355
@ does_deadcode
Dead-code analysis is done on this space.
Definition: space.hh:79
@ heritaged
This space is heritaged.
Definition: space.hh:78
@ truncated
Space is truncated from its original size, expect pointers larger than this size.
Definition: space.hh:84
@ other_space_index
Reserved index for the other space.
Definition: space.hh:91
@ IPTR_FSPEC
Special internal FuncCallSpecs reference.
Definition: space.hh:33
bool isOverlayBase(void) const
Return true if other spaces overlay this space.
Definition: space.hh:434
@ has_nearpointers
Does there exist near pointers into this space.
Definition: space.hh:87
uint4 wordsize
Size of unit being addressed (1=byte)
Definition: space.hh:106
@ IPTR_INTERNAL
Internally managed temporary space.
Definition: space.hh:32
The pool of temporary storage registers.
Definition: space.hh:205
@ overlaybase
This is the base space for overlay space(s)
Definition: space.hh:83
spacetype getType(void) const
Get the type of space.
Definition: space.hh:291
void truncateSpace(uint4 newsize)
Definition: space.cc:105
virtual void printRaw(ostream &s, uintb offset) const
Write an address in this space to a stream.
Definition: space.cc:415
virtual void saveXml(ostream &s) const
Write the details of this space as XML.
Definition: space.cc:286
An XML element. A node in the DOM tree.
Definition: xml.hh:150
bool doesDeadcode(void) const
Return true if dead code analysis should be done on this space.
Definition: space.hh:402
virtual const VarnodeData & getSpacebaseFull(int4 i) const
Return original spacebase register before truncation.
Definition: space.hh:472
@ IPTR_JOIN
Special virtual space to represent split variables.
Definition: space.hh:35
virtual void restoreXml(const Element *el)
Recover the details of this space from XML.
Definition: space.cc:673
@ hasphysical
Has physical memory associated with it.
Definition: space.hh:85
int4 minimumPointerSize
Smallest size of a pointer into this space (in bytes)
Definition: space.hh:107
virtual void printRaw(ostream &s, uintb offset) const
Write an address in this space to a stream.
Definition: space.cc:579
The pool of logically joined variables.
Definition: space.hh:220
uintb getPointerLowerBound(void) const
Get lower bound for assuming an offset is a pointer.
Definition: space.hh:348
ConstantSpace(AddrSpaceManager *m, const Translate *t, const string &nm, int4 ind)
Only constructor.
Definition: space.cc:360
@ IPTR_CONSTANT
Special space to represent constants.
Definition: space.hh:29
JoinSpace(AddrSpaceManager *m, const Translate *t, const string &nm, int4 ind)
Definition: space.cc:464
int4 deadcodedelay
Delay before deadcode removal is allowed on this space.
Definition: space.hh:110
virtual void saveXmlAttributes(ostream &s, uintb offset) const
Save an address as XML.
Definition: space.cc:119
virtual bool stackGrowsNegative(void) const
Return true if a stack in this space grows negative.
Definition: space.hh:479
virtual void saveXmlAttributes(ostream &s, uintb offset) const
Definition: space.cc:477
virtual void restoreXml(const Element *el)
Recover the details of this space from XML.
Definition: space.cc:298
@ IPTR_PROCESSOR
Normal spaces modelled by processor.
Definition: space.hh:30
const string & getName(void) const
Get the name.
Definition: space.hh:264
@ IPTR_IOP
Special internal PcodeOp reference.
Definition: space.hh:34
static uintb addressToByte(uintb val, uint4 ws)
Scale from addressable units to byte units.
Definition: space.hh:496
virtual uintb restoreXmlAttributes(const Element *el, uint4 &size) const
Definition: space.cc:530
static int4 addressToByteInt(int4 val, uint4 ws)
Scale int4 from addressable units to byte units.
Definition: space.hh:514
AddrSpaceManager * getManager(void) const
Get the space manager.
Definition: space.hh:271
int4 getIndex(void) const
Get the integer identifier.
Definition: space.hh:319
@ overlay
This space is an overlay of another space.
Definition: space.hh:82
bool isTruncated(void) const
Return true if this space is truncated from its original size.
Definition: space.hh:444
virtual void saveXml(ostream &s) const
Write the details of this space as XML.
Definition: space.cc:450
UniqueSpace(AddrSpaceManager *m, const Translate *t, const string &nm, int4 ind, uint4 fl)
Constructor.
Definition: space.cc:437
void clearFlags(uint4 fl)
Clear a cached attribute.
Definition: space.hh:257
virtual void printRaw(ostream &s, uintb offset) const
Definition: space.cc:371
The interface to a translation engine for a processor.
Definition: translate.hh:294
virtual uintb restoreXmlAttributes(const Element *el, uint4 &size) const
Recover an offset and size.
Definition: space.cc:149
void saveBasicAttributes(ostream &s) const
Write the XML attributes of this space.
Definition: space.cc:88
bool isHeritaged(void) const
Return true if dataflow has been traced.
Definition: space.hh:394
bool hasNearPointers(void) const
Return true if near (truncated) pointers into this space are possible.
Definition: space.hh:448
virtual void restoreXml(const Element *el)
Recover the details of this space from XML.
Definition: space.cc:641
bool isOverlay(void) const
Return true if this is an overlay space.
Definition: space.hh:430
bool hasPhysical(void) const
Return true if data is physically stored in this.
Definition: space.hh:410
Lightweight (and incomplete) XML parser for marshaling data to and from the decompiler.
bool isBigEndian(void) const
Return true if values in this space are big endian.
Definition: space.hh:417
OtherSpace(AddrSpaceManager *m, const Translate *t, const string &nm, int4 ind)
Constructor.
Definition: space.cc:400
const Translate * getTrans(void) const
Get the processor translator.
Definition: space.hh:279
static int4 byteToAddressInt(int4 val, uint4 ws)
Scale int4 from byte units to addressable units.
Definition: space.hh:523
spacetype
Fundemental address space types.
Definition: space.hh:28
virtual AddrSpace * getContain(void) const
Return this space's containing space (if any)
Definition: space.hh:487
Special AddrSpace for representing constants during analysis.
Definition: space.hh:179
@ is_otherspace
Quick check for the OtherSpace derived class.
Definition: space.hh:86
void calcScaleMask(void)
Calculate scale and mask.
Definition: space.cc:21
virtual void saveXml(ostream &s) const
Write the details of this space as XML.
Definition: space.cc:663
virtual int4 numSpacebase(void) const
Number of base registers associated with this space.
Definition: space.hh:456
Data defining a specific memory location.
Definition: pcoderaw.hh:33
uintb wrapOffset(uintb off) const
Wrap -off- to the offset that fits into this space.
Definition: space.hh:370
virtual void restoreXml(const Element *el)
Definition: space.cc:387
@ constant_space_index
Reserved index for the constant space.
Definition: space.hh:90
A manager for different address spaces.
Definition: translate.hh:218
virtual uintb read(const string &s, int4 &size) const
Read in an address (and possible size) from a string.
Definition: space.cc:600
int4 getDelay(void) const
Get number of heritage passes being delayed.
Definition: space.hh:302
virtual void saveXml(ostream &s) const
Definition: space.cc:379
void printOffset(ostream &s, uintb offset) const
Write an address offset to a stream.
Definition: space.cc:177
bool isReverseJustified(void) const
Return true if alignment justification does not match endianness.
Definition: space.hh:426