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; }
182 bool contains(
const Address &addr)
const;
192 return (first < op2.first); }
194 void saveXml(ostream &s)
const;
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(); }
213 const Range *getFirstRange(
void)
const;
214 const Range *getLastRange(
void)
const;
217 void insertRange(
AddrSpace *spc,uintb first,uintb last);
218 void removeRange(
AddrSpace *spc,uintb first,uintb last);
220 bool inRange(
const Address &addr,int4 size)
const;
221 uintb longestFit(
const Address &addr,uintb maxsize)
const;
222 void printBounds(ostream &s)
const;
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);
SeqNum(const SeqNum &op2)
Copy a sequence number.
Definition: address.hh:123
A region where processor data is stored.
Definition: space.hh:73
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
const Address & getAddr(void) const
Get the address portion of a sequence number.
Definition: address.hh:126
virtual uintb read(const string &s, int4 &size) const
Read in an address (and possible size) from a string.
Definition: space.cc:237
int4 popcount(uintb val)
Return the number of one bits in the given value.
Definition: address.cc:726
bool empty(void) const
Return true if this is empty.
Definition: address.hh:209
uintb getLast(void) const
Get the offset of the last byte in this Range.
Definition: address.hh:178
Range(void)
Constructor for use with restoreXml.
Definition: address.hh:175
int4 numRanges(void) const
Return the number of Range objects in container.
Definition: address.hh:212
bool operator==(const Address &op2) const
Compare two addresses for equality.
Definition: address.hh:327
A manager for different address spaces.
Definition: translate.hh:218
bool isJoin(void) const
Is this a join value.
Definition: address.hh:418
RangeList(const RangeList &op2)
Copy constructor.
Definition: address.hh:206
void unsignedSubtract128(uint8 *a, uint8 *b)
Subtract (in-place) a 128-bit value from a base 128-value.
Definition: address.cc:834
static Address restoreXml(const Element *el, const AddrSpaceManager *manage)
Restore an address from parsed XML.
Definition: address.cc:201
uintb pcode_left(uintb val, int4 sa)
Definition: address.hh:482
A contiguous range of bytes in some address space.
Definition: address.hh:161
bool operator==(const SeqNum &op2) const
Compare two sequence numbers for equality.
Definition: address.hh:138
void printRaw(ostream &s) const
Write a raw version of the address to a stream.
Definition: address.hh:276
bool operator<=(const Address &op2) const
Compare two addresses via their natural ordering.
Definition: address.hh:369
uintb offset
Offset (in bytes)
Definition: address.hh:49
SeqNum(void)
Create an invalid sequence number.
Definition: address.hh:116
Address getLastAddr(void) const
Get the address of the last byte.
Definition: address.hh:180
Special space to represent constants.
Definition: space.hh:29
AddrSpace * getSpace(void) const
Get the address space containing this Range.
Definition: address.hh:176
uintm getOrder(void) const
Get the order field of a sequence number.
Definition: address.hh:132
bool containedBy(int4 sz, const Address &op2, int4 sz2) const
Determine if op2 range contains this range.
Definition: address.cc:104
A disjoint set of Ranges, possibly across multiple address spaces.
Definition: address.hh:203
bool operator!=(const SeqNum &op2) const
Compare two sequence numbers for inequality.
Definition: address.hh:141
uintb pcode_right(uintb val, int4 sa)
Definition: address.hh:473
uintb minimalmask(uintb val)
Calculate smallest mask that covers the given value.
Definition: address.hh:493
Address getFirstAddr(void) const
Get the address of the first byte.
Definition: address.hh:179
virtual void printRaw(ostream &s, uintb offset) const
Write an address in this space to a stream.
Definition: space.cc:188
set< Range >::const_iterator end(void) const
Get iterator to ending Range.
Definition: address.hh:211
Address(void)
Create an invalid address.
Definition: address.hh:234
bool operator!=(const Address &op2) const
Compare two addresses for inequality.
Definition: address.hh:335
void zero_extend(intb &val, int4 bit)
Clear all bits above given bit.
Definition: address.cc:639
spacetype getType(void) const
Get the type of space.
Definition: space.hh:289
uintb coveringmask(uintb val)
Return a mask that covers the given value.
Definition: address.cc:770
set< Range >::const_iterator begin(void) const
Get iterator to beginning Range.
Definition: address.hh:210
Address & operator=(const Address &op2)
Copy an address.
Definition: address.hh:315
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
int4 unsignedCompare128(uint8 *a, uint8 *b)
Compare two unsigned 128-bit values.
Definition: address.cc:852
static AddrSpace * getSpaceFromConst(const Address &addr)
Recover an encoded address space from an address.
Definition: address.hh:452
bool isBigEndian(void) const
Is data at this address big endian encoded.
Definition: address.hh:269
void saveXml(ostream &s) const
Save this to a stream as an XML tag.
Definition: address.hh:426
bool contains(const Address &addr) const
Determine if the address is in this Range.
Definition: address.hh:458
AddrSpace * getSpace(void) const
Get the address space.
Definition: address.hh:294
friend ostream & operator<<(ostream &s, const Address &addr)
Write out an address to stream.
Definition: address.cc:34
bool operator<(const SeqNum &op2) const
Compare two sequence numbers with their natural order.
Definition: address.hh:144
uintb wrapOffset(uintb off) const
Wrap -off- to the offset that fits into this space.
Definition: space.hh:361
int4 leastsigbit_set(uintb val)
Return index of least significant bit set in given value.
Definition: address.cc:684
Biggest possible address.
Definition: address.hh:54
void renormalize(int4 size)
Make sure there is a backing JoinRecord if this is in the join space.
Definition: address.cc:185
int4 overlap(int4 skip, const Address &op, int4 size) const
Determine how two address ranges overlap.
Definition: address.cc:147
bool isContiguous(int4 sz, const Address &loaddr, int4 losz) const
Does this form a contigous range with loaddr.
Definition: address.cc:167
bool isInvalid(void) const
Is the address invalid?
Definition: address.hh:256
An XML element. A node in the DOM tree.
Definition: xml.hh:150
uintb getOffset(void) const
Get the address offset.
Definition: address.hh:300
void printBounds(ostream &s) const
Print a description of this RangeList to stream.
Definition: address.cc:522
Classes for describing address spaces.
uint4 getAddrSize(void) const
Get the size of the space.
Definition: space.hh:333
void clear(void)
Clear this container to empty.
Definition: address.hh:208
uintb uintbmasks[]
Precalculated masks indexed by size.
Definition: address.cc:571
SeqNum(const Address &a, uintm b)
Create a sequence number with a specific time field.
Definition: address.hh:120
bool signbit_negative(uintb val, int4 size)
Return true if the sign-bit is set.
Definition: address.cc:579
char getShortcut(void) const
Get the shortcut character for the address space.
Definition: address.hh:307
void mult64to128(uint8 *res, uint8 x, uint8 y)
Multiply 2 unsigned 64-bit values, producing a 128-bit value.
Definition: address.cc:812
bool operator<(const Address &op2) const
Compare two addresses via their natural ordering.
Definition: address.hh:346
bool isConstant(void) const
Is this a constant value.
Definition: address.hh:412
void setOrder(uintm ord)
Set the order field of a sequence number.
Definition: address.hh:135
uintb calc_mask(int4 size)
Calculate a mask for a given byte size.
Definition: address.hh:467
void toPhysical(void)
Convert this to a physical address.
Definition: address.cc:91
uintm getTime(void) const
Get the time field of a sequence number.
Definition: address.hh:129
virtual void saveXmlAttributes(ostream &s, uintb offset) const
Save an address as XML.
Definition: space.cc:118
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:375
int4 getIndex(void) const
Get the integer identifier.
Definition: space.hh:317
AddrSpace * base
Pointer to our address space.
Definition: address.hh:48
Range(AddrSpace *s, uintb f, uintb l)
Construct a Range from offsets.
Definition: address.hh:173
uintb uintb_negate(uintb in, int4 size)
Negate the sized value.
Definition: address.cc:592
bool isBigEndian(void) const
Return true if values in this space are big endian.
Definition: space.hh:408
int4 getAddrSize(void) const
Get the number of bytes in the address.
Definition: address.hh:263
void byte_swap(intb &val, int4 size)
Swap bytes in the given value.
Definition: address.cc:651
uintb getFirst(void) const
Get the offset of the first byte in this Range.
Definition: address.hh:177
Address operator-(int4 off) const
Decrement address by a number of bytes.
Definition: address.hh:404
Smallest possible address.
Definition: address.hh:53
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
mach_extreme
An enum for specifying extremal addresses.
Definition: address.hh:52
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
int4 bit_transitions(uintb val, int4 sz)
Calculate the number of bit transitions in the sized value.
Definition: address.cc:788
RangeList(void)
Construct an empty container.
Definition: address.hh:207
bool operator<(const Range &op2) const
Sorting operator for Ranges.
Definition: address.hh:189
Special virtual space to represent split variables.
Definition: space.hh:35
int4 read(const string &s)
Read in the address from a string.
Definition: address.hh:288
A class for uniquely labelling and comparing PcodeOps.
Definition: address.hh:111
int4 count_leading_zeros(uintb val)
Return the number of leading zero bits in the given value.
Definition: address.cc:743