Interface Emulator.ImageSpace
- All Known Implementing Classes:
MutableAddressSpace
- Enclosing interface:
Emulator
public static interface Emulator.ImageSpace
This interface represents a mutable address space. It is used by the
Emulator
to read and write values. It is similar to ImageOutputStreamImpl
except that it adds the ability to allocate an area of memory.-
Method Summary
Modifier and TypeMethodDescriptionboolean
is64bit()
Return true if this dump is from a 64-bit machinelong
malloc
(int size) Allocate a chunk of unused memory.int
readInt
(long address) Read an int at the specified address.long
readLong
(long address) Read a long at the specified address.short
readShort
(long address) Read a short at the specified address.int
readUnsignedByte
(long address) Read a byte at the specified address.long
readUnsignedInt
(long address) Read an unsigned int at the specified address.int
readUnsignedShort
(long address) Read an unsigned short at the specified address.void
writeByte
(long address, int value) Write a byte at the specified address.void
writeInt
(long address, int value) Write an int at the specified address.void
writeLong
(long address, long value) Write a long at the specified address.void
writeShort
(long address, int value) Write a short at the specified address.
-
Method Details
-
readUnsignedByte
Read a byte at the specified address.- Throws:
IOException
- if the given address is not present in this address space
-
readUnsignedShort
Read an unsigned short at the specified address.- Throws:
IOException
- if the given address is not present in this address space
-
readShort
Read a short at the specified address.- Throws:
IOException
- if the given address is not present in this address space
-
readInt
Read an int at the specified address.- Throws:
IOException
- if the given address is not present in this address space
-
readUnsignedInt
Read an unsigned int at the specified address.- Throws:
IOException
- if the given address is not present in this address space
-
readLong
Read a long at the specified address.- Throws:
IOException
- if the given address is not present in this address space
-
writeByte
Write a byte at the specified address.- Throws:
IOException
- if the given address is not present in this address space
-
writeShort
Write a short at the specified address.- Throws:
IOException
- if the given address is not present in this address space
-
writeInt
Write an int at the specified address.- Throws:
IOException
- if the given address is not present in this address space
-
writeLong
Write a long at the specified address.- Throws:
IOException
- if the given address is not present in this address space
-
malloc
Allocate a chunk of unused memory. This searches the known address ranges and tries to find an unallocated area of the given size. If successful, this area effectively becomes part of this ImageSpace and may be read and written to as normal. This method is used by users of the Emulator for things like allocating stack, arguments etc.- Returns:
- the address of the allocated memory
- Throws:
IOException
-
is64bit
boolean is64bit()Return true if this dump is from a 64-bit machine
-