suspension queue resume process with value
This commit is contained in:
@@ -20,7 +20,7 @@ void proc_cleanup_resource_mail(struct proc_resource* resource, struct reschedul
|
||||
struct proc_sq_entry* sq_entry = list_entry(node, struct proc_sq_entry, sq_link);
|
||||
struct proc* suspended_proc = sq_entry->proc;
|
||||
|
||||
proc_sq_resume(suspended_proc, sq_entry, rctx);
|
||||
proc_sq_resume(suspended_proc, sq_entry, rctx, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ void proc_mail_send(struct proc* proc, struct proc_mail* mail, struct reschedule
|
||||
size_t copy_size = min(data_size, saved_buffer->size);
|
||||
memcpy(saved_buffer->buffer, data, copy_size);
|
||||
|
||||
proc_sq_resume(resumed_proc, sq_entry, rctx);
|
||||
proc_sq_resume(resumed_proc, sq_entry, rctx, copy_size);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,8 @@ void proc_mail_receive(struct proc* proc, struct proc_mail* mail, struct resched
|
||||
list_remove(mail->packets, &packet->packets_link);
|
||||
mail->packets_count--;
|
||||
|
||||
memcpy(recv_buffer, packet->packet_buffer, min(recv_size, packet->packet_size));
|
||||
size_t copy_size = min(recv_size, packet->packet_size);
|
||||
memcpy(recv_buffer, packet->packet_buffer, copy_size);
|
||||
free(packet->packet_buffer);
|
||||
free(packet);
|
||||
|
||||
@@ -90,7 +91,7 @@ void proc_mail_receive(struct proc* proc, struct proc_mail* mail, struct resched
|
||||
struct proc_sq_entry* sq_entry = list_entry(node, struct proc_sq_entry, sq_link);
|
||||
struct proc* resumed_proc = sq_entry->proc;
|
||||
|
||||
proc_sq_resume(resumed_proc, sq_entry, rctx);
|
||||
proc_sq_resume(resumed_proc, sq_entry, rctx, copy_size);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ void proc_cleanup_resource_mutex(struct proc_resource* resource, struct reschedu
|
||||
struct proc_sq_entry* sq_entry = list_entry(node, struct proc_sq_entry, sq_link);
|
||||
struct proc* suspended_proc = sq_entry->proc;
|
||||
|
||||
proc_sq_resume(suspended_proc, sq_entry, rctx);
|
||||
proc_sq_resume(suspended_proc, sq_entry, rctx, 0);
|
||||
}
|
||||
|
||||
mutex->locked = false;
|
||||
@@ -74,7 +74,7 @@ void proc_mutex_unlock(struct proc* proc, struct proc_mutex* mutex, struct resch
|
||||
mutex->owner = resumed_proc;
|
||||
mutex->locked = true;
|
||||
|
||||
proc_sq_resume(resumed_proc, sq_entry, rctx);
|
||||
proc_sq_resume(resumed_proc, sq_entry, rctx, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <proc/suspension_q.h>
|
||||
#include <status.h>
|
||||
#include <sync/spin_lock.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/smp.h>
|
||||
#include <sys/spin_lock.h>
|
||||
|
||||
@@ -41,7 +42,8 @@ int proc_sq_suspend(struct proc* proc, struct proc_suspension_q* sq, struct resc
|
||||
return state;
|
||||
}
|
||||
|
||||
int proc_sq_resume(struct proc* proc, struct proc_sq_entry* sq_entry, struct reschedule_ctx* rctx) {
|
||||
int proc_sq_resume(struct proc* proc, struct proc_sq_entry* sq_entry, struct reschedule_ctx* rctx,
|
||||
uintptr_t value) {
|
||||
struct cpu* cpu = cpu_find_lightest();
|
||||
struct proc_suspension_q* sq = sq_entry->sq;
|
||||
|
||||
@@ -52,6 +54,7 @@ int proc_sq_resume(struct proc* proc, struct proc_sq_entry* sq_entry, struct res
|
||||
list_remove(proc->sq_entries, &sq_entry->proc_link);
|
||||
|
||||
proc->cpu = cpu;
|
||||
proc_set_syscall_value(proc, value);
|
||||
|
||||
if (proc->sq_entries == NULL)
|
||||
proc->state = PROC_READY;
|
||||
|
||||
@@ -28,6 +28,7 @@ void proc_sqs_cleanup(struct proc* proc);
|
||||
int proc_sq_suspend(struct proc* proc, struct proc_suspension_q* sq, struct reschedule_ctx* rctx,
|
||||
void* udata, sq_entry_free_udata_func_t free_func);
|
||||
|
||||
int proc_sq_resume(struct proc* proc, struct proc_sq_entry* sq_entry, struct reschedule_ctx* rctx);
|
||||
int proc_sq_resume(struct proc* proc, struct proc_sq_entry* sq_entry, struct reschedule_ctx* rctx,
|
||||
uintptr_t value);
|
||||
|
||||
#endif // _KERNEL_PROC_SUSPENTION_Q_H
|
||||
|
||||
Reference in New Issue
Block a user