Package ghidra.pcode.memstate
Class MemoryPage
- java.lang.Object
-
- ghidra.pcode.memstate.MemoryPage
-
public class MemoryPage extends java.lang.Object
MemoryPage
is allows the contents/data of a memory page to be maintained along with an initializedMask. Each bit within the initializedMask corresponds to a data byte within the page. A null mask indicates that all data within the page is initialized. A one-bit within the mask indicates that the corresponding data byte is initialized.
-
-
Field Summary
Fields Modifier and Type Field Description byte[]
data
-
Constructor Summary
Constructors Constructor Description MemoryPage(byte[] bytes)
Construct a memory page with an existing data bytes bufferMemoryPage(int pageSize)
Construct a new fully initialized page containing all zero (0) byte data.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
getInitializedByteCount(byte[] initializedMask, int pageOffset, int size)
Determine how many leading bytes of a specified page region is marked as initialized.int
getInitializedByteCount(int pageOffset, int size)
Get number of leading bytes within page range which have been initialized.byte[]
getInitializedMask()
static byte[]
getInitializedMask(int pageSize, boolean initialized)
Generate an initialized mask for the specified page sizestatic byte[]
getInitializedMask(int pageSize, int offset, int size, boolean initialized)
Generate an initialized mask for the specified page size.void
setInitialized()
Mark entire page as uninitializedstatic void
setInitialized(byte[] initializedMask, int pageOffset, int size)
Mark specified page region as initialized.void
setInitialized(int pageOffset, int size)
Mark specified page region as initialized.void
setInitialized(int pageOffset, int size, byte[] maskUpdate)
Update initialization maskvoid
setUninitialized()
Mark entire page as uninitializedstatic void
setUninitialized(byte[] initializedMask, int pageOffset, int size)
Mark specified page region as uninitialized.void
setUninitialized(int pageOffset, int size)
Mark specified page region as uninitialized.
-
-
-
Method Detail
-
getInitializedMask
public byte[] getInitializedMask()
-
setUninitialized
public void setUninitialized()
Mark entire page as uninitialized
-
setInitialized
public void setInitialized()
Mark entire page as uninitialized
-
setInitialized
public void setInitialized(int pageOffset, int size, byte[] maskUpdate)
Update initialization mask- Parameters:
pageOffset
-size
-maskUpdate
-
-
setInitialized
public void setInitialized(int pageOffset, int size)
Mark specified page region as initialized.- Parameters:
pageOffset
-size
-
-
setUninitialized
public void setUninitialized(int pageOffset, int size)
Mark specified page region as uninitialized.- Parameters:
pageOffset
-size
-
-
getInitializedByteCount
public int getInitializedByteCount(int pageOffset, int size)
Get number of leading bytes within page range which have been initialized.- Parameters:
pageOffset
-size
-- Returns:
- number of leading bytes within page range which have been initialized.
-
getInitializedMask
public static byte[] getInitializedMask(int pageSize, boolean initialized)
Generate an initialized mask for the specified page size- Parameters:
pageSize
-initialized
-- Returns:
-
getInitializedMask
public static byte[] getInitializedMask(int pageSize, int offset, int size, boolean initialized)
Generate an initialized mask for the specified page size. The region is identified by offset and size. The remaining portions of the mask will be set based upon !initialized.- Parameters:
pageSize
-offset
-size
-initialized
-- Returns:
-
setInitialized
public static void setInitialized(byte[] initializedMask, int pageOffset, int size)
Mark specified page region as initialized.- Parameters:
initializedMask
-pageOffset
-size
-
-
setUninitialized
public static void setUninitialized(byte[] initializedMask, int pageOffset, int size)
Mark specified page region as uninitialized.- Parameters:
initializedMask
-pageOffset
-size
-
-
getInitializedByteCount
public static int getInitializedByteCount(byte[] initializedMask, int pageOffset, int size)
Determine how many leading bytes of a specified page region is marked as initialized. Valid page region defined by pageOffset and size is assumed.- Parameters:
initializedMask
-pageOffset
-size
-- Returns:
- number of leading bytes at pageOffset (upto size) are initialized.
-
-