| java.lang.Object | |
| ↳ | com.pnfsoftware.jeb.core.units.code.asm.memory.VirtualMemoryUtil |
Utility methods for virtual memory classes.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| VirtualMemoryUtil() | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| static long |
allocate(IVirtualMemory mem, long start, int size, int protection)
Search an available range and allocate at least the requested amount of bytes.
| ||||||||||
| static int |
allocateFillGaps(IVirtualMemory mem, long address, int size, int protection)
Allocate a memory range, filling gaps in between already allocated pages if needed.
| ||||||||||
| static int | convertSegmentFlagsToVMFlags(int segmentFlags) | ||||||||||
| static IVirtualMemory |
createMemory(int spaceBits, int pageBits, Endianness standardEndianness)
Facade factory method returning a concrete, private implementation of an efficient page-based
virtual memory.
| ||||||||||
| static long |
findAvailableRange(IVirtualMemory mem, long start, int size)
Search for an available memory range.
| ||||||||||
| static boolean |
isPageAllocated(IVirtualMemory mem, long address)
Verify if a page was allocated (regardless of protection rights on the page).
| ||||||||||
| static int |
read(IVirtualMemory mem, long address)
Read a single byte and perform a zero-extension.
| ||||||||||
| static boolean |
readByteSafe(IVirtualMemory mem, long address, byte[] out)
Read a byte safely (this method does not raise
MemoryException). | ||||||||||
| static int |
readBytesSafe(IVirtualMemory mem, long address, int size, byte[] dst, int dstOffset, int protection)
Safely read at most the requested amount of bytes.
| ||||||||||
| static boolean | readIntSafe(Endianness end, IVirtualMemory mem, long address, int[] out) | ||||||||||
| static boolean | readLEIntSafe(IVirtualMemory mem, long address, int[] out) | ||||||||||
| static boolean | readLELongSafe(IVirtualMemory mem, long address, long[] out) | ||||||||||
| static boolean | readLEShortSafe(IVirtualMemory mem, long address, short[] out) | ||||||||||
| static boolean | readLongSafe(Endianness end, IVirtualMemory mem, long address, long[] out) | ||||||||||
| static boolean |
readSafe(IVirtualMemory mem, long address, byte[] data)
Read an array of bytes from memory (this method does not raise
MemoryException). | ||||||||||
| static boolean | readShortSafe(Endianness end, IVirtualMemory mem, long address, short[] out) | ||||||||||
| static boolean |
writeByteSafe(IVirtualMemory mem, long address, byte v)
Write a byte safely (this method does not raise
MemoryException). | ||||||||||
| static boolean | writeIntSafe(Endianness end, IVirtualMemory mem, long address, int v) | ||||||||||
| static boolean | writeLEIntSafe(IVirtualMemory mem, long address, int v) | ||||||||||
| static boolean | writeLELongSafe(IVirtualMemory mem, long address, long v) | ||||||||||
| static boolean | writeLEShortSafe(IVirtualMemory mem, long address, short v) | ||||||||||
| static boolean | writeLongSafe(Endianness end, IVirtualMemory mem, long address, long v) | ||||||||||
| static boolean |
writeSafe(IVirtualMemory mem, long address, byte[] data)
Write an array of bytes to memory (this method does not raise
MemoryException). | ||||||||||
| static boolean | writeShortSafe(Endianness end, IVirtualMemory mem, long address, short v) | ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Search an available range and allocate at least the requested amount of bytes. Do not confuse
this method with allocate(long, int, int).
| start | soft start address, considered a hint by this allocator routine; if you wish to
allocate at a fixed, given address, use
allocate(long, int, int) |
|---|---|
| size | range size |
Allocate a memory range, filling gaps in between already allocated pages if needed. (The given range [address, address + size) may have already allocated pages. Those pages will not be re-allocated.) When the method returns, the range [address, address + size) is guaranteed to be allocated.
Facade factory method returning a concrete, private implementation of an efficient page-based virtual memory.
Search for an available memory range.
| start | soft start address, a hint |
|---|---|
| size | range size |
Verify if a page was allocated (regardless of protection rights on the page).
Read a single byte and perform a zero-extension. This method does not raise
MemoryException; on error, -1 is returned.
Read a byte safely (this method does not raise MemoryException).
| mem | virtual memory |
|---|---|
| address | address |
| out | a 1-unit long array that will receive the value read |
Safely read at most the requested amount of bytes.
| mem | the memory |
|---|---|
| address | target address |
| size | requested read size |
| dst | destination buffer |
| dstOffset | position within the destination buffer |
| protection | the requested protection level, should be at least
ACCESS_READ |
Read an array of bytes from memory (this method does not raise MemoryException).
Write a byte safely (this method does not raise MemoryException).
| mem | virtual memory |
|---|---|
| address | address |
| v | the value to be written |
Write an array of bytes to memory (this method does not raise MemoryException).