decompiler  1.0.0
Variables
ghidra::PackedFormat Namespace Reference

Protocol format for PackedEncode and PackedDecode classes. More...

Variables

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 boolean type.
 
static const uint1 TYPECODE_SIGNEDINT_POSITIVE = 2
 Type code for the signed positive integer type.
 
static const uint1 TYPECODE_SIGNEDINT_NEGATIVE = 3
 Type code for the signed negative integer type.
 
static const uint1 TYPECODE_UNSIGNEDINT = 4
 Type code for the unsigned integer type.
 
static const uint1 TYPECODE_ADDRESSSPACE = 5
 Type code for the address space type.
 
static const uint1 TYPECODE_SPECIALSPACE = 6
 Type code for the special address space type.
 
static const uint1 TYPECODE_STRING = 7
 Type code for the string type.
 
static const uint4 SPECIALSPACE_STACK = 0
 Special code for the stack space.
 
static const uint4 SPECIALSPACE_JOIN = 1
 Special code for the join space.
 
static const uint4 SPECIALSPACE_FSPEC = 2
 Special code for the fspec space.
 
static const uint4 SPECIALSPACE_IOP = 3
 Special code for the iop space.
 
static const uint4 SPECIALSPACE_SPACEBASE = 4
 Special code for a spacebase space.
 

Detailed Description

Protocol format for PackedEncode and PackedDecode classes.

All bytes in the encoding are expected to be non-zero. Element encoding looks like

Where iiiii is the (first) 5 bits of the element/attribute id. If x=0, the id is complete. If x=1, the next byte contains 7 more bits of the id: 1iiiiiii

After an attribute start, there follows a type byte: ttttllll, where the first 4 bits indicate the type of attribute and final 4 bits are a length code. The types are:

All attribute types except boolean and special, have an encoded integer after the type byte. The length code, indicates the number bytes used to encode the integer, 7-bits of info per byte, 1iiiiiii. A length code of zero is used to encode an integer value of 0, with no following bytes.

For strings, the integer encoded after the type byte, is the actual length of the string. The string data itself is stored immediately after the length integer using UTF8 format.