aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO.txt3
-rw-r--r--arch/riscv64/kernel/vmem.c4
-rw-r--r--include/apos/types.h2
-rw-r--r--include/apos/vmem.h3
4 files changed, 9 insertions, 3 deletions
diff --git a/TODO.txt b/TODO.txt
index 8492ade..7adcceb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -49,3 +49,6 @@ be better for cache locality.
+ Add in more logging etc. dumbass
+ More functions, less macros? sometimes helpful in gdb, maybe also for kernel
binary size?
++ Add in purely virtual memory pages, i.e. stuff that shouldn't free physical
+memory when the memory page is freed, for example if two processes share the
+same memory
diff --git a/arch/riscv64/kernel/vmem.c b/arch/riscv64/kernel/vmem.c
index 9fd42dd..cd822ae 100644
--- a/arch/riscv64/kernel/vmem.c
+++ b/arch/riscv64/kernel/vmem.c
@@ -46,7 +46,7 @@ stat_t mod_vpage(struct vm_branch *branch, vm_t vaddr, pm_t paddr, vmflags_t fla
{
pm_t *pte = __find_vmem(branch, vaddr, 0);
if(pte){
- *pte = to_pte((pm_t)__pa(paddr), flags);
+ *pte = to_pte((pm_t)__pa(paddr), vp_flags(flags));
return OK;
}
@@ -111,7 +111,7 @@ stat_t map_vpage(struct vm_branch *branch,
if (is_branch(branch->leaf[idx])) /* something has gone terribly wrong? */
__destroy_branch(branch->leaf[idx]);
- branch->leaf[idx] = (struct vm_branch *)to_pte((pm_t)__pa(paddr), flags);
+ branch->leaf[idx] = (struct vm_branch *)to_pte((pm_t)__pa(paddr), vp_flags(flags));
return OK;
}
diff --git a/include/apos/types.h b/include/apos/types.h
index 9b90611..fea71ae 100644
--- a/include/apos/types.h
+++ b/include/apos/types.h
@@ -178,7 +178,7 @@ typedef intmax_t ssize_t;
/* some common types used throughout the kernel */
typedef int_fast8_t stat_t;
typedef uint_fast32_t id_t;
-typedef uint_fast8_t vmflags_t;
+typedef uint_fast16_t vmflags_t;
/* error types (should this go somewhere else? */
/* negative error codes are reserved for general usage, positive error codes are
diff --git a/include/apos/vmem.h b/include/apos/vmem.h
index 92e9d61..cbdef2e 100644
--- a/include/apos/vmem.h
+++ b/include/apos/vmem.h
@@ -21,4 +21,7 @@ stat_t free_uvmem_wrapper(struct vm_branch *b, pm_t *offset, vm_t vaddr, vmflags
#define unmap_freed_region(b, start, bytes)\
map_fill_region(b, &free_uvmem_wrapper, 0, start, bytes, 0)
+#define vm_flags(x) ((x) & ~0xff)
+#define vp_flags(x) ((x) & 0xff)
+
#endif /* APOS_VMEM_H */