mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
Merge remote-tracking branch 'origin/GP-2438_ReturnStorage'
This commit is contained in:
commit
add99c05ba
15 changed files with 342 additions and 227 deletions
|
@ -123,7 +123,7 @@ public:
|
|||
int4 getSize(void) const { return size; } ///< Get the size of the memory range in bytes.
|
||||
int4 getMinSize(void) const { return minsize; } ///< Get the minimum size of a logical value contained in \b this
|
||||
int4 getAlign(void) const { return alignment; } ///< Get the alignment of \b this entry
|
||||
JoinRecord *getJoinRecord(void) const { return joinrec; }
|
||||
JoinRecord *getJoinRecord(void) const { return joinrec; } ///< Get record describing joined pieces (or null if only 1 piece)
|
||||
type_metatype getType(void) const { return type; } ///< Get the data-type class associated with \b this
|
||||
bool isExclusion(void) const { return (alignment==0); } ///< Return \b true if this holds a single parameter exclusively
|
||||
bool isReverseStack(void) const { return ((flags & reverse_stack)!=0); } ///< Return \b true if parameters are allocated in reverse order
|
||||
|
|
|
@ -857,6 +857,11 @@ AddrSpace *PackedDecode::readSpace(const AttributeId &attribId)
|
|||
return res;
|
||||
}
|
||||
|
||||
/// The value is either an unsigned integer, an address space index, or (the absolute value of) a signed integer.
|
||||
/// A type header is passed in with the particular type code for the value already filled in.
|
||||
/// This method then fills in the length code, outputs the full type header and the encoded bytes of the integer.
|
||||
/// \param typeByte is the type header
|
||||
/// \param val is the integer value
|
||||
void PackedEncode::writeInteger(uint1 typeByte,uint8 val)
|
||||
|
||||
{
|
||||
|
|
|
@ -390,29 +390,29 @@ public:
|
|||
/// For strings, the integer encoded after the \e type byte, is the actual length of the string. The
|
||||
/// string data itself is stored immediately after the length integer using UTF8 format.
|
||||
namespace PackedFormat {
|
||||
static const uint1 HEADER_MASK = 0xc0;
|
||||
static const uint1 ELEMENT_START = 0x40;
|
||||
static const uint1 ELEMENT_END = 0x80;
|
||||
static const uint1 ATTRIBUTE = 0xc0;
|
||||
static const uint1 HEADEREXTEND_MASK = 0x20;
|
||||
static const uint1 ELEMENTID_MASK = 0x1f;
|
||||
static const uint1 RAWDATA_MASK = 0x7f;
|
||||
static const int4 RAWDATA_BITSPERBYTE = 7;
|
||||
static const uint1 RAWDATA_MARKER = 0x80;
|
||||
static const int4 TYPECODE_SHIFT = 4;
|
||||
static const uint1 LENGTHCODE_MASK = 0xf;
|
||||
static const uint1 TYPECODE_BOOLEAN = 1;
|
||||
static const uint1 TYPECODE_SIGNEDINT_POSITIVE = 2;
|
||||
static const uint1 TYPECODE_SIGNEDINT_NEGATIVE = 3;
|
||||
static const uint1 TYPECODE_UNSIGNEDINT = 4;
|
||||
static const uint1 TYPECODE_ADDRESSSPACE = 5;
|
||||
static const uint1 TYPECODE_SPECIALSPACE = 6;
|
||||
static const uint1 TYPECODE_STRING = 7;
|
||||
static const uint4 SPECIALSPACE_STACK = 0;
|
||||
static const uint4 SPECIALSPACE_JOIN = 1;
|
||||
static const uint4 SPECIALSPACE_FSPEC = 2;
|
||||
static const uint4 SPECIALSPACE_IOP = 3;
|
||||
static const uint4 SPECIALSPACE_SPACEBASE = 4;
|
||||
static const uint1 HEADER_MASK = 0xc0; ///< Bits encoding the record type
|
||||
static const uint1 ELEMENT_START = 0x40; ///< Header for an element start record
|
||||
static const uint1 ELEMENT_END = 0x80; ///< Header for an element end record
|
||||
static const uint1 ATTRIBUTE = 0xc0; ///< Header for an attribute record
|
||||
static const uint1 HEADEREXTEND_MASK = 0x20; ///< Bit indicating the id extends into the next byte
|
||||
static const uint1 ELEMENTID_MASK = 0x1f; ///< Bits encoding (part of) the id in the record header
|
||||
static const uint1 RAWDATA_MASK = 0x7f; ///< Bits of raw data in follow-on bytes
|
||||
static const int4 RAWDATA_BITSPERBYTE = 7; ///< Number of bits used in a follow-on byte
|
||||
static const uint1 RAWDATA_MARKER = 0x80; ///< The unused bit in follow-on bytes. (Always set to 1)
|
||||
static const int4 TYPECODE_SHIFT = 4; ///< Bit position of the type code in the type byte
|
||||
static const uint1 LENGTHCODE_MASK = 0xf; ///< Bits in the type byte forming the length code
|
||||
static const uint1 TYPECODE_BOOLEAN = 1; ///< Type code for the \e boolean type
|
||||
static const uint1 TYPECODE_SIGNEDINT_POSITIVE = 2; ///< Type code for the \e signed \e positive \e integer type
|
||||
static const uint1 TYPECODE_SIGNEDINT_NEGATIVE = 3; ///< Type code for the \e signed \e negative \e integer type
|
||||
static const uint1 TYPECODE_UNSIGNEDINT = 4; ///< Type code for the \e unsigned \e integer type
|
||||
static const uint1 TYPECODE_ADDRESSSPACE = 5; ///< Type code for the \e address \e space type
|
||||
static const uint1 TYPECODE_SPECIALSPACE = 6; ///< Type code for the \e special \e address \e space type
|
||||
static const uint1 TYPECODE_STRING = 7; ///< Type code for the \e string type
|
||||
static const uint4 SPECIALSPACE_STACK = 0; ///< Special code for the \e stack space
|
||||
static const uint4 SPECIALSPACE_JOIN = 1; ///< Special code for the \e join space
|
||||
static const uint4 SPECIALSPACE_FSPEC = 2; ///< Special code for the \e fspec space
|
||||
static const uint4 SPECIALSPACE_IOP = 3; ///< Special code for the \e iop space
|
||||
static const uint4 SPECIALSPACE_SPACEBASE = 4; ///< Special code for a \e spacebase space
|
||||
}
|
||||
|
||||
/// \brief A byte-based decoder designed to marshal info to the decompiler efficiently
|
||||
|
@ -482,8 +482,8 @@ public:
|
|||
/// See PackedDecode for details of the encoding format.
|
||||
class PackedEncode : public Encoder {
|
||||
ostream &outStream; ///< The stream receiving the encoded data
|
||||
void writeHeader(uint1 header,uint4 id);
|
||||
void writeInteger(uint1 typeByte,uint8 val);
|
||||
void writeHeader(uint1 header,uint4 id); ///< Write a header, element or attribute, to stream
|
||||
void writeInteger(uint1 typeByte,uint8 val); ///< Write an integer value to the stream
|
||||
public:
|
||||
PackedEncode(ostream &s) : outStream(s) {} ///< Construct from a stream
|
||||
virtual void openElement(const ElementId &elemId);
|
||||
|
@ -547,6 +547,8 @@ inline void PackedDecode::advancePosition(Position &pos,int4 skip)
|
|||
pos.current += skip;
|
||||
}
|
||||
|
||||
/// \param header is the type of header
|
||||
/// \param id is the id associated with the element or attribute
|
||||
inline void PackedEncode::writeHeader(uint1 header,uint4 id)
|
||||
|
||||
{
|
||||
|
|
|
@ -495,7 +495,7 @@ void JoinSpace::encodeAttributes(Encoder &encoder,uintb offset) const
|
|||
encoder.writeString(*attribId, t.str());
|
||||
}
|
||||
if (num == 1)
|
||||
encoder.writeSignedInteger(ATTRIB_LOGICALSIZE, rec->getUnified().size);
|
||||
encoder.writeUnsignedInteger(ATTRIB_LOGICALSIZE, rec->getUnified().size);
|
||||
}
|
||||
|
||||
/// Encode a \e join address to the stream. This method in the interface only
|
||||
|
|
|
@ -906,9 +906,10 @@ const FloatFormat *Translate::getFloatFormat(int4 size) const
|
|||
return (const FloatFormat *)0;
|
||||
}
|
||||
|
||||
/// A convenience method for passing around pcode operations via stream.
|
||||
/// A single pcode operation is parsed from an \<op> element and
|
||||
/// A convenience method for passing around p-code operations via stream.
|
||||
/// A single p-code operation is parsed from an \<op> element and
|
||||
/// returned to the application via the PcodeEmit::dump method.
|
||||
/// \param addr is the address (of the instruction) to associate with the p-code op
|
||||
/// \param decoder is the stream decoder
|
||||
void PcodeEmit::decodeOp(const Address &addr,Decoder &decoder)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue