mm: properly implement page locking

This commit is contained in:
Matheus
2026-07-08 01:37:12 -03:00
parent af30088c0d
commit 1512b2f3c6
14 changed files with 123 additions and 45 deletions
+10 -1
View File
@@ -62,11 +62,17 @@ syscallret_t syscall_futex(context_t *, uint32_t *futexp, int op, uint32_t value
bool doleave = true;
uint32_t word;
uint32_t *physical = NULL;
ret.errno = usercopy_fromuseratomic32(futexp, &word);
if (unlikely(ret.errno))
goto cleanup;
uint32_t *physical = mm_get_physical_address(futexp, 0);
physical = mm_get_physical_address(futexp, MM_GET_PHYSICAL_ADDRESS_FLAGS_HOLD | MM_GET_PHYSICAL_ADDRESS_FLAGS_LOCK);
if (unlikely(physical == NULL)) {
ret.errno = EFAULT;
goto cleanup;
}
futex_t *futex = getfutex(physical);
switch (op) {
@@ -162,6 +168,9 @@ syscallret_t syscall_futex(context_t *, uint32_t *futexp, int op, uint32_t value
poll_destroydesc(&desc);
if (physical)
mm_unlock_and_release_page(physical);
MUTEX_RELEASE(&futexmutex);
return ret;
}