aboutsummaryrefslogtreecommitdiff
path: root/src/regions.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-08-30 19:20:21 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-08-30 19:20:21 +0300
commit314bca3dc19a864c76153bfcd5a58be8c40000f9 (patch)
tree9aba30284fce66e149a7472adea1cb4037e49463 /src/regions.c
parent1a2e1fff7ce4b8fd8db46549d81e71e76b842da3 (diff)
downloadkmi-314bca3dc19a864c76153bfcd5a58be8c40000f9.tar.gz
kmi-314bca3dc19a864c76153bfcd5a58be8c40000f9.zip
improvements to shared memory handling
+ Now each shared region is reference counter (technically each region is refernce counted, private regions just have a count of 1). Also, syscalls that touch the TLB get flushed, but should probably look into where else this flushing might be needed.
Diffstat (limited to 'src/regions.c')
-rw-r--r--src/regions.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/regions.c b/src/regions.c
index d5f431d..2db1a91 100644
--- a/src/regions.c
+++ b/src/regions.c
@@ -440,6 +440,9 @@ static vm_t __partition_region(struct mem_region_root *r, struct mem_region *m,
m->start = start;
m->flags = flags;
m->pid = pid;
+ if (m->pid == 0)
+ m->refcount = 1;
+
mark_region_used(m->flags);
__insert_used_region(r, m);
return __addr(start);