This commit is contained in:
2026-08-14 21:31:01 +02:00
parent 40cea4dedd
commit ac9d47fa16
58 changed files with 148 additions and 37 deletions
+11 -10
View File
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT
#include <zinnia/handle.h>
#include <zinnia/rights.h>
#include <zinnia/status.h>
@@ -14,11 +16,11 @@
#include <string.h>
zn_status_t syscall_thread_create(struct arch_context* ctx) {
zn_handle_t ns_handle = ctx->ARCH_CTX_A0;
__user const char* name = (__user const char*)ctx->ARCH_CTX_A1;
size_t name_len = ctx->ARCH_CTX_A2;
enum zn_thread_flags flags = ctx->ARCH_CTX_A3;
__user zn_handle_t* out = (__user zn_handle_t*)ctx->ARCH_CTX_A4;
zn_handle_t ns_handle = ctx->a0;
__user const char* name = (__user const char*)ctx->a1;
size_t name_len = ctx->a2;
enum zn_thread_flags flags = ctx->a3;
__user zn_handle_t* out = (__user zn_handle_t*)ctx->a4;
struct task* current = percpu_get()->sched.current;
// Resolve namespace.
@@ -44,7 +46,6 @@ zn_status_t syscall_thread_create(struct arch_context* ctx) {
return ZN_ERR_BAD_BUFFER;
// Create the task sharing the caller's address space.
// Uses sched_to_user as a placeholder entry — the real IP/SP come from thread_start.
struct task* new_task;
zn_status_t status = task_create(task_name, current->space, ns, sched_to_user, 0, &new_task);
if (status != ZN_OK)
@@ -71,10 +72,10 @@ zn_status_t syscall_thread_create(struct arch_context* ctx) {
}
zn_status_t syscall_thread_start(struct arch_context* ctx) {
zn_handle_t thread_handle = ctx->ARCH_CTX_A0;
uintptr_t ip = ctx->ARCH_CTX_A1;
uintptr_t sp = ctx->ARCH_CTX_A2;
uintptr_t arg = ctx->ARCH_CTX_A3;
zn_handle_t thread_handle = ctx->a0;
uintptr_t ip = ctx->a1;
uintptr_t sp = ctx->a2;
uintptr_t arg = ctx->a3;
struct task* current = percpu_get()->sched.current;
struct sched_percpu* sched = &percpu_get()->sched;