Ghidra Decompiler Analysis Engine
|
Go to the documentation of this file.
65 int4
read(
const string &s);
86 void saveXml(ostream &s,int4 size)
const;
146 return (uniq < op2.uniq);
147 return (pc < op2.pc);
151 void saveXml(ostream &s)
const;
174 spc = s; first = f; last = l; }
176 AddrSpace *getSpace(
void)
const {
return spc; }
177 uintb getFirst(
void)
const {
return first; }
178 uintb getLast(
void)
const {
return last; }
192 return (first < op2.first); }
194 void saveXml(ostream &s)
const;
208 void clear(
void) { tree.clear(); }
209 bool empty(
void)
const {
return tree.empty(); }
210 set<Range>::const_iterator begin(
void)
const {
return tree.begin(); }
211 set<Range>::const_iterator end(
void)
const {
return tree.end(); }
212 int4 numRanges(
void)
const {
return tree.size(); }
223 void saveXml(ostream &s)
const;
336 return !(*
this==op2);
459 if (spc != addr.
getSpace())
return false;
460 if (first > addr.
getOffset())
return false;
461 if (last < addr.
getOffset())
return false;
474 if (sa >= 8*
sizeof(uintb))
return 0;
483 if (sa >= 8*
sizeof(uintb))
return 0;
496 if (val > 0xffffffff)
508 extern uintb
sign_extend(uintb in,int4 sizein,int4 sizeout);
512 extern void byte_swap(intb &val,int4 size);
514 extern uintb
byte_swap(uintb val,int4 size);
523 extern void mult64to128(uint8 *res,uint8 x,uint8 y);
526 extern int4
power2Divide(int4 n,uint8 divisor,uint8 &q,uint8 &r);
int4 power2Divide(int4 n, uint8 divisor, uint8 &q, uint8 &r)
Unsigned division of a power of 2 (upto 2^127) by a 64-bit divisor.
Definition: address.cc:870
static SeqNum restoreXml(const Element *el, const AddrSpaceManager *manage)
Restore a SeqNum from parsed XML.
Definition: address.cc:56
uintm getTime(void) const
Get the time field of a sequence number.
Definition: address.hh:129
bool operator<(const Range &op2) const
Sorting operator for Ranges.
Definition: address.hh:189
virtual void printRaw(ostream &s, uintb offset) const
Write an address in this space to a stream.
Definition: space.cc:189
uintb longestFit(const Address &addr, uintb maxsize) const
Find size of biggest Range containing given address.
Definition: address.cc:446
const Range * getLastSignedRange(AddrSpace *spaceid) const
Get the last Range viewing offsets as signed.
Definition: address.cc:496
A region where processor data is stored.
Definition: space.hh:73
int4 count_leading_zeros(uintb val)
Return the number of leading zero bits in the given value.
Definition: address.cc:743
int4 bit_transitions(uintb val, int4 sz)
Calculate the number of bit transitions in the sized value.
Definition: address.cc:788
Address(void)
Create an invalid address.
Definition: address.hh:234
uintb pcode_left(uintb val, int4 sa)
Definition: address.hh:482
void restoreXml(const Element *el, const AddrSpaceManager *manage)
Restore this RangeList from an XML stream.
Definition: address.cc:554
SeqNum(Address::mach_extreme ex)
Create an extremal sequence number.
Definition: address.cc:41
int4 overlap(int4 skip, const Address &op, int4 size) const
Determine how two address ranges overlap.
Definition: address.cc:147
int4 read(const string &s)
Read in the address from a string.
Definition: address.hh:288
uint4 getAddrSize(void) const
Get the size of the space.
Definition: space.hh:335
const Range * getLastRange(void) const
Get the last Range.
Definition: address.cc:482
A class for uniquely labelling and comparing PcodeOps.
Definition: address.hh:111
void saveXml(ostream &s) const
Save this Range to an XML stream.
Definition: address.cc:264
uintm getOrder(void) const
Get the order field of a sequence number.
Definition: address.hh:132
virtual uintb read(const string &s, int4 &size) const
Read in an address (and possible size) from a string.
Definition: space.cc:238
Address operator+(int4 off) const
Increment address by a number of bytes.
Definition: address.hh:394
char getShortcut(void) const
Get the shortcut character.
Definition: space.hh:384
bool operator<=(const Address &op2) const
Compare two addresses via their natural ordering.
Definition: address.hh:369
bool inRange(const Address &addr, int4 size) const
Check containment an address range.
Definition: address.cc:402
friend ostream & operator<<(ostream &s, const Address &addr)
Write out an address to stream.
Definition: address.cc:34
SeqNum(const Address &a, uintm b)
Create a sequence number with a specific time field.
Definition: address.hh:120
void mult64to128(uint8 *res, uint8 x, uint8 y)
Multiply 2 unsigned 64-bit values, producing a 128-bit value.
Definition: address.cc:812
void printBounds(ostream &s) const
Print this Range to a stream.
Definition: address.cc:255
void renormalize(int4 size)
Make sure there is a backing JoinRecord if this is in the join space.
Definition: address.cc:185
uintb uintb_negate(uintb in, int4 size)
Negate the sized value.
Definition: address.cc:592
mach_extreme
An enum for specifying extremal addresses.
Definition: address.hh:52
void toPhysical(void)
Convert this to a physical address.
Definition: address.cc:91
spacetype getType(void) const
Get the type of space.
Definition: space.hh:291
bool isInvalid(void) const
Is the address invalid?
Definition: address.hh:256
void restoreXml(const Element *el, const AddrSpaceManager *manage)
Restore this from XML stream.
Definition: address.cc:277
uintb getOffset(void) const
Get the address offset.
Definition: address.hh:300
uintb pcode_right(uintb val, int4 sa)
Definition: address.hh:473
bool operator<(const SeqNum &op2) const
Compare two sequence numbers with their natural order.
Definition: address.hh:144
void zero_extend(intb &val, int4 bit)
Clear all bits above given bit.
Definition: address.cc:639
An XML element. A node in the DOM tree.
Definition: xml.hh:150
uintb minimalmask(uintb val)
Calculate smallest mask that covers the given value.
Definition: address.hh:493
static AddrSpace * getSpaceFromConst(const Address &addr)
Recover an encoded address space from an address.
Definition: address.hh:452
bool operator==(const SeqNum &op2) const
Compare two sequence numbers for equality.
Definition: address.hh:138
AddrSpace * base
Pointer to our address space.
Definition: address.hh:48
char getShortcut(void) const
Get the shortcut character for the address space.
Definition: address.hh:307
void saveXml(ostream &s) const
Save this to a stream as an XML tag.
Definition: address.hh:426
bool isConstant(void) const
Is this a constant value.
Definition: address.hh:412
@ IPTR_JOIN
Special virtual space to represent split variables.
Definition: space.hh:35
Address operator-(int4 off) const
Decrement address by a number of bytes.
Definition: address.hh:404
bool contains(const Address &addr) const
Determine if the address is in this Range.
Definition: address.hh:458
Classes for describing address spaces.
A disjoint set of Ranges, possibly across multiple address spaces.
Definition: address.hh:203
@ m_minimal
Smallest possible address.
Definition: address.hh:53
uintb sign_extend(uintb in, int4 sizein, int4 sizeout)
Sign-extend a value between two byte sizes.
Definition: address.cc:604
int4 mostsigbit_set(uintb val)
Return index of most significant bit set in given value.
Definition: address.cc:705
@ IPTR_CONSTANT
Special space to represent constants.
Definition: space.hh:29
virtual void saveXmlAttributes(ostream &s, uintb offset) const
Save an address as XML.
Definition: space.cc:119
const Address & getAddr(void) const
Get the address portion of a sequence number.
Definition: address.hh:126
bool operator!=(const Address &op2) const
Compare two addresses for inequality.
Definition: address.hh:335
int4 popcount(uintb val)
Return the number of one bits in the given value.
Definition: address.cc:726
int4 unsignedCompare128(uint8 *a, uint8 *b)
Compare two unsigned 128-bit values.
Definition: address.cc:852
uintb coveringmask(uintb val)
Return a mask that covers the given value.
Definition: address.cc:770
Address & operator=(const Address &op2)
Copy an address.
Definition: address.hh:315
void merge(const RangeList &op2)
Merge another RangeList into this.
Definition: address.cc:385
bool operator==(const Address &op2) const
Compare two addresses for equality.
Definition: address.hh:327
AddrSpace * getSpace(void) const
Get the address space.
Definition: address.hh:294
void saveXml(ostream &s) const
Write this RangeList to an XML stream.
Definition: address.cc:538
void printBounds(ostream &s) const
Print a description of this RangeList to stream.
Definition: address.cc:522
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
SeqNum(const SeqNum &op2)
Copy a sequence number.
Definition: address.hh:123
const Range * getRange(AddrSpace *spaceid, uintb offset) const
Get Range containing the given byte.
Definition: address.cc:425
int4 getIndex(void) const
Get the integer identifier.
Definition: space.hh:319
bool isJoin(void) const
Is this a join value.
Definition: address.hh:418
friend ostream & operator<<(ostream &s, const SeqNum &sq)
Write out a SeqNum to a stream.
Definition: address.cc:19
bool isBigEndian(void) const
Is data at this address big endian encoded.
Definition: address.hh:269
int4 justifiedContain(int4 sz, const Address &op2, int4 sz2, bool forceleft) const
Determine if op2 is the least significant part of this.
Definition: address.cc:125
void unsignedSubtract128(uint8 *a, uint8 *b)
Subtract (in-place) a 128-bit value from a base 128-value.
Definition: address.cc:834
bool isContiguous(int4 sz, const Address &loaddr, int4 losz) const
Does this form a contigous range with loaddr.
Definition: address.cc:167
void insertRange(AddrSpace *spc, uintb first, uintb last)
Insert a range of addresses.
Definition: address.cc:317
const Range * getFirstRange(void) const
Get the first Range.
Definition: address.cc:474
A contiguous range of bytes in some address space.
Definition: address.hh:161
bool signbit_negative(uintb val, int4 size)
Return true if the sign-bit is set.
Definition: address.cc:579
Range(AddrSpace *s, uintb f, uintb l)
Construct a Range from offsets.
Definition: address.hh:173
void printRaw(ostream &s) const
Write a raw version of the address to a stream.
Definition: address.hh:276
bool isBigEndian(void) const
Return true if values in this space are big endian.
Definition: space.hh:417
bool containedBy(int4 sz, const Address &op2, int4 sz2) const
Determine if op2 range contains this range.
Definition: address.cc:104
void saveXml(ostream &s) const
Save a SeqNum to a stream as an XML tag.
Definition: address.cc:47
Address getLastAddrOpen(const AddrSpaceManager *manage) const
Get address of first byte after this.
Definition: address.cc:237
int4 getAddrSize(void) const
Get the number of bytes in the address.
Definition: address.hh:263
bool operator<(const Address &op2) const
Compare two addresses via their natural ordering.
Definition: address.hh:346
bool operator!=(const SeqNum &op2) const
Compare two sequence numbers for inequality.
Definition: address.hh:141
uintb wrapOffset(uintb off) const
Wrap -off- to the offset that fits into this space.
Definition: space.hh:370
uintb uintbmasks[]
Precalculated masks indexed by size.
Definition: address.cc:571
static Address restoreXml(const Element *el, const AddrSpaceManager *manage)
Restore an address from parsed XML.
Definition: address.cc:201
void setOrder(uintm ord)
Set the order field of a sequence number.
Definition: address.hh:135
A manager for different address spaces.
Definition: translate.hh:218
@ m_maximal
Biggest possible address.
Definition: address.hh:54
void removeRange(AddrSpace *spc, uintb first, uintb last)
Remove a range of addresses.
Definition: address.cc:351
int4 leastsigbit_set(uintb val)
Return index of least significant bit set in given value.
Definition: address.cc:684
uintb offset
Offset (in bytes)
Definition: address.hh:49
uintb calc_mask(int4 size)
Calculate a mask for a given byte size.
Definition: address.hh:467
void byte_swap(intb &val, int4 size)
Swap bytes in the given value.
Definition: address.cc:651