vm: implement demand-paging via userspace services with vm-controller
This commit is contained in:
@@ -6,10 +6,27 @@
|
||||
|
||||
#define VM_OBJECT_NAME_MAX 64
|
||||
|
||||
struct vm_controller;
|
||||
|
||||
enum vm_object_flags {
|
||||
/* the memory behind this vm-object wasn't allocated by us, and
|
||||
* therefore shouldn't be freed by us */
|
||||
VMO_IN_PLACE = 0x01u,
|
||||
/* this vm-object is/was attached to a vm-controller */
|
||||
VMO_CONTROLLER = 0x02u,
|
||||
|
||||
/* these flags are for use with vm_object_get_page */
|
||||
/**************************************************/
|
||||
|
||||
/* if the relevant page hasn't been allocated yet, it will be allocated
|
||||
* and returned. if this flag isn't specified, NULL will be returned. */
|
||||
VMO_ALLOCATE_MISSING_PAGE = 0x04u,
|
||||
/* if the vm-object is attached to a vm-controller, and the relevant
|
||||
* page is uncommitted, send a request to the vm-controller to provide
|
||||
* the missing page. will result in the vm-object being unlocked and
|
||||
* the current thread sleeping until the request is fulfilled. the
|
||||
* vm-object will be re-locked before the function returns. */
|
||||
VMO_REQUEST_MISSING_PAGE = 0x08u,
|
||||
};
|
||||
|
||||
struct vm_object {
|
||||
@@ -21,8 +38,12 @@ struct vm_object {
|
||||
/* queue of struct vm_region_mapping */
|
||||
struct queue vo_mappings;
|
||||
|
||||
/* memory protection flags. mappings of this vm_object can only use
|
||||
* a subset of the flags set in this mask. */
|
||||
struct vm_controller *vo_ctrl;
|
||||
equeue_key_t vo_key;
|
||||
struct btree_node vo_ctrl_node;
|
||||
|
||||
/* memory protection flags. mappings of this vm_object can only
|
||||
* use a subset of the flags set in this mask. */
|
||||
vm_prot_t vo_prot;
|
||||
|
||||
/* btree of vm_pages that have been allocated to this vm_object.
|
||||
@@ -58,13 +79,10 @@ extern struct vm_object *vm_object_create_in_place(
|
||||
vm_prot_t prot);
|
||||
|
||||
extern struct vm_page *vm_object_get_page(
|
||||
const struct vm_object *vo,
|
||||
off_t offset);
|
||||
|
||||
extern struct vm_page *vm_object_alloc_page(
|
||||
struct vm_object *vo,
|
||||
off_t offset,
|
||||
enum vm_page_order size);
|
||||
enum vm_object_flags flags,
|
||||
unsigned long *irq_flags);
|
||||
|
||||
extern kern_status_t vm_object_read(
|
||||
struct vm_object *vo,
|
||||
|
||||
Reference in New Issue
Block a user