summaryrefslogtreecommitdiff
path: root/src/user/lib/thread.S
diff options
context:
space:
mode:
authordzwdz2023-08-14 18:51:07 +0200
committerdzwdz2023-08-14 18:51:07 +0200
commit642b5fb0007b64c77d186fcb018d571152ee1d47 (patch)
tree1c466461f3602d306be309a053edae558ef2568e /src/user/lib/thread.S
parent8050069c57b729c18c19b1a03ab6e4bf63b4735e (diff)
reorganization: first steps
Diffstat (limited to 'src/user/lib/thread.S')
-rw-r--r--src/user/lib/thread.S40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/user/lib/thread.S b/src/user/lib/thread.S
deleted file mode 100644
index 2900544..0000000
--- a/src/user/lib/thread.S
+++ /dev/null
@@ -1,40 +0,0 @@
-#define ASM_FILE 1
-#include <camellia/syscalls.h>
-#include <camellia/flags.h>
-
-.section .text
-.global thread_creates
-.type thread_creates, @function
-// void thread_creates(int flags, void (*fn)(void*), void *arg, void *stack);
-thread_creates:
- push %r12
- push %r13
- push %r14
-
- /* save fn, arg, stack */
- mov %rsi, %r12
- mov %rdx, %r13
- mov %rcx, %r14
-
- mov %rdi, %rsi
- or $(FORK_SHAREMEM | FORK_SHAREHANDLE), %rsi
- mov $_SYS_FORK, %rdi
- xor %rdx, %rdx
- syscall
-
- test %rax, %rax
- jz 1f
- /* in parent, return normally */
- pop %r14
- pop %r13
- pop %r12
- ret
-1: /* in child */
- mov %r14, %rsp
- mov %r13, %rdi
- call *%r12
-
- mov $_SYS_EXIT, %rdi
- xor %rsi, %rsi
- syscall
- hlt /* if all else fails... */