diff options
Diffstat (limited to 'include/apos')
| -rw-r--r-- | include/apos/mem_regions.h | 18 | ||||
| -rw-r--r-- | include/apos/uapi.h | 16 | ||||
| -rw-r--r-- | include/apos/vmem.h | 16 |
3 files changed, 28 insertions, 22 deletions
diff --git a/include/apos/mem_regions.h b/include/apos/mem_regions.h index b94d15a..7231dbd 100644 --- a/include/apos/mem_regions.h +++ b/include/apos/mem_regions.h @@ -85,6 +85,9 @@ struct mem_region { * MR_SHARED, MR_OWNED, MR_COW, MR_KEEP. */ vmflags_t flags; + /** In shared regions, mark the other pid that shared the region. */ + id_t pid; + /** End address of memory region. */ vm_t end; @@ -125,6 +128,21 @@ vm_t alloc_region(struct mem_region_root *r, size_t size, size_t *actual_size, vmflags_t flags); /** + * Allocate memory region and associate it with some other process. + * Will allocate region of at least \c size bytes, with best possible location. + * + * @param r Memory region root. + * @param size Size of region to allocate. + * @param actual_size Size of region that was allocated. + * @param flags Memory flags. + * @param pid Process to associate with region. + * @return Address of allocated region on success, otherwise \c NULL. + */ +stat_t alloc_shared_region(struct mem_region_root *r, size_t size, + size_t *actual_size, + vmflags_t flags, id_t pid); + +/** * Allocate fixed memory region. * Will allocate region that is at least \c size bytes, and includes \c start. * \note The address returned might not be the address requested, and the caller diff --git a/include/apos/uapi.h b/include/apos/uapi.h index 7bd00bb..dda4391 100644 --- a/include/apos/uapi.h +++ b/include/apos/uapi.h @@ -374,22 +374,6 @@ SYSCALL_DECLARE3(req_fixmem, start, size, flags); SYSCALL_DECLARE4(req_sharedmem, tid, size, sflags, cflags); /** - * Reference shared memory syscall. - * - * \see sys_req_sharedmem(). - * - * @param t Current tcb. - * @param tid Thread ID of owner of shared memory. - * @param va Start address of shared memory. - * @param flags Flags to use for reference. - * @param d Unused. - * @param e Unused. - * - * Returns \ref OK and start of shared memory. - */ -SYSCALL_DECLARE3(ref_sharedmem, tid, va, flags); - -/** * Free memory syscall. * * Frees the memory region pointed to. diff --git a/include/apos/vmem.h b/include/apos/vmem.h index 1e481fa..38bad16 100644 --- a/include/apos/vmem.h +++ b/include/apos/vmem.h @@ -46,14 +46,18 @@ vm_t alloc_fixed_uvmem(struct tcb *r, vm_t start, size_t size, vmflags_t flags); /** * Allocate shared user virtual memory. * - * Only callable by servers, who are the owners of the shared region. - * - * @param r Process to allocate memory in. + * @param s First process to allocate memory in. + * @param c Second process to allocate memory in. * @param size Minimum size of allocation. - * @param flags Flags of allocation. - * @return Start of allocation when succesful, \c NULL otherwise. + * @param sflags Flags of allocation for \p s. + * @param cflags Flags of allocation for \p c. + * @param sstart Start of allocation for \p s. + * @param cstart Start of allocation for \p c. + * @return Status of allocation. */ -vm_t alloc_shared_uvmem(struct tcb *r, size_t size, vmflags_t flags); +stat_t alloc_shared_uvmem(struct tcb *s, struct tcb *c, size_t size, + vmflags_t sflags, vmflags_t cflags, + vm_t *sstart, vm_t *cstart); /** * Reference shared user virtual memory. |
