public class PhysicalMemoryFactory
extends java.lang.Object
PhysicalMemoryRegion
instances with physical memory characteristics
in the form of PhysicalMemoryCharacteristic
instances for creating
memory areas in those ranges.
Each physical memory module can have one or more physical memory characteristic. A physical memory characteristic can apply to many physical memory modules. The range of physical addresses of modules shall not overlap. A memory that spans more than one physical memory module may not be created.
The PhysicalMemoryFactory
determines the physical
addresses from the modules and keeps a relation between instances of
PhysicalMemoryRegion
and Physical Memory Addresses. The range of
physical addresses of modules shall not overlap. A created memory area may
not span more than one physical memory module. To find a memory range that
supports PMC A and PMC B, it uses set intersection modules(A) ∩
modules(B)
Constructor and Description |
---|
PhysicalMemoryFactory()
Creates an empty factory, but when only one factory is required, uses
getDefault() instead. |
Modifier and Type | Method and Description |
---|---|
void |
associate(PhysicalMemoryCharacteristic[] names,
PhysicalMemoryRegion module)
Associates an array of programmer-defined names with a physical
address range.
|
void |
associate(PhysicalMemoryCharacteristic name,
PhysicalMemoryRegion module)
Associates a programmer-defined name with a physical
address range.
|
static void |
associate(PhysicalMemoryCharacteristic name,
PhysicalMemoryRegion[] modules)
Associates a programmer-defined name with an array of physical
address ranges.
|
ImmortalMemory |
createImmortalMemory(PhysicalMemorySelector selector,
long size,
java.lang.Runnable logic)
Instantiates a
ImmortalMemory object in a
PhysicalMemoryRegion , where the memory type matches the
PhysicalMemoryCharacteristic instances in selector and
the virtual memory parameters of selector are applied. |
PinnableMemory |
createLTMemory(PhysicalMemorySelector selector,
long size,
java.lang.Runnable logic)
Instantiates a
LTMemory object in a PhysicalMemoryRegion ,
matching the PhysicalMemoryCharacteristic in selector with
virtual memory parameters of selector applied. |
PinnableMemory |
createPinnableMemory(PhysicalMemorySelector selector,
long size,
java.lang.Runnable logic)
Instantiates a
PinnableMemory object in a
PhysicalMemoryRegion , matching the
PhysicalMemoryCharacteristic in selector
with virtual memory parameters of selector applied. |
StackedMemory |
createStackedMemory(PhysicalMemorySelector selector,
long scopeSize,
long backingSize,
java.lang.Runnable logic)
Instantiates a
StackedMemory object in a
PhysicalMemoryRegion , matching the
PhysicalMemoryCharacteristic in selector with virtual
memory parameters of selector applied. |
static PhysicalMemoryFactory |
getDefault()
Obtains the default physical memory factory.
|
public PhysicalMemoryFactory()
getDefault()
instead.public static PhysicalMemoryFactory getDefault()
public void associate(PhysicalMemoryCharacteristic name, PhysicalMemoryRegion module) throws StaticIllegalArgumentException, RangeOutOfBoundsException
name
- The physical memory characteristic. e.g
STATIC_RAM.module
- The object representing a range of
contiguous physical addresses.StaticIllegalArgumentException
- when either
name or module is null.RangeOutOfBoundsException
- when module
overlaps a previously
associated PhysicalMemoryRegion
instance or cannot be
mapped as Java object storage.public void associate(PhysicalMemoryCharacteristic[] names, PhysicalMemoryRegion module) throws StaticIllegalArgumentException, RangeOutOfBoundsException
names
- The array of physical memory characteristics. e.g
{ STATIC_RAM }.module
- The object representing a range of
contiguous physical addresses.StaticIllegalArgumentException
- when either
names or module is null.RangeOutOfBoundsException
- when module
overlaps a previously
associated PhysicalMemoryRegion
instance or cannot be
mapped as Java object storage.public static void associate(PhysicalMemoryCharacteristic name, PhysicalMemoryRegion[] modules) throws StaticIllegalArgumentException, RangeOutOfBoundsException
name
- is the physical memory characteristic. e.g
STATIC_RAM.modules
- is an array of objects each representing
a range of contiguous physical addresses.StaticIllegalArgumentException
- when either
name or modules is null.RangeOutOfBoundsException
- when module
overlaps a
previously associated PhysicalMemoryRegion
instance
or cannot be mapped as Java object storage.public ImmortalMemory createImmortalMemory(PhysicalMemorySelector selector, long size, java.lang.Runnable logic) throws StaticSecurityException, SizeOutOfBoundsException, UnsupportedPhysicalMemoryException, MemoryTypeConflictException, StaticIllegalArgumentException
ImmortalMemory
object in a
PhysicalMemoryRegion
, where the memory type matches the
PhysicalMemoryCharacteristic
instances in selector
and
the virtual memory parameters of selector
are applied.selector
- Used to choose the memory module and set the virtual
mapping.size
- The size of memory to be taken out of the
selected module.logic
- The default logic to execute on entry (may be null
).StaticSecurityException
- when the application does not have
permission to access physical memory or the given range of memory.SizeOutOfBoundsException
- when
the implementation detects that size
extends
beyond a physically addressable memory module.UnsupportedPhysicalMemoryException
- when the
underlying hardware does not support the given type, or
when no matching PhysicalMemoryCharacteristic
has
been registered with this PhysicalMemoryFactory
.MemoryTypeConflictException
- when the specified base does
not point to memory that matches the requested type, or when
type
specifies incompatible memory attributes.StaticIllegalArgumentException
- when
size
is less than zero.public PinnableMemory createLTMemory(PhysicalMemorySelector selector, long size, java.lang.Runnable logic) throws StaticSecurityException, SizeOutOfBoundsException, UnsupportedPhysicalMemoryException, MemoryTypeConflictException, StaticIllegalArgumentException
LTMemory
object in a PhysicalMemoryRegion
,
matching the PhysicalMemoryCharacteristic
in selector
with
virtual memory parameters of selector
applied.selector
- Used to choose the memory module and set the virtual
mapping.size
- The size of memory to be taken out of the
selected module.logic
- The default logic to execute on entry (may be null
).StaticSecurityException
- when the application does not have
permission to access physical memory or the given range of memory.SizeOutOfBoundsException
- when
the implementation detects that size
extends
beyond a physically addressable memory module.UnsupportedPhysicalMemoryException
- when the
underlying hardware does not support the given type, or
when no matching PhysicalMemoryCharacteristic
has been registered with this PhysicalMemoryFactory
.MemoryTypeConflictException
- when the specified base does
not point to memory that matches the requested type, or when
type
specifies incompatible memory attributes.StaticIllegalArgumentException
- when
size
is less than zero.public PinnableMemory createPinnableMemory(PhysicalMemorySelector selector, long size, java.lang.Runnable logic) throws StaticSecurityException, SizeOutOfBoundsException, UnsupportedPhysicalMemoryException, MemoryTypeConflictException, StaticIllegalArgumentException
PinnableMemory
object in a
PhysicalMemoryRegion
, matching the
PhysicalMemoryCharacteristic
in selector
with virtual memory parameters of selector
applied.selector
- Used to choose the memory module and set the virtual
mapping.size
- The size of memory to be taken out of the
selected module.logic
- The default logic to execute on entry (may be null
).StaticSecurityException
- when the application does not have
permissions to access physical memory or the given range of memory.SizeOutOfBoundsException
- when
the implementation detects that size
extends
beyond a physically addressable memory module.UnsupportedPhysicalMemoryException
- when the
underlying hardware does not support the given type, or
when no matching PhysicalMemoryCharacteristic
has
been registered with this PhysicalMemoryFactory
.MemoryTypeConflictException
- when the specified base does
not point to memory that matches the requested type, or when
type
specifies incompatible memory attributes.StaticIllegalArgumentException
- when
size
is less than zero.public StackedMemory createStackedMemory(PhysicalMemorySelector selector, long scopeSize, long backingSize, java.lang.Runnable logic) throws StaticSecurityException, SizeOutOfBoundsException, UnsupportedPhysicalMemoryException, MemoryTypeConflictException, StaticIllegalArgumentException
StackedMemory
object in a
PhysicalMemoryRegion
, matching the
PhysicalMemoryCharacteristic
in selector
with virtual
memory parameters of selector
applied.selector
- Used to choose the memory module and set the virtual
mapping.scopeSize
- The size of the scope to be created.backingSize
- The size of the backing store to take out of the
selected module.logic
- The default logic to execute on entry (may be null
).StaticSecurityException
- when the application does not have
permissions to access physical memory or the given range of memory.SizeOutOfBoundsException
- when
the implementation detects that size
extends
beyond a physically addressable memory module.UnsupportedPhysicalMemoryException
- when the
underlying hardware does not support the given type, or
when no matching PhysicalMemoryCharacteristic
has
been registered with this PhysicalMemoryFactory
.MemoryTypeConflictException
- when the specified base does
not point to memory that matches the requested type, or when
type
specifies incompatible memory attributes.StaticIllegalArgumentException
- when
scopeSize
or backingSize
is less than zero.