vmm: pass cred struct to VOP_MAP and VOP_UNMAP

This commit is contained in:
Matheus
2023-07-08 14:40:04 -03:00
parent 300e77e36d
commit 92a518927d
3 changed files with 9 additions and 5 deletions
-2
View File
@@ -1,7 +1,5 @@
#include <arch/io.h>
// TODO compile time options for disabling output to port e9h
void arch_e9_putc(char c) {
#ifdef X86_64_ENABLE_E9
outb(0xe9, c);
-1
View File
@@ -20,7 +20,6 @@ static void initarea(scache_t *cache, void *obj) {
}
static scache_t *getcachefromsize(size_t size) {
// XXX find a faster way to check this
scache_t *cache = NULL;
for (int i = 0; i < CACHE_COUNT; ++i) {
if (size <= allocsizes[i]) {
+9 -2
View File
@@ -215,8 +215,12 @@ static void destroyrange(vmmcontext_t *context, vmmrange_t *range, uintmax_t _of
if (physical == NULL)
continue;
thread_t *thread = _cpu()->thread;
proc_t *proc = thread ? thread->proc : NULL;
cred_t *cred = proc ? &proc->cred : NULL;
if ((range->flags & VMM_FLAGS_FILE) && (range->flags & VMM_FLAGS_SHARED) && (flags & VMM_DESTROY_FLAGS_NOSYNC) == 0) {
__assert(VOP_MUNMAP(range->vnode, vaddr, range->offset + offset, mmuflagstovnodeflags(range->mmuflags), NULL) == 0); // XXX pass cred struct
__assert(VOP_MUNMAP(range->vnode, vaddr, range->offset + offset, mmuflagstovnodeflags(range->mmuflags), cred) == 0);
} else {
pmm_free(physical, 1);
arch_mmu_unmap(context->pagetable, vaddr);
@@ -320,10 +324,13 @@ bool vmm_pagefault(void *addr, bool user, int actions) {
goto cleanup;
// TODO CoW
thread_t *thread = _cpu()->thread;
proc_t *proc = thread ? thread->proc : NULL;
cred_t *cred = proc ? &proc->cred : NULL;
if (range->flags & VMM_FLAGS_FILE) {
uintmax_t mapoffset = (uintptr_t)addr - (uintptr_t)range->start;
__assert(VOP_MMAP(range->vnode, addr, range->offset + mapoffset, mmuflagstovnodeflags(range->mmuflags), NULL) == 0); // XXX pass cred struct
__assert(VOP_MMAP(range->vnode, addr, range->offset + mapoffset, mmuflagstovnodeflags(range->mmuflags), cred) == 0);
status = true;
} else {
void *paddr = pmm_alloc(1, PMM_SECTION_DEFAULT);