mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-31 06:28:22 +00:00
vmm: allow vmm_getphysical to return a page held
This commit is contained in:
+4
-1
@@ -655,7 +655,7 @@ bool vmm_pagefault(void *addr, bool user, int actions) {
|
||||
return status;
|
||||
}
|
||||
|
||||
void *vmm_getphysical(void *addr) {
|
||||
void *vmm_getphysical(void *addr, bool hold) {
|
||||
addr = (void *)ROUND_DOWN((uintptr_t)addr, PAGE_SIZE);
|
||||
|
||||
vmmspace_t *space = getspace(addr);
|
||||
@@ -666,6 +666,9 @@ void *vmm_getphysical(void *addr) {
|
||||
|
||||
void *physical = arch_mmu_getphysical(current_vmm_context()->pagetable, addr);
|
||||
|
||||
if (hold)
|
||||
pmm_hold(physical);
|
||||
|
||||
MUTEX_RELEASE(&space->lock);
|
||||
return physical + ((uintptr_t)addr - ROUND_DOWN((uintptr_t)addr, PAGE_SIZE));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user