Implement proc_spawn_thread syscall, fix proc_resume and proc_suspend
All checks were successful
Build documentation / build-and-deploy (push) Successful in 35s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 35s
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <sync/spin_lock.h>
|
||||
#include <sys/debug.h>
|
||||
#include <sys/mm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <syscall/syscall.h>
|
||||
|
||||
#define DEFINE_SYSCALL(name) \
|
||||
@@ -24,7 +25,7 @@ DEFINE_SYSCALL (sys_proc_quit) {
|
||||
/* int proc_test (void) */
|
||||
DEFINE_SYSCALL (sys_proc_test) {
|
||||
char c = (char)a1;
|
||||
DEBUG ("test syscall! %c\n", c);
|
||||
DEBUG ("test syscall from %d! %c\n", proc->pid, c);
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
@@ -163,6 +164,35 @@ DEFINE_SYSCALL (sys_proc_drop_resource) {
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
/* int proc_spawn_thread (uintptr_t vstack_top, size_t stack_size, void* entry) */
|
||||
DEFINE_SYSCALL (sys_proc_spawn_thread) {
|
||||
uintptr_t vstack_top = a1;
|
||||
size_t stack_size = (size_t)a2;
|
||||
uintptr_t entry = a3;
|
||||
|
||||
struct cpu* cpu = proc->cpu;
|
||||
|
||||
struct proc* new = proc_spawn_thread (proc, vstack_top, stack_size, entry);
|
||||
|
||||
DEBUG ("new=%p\n", new);
|
||||
|
||||
if (new == NULL) {
|
||||
return -SR_OOM_ERROR;
|
||||
}
|
||||
|
||||
int pid = new->pid;
|
||||
|
||||
proc_register (new, cpu);
|
||||
|
||||
return pid;
|
||||
}
|
||||
|
||||
/* int proc_sched (void) */
|
||||
DEFINE_SYSCALL (sys_proc_sched) {
|
||||
proc_sched (regs);
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static syscall_handler_func_t handler_table[] = {
|
||||
[SYS_PROC_QUIT] = &sys_proc_quit,
|
||||
[SYS_PROC_TEST] = &sys_proc_test,
|
||||
@@ -173,6 +203,8 @@ static syscall_handler_func_t handler_table[] = {
|
||||
[SYS_PROC_CREATE_RESOURCE_MUTEX] = &sys_proc_create_resource_mutex,
|
||||
[SYS_PROC_MUTEX_LOCK] = &sys_proc_mutex_lock,
|
||||
[SYS_PROC_MUTEX_UNLOCK] = &sys_proc_mutex_unlock,
|
||||
[SYS_PROC_SPAWN_THREAD] = &sys_proc_spawn_thread,
|
||||
[SYS_PROC_SCHED] = &sys_proc_sched,
|
||||
};
|
||||
|
||||
syscall_handler_func_t syscall_find_handler (int syscall_num) {
|
||||
|
||||
Reference in New Issue
Block a user