This commit is contained in:
Julian Barathieu 2021-03-09 13:33:43 +01:00
parent 9abb67a194
commit 6a3646bd28
No known key found for this signature in database
GPG Key ID: 2AA3A79C50CB07BD
4 changed files with 75 additions and 5 deletions

View File

@ -102,7 +102,7 @@ NC='\033[1;37m'
LibCSources = libc/mem.c libc/ctype.c \
libc/rand.c libc/sprintf.c \
libc/errno.c libc/string.c \
libc/strtol.c \
libc/strtol.c libc/syscall.c \
libbuf/bopen.c libbuf/bputc.c libbuf/bscroll.c \
libbuf/bprint.c libbuf/bgetc.c libbuf/bscan.c \
libbuf/bflush.c libbuf/bwrite.c libbuf/bread.c \
@ -219,6 +219,10 @@ $(KOBJDIR)/libc/mem.o: $(KALEIDDIR)/libc/mem.c | $(KOBJDIR)
@$(KCC) -fno-strict-aliasing $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/libc/syscall.o: $(KALEIDDIR)/libc/syscall.asm | $(KOBJDIR)
@mkdir -p $(shell dirname $@)
@$(ASM) $(ASMFLAGS) $(KALEIDDIR)/libc/syscall.asm -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
## KERNEL SPECIAL RECIPES MAKEFILE ------------------------------------------- #

View File

@ -13,10 +13,11 @@ registers
#### Arguments
rdi : system call code
rsi : first argument
rdx : second argument
r10 : third argument
rax : system call code
rdi : first argument
rsi : second argument
rdx : third argument
rcx : fourth argument
#### Return value

34
include/sys.h Normal file
View File

@ -0,0 +1,34 @@
//----------------------------------------------------------------------------//
// OS on Kaleid //
// //
// Desc: System calls //
// //
// //
// Copyright © 2018-2021 The OS/K Team //
// //
// This file is part of OS/K. //
// //
// OS/K is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// any later version. //
// //
// OS/K is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//
#ifndef _SYS_H
#define _SYS_H
#ifndef _LIBC_H
#include <libc.h>
#endif
error_t SysStartKernelShell(void);
#endif

31
kaleid/libc/syscall.asm Normal file
View File

@ -0,0 +1,31 @@
;=----------------------------------------------------------------------------=;
; OS on Kaleid ;
; ;
; Desc: System calls ;
; ;
; ;
; Copyright © 2018-2021 The OS/K Team ;
; ;
; This file is part of OS/K. ;
; ;
; OS/K is free software: you can redistribute it and/or modify ;
; it under the terms of the GNU General Public License as published by ;
; the Free Software Foundation, either version 3 of the License, or ;
; (at your option) any later version. ;
; ;
; OS/K is distributed in the hope that it will be useful, ;
; but WITHOUT ANY WARRANTY; without even the implied warranty of ;
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;
; GNU General Public License for more details. ;
; ;
; You should have received a copy of the GNU General Public License ;
; along with OS/K. If not, see <https://www.gnu.org/licenses/>. ;
;=----------------------------------------------------------------------------=;
global SysStartKernelShell
SysStartKernelShell:
mov eax, 4
int $0x80
ret