mirror of
https://github.com/Fennix-Project/Userspace.git
synced 2025-05-28 15:34:26 +00:00
libsys stub
This commit is contained in:
parent
06eb5a1467
commit
741e1e908f
@ -3,8 +3,10 @@ build:
|
||||
make --quiet -C libgcc build
|
||||
make --quiet -C libinit build
|
||||
make --quiet -C libssp build
|
||||
make --quiet -C libsys build
|
||||
|
||||
clean:
|
||||
make -C libgcc clean
|
||||
make -C libinit clean
|
||||
make -C libssp clean
|
||||
make -C libsys clean
|
||||
|
17
libs/include/syslib.h
Normal file
17
libs/include/syslib.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef __FENNIX_LIBS_SYS_H__
|
||||
#define __FENNIX_LIBS_SYS_H__
|
||||
|
||||
#include <types.h>
|
||||
|
||||
enum KCtl
|
||||
{
|
||||
KCTL_NULL,
|
||||
KCTL_GETPID,
|
||||
KCTL_GETTID,
|
||||
KCTL_GETUID,
|
||||
KCTL_GETGID,
|
||||
};
|
||||
|
||||
long DoCtl(uint64_t Command, uint64_t Arg1, uint64_t Arg2, uint64_t Arg3, uint64_t Arg4);
|
||||
|
||||
#endif // !__FENNIX_LIBS_SYS_H__
|
51
libs/libsys/Makefile
Normal file
51
libs/libsys/Makefile
Normal file
@ -0,0 +1,51 @@
|
||||
# Config file
|
||||
include ../../../Makefile.conf
|
||||
|
||||
NAME=sys
|
||||
|
||||
OBJECT_NAME=lib$(NAME).so
|
||||
SO_NAME=libsys
|
||||
|
||||
OUTPUT_DIR=../../out/system/lib/
|
||||
SYSROOT = --sysroot=../../out/system/
|
||||
|
||||
CC = ../../../$(TC_COMPILER_PATH)/$(TC_COMPILER_ARCH)gcc
|
||||
AS = ../../../$(TC_COMPILER_PATH)/$(TC_COMPILER_ARCH)as
|
||||
AR = ../../../$(TC_COMPILER_PATH)/$(TC_COMPILER_ARCH)ar
|
||||
OBJDUMP = ../../../$(TC_COMPILER_PATH)/$(TC_COMPILER_ARCH)objdump
|
||||
NASM = /usr/bin/nasm
|
||||
|
||||
C_SOURCES = $(shell find ./ -type f -name '*.c')
|
||||
CPP_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
S_SOURCES = $(shell find ./ -type f -name '*.S')
|
||||
ASM_SOURCES = $(shell find ./ -type f -name '*.asm')
|
||||
OBJ = ${C_SOURCES:.c=.o} ${CPP_SOURCES:.cpp=.o} ${ASM_SOURCES:.asm=.o} ${S_SOURCES:.S=.o}
|
||||
|
||||
ifeq ($(OSARCH), amd64)
|
||||
ASM_ARCH := elf64
|
||||
else ifeq ($(OSARCH), i686)
|
||||
ASM_ARCH := elf32
|
||||
endif
|
||||
|
||||
CFLAGS := -fPIC -I../include -I../../libc/include
|
||||
|
||||
build: $(OBJECT_NAME)
|
||||
|
||||
$(OBJECT_NAME): $(OBJ)
|
||||
$(CC) -nostdlib -shared -fPIC -Wl,-soname,$(SO_NAME) $(SYSROOT) $(OBJ) -o $(OUTPUT_DIR)$@
|
||||
$(OBJDUMP) -d $(OUTPUT_DIR)$@ > file_dump.map
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -std=c17 -c $< -o $@
|
||||
|
||||
%.o: %.cpp
|
||||
$(CC) $(CFLAGS) -std=c++20 -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(AS) -c $< -o $@
|
||||
|
||||
%.o: %.asm
|
||||
$(NASM) $< -f $(ASM_ARCH) -o $@
|
||||
|
||||
clean:
|
||||
rm -f file_dump.map $(OBJ)
|
8
libs/libsys/kcall.c
Normal file
8
libs/libsys/kcall.c
Normal file
@ -0,0 +1,8 @@
|
||||
#include <syslib.h>
|
||||
|
||||
#include "../../../Kernel/syscalls.h"
|
||||
|
||||
long DoCtl(uint64_t Command, uint64_t Arg1, uint64_t Arg2, uint64_t Arg3, uint64_t Arg4)
|
||||
{
|
||||
return syscall5(_KernelCTL, Command, Arg1, Arg2, Arg3, Arg4);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user