aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/proc.c2
-rw-r--r--common/tcb.c5
-rw-r--r--common/uapi/proc.c6
3 files changed, 11 insertions, 2 deletions
diff --git a/common/proc.c b/common/proc.c
index b2caa54..6a3bedf 100644
--- a/common/proc.c
+++ b/common/proc.c
@@ -23,7 +23,7 @@ stat_t prepare_proc(struct tcb *t, vm_t bin, vm_t interp)
alloc_stacks(t);
set_thread(t);
- set_return(entry);
+ set_return(t, entry);
return OK;
}
diff --git a/common/tcb.c b/common/tcb.c
index 8ff86ab..f618cd6 100644
--- a/common/tcb.c
+++ b/common/tcb.c
@@ -342,3 +342,8 @@ stat_t clone_proc_maps(struct tcb *r)
return OK;
}
+
+void set_return(struct tcb *t, vm_t v)
+{
+ t->exec = v;
+}
diff --git a/common/uapi/proc.c b/common/uapi/proc.c
index d1d2bd7..a668246 100644
--- a/common/uapi/proc.c
+++ b/common/uapi/proc.c
@@ -91,7 +91,11 @@ SYSCALL_DEFINE2(exec)(sys_arg_t bin, sys_arg_t interp){
*/
SYSCALL_DEFINE2(spawn)(sys_arg_t bin, sys_arg_t interp)
{
- /* @todo implement */
+ struct tcb *t = create_proc(NULL);
+ if (!t)
+ return (struct sys_ret){ERR_OOMEM, 0, 0, 0, 0, 0};
+
+ return (struct sys_ret){prepare_proc(t, bin, interp), t->pid, 0, 0, 0, 0};
}
/**