| com.pnfsoftware.jeb.core.units.code.IVirtualMemory |
Known Indirect Subclasses
|
Definition of a virtual memory space addressing bytes. Up to 2^64 bytes may addressed. The page size is variable.
Implementors may decide to provide support for concurrency.
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| int | ACCESS_EXECUTE | ||||||||||
| int | ACCESS_NONE | No access. | |||||||||
| int | ACCESS_READ | ||||||||||
| int | ACCESS_RW | Read/Write access. | |||||||||
| int | ACCESS_RWX | Read/Write/Execute access. | |||||||||
| int | ACCESS_RX | Read/Execute access. | |||||||||
| int | ACCESS_WRITE | ||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| abstract void |
allocate(long address, int size, int protection)
Allocate the entire memory range or nothing.
| ||||||||||
| abstract int |
check(long address, int size, int protection)
Check if a memory range has at least the given set of protection flags.
| ||||||||||
| abstract int |
getPageProtection(long address)
Set the protection flags for a page.
| ||||||||||
| abstract int |
getPageSize()
Get the size of a page in bytes.
| ||||||||||
| abstract int |
getSpaceBits()
Get the size of this memory space in bits.
| ||||||||||
| abstract boolean |
isValidAddress(long address)
Determine if an address is valid for this memory space.
| ||||||||||
| abstract int |
read(long address, int size, byte[] dst, int dstOffset)
Read a range of bytes.
| ||||||||||
| abstract byte |
readByte(long address)
Read a byte.@return
| ||||||||||
| abstract int |
readLEInt(long address)
Read a little-endian 32-bit integer.
| ||||||||||
| abstract long |
readLELong(long address)
Read a little-endian 64-bit integer.
| ||||||||||
| abstract short |
readLEShort(long address)
Read a little-endian 16-bit integer.
| ||||||||||
| abstract long |
roundToPage(long address)
Round an address to the page this address currently resides in, that is the highest page so
that boundary ≤ address.
| ||||||||||
| abstract long |
roundToSize(long address)
Round an address to the lowest page boundary so that address ≤ boundary.
| ||||||||||
| abstract void |
setPageProtection(long address, int protection)
Get the protection flags for a page.
| ||||||||||
| abstract int |
write(long address, int size, byte[] src, int srcOffset)
Write a range of bytes.
| ||||||||||
| abstract void |
writeByte(long address, byte v)
Write a byte.
| ||||||||||
| abstract void |
writeLEInt(long address, int v)
Write a little-endian 32-bit integer.
| ||||||||||
| abstract void |
writeLELong(long address, long v)
Write a little-endian 64-bit integer.
| ||||||||||
| abstract void |
writeLEShort(long address, short v)
Write a little-endian 16-bit integer.
| ||||||||||
No access. The page exists but any attempt to write, read, or execute from/to it will raise.
Read/Write access.
Read/Write/Execute access.
Read/Execute access.
Allocate the entire memory range or nothing. On error, this method should throw a
MemoryException, and no page should have been allocated. If successful, all pages
within the range should have been been allocated.
| MemoryException |
|---|
Check if a memory range has at least the given set of protection flags. For example, if the
`protection` argument is ACCESS_RW,
| address | start address |
|---|---|
| size | range size |
| protection | protection to check |
Set the protection flags for a page. This method raises on error (invalid address, no page, etc.)
| address | address within the page |
|---|
| MemoryException |
|---|
Get the size of a page in bytes. A page size should always be a multiple of 2.
Get the size of this memory space in bits. Example: 32 for a 32-bit address space.
Determine if an address is valid for this memory space.
Read a range of bytes. This method should do its best to transact: the entire range is read, or nothing is and an error is thrown. If the implementor cannot support transaction, this method simply returns the amount of bytes read.
| MemoryException | if the method failed |
|---|
Read a little-endian 32-bit integer. This method does not do partial reads.@return
| MemoryException |
|---|
Read a little-endian 64-bit integer. This method does not do partial reads.@return
| MemoryException |
|---|
Read a little-endian 16-bit integer. This method does not do partial reads.@return
| MemoryException |
|---|
Round an address to the page this address currently resides in, that is the highest page so that boundary ≤ address. This method does not raise, even if the address is invalid for this memory space.
| address | an address |
|---|
Round an address to the lowest page boundary so that address ≤ boundary. This method does not raise, even if the address is invalid for this memory space.
| address | an address or a size |
|---|
Get the protection flags for a page. This method raises on error (invalid address, no page, etc.)
| address | address within the page |
|---|---|
| protection | the new protection for the page |
| MemoryException |
|---|
Write a range of bytes. This method should do its best to transact: the entire range is written, or nothing is and an error is thrown. If the implementor cannot support transaction, this method returns the amount of bytes written, or throws on error.
| MemoryException | if the method failed |
|---|
Write a little-endian 32-bit integer. This method does not do partial writes.
| MemoryException |
|---|
Write a little-endian 64-bit integer. This method does not do partial writes.
| MemoryException |
|---|
Write a little-endian 16-bit integer. This method does not do partial writes.
| MemoryException |
|---|