javax.realtime
Interface PhysicalMemoryTypeFilter


public interface PhysicalMemoryTypeFilter

Implementation or device providers may include classes that implement PhysicalMemoryTypeFilter which allow additional characteristics of memory in devices to be specified. Implementations of PhysicalMemoryTypeFilter are intended to be used by the PhysicalMemoryManager, not directly from application code.


Method Summary
 boolean contains(long base, long size)
          Queries the system about whether the specified range of memory contains any of this type.
 long find(long base, long size)
          Search for physical memory of the right type.
 int getVMAttributes()
          Gets the virtual memory attributes of this.
 int getVMFlags()
          Gets the virtual memory flags of this.
 void initialize(long base, long vBase, long size)
          If configuration is required for memory to fit the attribute of this object, do the configuration here.
 boolean isPresent(long base, long size)
          Queries the system about the existence of the specified range of physical memory.
 boolean isRemovable()
          Queries the system about the removability of this memory.
 void onInsertion(long base, long size, AsyncEvent ae)
          Register the specified AsyncEvent to fire when any memory of this type in the range is added to the system.
 void onInsertion(long base, long size, AsyncEventHandler aeh)
          Deprecated. 1.0.1 Replace with onInsertion(long, long, AsyncEvent)
 void onRemoval(long base, long size, AsyncEvent ae)
          Register the specified AE to fire when any memory in the range is removed from the system.
 void onRemoval(long base, long size, AsyncEventHandler aeh)
          Deprecated. 1.0.1
 boolean unregisterInsertionEvent(long base, long size, AsyncEvent ae)
          Unregister the specified insertion event.
 boolean unregisterRemovalEvent(long base, long size, AsyncEvent ae)
          Unregister the specified removal event.
 long vFind(long base, long size)
          Search for virtual memory of the right type.
 

Method Detail

contains

boolean contains(long base,
                 long size)
Queries the system about whether the specified range of memory contains any of this type.

Parameters:
base - The physical address of the beginning of the memory region.
size - The size of the memory region.
Returns:
true if the specified range contains ANY of this type of memory.
Throws:
java.lang.IllegalArgumentException - Thrown if base or size is negative.
OffsetOutOfBoundsException - Thrown if base is less than zero.
SizeOutOfBoundsException - Thrown if base plus size would be greater than the physical addressing range of the processor.
See Also:
PhysicalMemoryManager.isRemovable(long, long)

find

long find(long base,
          long size)
Search for physical memory of the right type.

Parameters:
base - The physical address at which to start searching.
size - The amount of memory to be found.
Returns:
The address where memory was found or -1 if it was not found.
Throws:
OffsetOutOfBoundsException - Thrown if base is less than zero.
SizeOutOfBoundsException - Thrown if base plus size would be greater than the physical addressing range of the processor.
java.lang.IllegalArgumentException - Thrown if base or size is negative.

getVMAttributes

int getVMAttributes()
Gets the virtual memory attributes of this. The value of this field is as defined for the POSIX mmap function's prot parameter for the platform. The meaning of the bits is platform-dependent. POSIX defines constants for PROT_READ, PROT_WRITE, PROT_EXEC, and PROT_NONE.

Returns:
The virtual memory attributes as an integer.

getVMFlags

int getVMFlags()
Gets the virtual memory flags of this. The value of this field is as defined for the POSIX mmap function's flags parameter for the platform. The meaning of the bits is platform-dependent. POSIX defines constants for MAP_SHARED, MAP_PRIVATE, and MAP_FIXED.

Returns:
The virtual memory flags as an integer.

initialize

void initialize(long base,
                long vBase,
                long size)
If configuration is required for memory to fit the attribute of this object, do the configuration here.

Parameters:
base - The address of the beginning of the physical memory region.
vBase - The address of the beginning of the virtual memory region.
size - The size of the memory region.
Throws:
java.lang.IllegalArgumentException - Thrown if base or size is negative.
OffsetOutOfBoundsException - Thrown if base is less than zero.
SizeOutOfBoundsException - Thrown if base plus size would be greater than the physical addressing range of the processor, or vBase plus size would exceed the virtual addressing range of the processor.

isPresent

boolean isPresent(long base,
                  long size)
Queries the system about the existence of the specified range of physical memory.

Parameters:
base - The address of the beginning of the memory region.
size - The size of the memory region.
Returns:
True if all of the memory is present. False if any of the memory has been removed.
Throws:
java.lang.IllegalArgumentException - if the base and size do not fall into this type of memory.
OffsetOutOfBoundsException - Thrown if base is less than zero.
SizeOutOfBoundsException - Thrown if base plus size would be greater than the physical addressing range of the processor.
See Also:
PhysicalMemoryManager.isRemoved(long, long)

isRemovable

boolean isRemovable()
Queries the system about the removability of this memory.

Returns:
true if this type of memory is removable.

onInsertion

void onInsertion(long base,
                 long size,
                 AsyncEvent ae)
