From 88036fb036642af4bd68cb77927cb5bd64c22ea0 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Sat, 23 Nov 2019 15:43:48 +0900 Subject: [PATCH] Move cxsend(), cxrecv(), cxsendrecv() syscalls from core into klibc --- kernel/core/syscall.S | 39 ------------------------------------ kernel/klibc/Makefile | 2 +- kernel/klibc/coraxcall.S | 43 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 40 deletions(-) create mode 100644 kernel/klibc/coraxcall.S diff --git a/kernel/core/syscall.S b/kernel/core/syscall.S index 61717ef..fbb6308 100644 --- a/kernel/core/syscall.S +++ b/kernel/core/syscall.S @@ -187,45 +187,6 @@ bind: popl %ebx ret -/* int cxsend(pid_t dst, struct ipc_msg *buf) */ - -.global cxsend -cxsend: - pushl %ebx - - movl $IPC_SEND, %eax - movl 8(%esp), %ebx - movl 12(%esp), %ecx - int $SYSCALL_CXIPC - - popl %ebx - ret - -/* int cxrecv(pid_t src, struct ipc_msg *buf) */ -.global cxrecv -cxrecv: - pushl %ebx - - movl $IPC_RECV, %eax - movl 8(%esp), %ebx - movl 12(%esp), %ecx - int $SYSCALL_CXIPC - - popl %ebx - ret - -.global cxsendrecv -cxsendrecv: - pushl %ebx - - movl $IPC_SENDRECV, %eax - movl 8(%esp), %ebx - movl 12(%esp), %ecx - int $SYSCALL_CXIPC - - popl %ebx - ret - .global sleep sleep: pushl %ebx diff --git a/kernel/klibc/Makefile b/kernel/klibc/Makefile index 5c90aca..f4f88a0 100644 --- a/kernel/klibc/Makefile +++ b/kernel/klibc/Makefile @@ -1,5 +1,5 @@ OUTPUT = klibc.a -OBJECTS = string.o spinlock.o mutex.o posixcall.o +OBJECTS = string.o spinlock.o mutex.o posixcall.o coraxcall.o PHONY = clean INCLUDES = -I../include -I../../include -I../.. CFLAGS = -m32 -Wall -nostdlib -nodefaultlibs -nostartfiles -ffreestanding $(INCLUDES) diff --git a/kernel/klibc/coraxcall.S b/kernel/klibc/coraxcall.S new file mode 100644 index 0000000..5dc0bc9 --- /dev/null +++ b/kernel/klibc/coraxcall.S @@ -0,0 +1,43 @@ +#define __ASSEMBLY_SOURCE + +#include +#include + + .section .text + + .global cxsend + .global cxrecv + .global cxsendrecv + +cxsend: + pushl %ebx + + movl $IPC_SEND, %eax + movl 8(%esp), %ebx + movl 12(%esp), %ecx + int $SYSCALL_CXIPC + + popl %ebx + ret + +cxrecv: + pushl %ebx + + movl $IPC_RECV, %eax + movl 8(%esp), %ebx + movl 12(%esp), %ecx + int $SYSCALL_CXIPC + + popl %ebx + ret + +cxsendrecv: + pushl %ebx + + movl $IPC_SENDRECV, %eax + movl 8(%esp), %ebx + movl 12(%esp), %ecx + int $SYSCALL_CXIPC + + popl %ebx + ret -- 2.47.3