diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-08-30 19:20:21 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-08-30 19:20:21 +0300 |
| commit | 314bca3dc19a864c76153bfcd5a58be8c40000f9 (patch) | |
| tree | 9aba30284fce66e149a7472adea1cb4037e49463 /include | |
| parent | 1a2e1fff7ce4b8fd8db46549d81e71e76b842da3 (diff) | |
| download | kmi-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 'include')
| -rw-r--r-- | include/kmi/assert.h | 2 | ||||
| -rw-r--r-- | include/kmi/regions.h | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/kmi/assert.h b/include/kmi/assert.h index ecf5272..14e0679 100644 --- a/include/kmi/assert.h +++ b/include/kmi/assert.h @@ -18,6 +18,7 @@ * Catastrophic assertions warn about the assertion and crash the kernel. */ +#include <kmi/power.h> #include <kmi/debug.h> #include <kmi/utils.h> @@ -35,6 +36,7 @@ if (unlikely(!(x))) { \ error("assertion failed: " #x "\n"); \ while (1) { \ + poweroff(SYS_COLD_REBOOT); \ } \ } \ } while (0); diff --git a/include/kmi/regions.h b/include/kmi/regions.h index ebaa07a..5167d28 100644 --- a/include/kmi/regions.h +++ b/include/kmi/regions.h @@ -78,6 +78,8 @@ struct mem_region_root { * track of free and used regions, respectively. All regions are chained * together with a doubly linked list, so that the next region's start address * should be the current region's end address. + * + * Note that addresses are expressed in pages! */ struct mem_region { /** Sp-tree node slot. */ @@ -98,6 +100,11 @@ struct mem_region { /** In shared regions, mark the other pid that shared the region. */ id_t pid; + union { + vm_t shaddr; + size_t refcount; + }; + /** Memory region flags, both access as well as metadata. \see MR_USED, * MR_SHARED, MR_OWNED, MR_COW, MR_KEEP. */ vmflags_t flags; |
