From b3be4c541bbdab9f32f471b8837121ef159a8a4c Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 19 Apr 2026 20:13:07 +0100 Subject: [PATCH] libmango: rename page requests to vm requests --- libmango/include-user/mango/vm.h | 2 +- libmango/include/mango/types.h | 48 ++++++++++++++++++++++---------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/libmango/include-user/mango/vm.h b/libmango/include-user/mango/vm.h index da1a0a7..ca19f7d 100644 --- a/libmango/include-user/mango/vm.h +++ b/libmango/include-user/mango/vm.h @@ -67,7 +67,7 @@ extern kern_status_t address_space_release( extern kern_status_t vm_controller_create(kern_handle_t *out); extern kern_status_t vm_controller_recv( kern_handle_t ctrl, - equeue_packet_page_request_t *out); + equeue_packet_vm_request_t *out); extern kern_status_t vm_controller_recv_async( kern_handle_t ctrl, kern_handle_t eq, diff --git a/libmango/include/mango/types.h b/libmango/include/mango/types.h index 109e96d..acf439a 100644 --- a/libmango/include/mango/types.h +++ b/libmango/include/mango/types.h @@ -61,13 +61,14 @@ #define KERN_MSG_EVENT_DISCONNECTION 2 /* equeue packet types */ -#define EQUEUE_PKT_PAGE_REQUEST 0x01u +#define EQUEUE_PKT_VM_REQUEST 0x01u #define EQUEUE_PKT_ASYNC_SIGNAL 0x02u -/* page request types */ -#define PAGE_REQUEST_READ 0x01u -#define PAGE_REQUEST_DIRTY 0x02u -#define PAGE_REQUEST_DETACH 0x03u +/* vm request types */ +#define VM_REQUEST_READ 0x01u +#define VM_REQUEST_DIRTY 0x02u +#define VM_REQUEST_ATTACH 0x03u +#define VM_REQUEST_DETACH 0x04u /* futex special values */ #define FUTEX_WAKE_ALL ((size_t)-1) @@ -175,14 +176,33 @@ typedef struct { /* the key of the vm-object for which the page request relates, as * specified when the vm-object was created */ equeue_key_t req_vmo; - /* page request type. one of PAGE_REQUEST_* */ + /* page request type. one of VM_REQUEST_* */ unsigned short req_type; - /* of the offset into the vm-object for which pages are being requested - */ - off_t req_offset; - /* the length in bytes of the region being requested */ - size_t req_length; -} equeue_packet_page_request_t; + /* the offset into the vm-object for which pages are being requested */ + union { + /* used for: + * VM_REQUEST_READ + * VM_REQUEST_DIRTY + */ + struct { + off_t req_offset; + /* the length in bytes of the region being requested */ + size_t req_length; + }; + + /* used for: + * VM_REQUEST_ATTACH + */ + struct { + /* the key of the original/source vmo. */ + equeue_key_t req_src_vmo; + /* a request ID. used to retrieve information about + * the newly-attached object, as the server won't know + * about it yet, and won't have a handle to it. */ + uint64_t req_id; + }; + }; +} equeue_packet_vm_request_t; typedef struct { /* the type of packet. one of EQUEUE_PKT_* */ @@ -192,8 +212,8 @@ typedef struct { equeue_key_t p_key; union { - /* p_type = EQUEUE_PKT_PAGE_REQUEST */ - equeue_packet_page_request_t page_request; + /* p_type = EQUEUE_PKT_VM_REQUEST */ + equeue_packet_vm_request_t vm_request; /* p_type = EQUEUE_PKT_ASYNC_SIGNAL */ equeue_packet_async_signal_t async_signal; };