From 45cea14165bac11f68fb4742e44a2662404656a5 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Fri, 22 Mar 2024 12:48:54 +0200 Subject: [PATCH] Kernel: Move sys_fork trampolines to kernel/arch/ directory --- kernel/CMakeLists.txt | 3 ++- kernel/arch/i386/Syscall.S | 18 ++++++++++++++++++ kernel/{kernel => arch/x86_64}/Syscall.S | 0 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 kernel/arch/i386/Syscall.S rename kernel/{kernel => arch/x86_64}/Syscall.S (100%) diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt index 14a2c771be..a7438da8bd 100644 --- a/kernel/CMakeLists.txt +++ b/kernel/CMakeLists.txt @@ -83,7 +83,6 @@ set(KERNEL_SOURCES kernel/Storage/Partition.cpp kernel/Storage/StorageDevice.cpp kernel/Syscall.cpp - kernel/Syscall.S kernel/Terminal/FramebufferTerminal.cpp kernel/Terminal/Serial.cpp kernel/Terminal/TTY.cpp @@ -111,6 +110,7 @@ if("${BANAN_ARCH}" STREQUAL "x86_64") arch/x86_64/interrupts.S arch/x86_64/PageTable.cpp arch/x86_64/Signal.S + arch/x86_64/Syscall.S arch/x86_64/Thread.S ) elseif("${BANAN_ARCH}" STREQUAL "i386") @@ -118,6 +118,7 @@ elseif("${BANAN_ARCH}" STREQUAL "i386") ${KERNEL_SOURCES} arch/i386/boot.S arch/i386/SpinLock.S + arch/i386/Syscall.S arch/i386/Thread.S ) else() diff --git a/kernel/arch/i386/Syscall.S b/kernel/arch/i386/Syscall.S new file mode 100644 index 0000000000..617549c45d --- /dev/null +++ b/kernel/arch/i386/Syscall.S @@ -0,0 +1,18 @@ +.global sys_fork_trampoline +sys_fork_trampoline: + subl $4, %esp + pushl %ebx + pushl %ebp + call read_rip + testl %eax, %eax + je .done + subl $8, %esp + pushl %eax + pushl %esp + call sys_fork + addl $16, %esp +.done: + popl %ebp + popl %ebx + addl $4, %esp + ret diff --git a/kernel/kernel/Syscall.S b/kernel/arch/x86_64/Syscall.S similarity index 100% rename from kernel/kernel/Syscall.S rename to kernel/arch/x86_64/Syscall.S