Package ghidra.util.bytesearch
Class AlignRule
- java.lang.Object
-
- ghidra.util.bytesearch.AlignRule
-
- All Implemented Interfaces:
PostRule
public class AlignRule extends java.lang.Object implements 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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
apply(Pattern pat, long matchoffset)
Apply a post rule given the matching pattern and offset into the byte stream.int
getAlignMask()
void
restoreXml(XmlPullParser parser)
Can restore state of instance PostRule from XML
-
-
-
Constructor Detail
-
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 Detail
-
apply
public boolean apply(Pattern pat, long matchoffset)
Description copied from interface:PostRule
Apply a post rule given the matching pattern and offset into the byte stream.
-
restoreXml
public void restoreXml(XmlPullParser parser)
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()
-
-