Implement lock IRQ nesting via stack variables/contexts
All checks were successful
Build documentation / build-and-deploy (push) Successful in 21s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 21s
This commit is contained in:
@@ -60,21 +60,22 @@ DEFINE_SYSCALL (sys_proc_unmap) {
|
||||
/* int proc_create_resource_mem (size_t pages, int vis, uintptr_t* out_paddr) */
|
||||
DEFINE_SYSCALL (sys_proc_create_resource_mem) {
|
||||
struct limine_hhdm_response* hhdm = limine_hhdm_request.response;
|
||||
spin_lock_ctx_t ctxprpd;
|
||||
|
||||
size_t pages = (size_t)a1;
|
||||
int vis = (int)a2;
|
||||
uintptr_t* out_paddr_buf = (uintptr_t*)a3;
|
||||
|
||||
spin_lock (&proc->pd.lock);
|
||||
spin_lock (&proc->pd.lock, &ctxprpd);
|
||||
|
||||
uintptr_t out_paddr_buf_paddr = mm_v2p (&proc->pd, (uintptr_t)out_paddr_buf, 0);
|
||||
|
||||
if (!mm_validate_buffer (&proc->pd, (uintptr_t)out_paddr_buf, sizeof (uintptr_t), 0)) {
|
||||
spin_unlock (&proc->pd.lock);
|
||||
spin_unlock (&proc->pd.lock, &ctxprpd);
|
||||
return -SR_BAD_ADDRESS_SPACE;
|
||||
}
|
||||
|
||||
spin_unlock (&proc->pd.lock);
|
||||
spin_unlock (&proc->pd.lock, &ctxprpd);
|
||||
|
||||
uintptr_t* out_paddr_buf_vaddr = (uintptr_t*)((uintptr_t)hhdm->offset + out_paddr_buf_paddr);
|
||||
|
||||
@@ -104,13 +105,14 @@ DEFINE_SYSCALL (sys_proc_create_resource_mutex) {
|
||||
|
||||
/* int proc_mutex_lock (int mutex_rid) */
|
||||
DEFINE_SYSCALL (sys_proc_mutex_lock) {
|
||||
spin_lock_ctx_t ctxpr;
|
||||
int rid = (int)a1;
|
||||
|
||||
struct proc_resource* resource;
|
||||
spin_lock (&proc->lock);
|
||||
spin_lock (&proc->lock, &ctxpr);
|
||||
rbtree_find (struct proc_resource, &proc->resource_tree, rid, resource, proc_resource_tree_link,
|
||||
rid);
|
||||
spin_unlock (&proc->lock);
|
||||
spin_unlock (&proc->lock, &ctxpr);
|
||||
|
||||
if (resource == NULL)
|
||||
return -SR_NOT_FOUND;
|
||||
@@ -121,13 +123,14 @@ DEFINE_SYSCALL (sys_proc_mutex_lock) {
|
||||
}
|
||||
|
||||
DEFINE_SYSCALL (sys_proc_mutex_unlock) {
|
||||
spin_lock_ctx_t ctxpr;
|
||||
int rid = (int)a1;
|
||||
|
||||
struct proc_resource* resource;
|
||||
spin_lock (&proc->lock);
|
||||
spin_lock (&proc->lock, &ctxpr);
|
||||
rbtree_find (struct proc_resource, &proc->resource_tree, rid, resource, proc_resource_tree_link,
|
||||
rid);
|
||||
spin_unlock (&proc->lock);
|
||||
spin_unlock (&proc->lock, &ctxpr);
|
||||
|
||||
if (resource == NULL)
|
||||
return -SR_NOT_FOUND;
|
||||
@@ -137,13 +140,14 @@ DEFINE_SYSCALL (sys_proc_mutex_unlock) {
|
||||
|
||||
/* int proc_drop_resource (int rid) */
|
||||
DEFINE_SYSCALL (sys_proc_drop_resource) {
|
||||
spin_lock_ctx_t ctxpr;
|
||||
int rid = (int)a1;
|
||||
|
||||
struct proc_resource* resource;
|
||||
spin_lock (&proc->lock);
|
||||
spin_lock (&proc->lock, &ctxpr);
|
||||
rbtree_find (struct proc_resource, &proc->resource_tree, rid, resource, proc_resource_tree_link,
|
||||
rid);
|
||||
spin_unlock (&proc->lock);
|
||||
spin_unlock (&proc->lock, &ctxpr);
|
||||
|
||||
if (resource == NULL)
|
||||
return -SR_NOT_FOUND;
|
||||
|
||||
Reference in New Issue
Block a user