mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
vmm: pass cred struct to VOP_MAP and VOP_UNMAP
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
#include <arch/io.h>
|
#include <arch/io.h>
|
||||||
|
|
||||||
// TODO compile time options for disabling output to port e9h
|
|
||||||
|
|
||||||
void arch_e9_putc(char c) {
|
void arch_e9_putc(char c) {
|
||||||
#ifdef X86_64_ENABLE_E9
|
#ifdef X86_64_ENABLE_E9
|
||||||
outb(0xe9, c);
|
outb(0xe9, c);
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ static void initarea(scache_t *cache, void *obj) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static scache_t *getcachefromsize(size_t size) {
|
static scache_t *getcachefromsize(size_t size) {
|
||||||
// XXX find a faster way to check this
|
|
||||||
scache_t *cache = NULL;
|
scache_t *cache = NULL;
|
||||||
for (int i = 0; i < CACHE_COUNT; ++i) {
|
for (int i = 0; i < CACHE_COUNT; ++i) {
|
||||||
if (size <= allocsizes[i]) {
|
if (size <= allocsizes[i]) {
|
||||||
|
|||||||
+9
-2
@@ -215,8 +215,12 @@ static void destroyrange(vmmcontext_t *context, vmmrange_t *range, uintmax_t _of
|
|||||||
if (physical == NULL)
|
if (physical == NULL)
|
||||||
continue;
|
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) {
|
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 {
|
} else {
|
||||||
pmm_free(physical, 1);
|
pmm_free(physical, 1);
|
||||||
arch_mmu_unmap(context->pagetable, vaddr);
|
arch_mmu_unmap(context->pagetable, vaddr);
|
||||||
@@ -320,10 +324,13 @@ bool vmm_pagefault(void *addr, bool user, int actions) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
// TODO CoW
|
// 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) {
|
if (range->flags & VMM_FLAGS_FILE) {
|
||||||
uintmax_t mapoffset = (uintptr_t)addr - (uintptr_t)range->start;
|
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;
|
status = true;
|
||||||
} else {
|
} else {
|
||||||
void *paddr = pmm_alloc(1, PMM_SECTION_DEFAULT);
|
void *paddr = pmm_alloc(1, PMM_SECTION_DEFAULT);
|
||||||
|
|||||||
Reference in New Issue
Block a user