]> git.corax.cc Git - corax/commitdiff
Move fork() and execfve() syscalls from core to klibc
authorMatthias Kruk <m@m10k.eu>
Sat, 23 Nov 2019 06:37:49 +0000 (15:37 +0900)
committerMatthias Kruk <m@m10k.eu>
Sat, 23 Nov 2019 06:37:49 +0000 (15:37 +0900)
kernel/core/syscall.S
kernel/klibc/Makefile
kernel/klibc/posixcall.S [new file with mode: 0644]

index 075f9d71cfcf20d7d6a0b4656621ed5dc19988f8..61717ef9f26765edf2b11dad154d317911f9c827 100644 (file)
@@ -226,29 +226,6 @@ cxsendrecv:
        popl    %ebx
        ret
 
-.global fork
-fork:
-       pushl   %ebx
-
-       movl    $SYS_FORK, %eax
-       int             $SYSCALL_POSIX
-
-       popl    %ebx
-       ret
-
-.global execfve
-execfve:
-       pushl   %ebx
-
-       movl    $SYS_EXECFVE, %eax
-       movl    8(%esp), %ebx
-       movl    12(%esp), %ecx
-       movl    16(%esp), %edx
-       int             $SYSCALL_POSIX
-
-       popl    %ebx
-       ret
-
        .global sleep
 sleep:
        pushl   %ebx
index 515ccae576ccb8790a62a0952063c53529abc8ff..5c90acab94e3ffb547d61d09809ec771a59d202d 100644 (file)
@@ -1,5 +1,5 @@
 OUTPUT = klibc.a
-OBJECTS = string.o spinlock.o mutex.o
+OBJECTS = string.o spinlock.o mutex.o posixcall.o
 PHONY = clean
 INCLUDES = -I../include -I../../include -I../..
 CFLAGS = -m32 -Wall -nostdlib -nodefaultlibs -nostartfiles -ffreestanding $(INCLUDES)
diff --git a/kernel/klibc/posixcall.S b/kernel/klibc/posixcall.S
new file mode 100644 (file)
index 0000000..0b455c2
--- /dev/null
@@ -0,0 +1,34 @@
+#define _ASSEMBLY_SOURCE
+
+#include <config.h>
+#include <corax/syscall.h>
+
+#if FEATURE(POSIX)
+
+       .section .text
+
+       .global fork
+       .global execfve
+
+fork:
+       pushl   %ebx
+
+       movl    $SYS_FORK, %eax
+       int             $SYSCALL_POSIX
+
+       popl    %ebx
+       ret
+
+execfve:
+       pushl   %ebx
+
+       movl    $SYS_EXECFVE, %eax
+       movl    8(%esp), %ebx
+       movl    12(%esp), %ecx
+       movl    16(%esp), %edx
+       int             $SYSCALL_POSIX
+
+       popl    %ebx
+       ret
+
+#endif /* FEATURE(POSIX) */