Class AddressSpace
java.lang.Object
com.ibm.dtfj.corereaders.zos.dumpreader.AddressSpace
- All Implemented Interfaces:
Serializable
This class represents an address space in an svcdump. It provides the ability to read
the contents of an address amongst other things. Note that in Zebedee as a whole, addresses
are always represented by a long (Java primitive) to avoid the overhead of continually
creating address objects.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected IntegerMap
Mapping of address to file offsetsprotected int
Our address space idprotected Dump
The dump we belong toprotected long
The last block address requested (quick block cache)protected long
The last but one block address requested (quick block cache)protected AddressRange[]
Array of AddressRangesstatic final long
Constant used to indicate an uninitialized pointer (for performance reasons we use primitive longs for pointers rather than objects) -
Constructor Summary
ConstructorDescriptionAddressSpace
(Dump dump, int asid) Creates a new AddressSpace belonging to the given Dump and having the given id. -
Method Summary
Modifier and TypeMethodDescriptionReturns an array of all theAddressRange
s in this address space.int
getAsid()
Returns the MVS ASID (Address Space Identifier) for this address space.protected byte[]
getBlockFromCacheOrDisk
(long address) Get the block either from the cache or from disk.getDump()
Returns anAddressSpaceImageInputStream
for this address space.Returns 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.int
Returns the word length in bytes (either 4 or 8 bytes depending on the machine context).boolean
is64bit()
Returns true if this is a 64-bit machineboolean
isValid
(long address) Returns true if the given address is present in this address space.int
read
(long address) Read an unsigned byte at the specified address.void
read
(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.byte
readByte
(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.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 (signed) short at the specified address.int
readUnsignedByte
(long address) Read an unsigned 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.readUtf8String
(long address) Read a UTF8 String.long
readWord
(long address) Read a word at the specified address.protected long
roundToPage
(long address) Rounds the address to the base page address and also strips the top bit if in 32-bit mode.void
setIs64bit
(boolean is64bit) Sets whether this is a 64-bit machine.long
stripTopBit
(long address) Strip the top bit if this is a 32-bit platformtoString()
Returns the address space id as a hex string.
-
Field Details
-
dump
The dump we belong to -
asid
protected int asidOur address space id -
addressMap
Mapping of address to file offsets -
lastBlockAddress
protected long lastBlockAddressThe last block address requested (quick block cache) -
lastButOneBlockAddress
protected long lastButOneBlockAddressThe last but one block address requested (quick block cache) -
ranges
Array of AddressRanges -
WILD_POINTER
public static final long WILD_POINTERConstant used to indicate an uninitialized pointer (for performance reasons we use primitive longs for pointers rather than objects)- See Also:
-
-
Constructor Details
-
AddressSpace
-
-
Method Details
-
getDump
- Returns:
- the Dump we belong to
-
getRootAddressSpace
- Returns:
- the root address space
-
getUserMap
Returns a general purpose Map object that AddressSpace users can use as they see fit. This map is provided as a convenience since users of AddressSpace often want to store related info somewhere. Care should be taken that nobody else has used the same key - one way to achieve this would be to use a class object as a key. -
getAsid
public int getAsid()Returns the MVS ASID (Address Space Identifier) for this address space. -
getAddressRanges
Returns an array of all theAddressRange
s in this address space. An address range is simply a pair of [low, high] addresses for which memory is available in the dump. -
getUnusedAddressRanges
Returns an array of all the unused address ranges in the address space. This is the inverse ofgetAddressRanges()
. -
getImageInputStream
Returns anAddressSpaceImageInputStream
for this address space. The ImageInputStream interface provides a wealth of read methods. -
roundToPage
protected long roundToPage(long address) Rounds the address to the base page address and also strips the top bit if in 32-bit mode. -
stripTopBit
public long stripTopBit(long address) Strip the top bit if this is a 32-bit platform -
getBlockFromCacheOrDisk
Get the block either from the cache or from disk. This protected method is provided so that MutableAddressSpace has the chance to look in its own cache first.- Throws:
IOException
-
read
Read an unsigned byte 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
-
readUnsignedByte
Read an unsigned byte at the specified address.- Throws:
IOException
- if the given address is not present in this address space
-
readByte
Read a (signed) 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 (signed) short 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
-
readWord
Read a word at the specified address. A word is either 32 or 64 bits depending on the machine context.- Throws:
IOException
-
getWordLength
public int getWordLength()Returns the word length in bytes (either 4 or 8 bytes depending on the machine context). -
read
Reads len bytes of data from the given address into an array of bytes.- Parameters:
address
- the address to read fromb
- - the buffer into which the data is readoff
- - the start offset in array b at which the data is writtenlen
- - the number of bytes to read- Throws:
IOException
-
readEbcdicString
Read an EBCDIC String. This method expects to find a sequence of EBCDIC bytes at the given address.- Parameters:
address
- the start address of the EBCDIC byteslength
- the number of bytes to be read- Throws:
IOException
- if the given address is not present in this address space
-
readEbcdicString
Read an EBCDIC String. Assumes that address points to the halfword length immediately followed by the EBCDIC bytes.- Parameters:
address
- the start address of the EBCDIC bytes- Throws:
IOException
- if the given address is not present in this address space
-
readEbcdicCString
Read an EBCDIC String. Assumes that address points to a null-terminated EBCDIC string.- Parameters:
address
- the start address of the EBCDIC bytes- Throws:
IOException
- if the given address is not present in this address space
-
readAsciiString
Read an ASCII String. This method expects to find a sequence of ASCII bytes at the given address.- Parameters:
address
- the start address of the ASCII byteslength
- the number of bytes to be read- Throws:
IOException
- if the given address is not present in this address space
-
readAsciiCString
Read the ASCII string at the given address. Assumes that address points to a null-terminated ASCII C string.- Parameters:
address
- the start address of the ASCII bytes- Throws:
IOException
- if the given address is not present in this address space
-
readAsciiString
Read an ASCII String. Assumes that address points to the halfword length immediately followed by the ASCII bytes.- Parameters:
address
- the start address of the ASCII bytes- Throws:
IOException
- if the given address is not present in this address space
-
readUtf8String
Read a UTF8 String. Assumes that address points to the halfword length immediately followed by the utf8 bytes. XXX Despite the name no UTF8 conversion is done yet! (i.e. assumes ASCII)- Parameters:
address
- the start address of the structure- Throws:
IOException
- if the given address is not present in this address space
-
isValid
public boolean isValid(long address) Returns true if the given address is present in this address space. -
is64bit
public boolean is64bit()Returns true if this is a 64-bit machine -
setIs64bit
public void setIs64bit(boolean is64bit) Sets whether this is a 64-bit machine. Unfortunately there is no way of knowing at the beginning if we are running in 64-bit mode, this is only discovered in le/Caa. So perhaps this knowledge should only be in the le layer? -
toString
-