diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-12-02 22:09:41 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-12-02 22:09:41 +0200 |
| commit | d96dbf6384ef19fb3b43d315663936f43110eade (patch) | |
| tree | 1608756692f8a0a6cd1b9ec2d557523ef92d2e49 /include | |
| parent | 10ae2e6ebc7e9776b9f124c9fc530c79f5e84460 (diff) | |
| download | kmi-d96dbf6384ef19fb3b43d315663936f43110eade.tar.gz kmi-d96dbf6384ef19fb3b43d315663936f43110eade.zip | |
remove MR_SHARED
+ The new shared memory plan doesn't need it.
Diffstat (limited to 'include')
| -rw-r--r-- | include/apos/mem.h | 6 | ||||
| -rw-r--r-- | include/apos/mem_regions.h | 41 |
2 files changed, 20 insertions, 27 deletions
diff --git a/include/apos/mem.h b/include/apos/mem.h index da88edb..4db7a67 100644 --- a/include/apos/mem.h +++ b/include/apos/mem.h @@ -133,12 +133,8 @@ /** Memory region is used. */ #define MR_USED (1 << 8) -/** Memory region is shared. */ -#define MR_SHARED (1 << 9) -/** Owner of shared region. */ -#define MR_OWNED (1 << 10) /** Don't free memory on clear. */ -#define MR_KEEP (1 << 11) +#define MR_KEEP (1 << 9) /** @} */ diff --git a/include/apos/mem_regions.h b/include/apos/mem_regions.h index 7231dbd..6fdb5b4 100644 --- a/include/apos/mem_regions.h +++ b/include/apos/mem_regions.h @@ -32,22 +32,6 @@ #define is_region_used(r) is_set(r->flags, MR_USED) /** - * Check if region is owned. - * - * @param r Memory region to check. - * @return \c 0 if not owned, non-zero otherwise. - */ -#define is_region_owned(r) is_set(r->flags, MR_OWNED) - -/** - * Check if region is shared. - * - * @param r Memory region to check. - * @return \c 0 if not shared, non-zero otherwise. - */ -#define is_region_shared(r) is_set(r->flags, MR_SHARED) - -/** * Check if region should be kept during clear. * * @param r Memory region to check. @@ -85,14 +69,18 @@ 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; /** Start address of memory region. */ vm_t start; + + /** In shared regions, mark the other pid that shared the region. */ + id_t pid; + + /** In shared regions, this is the address associated with region in the + * other process. */ + vm_t alt_va; }; /** @@ -138,9 +126,9 @@ vm_t alloc_region(struct mem_region_root *r, size_t size, size_t *actual_size, * @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); +vm_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. @@ -268,6 +256,15 @@ stat_t stat_region(struct mem_region_root *r, vm_t va, vmflags_t *flags); stat_t mod_region(struct mem_region_root *r, vm_t va, vmflags_t flags); /** + * Set alternate virtual address associated with shared memory region in other process. + * + * @param r Memory region root. + * @param va Virtual address in \p r. + * @param alt_va Virtual address in other process. + */ +void set_alt_region_addr(struct mem_region_root *r, vm_t va, vm_t alt_va); + +/** * Conversion function between abstract memory region and actual page mappings. * Assumes that pages of some order are mappable at multiples of their size, and * tries to fit as many and as high order pages as it can into the region. |
