mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
mm: properly implement page locking
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user