Package ghidra.program.model.mem
Interface Memory
-
- All Superinterfaces:
AddressSetView
,java.lang.Iterable<AddressRange>
- All Known Implementing Classes:
MemoryMapDB
,MemoryStub
public interface Memory extends AddressSetView
Interface for Memory.
-
-
Field Summary
Fields Modifier and Type Field Description static long
GBYTE
static int
GBYTE_SHIFT_FACTOR
static long
MAX_BINARY_SIZE
static int
MAX_BINARY_SIZE_GB
Maximum size of all memory blocks, 16-GByte (seegetAllInitializedAddressSet()
).static long
MAX_INITIALIZED_BLOCK_SIZE
static int
MAX_INITIALIZED_BLOCK_SIZE_GB
Initialized blocks must be addressable by an int, 1-GByte.static long
MAX_UNINITIALIZED_BLOCK_SIZE
static int
MAX_UNINITIALIZED_BLOCK_SIZE_GB
Uninitialized blocks size limit, 12-GByte (limit number of 32-bit segments).
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description MemoryBlock
convertToInitialized(MemoryBlock unitializedBlock, byte initialValue)
Convert an existing uninitialized block with an initialized block.MemoryBlock
convertToUninitialized(MemoryBlock itializedBlock)
MemoryBlock
createBitMappedBlock(java.lang.String name, Address start, Address mappedAddress, long length)
Create a bit overlay memory block and add it to this Memory.MemoryBlock
createBlock(MemoryBlock block, java.lang.String name, Address start, long length)
Creates a MemoryBlock at the given address with the same properties as block, and adds it to this Memory.MemoryBlock
createByteMappedBlock(java.lang.String name, Address start, Address mappedAddress, long length)
Create a memory block that uses the bytes located at a different location.MemoryBlock
createInitializedBlock(java.lang.String name, Address start, long size, byte initialValue, TaskMonitor monitor, boolean overlay)
Create an initialized memory block and add it to this Memory.MemoryBlock
createInitializedBlock(java.lang.String name, Address start, java.io.InputStream is, long length, TaskMonitor monitor, boolean overlay)
Create an initialized memory block and add it to this Memory.MemoryBlock
createUninitializedBlock(java.lang.String name, Address start, long size, boolean overlay)
Create an uninitialized memory block and add it to this Memory.Address
findBytes(Address addr, byte[] bytes, byte[] masks, boolean forward, TaskMonitor monitor)
Finds a sequence of contiguous bytes that match the given byte array at all bit positions where the mask contains an "on" bit.Address
findBytes(Address startAddr, Address endAddr, byte[] bytes, byte[] masks, boolean forward, TaskMonitor monitor)
Finds a sequence of contiguous bytes that match the given byte array at all bit positions where the mask contains an "on" bit.AddressSetView
getAllInitializedAddressSet()
Returns the set of addresses which correspond to all memory blocks that have initialized data.MemoryBlock
getBlock(Address addr)
Returns the Block which contains addr.MemoryBlock
getBlock(java.lang.String blockName)
Returns the Block with the specified blockNameMemoryBlock[]
getBlocks()
Returns an array containing all the memory blocks.byte
getByte(Address addr)
Get byte at addr.int
getBytes(Address addr, byte[] dest)
Get dest.length number of bytes starting at the given address.int
getBytes(Address addr, byte[] dest, int destIndex, int size)
Get size number of bytes starting at the given address and populates dest starting at dIndex.AddressSetView
getExecuteSet()
Returns the set of addresses which correspond to the executable memory.AddressSetView
getInitializedAddressSet()
Deprecated.int
getInt(Address addr)
Get the int at addr.int
getInt(Address addr, boolean bigEndian)
Get the int at addr using the specified endian order.int
getInts(Address addr, int[] dest)
Get dest.length number of ints starting at the given address.int
getInts(Address addr, int[] dest, int dIndex, int nElem)
Get dest.length number of ints starting at the given address.int
getInts(Address addr, int[] dest, int dIndex, int nElem, boolean isBigEndian)
Get dest.length number of ints starting at the given address.LiveMemoryHandler
getLiveMemoryHandler()
Returns the live memory handler instance used by this memory.AddressSetView
getLoadedAndInitializedAddressSet()
Returns the set of addresses which correspond to all the "loaded" memory blocks that have initialized data.long
getLong(Address addr)
Get the long at addr.long
getLong(Address addr, boolean bigEndian)
Get the long at addr in the specified endian order.int
getLongs(Address addr, long[] dest)
Get dest.length number of longs starting at the given address.int
getLongs(Address addr, long[] dest, int dIndex, int nElem)
Get dest.length number of longs starting at the given address.int
getLongs(Address addr, long[] dest, int dIndex, int nElem, boolean isBigEndian)
Get dest.length number of longs starting at the given address.Program
getProgram()
Returns the program that this memory belongs to.short
getShort(Address addr)
Get the short at addr.short
getShort(Address addr, boolean bigEndian)
Get the short at addr using the specified endian order.int
getShorts(Address addr, short[] dest)
Get dest.length number of shorts starting at the given address.int
getShorts(Address addr, short[] dest, int dIndex, int nElem)
Get dest.length number of shorts starting at the given address.int
getShorts(Address addr, short[] dest, int dIndex, int nElem, boolean isBigEndian)
Get dest.length number of shorts starting at the given address.long
getSize()
Get the memory size in bytes.boolean
isBigEndian()
Returns true if the memory is bigEndian, false otherwise.MemoryBlock
join(MemoryBlock blockOne, MemoryBlock blockTwo)
Join the two blocks to create a single memory block.void
moveBlock(MemoryBlock block, Address newStartAddr, TaskMonitor monitor)
Move the memory block containing source address to the destination address.void
removeBlock(MemoryBlock block, TaskMonitor monitor)
Remove the memory blockvoid
setByte(Address addr, byte value)
Write byte at addr.void
setBytes(Address addr, byte[] source)
Write size bytes from values at addr.void
setBytes(Address addr, byte[] source, int sIndex, int size)
Write an array of bytes.void
setInt(Address addr, int value)
Write int at addr.void
setInt(Address addr, int value, boolean bigEndian)
Write int at addr in the specified endian order.void
setLiveMemoryHandler(LiveMemoryHandler handler)
Sets the live memory handlervoid
setLong(Address addr, long value)
Write long at addr.void
setLong(Address addr, long value, boolean bigEndian)
Write long at addr in the specified endian order.void
setShort(Address addr, short value)
Write short at addr in big endian order.void
setShort(Address addr, short value, boolean bigEndian)
Write short at addr in the specified endian order.void
split(MemoryBlock block, Address addr)
Split a block at the given addr and create a new block starting at addr.-
Methods inherited from interface ghidra.program.model.address.AddressSetView
contains, contains, contains, findFirstAddressInCommon, getAddresses, getAddresses, getAddressRanges, getAddressRanges, getAddressRanges, getFirstRange, getLastRange, getMaxAddress, getMinAddress, getNumAddresses, getNumAddressRanges, getRangeContaining, hasSameAddresses, intersect, intersectRange, intersects, intersects, isEmpty, iterator, iterator, iterator, subtract, union, xor
-
-
-
-
Field Detail
-
GBYTE_SHIFT_FACTOR
static final int GBYTE_SHIFT_FACTOR
- See Also:
- Constant Field Values
-
GBYTE
static final long GBYTE
- See Also:
- Constant Field Values
-
MAX_BINARY_SIZE_GB
static final int MAX_BINARY_SIZE_GB
Maximum size of all memory blocks, 16-GByte (seegetAllInitializedAddressSet()
). This restriction is somewhat arbitrary but is established to prevent an excessive number of memory map segments which can have a negative impact on performance.- See Also:
- Constant Field Values
-
MAX_BINARY_SIZE
static final long MAX_BINARY_SIZE
- See Also:
- Constant Field Values
-
MAX_INITIALIZED_BLOCK_SIZE_GB
static final int MAX_INITIALIZED_BLOCK_SIZE_GB
Initialized blocks must be addressable by an int, 1-GByte. This value has been established due to limitations of theChainedBuffer
implementation use positive integers to convey length.- See Also:
- Constant Field Values
-
MAX_INITIALIZED_BLOCK_SIZE
static final long MAX_INITIALIZED_BLOCK_SIZE
- See Also:
- Constant Field Values
-
MAX_UNINITIALIZED_BLOCK_SIZE_GB
static final int MAX_UNINITIALIZED_BLOCK_SIZE_GB
Uninitialized blocks size limit, 12-GByte (limit number of 32-bit segments). This restriction is somewhat arbitrary but is established to prevent an excessive number of memory map segments (MAX_BINARY_SIZE_GB
).- See Also:
- Constant Field Values
-
MAX_UNINITIALIZED_BLOCK_SIZE
static final long MAX_UNINITIALIZED_BLOCK_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getProgram
Program getProgram()
Returns the program that this memory belongs to.
-
getLoadedAndInitializedAddressSet
AddressSetView getLoadedAndInitializedAddressSet()
Returns the set of addresses which correspond to all the "loaded" memory blocks that have initialized data. This does not include initialized memory blocks that contain data from the program's file header such as debug sections.
-
getAllInitializedAddressSet
AddressSetView getAllInitializedAddressSet()
Returns the set of addresses which correspond to all memory blocks that have initialized data. This includes initialized memory blocks that contain data from the program's file header that are not actually in the running in memory image, such as debug sections. UsegetLoadedAndInitializedAddressSet()
if you only want the addressed of the loaded in memory blocks.
-
getInitializedAddressSet
@Deprecated AddressSetView getInitializedAddressSet()
Deprecated.UsegetLoadedAndInitializedAddressSet()
instead.
-
getExecuteSet
AddressSetView getExecuteSet()
Returns the set of addresses which correspond to the executable memory.
-
isBigEndian
boolean isBigEndian()
Returns true if the memory is bigEndian, false otherwise.
-
setLiveMemoryHandler
void setLiveMemoryHandler(LiveMemoryHandler handler)
Sets the live memory handler- Parameters:
handler
- the live memory handler
-
getLiveMemoryHandler
LiveMemoryHandler getLiveMemoryHandler()
Returns the live memory handler instance used by this memory.- Returns:
- the live memory handler
-
createInitializedBlock
MemoryBlock createInitializedBlock(java.lang.String name, Address start, java.io.InputStream is, long length, TaskMonitor monitor, boolean overlay) throws LockException, MemoryConflictException, AddressOverflowException, CancelledException, DuplicateNameException
Create an initialized memory block and add it to this Memory.- Parameters:
name
- block namestart
- start address of the blockis
- source of the data used to fill the block.length
- the size of the blockoverlay
- if true, the block will be created as an OVERLAY which means that a new overlay address space will be created and the block will have a starting address at the same offset as the given start address paramaeter, but in the new address space.- Returns:
- new Initialized Memory Block
- Throws:
LockException
- if exclusive lock not in place (see haveLock())MemoryConflictException
- if the new block overlaps with a previous blockAddressOverflowException
- if the start is beyond the address spaceCancelledException
- user cancelled operationDuplicateNameException
-
createInitializedBlock
MemoryBlock createInitializedBlock(java.lang.String name, Address start, long size, byte initialValue, TaskMonitor monitor, boolean overlay) throws LockException, DuplicateNameException, MemoryConflictException, AddressOverflowException, CancelledException
Create an initialized memory block and add it to this Memory.- Parameters:
name
- block namestart
- start of the blocksize
- block lengthinitialValue
- initialization value for every byte in the block.monitor
- progress monitor, may be null.overlay
- if true, the block will be created as an OVERLAY which means that a new overlay address space will be created and the block will have a starting address at the same offset as the given start address paramaeter, but in the new address space.- Returns:
- new Initialized Memory Block
- Throws:
LockException
- if exclusive lock not in place (see haveLock())MemoryConflictException
- if the new block overlaps with a previous blockAddressOverflowException
- if the start is beyond the address spaceCancelledException
- user cancelled operationDuplicateNameException
-
createUninitializedBlock
MemoryBlock createUninitializedBlock(java.lang.String name, Address start, long size, boolean overlay) throws LockException, DuplicateNameException, MemoryConflictException, AddressOverflowException
Create an uninitialized memory block and add it to this Memory.- Parameters:
name
- block namestart
- start of the blocksize
- block lengthoverlay
- if true, the block will be created as an OVERLAY which means that a new overlay address space will be created and the block will have a starting address at the same offset as the given start address paramaeter, but in the new address space.- Returns:
- new Uninitialized Memory Block
- Throws:
LockException
- if exclusive lock not in place (see haveLock())MemoryConflictException
- if the new block overlaps with a previous blockAddressOverflowException
- if the start is beyond the address spaceDuplicateNameException
-
createBitMappedBlock
MemoryBlock createBitMappedBlock(java.lang.String name, Address start, Address mappedAddress, long length) throws LockException, MemoryConflictException, AddressOverflowException
Create a bit overlay memory block and add it to this Memory.- Parameters:
name
- block namestart
- start of the blockmappedAddress
- start address in the source block for the beginning of this blocklength
- block length- Returns:
- new Bit Memory Block
- Throws:
LockException
- if exclusive lock not in place (see haveLock())MemoryConflictException
- if the new block overlaps with a previous blockAddressOverflowException
-
createByteMappedBlock
MemoryBlock createByteMappedBlock(java.lang.String name, Address start, Address mappedAddress, long length) throws LockException, MemoryConflictException, AddressOverflowException
Create a memory block that uses the bytes located at a different location.- Parameters:
name
- block namestart
- start of the blockmappedAddress
- start address in the source block for the beginning of this blocklength
- block length- Returns:
- new Bit Memory Block
- Throws:
LockException
- if exclusive lock not in place (see haveLock())MemoryConflictException
- if the new block overlaps with a previous blockAddressOverflowException
-
createBlock
MemoryBlock createBlock(MemoryBlock block, java.lang.String name, Address start, long length) throws LockException, MemoryConflictException, AddressOverflowException
Creates a MemoryBlock at the given address with the same properties as block, and adds it to this Memory.- Parameters:
block
- source blockname
- block namestart
- start of the blocklength
- the size of the new block.- Throws:
LockException
- if exclusive lock not in place (see haveLock())AddressOverflowException
- if the new memory block would extend beyond the end of the address space.MemoryConflictException
-
removeBlock
void removeBlock(MemoryBlock block, TaskMonitor monitor) throws LockException
Remove the memory block- Parameters:
block
- the block to be removed.monitor
- monitor that is used to cancel the remove operation- Throws:
LockException
- if exclusive lock not in place (see haveLock())
-
getSize
long getSize()
Get the memory size in bytes.
-
getBlock
MemoryBlock getBlock(Address addr)
Returns the Block which contains addr.- Parameters:
addr
- a valid data Address.- Returns:
- the block containing addr; null if addr is not a valid location.
- Throws:
AddressTypeException
- if the addr is not the proper type of Address for this Memory.
-
getBlock
MemoryBlock getBlock(java.lang.String blockName)
Returns the Block with the specified blockName- Parameters:
blockName
- the name of the requested block- Returns:
- the Block with the specified blockName
-
getBlocks
MemoryBlock[] getBlocks()
Returns an array containing all the memory blocks.
-
moveBlock
void moveBlock(MemoryBlock block, Address newStartAddr, TaskMonitor monitor) throws LockException, MemoryBlockException, MemoryConflictException, AddressOverflowException, NotFoundException
Move the memory block containing source address to the destination address.- Parameters:
block
- block to be movednewStartAddr
- new start address for blockmonitor
- task monitor so the move block can be canceled- Throws:
LockException
- if exclusive lock not in place (see haveLock())MemoryConflictException
- if move would cause blocks to overlap.MemoryBlockException
- if block movement is not permittedAddressOverflowException
- if new start address + block.getSize() would cause the Address to wrap around.NotFoundException
- if memoryBlock does not exist in this memory.
-
split
void split(MemoryBlock block, Address addr) throws MemoryBlockException, LockException, NotFoundException
Split a block at the given addr and create a new block starting at addr.- Parameters:
block
- block to be split into twoaddr
- address (within block) that will be the start of new block- Throws:
LockException
- if exclusive lock not in place (see haveLock())NotFoundException
- thrown if block does not exist in memoryMemoryBlockException
- memory split not permittedAddressOutOfBoundsException
- thrown if address is not in the block
-
join
MemoryBlock join(MemoryBlock blockOne, MemoryBlock blockTwo) throws LockException, MemoryBlockException, NotFoundException
Join the two blocks to create a single memory block. IMPORTANT! When done, both blockOne and blockTwo should no longer be used.- Parameters:
blockOne
- block to be combined with blockTwoblockTwo
- block to be combined with blockOne- Returns:
- new block
- Throws:
LockException
- if exclusive lock not in place (see haveLock())MemoryBlockException
- thrown if the blocks are not contiguous in the address space,NotFoundException
-
convertToInitialized
MemoryBlock convertToInitialized(MemoryBlock unitializedBlock, byte initialValue) throws LockException, MemoryBlockException, NotFoundException
Convert an existing uninitialized block with an initialized block.- Parameters:
unitializedBlock
- unitialized block to convertinitialValue
- initial value for the bytes- Throws:
LockException
- if exclusive lock not in place (see haveLock())MemoryBlockException
- if there is no block in memory at the same address as block or if the block lengths are not the same.NotFoundException
-
convertToUninitialized
MemoryBlock convertToUninitialized(MemoryBlock itializedBlock) throws MemoryBlockException, NotFoundException, LockException
-
findBytes
Address findBytes(Address addr, byte[] bytes, byte[] masks, boolean forward, TaskMonitor monitor)
Finds a sequence of contiguous bytes that match the given byte array at all bit positions where the mask contains an "on" bit.- Parameters:
addr
- The beginning address in memory to search.bytes
- the array of bytes to search for.masks
- the array of masks. (One for each byte in the byte array) if all bits of each byte is to be checked (ie: all mask bytes are 0xff), then pass a null for masks.forward
- if true, search in the forward direction.- Returns:
- The address of where the first match is found. Null is returned if there is no match.
-
findBytes
Address findBytes(Address startAddr, Address endAddr, byte[] bytes, byte[] masks, boolean forward, TaskMonitor monitor)
Finds a sequence of contiguous bytes that match the given byte array at all bit positions where the mask contains an "on" bit. Starts at startAddr and ends at endAddr. If forward is true, search starts at startAddr and will end if startAddr ">" endAddr. If forward is false, search starts at start addr and will end if startAddr "<" endAddr.- Parameters:
startAddr
- The beginning address in memory to search.endAddr
- The ending address in memory to search (inclusive).bytes
- the array of bytes to search for.masks
- the array of masks. (One for each byte in the byte array) if all bits of each byte is to be checked (ie: all mask bytes are 0xff), then pass a null for masks.forward
- if true, search in the forward direction.- Returns:
- The address of where the first match is found. Null is returned if there is no match.
-
getByte
byte getByte(Address addr) throws MemoryAccessException
Get byte at addr.- Parameters:
addr
- the Address of the byte.- Returns:
- the byte.
- Throws:
MemoryAccessException
- if the address is not contained in any memory block.
-
getBytes
int getBytes(Address addr, byte[] dest) throws MemoryAccessException
Get dest.length number of bytes starting at the given address.- Parameters:
addr
- the starting Address.dest
- the byte array to populate.- Returns:
- the number of bytes put into dest. May be less than dest.length if the requested number extends beyond available memory.
- Throws:
MemoryAccessException
- if the starting address is not contained in any memory block.
-
getBytes
int getBytes(Address addr, byte[] dest, int destIndex, int size) throws MemoryAccessException
Get size number of bytes starting at the given address and populates dest starting at dIndex.- Parameters:
addr
- the starting Address.dest
- the byte array to populate.destIndex
- the offset into dest to place the bytes.size
- the number of bytes to get.- Returns:
- the number of bytes put into dest. May be less than size if the requested number extends beyond available memory.
- Throws:
MemoryAccessException
- if the starting address is not contained in any memory block.
-
getShort
short getShort(Address addr) throws MemoryAccessException
Get the short at addr.- Parameters:
addr
- the Address where the short starts.- Returns:
- the short.
- Throws:
MemoryAccessException
- if not all needed bytes are contained in initialized memory.
-
getShort
short getShort(Address addr, boolean bigEndian) throws MemoryAccessException
Get the short at addr using the specified endian order.- Parameters:
addr
- the Address where the short starts.bigEndian
- true means to get the short in bigEndian order- Returns:
- the short.
- Throws:
MemoryAccessException
- if not all needed bytes are contained in initialized memory.
-
getShorts
int getShorts(Address addr, short[] dest) throws MemoryAccessException
Get dest.length number of shorts starting at the given address.- Parameters:
addr
- the starting Address.dest
- the short array to populate.- Returns:
- the number of shorts put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is odd, the final byte will be discarded.
- Throws:
MemoryAccessException
- if not all needed bytes are contained in initialized memory.
-
getShorts
int getShorts(Address addr, short[] dest, int dIndex, int nElem) throws MemoryAccessException
Get dest.length number of shorts starting at the given address.- Parameters:
addr
- the starting Address.dest
- the short array to populate.dIndex
- the offset into dest to place the shorts.size
- the number of shorts to get.- Returns:
- the number of shorts put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is odd, the final byte will be discarded.
- Throws:
MemoryAccessException
- if not all needed bytes are contained in initialized memory.
-
getShorts
int getShorts(Address addr, short[] dest, int dIndex, int nElem, boolean isBigEndian) throws MemoryAccessException
Get dest.length number of shorts starting at the given address.- Parameters:
addr
- the starting Address.dest
- the short array to populate.dIndex
- the offset into dest to place the shorts.size
- the number of shorts to get.isBigEndian
- true means to get the shorts in bigEndian order- Returns:
- the number of shorts put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is odd, the final byte will be discarded.
- Throws:
MemoryAccessException
- if not all needed bytes are contained in initialized memory.
-
getInt
int getInt(Address addr) throws MemoryAccessException
Get the int at addr.- Parameters:
addr
- the Address where the int starts.- Returns:
- the int.
- Throws:
MemoryAccessException
- if not all needed bytes are contained in initialized memory.
-
getInt
int getInt(Address addr, boolean bigEndian) throws MemoryAccessException
Get the int at addr using the specified endian order.- Parameters:
addr
- the Address where the int starts.bigEndian
- true means to get the int in big endian order- Returns:
- the int.
- Throws:
MemoryAccessException
- if not all needed bytes are contained in initialized memory.
-
getInts
int getInts(Address addr, int[] dest) throws MemoryAccessException
Get dest.length number of ints starting at the given address.- Parameters:
addr
- the starting Address.dest
- the int array to populate.- Returns:
- the number of ints put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 4, the final byte(s) will be discarded.
- Throws:
MemoryAccessException
- if the starting address is not contained in any memory block.
-
getInts
int getInts(Address addr, int[] dest, int dIndex, int nElem) throws MemoryAccessException
Get dest.length number of ints starting at the given address.- Parameters:
addr
- the starting Address.dest
- the int array to populate.dIndex
- the offset into dest to place the ints.size
- the number of ints to get.- Returns:
- the number of ints put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 4, the final byte(s) will be discarded.
- Throws:
MemoryAccessException
- if not all needed bytes are contained in initialized memory.
-
getInts
int getInts(Address addr, int[] dest, int dIndex, int nElem, boolean isBigEndian) throws MemoryAccessException
Get dest.length number of ints starting at the given address.- Parameters:
addr
- the starting Address.dest
- the int array to populate.dIndex
- the offset into dest to place the ints.size
- the number of ints to get.isBigEndian
- true means to get the ints in bigEndian order- Returns:
- the number of ints put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 4, the final byte(s) will be discarded.
- Throws:
MemoryAccessException
- if not all needed bytes are contained in initialized memory.
-
getLong
long getLong(Address addr) throws MemoryAccessException
Get the long at addr.- Parameters:
addr
- the Address where the long starts.- Returns:
- the long.
- Throws:
MemoryAccessException
- if not all needed bytes are contained in initialized memory.
-
getLong
long getLong(Address addr, boolean bigEndian) throws MemoryAccessException
Get the long at addr in the specified endian order.- Parameters:
addr
- the Address where the long starts.bigEndian
- true means to get the long in big endian order- Returns:
- the long.
- Throws:
MemoryAccessException
- if not all needed bytes are contained in initialized memory.
-
getLongs
int getLongs(Address addr, long[] dest) throws MemoryAccessException
Get dest.length number of longs starting at the given address.- Parameters:
addr
- the starting Address.dest
- the long array to populate.- Returns:
- the number of longs put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 8, the final byte(s) will be discarded.
- Throws:
MemoryAccessException
- if not all needed bytes are contained in initialized memory.
-
getLongs
int getLongs(Address addr, long[] dest, int dIndex, int nElem) throws MemoryAccessException
Get dest.length number of longs starting at the given address.- Parameters:
addr
- the starting Address.dest
- the long array to populate.dIndex
- the offset into dest to place the longs.size
- the number of longs to get.- Returns:
- the number of longs put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 8, the final byte(s) will be discarded.
- Throws:
MemoryAccessException
- if not all needed bytes are contained in initialized memory.
-
getLongs
int getLongs(Address addr, long[] dest, int dIndex, int nElem, boolean isBigEndian) throws MemoryAccessException
Get dest.length number of longs starting at the given address.- Parameters:
addr
- the starting Address.dest
- the long array to populate.dIndex
- the offset into dest to place the longs.size
- the number of longs to get.isBigEndian
- true means to get the longs in bigEndian order- Returns:
- the number of longs put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 8, the final byte(s) will be discarded.
- Throws:
MemoryAccessException
- if not all needed bytes are contained in initialized memory.
-
setByte
void setByte(Address addr, byte value) throws MemoryAccessException
Write byte at addr.- Parameters:
addr
- the Address of the byte.value
- the data to write.- Throws:
MemoryAccessException
- if writing is not allowed.
-
setBytes
void setBytes(Address addr, byte[] source) throws MemoryAccessException
Write size bytes from values at addr.- Parameters:
addr
- the starting Address.source
- the bytes to write.- Throws:
MemoryAccessException
- if writing is not allowed.
-
setBytes
void setBytes(Address addr, byte[] source, int sIndex, int size) throws MemoryAccessException
Write an array of bytes. This should copy size bytes or fail!- Parameters:
addr
- the starting Address of the bytes.source
- an array to get bytes from.sIndex
- the starting source index.size
- the number of bytes to fill.- Throws:
MemoryAccessException
- if writing is not allowed.
-
setShort
void setShort(Address addr, short value) throws MemoryAccessException
Write short at addr in big endian order.- Parameters:
addr
- the Address of the short.value
- the data to write.- Throws:
MemoryAccessException
- if writing is not allowed.
-
setShort
void setShort(Address addr, short value, boolean bigEndian) throws MemoryAccessException
Write short at addr in the specified endian order.- Parameters:
addr
- the Address of the short.value
- the data to write.bigEndian
- true means to write short in big endian order- Throws:
MemoryAccessException
- if writing is not allowed.
-
setInt
void setInt(Address addr, int value) throws MemoryAccessException
Write int at addr.- Parameters:
addr
- the Address of the int.value
- the data to write.- Throws:
MemoryAccessException
- if writing is not allowed.
-
setInt
void setInt(Address addr, int value, boolean bigEndian) throws MemoryAccessException
Write int at addr in the specified endian order.- Parameters:
addr
- the Address of the int.bigEndian
- true means to write the short in bigEndian ordervalue
- the data to write.- Throws:
MemoryAccessException
- if writing is not allowed.
-
setLong
void setLong(Address addr, long value) throws MemoryAccessException
Write long at addr.- Parameters:
addr
- the Address of the long.value
- the data to write.- Throws:
MemoryAccessException
- if writing is not allowed.
-
setLong
void setLong(Address addr, long value, boolean bigEndian) throws MemoryAccessException
Write long at addr in the specified endian order.- Parameters:
addr
- the Address of the long.value
- the data to write.bigEndian
- true means to write the long in bigEndian order- Throws:
MemoryAccessException
- if writing is not allowed.
-
-