Register the specified AsyncEvent to fire when any memory of this type in the range is added to the system.

Parameters:
base - The starting address in physical memory.
size - The size of the memory area.
ae - The async event to fire.
Throws:
java.lang.IllegalArgumentException - Thrown if ae is null, or if the specified range contains no removable memory of this type. IllegalArgumentException may also be thrown if size is less than zero.
OffsetOutOfBoundsException - Thrown if base is less than zero.
SizeOutOfBoundsException - Thrown if base plus size would be greater than the physical addressing range of the processor.
Since:
1.0.1

onInsertion

void onInsertion(long base,
                 long size,
                 AsyncEventHandler aeh)
Deprecated. 1.0.1 Replace with onInsertion(long, long, AsyncEvent)

Register the specified AsyncEventHandler to run when any memory of this type, and in the range is added to the system. If the size or the base is less than 0, unregister all "onInsertion" references to the handler.

Note: This method only removes handlers that were registered with the same method. It has no effect on handlers that were registered using an associated async event.

Parameters:
base - The starting address in physical memory.
size - The size of the memory area.
aeh - The handler to register.
Throws:
java.lang.IllegalArgumentException - Thrown if the specified range contains no removable memory, or if aeh is null and size and base are both greater than or equal to zero.
SizeOutOfBoundsException - Thrown if base plus size would be greater than the physical addressing range of the processor.

onRemoval

void onRemoval(long base,
               long size,
               AsyncEvent ae)
Register the specified AE to fire when any memory in the range is removed from the system.

Parameters:
base - The starting address in physical memory.
size - The size of the memory area.
ae - The async event to register.
Throws:
java.lang.IllegalArgumentException - Thrown if the specified range contains no removable memory of this type, if ae is null, or if size is less than zero.
OffsetOutOfBoundsException - Thrown if base is less than zero.
SizeOutOfBoundsException - Thrown if base plus size would be greater than the physical addressing range of the processor.
Since:
1.0.1

onRemoval

void onRemoval(long base,
               long size,
               AsyncEventHandler aeh)
Deprecated. 1.0.1

Register the specified AEH to run when any memory in the range is removed from the system. If size or base is less than 0, unregister all "onRemoval" references to the handler parameter.

Note: This method only removes handlers that were registered with the same method. It has no effect on handlers that were registered using an associated async event.

Parameters:
base - The starting address in physical memory.
size - The size of the memory area.
aeh - The handler to register.
Throws:
java.lang.IllegalArgumentException - Thrown if the specified range contains no removable memory known to this filter, if aeh is null and size and base are both greater than or equal to zero.
SizeOutOfBoundsException - Thrown if base plus size would be greater than the physical addressing range of the processor.

unregisterInsertionEvent

boolean unregisterInsertionEvent(long base,
                                 long size,
                                 AsyncEvent ae)
Unregister the specified insertion event. The event is only unregistered if all three arguments match the arguments used to register the event, except that ae of null matches all values of ae and will unregister every ae that matches the address range.

Note: This method has no effect on handlers registered directly as async event handlers.

Parameters:
base - The starting address in physical memory associated with ae.
size - The size of the memory area associated with ae.
ae - The event to unregister.
Returns:
True if at least one event matched the pattern, false if no such event was found.
Throws:
java.lang.IllegalArgumentException - Thrown if size is less than 0.
OffsetOutOfBoundsException - Thrown if base is less than zero.
SizeOutOfBoundsException - Thrown if base plus size would be greater than the physical addressing range of the processor.
Since:
1.0.1

unregisterRemovalEvent

boolean unregisterRemovalEvent(long base,
                               long size,
                               AsyncEvent ae)
Unregister the specified removal event. The async event is only unregistered if all three arguments match the arguments used to register the event, except that ae of null matches all values of ae and will unregister every ae that matches the address range. Note: This method has no effect on handlers registered directly as async event handlers.

Parameters:
base - The starting address in physical memory associated with ae.
size - The size of the memory area associated with ae.
ae - The async event to unregister.
Returns:
True if at least one event matched the pattern, false if no such event was found.
Throws:
java.lang.IllegalArgumentException - Thrown if size is less than 0.
OffsetOutOfBoundsException - Thrown if base is less than zero.
SizeOutOfBoundsException - Thrown if base plus size would be greater than the physical addressing range of the processor.
Since:
1.0.1

vFind

long vFind(long base,
           long size)
Search for virtual memory of the right type. This is important for systems where attributes are associated with particular ranges of virtual memory.

Parameters:
base - The address at which to start searching.
size - The amount of memory to be found.
Returns:
The address where memory was found or -1 if it was not found.
Throws:
OffsetOutOfBoundsException - Thrown if base is less than zero.
SizeOutOfBoundsException - Thrown if base plus size would be greater than the physical addressing range of the processor.
java.lang.IllegalArgumentException - Thrown if base or size is negative. IllegalArgumentException may also be thrown if base is an invalid virtual address.