public abstract class PageManager
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
PageManager.SingletonHolder |
(package private) static class |
PageManager.Unix |
(package private) static class |
PageManager.Windows |
| Modifier and Type | Field and Description |
|---|---|
private Foreign |
foreign |
private int |
pageSize |
static int |
PROT_EXEC
The memory should be executable
|
static int |
PROT_READ
The memory should be readable
|
static int |
PROT_WRITE
The memory should be writable
|
| Constructor and Description |
|---|
PageManager() |
| Modifier and Type | Method and Description |
|---|---|
abstract long |
allocatePages(int npages,
int protection)
Allocates native memory pages.
|
private long |
calculatePageSize() |
abstract void |
freePages(long address,
int npages)
Free pages allocated via
allocatePages(int, int) |
static PageManager |
getInstance()
Gets the page manager for the current platform.
|
long |
pageSize()
Gets the system page size.
|
abstract void |
protectPages(long address,
int npages,
int protection)
Sets the protection mask on a memory region.
|
public static final int PROT_EXEC
public static final int PROT_READ
public static final int PROT_WRITE
private final Foreign foreign
private int pageSize
public static PageManager getInstance()
public final long pageSize()
private long calculatePageSize()
public abstract long allocatePages(int npages,
int protection)
pageSize.npages - The number of pages to allocate.protection - The initial protection for the page. This must be a
bitmask of PROT_READ, PROT_WRITE and PROT_EXEC.public abstract void freePages(long address,
int npages)
allocatePages(int, int)address - The memory address as returned from allocatePages(int, int)npages - The number of pages to free.public abstract void protectPages(long address,
int npages,
int protection)
address - The start of the memory region.npages - The number of pages to protect.protection - The protection mask.