public abstract class PageManager extends Object
Modifier and Type | Field and Description |
---|---|
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.
|
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
public static PageManager getInstance()
public final long pageSize()
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.Copyright © 2018. All rights reserved.