Class MutableAddressSpace
java.lang.Object
com.ibm.j9ddr.corereaders.tdump.zebedee.dumpreader.AddressSpace
com.ibm.j9ddr.corereaders.tdump.zebedee.dumpreader.MutableAddressSpace
- All Implemented Interfaces:
Emulator.ImageSpace, Serializable
Provides the ability to write as well as read to a copy of the address space. This class
is provided for use by the
Emulator.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longThe last mutable block address requested (quick block cache)Fields declared in class AddressSpace
addressMap, asid, dump, lastBlockAddress, lastButOneBlockAddress, ranges, WILD_POINTERModifier and TypeFieldDescriptionprotected IntegerMapMapping of address to file offsetsprotected intOur address space idprotected DumpThe dump we belong toprotected longThe last block address requested (quick block cache)protected longThe last but one block address requested (quick block cache)protected AddressRange[]Array of AddressRangesstatic final longConstant used to indicate an uninitialized pointer (for performance reasons we use primitive longs for pointers rather than objects) -
Constructor Summary
ConstructorsConstructorDescriptionMutableAddressSpace(AddressSpace space) Creates a new MutableAddressSpace from the given AddressSpace. -
Method Summary
Modifier and TypeMethodDescriptionvoidallocPage(long address) Allocate a page of memory at the given address.voidfree(long ptr) Free the memory that was previously allocated by malloc.protected byte[]getBlockFromCacheOrDisk(long address) Get the block of bytes for the given address.longmalloc(int size) Allocate a chunk of unused memory.longrmalloc(int size) voidwriteByte(long address, int value) Write a byte at the specified address.voidwriteBytes(long address, byte[] array) Write the contents of the byte array to the specified address.voidwriteInt(long address, int value) Write an int at the specified address.voidwriteLong(long address, long value) Write a long at the specified address.voidwriteShort(long address, int value) Write a short at the specified address.voidwriteWord(long address, long value) Write a word at the specified address.Methods declared in class AddressSpace
getAddressRanges, getAsid, getBlock, getDump, getImageInputStream, getLowestAddress, getRootAddressSpace, getUnusedAddressRanges, getUserMap, getWordLength, is64bit, isValidAddress, read, read, readAsciiCString, readAsciiString, readAsciiString, readByte, readEbcdicCString, readEbcdicString, readEbcdicString, readInt, readLong, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUtf8String, readWord, readWord, roundToPage, setIs64bit, toStringModifier and TypeMethodDescriptionReturns an array of all theAddressRanges in this address space.intgetAsid()Returns the MVS ASID (Address Space Identifier) for this address space.final byte[]getBlock(long address) Get the block of bytes for the given address.getDump()Returns anAddressSpaceImageInputStreamfor this address space.longReturns an array of all the unused address ranges in the address space.Returns a general purpose Map object that AddressSpace users can use as they see fit.intReturns the word length in bytes (either 4 or 8 bytes depending on the machine context).booleanis64bit()Returns true if this is a 64-bit machinebooleanisValidAddress(long address) Return true if the address is present in this address spaceintread(long address) Read an unsigned byte at the specified address.voidread(long address, byte[] b, int off, int len) Reads len bytes of data from the given address into an array of bytes.readAsciiCString(long address) Read the ASCII string at the given address.readAsciiString(long address) Read an ASCII String.readAsciiString(long address, int length) Read an ASCII String.bytereadByte(long address) Read a (signed) byte at the specified address.readEbcdicCString(long address) Read an EBCDIC String.readEbcdicString(long address) Read an EBCDIC String.readEbcdicString(long address, int length) Read an EBCDIC String.intreadInt(long address) Read an int at the specified address.longreadLong(long address) Read a long at the specified address.longReads the value of a field in a template at the given address.shortreadShort(long address) Read a (signed) short at the specified address.intreadUnsignedByte(long address) Read an unsigned byte at the specified address.longreadUnsignedInt(long address) Read an unsigned int at the specified address.intreadUnsignedShort(long address) Read an unsigned short at the specified address.readUtf8String(long address) Read a UTF8 String.longreadWord(long address) Read a word at the specified address.longreadWord(long address, boolean is64bitMode) Read a word at the specified address.protected longroundToPage(long address) Rounds the address to the base page address.voidsetIs64bit(boolean is64bit) Sets whether this is a 64-bit machine.toString()Returns the address space id as a hex string.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods declared in interface Emulator.ImageSpace
is64bit, readInt, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShortModifier and TypeMethodDescriptionbooleanis64bit()Return true if this dump is from a 64-bit machineintreadInt(long address) Read an int at the specified address.longreadLong(long address) Read a long at the specified address.shortreadShort(long address) Read a short at the specified address.intreadUnsignedByte(long address) Read a byte at the specified address.longreadUnsignedInt(long address) Read an unsigned int at the specified address.intreadUnsignedShort(long address) Read an unsigned short at the specified address.
-
Field Details
-
lastMutableBlockAddress
protected long lastMutableBlockAddressThe last mutable block address requested (quick block cache)
-
-
Constructor Details
-
MutableAddressSpace
Creates a new MutableAddressSpace from the given AddressSpace. Updates to this "forked" copy will not be reflected in the parent AddressSpace.- Parameters:
AddressSpace- the address space we read from
-
-
Method Details
-
getBlockFromCacheOrDisk
Get the block of bytes for the given address. We look first in our own cache and if its not there call the superclass method.- Overrides:
getBlockFromCacheOrDiskin classAddressSpace- Throws:
IOException
-
writeBytes
Write the contents of the byte array to the specified address.- Throws:
IOException- if the given address (of offset from there) is not present in this address space
-
writeWord
Write a word at the specified address. A word is either 32 or 64 bits depending on the machine context.- Throws:
IOException
-
writeByte
Write a byte at the specified address.- Specified by:
writeBytein interfaceEmulator.ImageSpace- Throws:
IOException- if the given address is not present in this address space
-
writeShort
Write a short at the specified address.- Specified by:
writeShortin interfaceEmulator.ImageSpace- Throws:
IOException- if the given address is not present in this address space
-
writeInt
Write an int at the specified address.- Specified by:
writeIntin interfaceEmulator.ImageSpace- Throws:
IOException- if the given address is not present in this address space
-
writeLong
Write a long at the specified address.- Specified by:
writeLongin interfaceEmulator.ImageSpace- 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.- Specified by:
mallocin interfaceEmulator.ImageSpace- Returns:
- the address of the allocated memory
- Throws:
IOException
-
rmalloc
- Throws:
IOException
-
free
Free the memory that was previously allocated by malloc.- Throws:
IOException
-
allocPage
Allocate a page of memory at the given address. The address must not already be in use. A page is 4096 bytes in length. Address must be on a page boundary.- Throws:
IOException
-