Package ghidra.util.bytesearch
Class AlignRule
java.lang.Object
ghidra.util.bytesearch.AlignRule
- All Implemented Interfaces:
PostRule
ByteSearch post search rule when a pattern is found. Used when a pattern must have a certain
alignment at an offset from the location the pattern matches.
The pattern can be constructed or restored from XML of the form, where alignOffset=mark, alignmask=bits
<align mark="0" bits="1"/>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Apply a post rule given the matching pattern and offset into the byte stream.int
void
restoreXml
(XmlPullParser parser) Can restore state of instance PostRule from XML
-
Constructor Details
-
AlignRule
public AlignRule() -
AlignRule
public AlignRule(int alignOffset, int alignmask) ByteSearch post search rule when a pattern is found. Used when a pattern must have a certain alignment at an offset from the location the pattern matches. The alignment is specified by the alignmask bits that must be zero. Normally alignOffset is 0, since most patterns will match at the address that must be aligned To align a match, use the following align to 2 = alignmask 0x1 - lower bit must be zero align to 4 = alignmask 0x3 - lower two bits must be zero align to 8 = alignmask 0x7 - lower three bits must be zero align to 16 = alignmask 0xF - lower four bits must be zero .... Other strange alignments could be specified, but most likely the above suffice.- Parameters:
alignOffset
- - bytes offset from pattern to check for alignmentalignmask
- - the mask where a 1 bit must be zero
-
-
Method Details
-
apply
Description copied from interface:PostRule
Apply a post rule given the matching pattern and offset into the byte stream. -
restoreXml
Description copied from interface:PostRule
Can restore state of instance PostRule from XML- Specified by:
restoreXml
in interfacePostRule
- Parameters:
parser
- XML pull parser
-
getAlignMask
public int getAlignMask()
-