From 8b7382fa1377541e7c63927513268b6e8c14019c Mon Sep 17 00:00:00 2001 From: Max Wash Date: Tue, 21 Apr 2026 21:11:42 +0100 Subject: [PATCH] libmango: add flags parameter to address_space_map --- libmango/arch/x86_64/syscall.S | 2 +- libmango/include-user/mango/vm.h | 1 + libmango/include/mango/types.h | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libmango/arch/x86_64/syscall.S b/libmango/arch/x86_64/syscall.S index 28d70d7..817dfa2 100644 --- a/libmango/arch/x86_64/syscall.S +++ b/libmango/arch/x86_64/syscall.S @@ -77,7 +77,7 @@ SYSCALL_GATE vm_object_copy SYS_VM_OBJECT_COPY 6 SYSCALL_GATE address_space_read SYS_ADDRESS_SPACE_READ 5 SYSCALL_GATE address_space_write SYS_ADDRESS_SPACE_WRITE 5 -SYSCALL_GATE address_space_map SYS_ADDRESS_SPACE_MAP 7 +SYSCALL_GATE address_space_map SYS_ADDRESS_SPACE_MAP 8 SYSCALL_GATE address_space_unmap SYS_ADDRESS_SPACE_UNMAP 3 SYSCALL_GATE address_space_reserve SYS_ADDRESS_SPACE_RESERVE 4 SYSCALL_GATE address_space_release SYS_ADDRESS_SPACE_RELEASE 3 diff --git a/libmango/include-user/mango/vm.h b/libmango/include-user/mango/vm.h index ca19f7d..2c16349 100644 --- a/libmango/include-user/mango/vm.h +++ b/libmango/include-user/mango/vm.h @@ -48,6 +48,7 @@ extern kern_status_t address_space_map( kern_handle_t object, off_t object_offset, size_t length, + vm_flags_t flags, vm_prot_t prot, virt_addr_t *out_base_address); extern kern_status_t address_space_unmap( diff --git a/libmango/include/mango/types.h b/libmango/include/mango/types.h index acf439a..63298ab 100644 --- a/libmango/include/mango/types.h +++ b/libmango/include/mango/types.h @@ -34,6 +34,16 @@ #define KERN_HANDLE_FLAG2 0x40000000UL #define KERN_HANDLE_FLAG3 0x80000000UL +/* flags to specify when creating address-space mappings */ +/* this mapping is private. if a task with this mapping is duplicated, + the duplicate task will receive a copy-on-write mapping. changes to one + mapping will not be visible to the other. */ +#define VM_PRIVATE 0x0000u +/* this mapping is shared. if a task with this mapping is duplicated, + * the duplicate will receive a mapping of the same data. changes to one mapping + * will be visibile to the other */ +#define VM_SHARED 0x0001u + /* maximum number of handles that can be sent in a single message */ #define KERN_MSG_MAX_HANDLES 64 @@ -107,6 +117,7 @@ typedef unsigned int kern_status_t; typedef uint32_t kern_handle_t; typedef uint32_t kern_config_key_t; typedef uint32_t vm_prot_t; +typedef uint32_t vm_flags_t; typedef int64_t ssize_t; typedef uint32_t kern_futex_t; typedef uint32_t kern_msg_type_t;