Package mars.mips.hardware
Class MemoryLayout
java.lang.Object
mars.mips.hardware.MemoryLayout
A specification for how MIPS memory should be laid out in the address space. The layout consists of a number of
address ranges as well as a number of special locations.
This class is typically constructed using fromProperties(Properties). Many of the public fields in this
class indicate which property in the Properties object they are derived from.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresentation of an address range defined by a minimum address and a maximum address. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal MemoryLayout.RangeThe range covered by the user data segment.final StringThe description displayed in the Preferences dialog for this layout.final StringThe name displayed in the Preferences dialog for this layout.final MemoryLayout.RangeThe range containing dynamic data (runtime heap/stack).final intThe location of the default exception handler.final MemoryLayout.RangeThe range containing global data (generated via.extern).final intThe initial value of the global pointer ($gp).final intThe initial value of the stack pointer ($sp).final MemoryLayout.RangeThe range covered by the kernel data segment (.kdata).final MemoryLayout.RangeThe range covered by the kernel text segment (.ktext).static final String[]Array of string descriptions for all memory locations.final int[]Array containing all memory locations.final MemoryLayout.RangeThe range of mapped address space.final MemoryLayout.RangeThe range dedicated for performing memory-mapped I/O.static final String[]Array of string descriptions for all memory ranges.final MemoryLayout.Range[]Array containing all memory ranges.final MemoryLayout.RangeThe range containing static data (.data).final MemoryLayout.RangeThe range covered by the user text segment (.text).final MemoryLayout.RangeThe range of user space. -
Constructor Summary
ConstructorsConstructorDescriptionMemoryLayout(String displayName, String description, MemoryLayout.Range mappedRange, MemoryLayout.Range userRange, MemoryLayout.Range textRange, MemoryLayout.Range dataRange, MemoryLayout.Range externRange, MemoryLayout.Range staticRange, MemoryLayout.Range dynamicRange, MemoryLayout.Range kernelTextRange, MemoryLayout.Range kernelDataRange, MemoryLayout.Range mmioRange, int exceptionHandlerAddress, int initialGlobalPointer, int initialStackPointer) Construct a newMemoryLayoutmanually. -
Method Summary
Modifier and TypeMethodDescriptionstatic MemoryLayoutfromProperties(Properties properties) Construct a newMemoryLayoutusing the providedProperties.
-
Field Details
-
RANGE_DESCRIPTIONS
Array of string descriptions for all memory ranges. Ordering is consistent withranges. -
LOCATION_DESCRIPTIONS
Array of string descriptions for all memory locations. Ordering is consistent withlocations. -
displayName
The name displayed in the Preferences dialog for this layout. (Derived from theDisplayNameproperty.) -
description
The description displayed in the Preferences dialog for this layout. (Derived from theDescriptionproperty.) -
mappedRange
The range of mapped address space. All other ranges should be fully contained by this one. (Derived from theMappedSpaceproperty.) -
userRange
The range of user space.textRangeanddataRangeshould be fully contained by this range. Note that "kernel space" is considered to be the space inmappedRangenot covered by this range. (Derived from theUserSpaceproperty.) -
textRange
The range covered by the user text segment (.text). Should be contained byuserRange. (Derived from theTextSegmentproperty.) -
dataRange
The range covered by the user data segment. Should be contained byuserRange.externRange,staticRange, anddynamicRangeshould all be fully contained by this range. (Derived from theDataSegmentproperty.) -
externRange
The range containing global data (generated via.extern). Should be contained bydataRange. (Derived from theExternDataproperty.) -
staticRange
The range containing static data (.data). Should be contained bydataRange. (Derived from theStaticDataproperty.) -
dynamicRange
The range containing dynamic data (runtime heap/stack). Should be contained bydataRange. Note that the heap grows upward from the minimum address and the stack grows downward from the maximum address — more specifically, frominitialStackPointer. (Derived from theHeapStackDataproperty.) -
kernelTextRange
The range covered by the kernel text segment (.ktext). Should not be contained byuserRange. (Derived from theKernelTextSegmentproperty.) -
kernelDataRange
The range covered by the kernel data segment (.kdata). Should not be contained byuserRange. (Derived from theKernelDataSegmentproperty.) -
mmioRange
The range dedicated for performing memory-mapped I/O. (Derived from theMemoryMappedIOproperty.) -
exceptionHandlerAddress
public final int exceptionHandlerAddressThe location of the default exception handler. Execution jumps to this address whenever an exception, interrupt, or trap occurs. (Derived from theExceptionHandlerproperty.) -
initialGlobalPointer
public final int initialGlobalPointerThe initial value of the global pointer ($gp). (Derived from theGlobalPointerproperty.) -
initialStackPointer
public final int initialStackPointerThe initial value of the stack pointer ($sp). This serves as the starting point for the runtime stack, which grows downward. Typically, this is the last word-aligned address indynamicRange. (Derived from theStackPointerproperty.) -
ranges
Array containing all memory ranges. Ordering is consistent withRANGE_DESCRIPTIONS. -
locations
public final int[] locationsArray containing all memory locations. Ordering is consistent withLOCATION_DESCRIPTIONS.
-
-
Constructor Details
-
MemoryLayout
public MemoryLayout(String displayName, String description, MemoryLayout.Range mappedRange, MemoryLayout.Range userRange, MemoryLayout.Range textRange, MemoryLayout.Range dataRange, MemoryLayout.Range externRange, MemoryLayout.Range staticRange, MemoryLayout.Range dynamicRange, MemoryLayout.Range kernelTextRange, MemoryLayout.Range kernelDataRange, MemoryLayout.Range mmioRange, int exceptionHandlerAddress, int initialGlobalPointer, int initialStackPointer) Construct a newMemoryLayoutmanually. To construct fromPropertiesinstead, seefromProperties(Properties).
-
-
Method Details
-
fromProperties
Construct a newMemoryLayoutusing the providedProperties. A property value is required for every range and location in the layout. See the documentation for the fields in this class for the specific property keys.- Parameters:
properties- The properties to initialize fields with.- Returns:
- The constructed
MemoryLayout. - Throws:
IllegalArgumentException- Thrown if one or more required properties is not present.
-