Update userspace

This commit is contained in:
Alex
2023-08-06 04:52:48 +03:00
parent 0f8cb900cb
commit 2fd23205db
49 changed files with 437 additions and 525 deletions

View File

@ -5,22 +5,22 @@
uintptr_t RequestPages(size_t Count)
{
return syscall1(_RequestPages, Count);
return syscall1(sys_RequestPages, Count);
}
int FreePages(uintptr_t Address, size_t Count)
{
return syscall2(_FreePages, Address, Count);
return syscall2(sys_FreePages, Address, Count);
}
int IPC(int Command, int Type, int ID, int Flags, void *Buffer, size_t Size)
{
return syscall6(_IPC, (long)Command, (long)Type, (long)ID, (long)Flags, (long)Buffer, (long)Size);
return syscall6(sys_IPC, (long)Command, (long)Type, (long)ID, (long)Flags, (long)Buffer, (long)Size);
}
uintptr_t KernelCTL(int Command, uint64_t Arg1, uint64_t Arg2, uint64_t Arg3, uint64_t Arg4)
{
return syscall5(_KernelCTL, Command, Arg1, Arg2, Arg3, Arg4);
return syscall5(sys_KernelCTL, Command, Arg1, Arg2, Arg3, Arg4);
}
int abs(int i) { return i < 0 ? -i : i; }
@ -112,38 +112,38 @@ int strcmp(const char *l, const char *r)
struct Elf64_Dyn ELFGetDynamicTag(char *Path, enum DynamicTags Tag)
{
void *KP = syscall2(_FileOpen, Path, (long)"r");
if (KP == NULL)
syscall1(_Exit, -0xF17E);
int fd = syscall2(sys_FileOpen, Path, (long)"r");
if (fd < 0)
syscall1(sys_Exit, -0xF17E);
Elf64_Ehdr ELFHeader;
syscall3(_FileRead, KP, &ELFHeader, sizeof(Elf64_Ehdr));
syscall3(sys_FileRead, fd, &ELFHeader, sizeof(Elf64_Ehdr));
Elf64_Phdr ItrProgramHeader;
for (Elf64_Half i = 0; i < ELFHeader.e_phnum; i++)
{
// memcpy(&ItrProgramHeader, (uint8_t *)ElfFile + ELFHeader.e_phoff + ELFHeader.e_phentsize * i, sizeof(Elf64_Phdr));
syscall3(_FileSeek, KP, ELFHeader.e_phoff + ELFHeader.e_phentsize * i, SEEK_SET);
syscall3(_FileRead, KP, &ItrProgramHeader, sizeof(Elf64_Phdr));
syscall3(sys_FileSeek, fd, ELFHeader.e_phoff + ELFHeader.e_phentsize * i, SYSCALL_SEEK_SET);
syscall3(sys_FileRead, fd, &ItrProgramHeader, sizeof(Elf64_Phdr));
if (ItrProgramHeader.p_type == PT_DYNAMIC)
{
struct Elf64_Dyn Dynamic; // = (struct Elf64_Dyn *)((uint8_t *)ElfFile + ItrProgramHeader.p_offset);
syscall3(_FileSeek, KP, ItrProgramHeader.p_offset, SEEK_SET);
syscall3(_FileRead, KP, &Dynamic, ItrProgramHeader.p_filesz);
syscall3(sys_FileSeek, fd, ItrProgramHeader.p_offset, SYSCALL_SEEK_SET);
syscall3(sys_FileRead, fd, &Dynamic, ItrProgramHeader.p_filesz);
for (size_t i = 0; i < ItrProgramHeader.p_filesz / sizeof(struct Elf64_Dyn); i++)
{
if (Dynamic.d_tag == Tag || Dynamic.d_tag == DT_NULL)
{
syscall1(_FileClose, KP);
syscall1(sys_FileClose, fd);
return Dynamic;
}
syscall3(_FileSeek, KP, ItrProgramHeader.p_offset + (i + 1) * sizeof(struct Elf64_Dyn), SEEK_SET);
syscall3(_FileRead, KP, &Dynamic, sizeof(struct Elf64_Dyn));
syscall3(sys_FileSeek, fd, ItrProgramHeader.p_offset + (i + 1) * sizeof(struct Elf64_Dyn), SYSCALL_SEEK_SET);
syscall3(sys_FileRead, fd, &Dynamic, sizeof(struct Elf64_Dyn));
}
}
}
syscall1(_FileClose, KP);
syscall1(sys_FileClose, fd);
return (struct Elf64_Dyn){0};
}
@ -168,12 +168,12 @@ char *GetELFStringTable(Elf64_Ehdr *Header)
Elf64_Sym ELFLookupSymbol(char *Path, const char *Name)
{
void *KP = syscall2(_FileOpen, Path, (long)"r");
if (KP == NULL)
syscall1(_Exit, -0xF17E);
int fd = syscall2(sys_FileOpen, Path, (long)"r");
if (fd < 0)
syscall1(sys_Exit, -0xF17E);
Elf64_Ehdr ELFHeader;
syscall3(_FileRead, KP, &ELFHeader, sizeof(Elf64_Ehdr));
syscall3(sys_FileRead, fd, &ELFHeader, sizeof(Elf64_Ehdr));
Elf64_Shdr SymbolTable;
Elf64_Shdr StringTable;
@ -183,20 +183,20 @@ Elf64_Sym ELFLookupSymbol(char *Path, const char *Name)
for (Elf64_Half i = 0; i < ELFHeader.e_shnum; i++)
{
Elf64_Shdr shdr;
syscall3(_FileSeek, KP,
syscall3(sys_FileSeek, fd,
ELFHeader.e_shoff + ELFHeader.e_shentsize * i,
SEEK_SET);
syscall3(_FileRead, KP, &shdr, sizeof(Elf64_Shdr));
SYSCALL_SEEK_SET);
syscall3(sys_FileRead, fd, &shdr, sizeof(Elf64_Shdr));
switch (shdr.sh_type)
{
case SHT_SYMTAB:
{
SymbolTable = shdr;
syscall3(_FileSeek, KP,
syscall3(sys_FileSeek, fd,
ELFHeader.e_shoff + ELFHeader.e_shentsize * shdr.sh_link,
SEEK_SET);
syscall3(_FileRead, KP, &StringTable, sizeof(Elf64_Shdr));
SYSCALL_SEEK_SET);
syscall3(sys_FileRead, fd, &StringTable, sizeof(Elf64_Shdr));
break;
}
default:
@ -208,7 +208,7 @@ Elf64_Sym ELFLookupSymbol(char *Path, const char *Name)
if (SymbolTable.sh_size == 0 || StringTable.sh_size == 0)
{
syscall1(_FileClose, KP);
syscall1(sys_FileClose, fd);
return (Elf64_Sym){0};
}
@ -216,19 +216,19 @@ Elf64_Sym ELFLookupSymbol(char *Path, const char *Name)
{
// Symbol = (Elf64_Sym *)((uintptr_t)Header + SymbolTable->sh_offset + (i * sizeof(Elf64_Sym)));
// String = (char *)((uintptr_t)Header + StringTable->sh_offset + Symbol->st_name);
syscall3(_FileSeek, KP, SymbolTable.sh_offset + (i * sizeof(Elf64_Sym)), SEEK_SET);
syscall3(_FileRead, KP, &Symbol, sizeof(Elf64_Sym));
syscall3(sys_FileSeek, fd, SymbolTable.sh_offset + (i * sizeof(Elf64_Sym)), SYSCALL_SEEK_SET);
syscall3(sys_FileRead, fd, &Symbol, sizeof(Elf64_Sym));
syscall3(_FileSeek, KP, StringTable.sh_offset + Symbol.st_name, SEEK_SET);
syscall3(_FileRead, KP, &String, sizeof(char *));
syscall3(sys_FileSeek, fd, StringTable.sh_offset + Symbol.st_name, SYSCALL_SEEK_SET);
syscall3(sys_FileRead, fd, &String, sizeof(char *));
if (strcmp(String, Name) == 0)
{
syscall1(_FileClose, KP);
syscall1(sys_FileClose, fd);
return Symbol;
}
}
syscall1(_FileClose, KP);
syscall1(sys_FileClose, fd);
return (Elf64_Sym){0};
}

View File

@ -90,9 +90,6 @@ void (*ELF_LAZY_RESOLVE_MAIN(struct LibsCollection *Info, long RelIndex))()
which determines the end of the list. */
while (CurLib->Valid)
{
KernelCTL(KCTL_GET_ABSOLUTE_PATH, CurLib->LibraryName,
LibraryPathBuffer, sizeof(LibraryPathBuffer), 0);
PrintDbg("-- ");
PrintDbg(LibraryPathBuffer);
PrintDbg(" ");
@ -105,46 +102,46 @@ void (*ELF_LAZY_RESOLVE_MAIN(struct LibsCollection *Info, long RelIndex))()
Elf64_Ehdr lib_Header;
Elf64_Ehdr app_Header;
void *KP_lib = syscall2(_FileOpen, LibraryPathBuffer, "r");
void *KP_app = syscall2(_FileOpen, ParentPath, "r");
int fd_lib = syscall2(sys_FileOpen, LibraryPathBuffer, "r");
int fd_app = syscall2(sys_FileOpen, ParentPath, "r");
if (!KP_lib)
if (fd_lib < 0)
{
PrintNL("Failed to open library");
goto RetryNextLib;
}
if (!KP_app)
if (fd_app < 0)
{
PrintNL("Failed to open application");
goto RetryNextLib;
}
syscall3(_FileRead, KP_lib, &lib_Header, sizeof(Elf64_Ehdr));
syscall3(_FileRead, KP_app, &app_Header, sizeof(Elf64_Ehdr));
syscall3(sys_FileRead, fd_lib, &lib_Header, sizeof(Elf64_Ehdr));
syscall3(sys_FileRead, fd_app, &app_Header, sizeof(Elf64_Ehdr));
Elf64_Phdr ItrProgramHeader;
for (Elf64_Half i = 0; i < lib_Header.e_phnum; i++)
{
syscall3(_FileSeek, KP_lib,
syscall3(sys_FileSeek, fd_lib,
lib_Header.e_phoff +
lib_Header.e_phentsize * i,
SEEK_SET);
SYSCALL_SEEK_SET);
syscall3(_FileRead, KP_lib, &ItrProgramHeader, sizeof(Elf64_Phdr));
syscall3(sys_FileRead, fd_lib, &ItrProgramHeader, sizeof(Elf64_Phdr));
lib_BaseAddress = MIN(lib_BaseAddress, ItrProgramHeader.p_vaddr);
}
for (Elf64_Half i = 0; i < app_Header.e_phnum; i++)
{
syscall3(_FileSeek, KP_app,
syscall3(sys_FileSeek, fd_app,
app_Header.e_phoff +
app_Header.e_phentsize * i,
SEEK_SET);
SYSCALL_SEEK_SET);
syscall3(_FileRead, KP_app, &ItrProgramHeader, sizeof(Elf64_Phdr));
syscall3(sys_FileRead, fd_app, &ItrProgramHeader, sizeof(Elf64_Phdr));
app_BaseAddress = MIN(app_BaseAddress, ItrProgramHeader.p_vaddr);
}
@ -268,7 +265,7 @@ FailEnd:
Print(DbgBuff);
PrintNL(" not found");
int ExitCode = 0x51801;
syscall1(_Exit, ExitCode);
syscall1(sys_Exit, ExitCode);
while (1) // Make sure we don't return
;
}
@ -280,9 +277,9 @@ int ld_main()
uintptr_t KCTL_ret = KernelCTL(KCTL_IS_CRITICAL, 0, 0, 0, 0);
do
{
syscall1(_Sleep, 250);
syscall1(sys_Sleep, 250);
KCTL_ret = KernelCTL(KCTL_IS_CRITICAL, 0, 0, 0, 0);
} while (KCTL_ret == SYSCALL_ACCESS_DENIED);
} while (KCTL_ret == false);
if (KCTL_ret == false)
return -1;
@ -307,111 +304,21 @@ bool ELFAddLazyResolverToGOT(void *MemoryImage, struct LibsCollection *Libs)
/* Actual load */
int ld_load(int argc, char *argv[], char *envp[])
{
PrintDbgNL("!");
uintptr_t PageSize = KernelCTL(KCTL_GET_PAGE_SIZE, 0, 0, 0, 0);
int PagesForIPCDataStruct = sizeof(InterpreterIPCData) / PageSize + 1;
int PagesForLibsCollectionStruct = sizeof(struct LibsCollection) / PageSize + 1;
InterpreterIPCData *IPCBuffer =
(InterpreterIPCData *)RequestPages(PagesForIPCDataStruct);
int IPC_ID = IPC(IPC_CREATE, IPC_TYPE_MessagePassing,
0, 0, "LOAD", sizeof(InterpreterIPCData));
while (true)
{
IPC(IPC_LISTEN, IPC_TYPE_MessagePassing, IPC_ID, 1, NULL, 0);
IPC(IPC_WAIT, IPC_TYPE_MessagePassing, IPC_ID, 0, NULL, 0);
int IPCResult = IPC(IPC_READ, IPC_TYPE_MessagePassing,
IPC_ID, 0, IPCBuffer, PageSize);
if (IPCResult == IPC_E_CODE_Success)
break;
}
struct LibsCollection *LibsForLazyResolver =
(struct LibsCollection *)RequestPages(PagesForLibsCollectionStruct);
for (short i = 0; i < 64; i++)
{
if (IPCBuffer->Libraries[i].Name[0] == '\0')
break;
uintptr_t lib_mm_image =
KernelCTL(KCTL_GET_ELF_LIB_MEMORY_IMAGE,
(uint64_t)IPCBuffer->Libraries[i].Name, 0, 0, 0);
if (lib_mm_image == 0)
{
enum SyscallsErrorCodes ret =
KernelCTL(KCTL_REGISTER_ELF_LIB,
(uint64_t)IPCBuffer->Libraries[i].Name,
(uint64_t)IPCBuffer->Libraries[i].Name, 0, 0);
if (ret != SYSCALL_OK)
{
PrintNL("Failed to register ELF lib");
return -0x11B;
}
lib_mm_image = KernelCTL(KCTL_GET_ELF_LIB_MEMORY_IMAGE,
(uint64_t)IPCBuffer->Libraries[i].Name, 0, 0, 0);
}
if (LibsForLazyResolver->Next == NULL)
{
LibsForLazyResolver->Valid = true;
LibsForLazyResolver->LibraryMemoryImage = (uintptr_t)lib_mm_image;
LibsForLazyResolver->ParentMemoryImage = (uintptr_t)IPCBuffer->MemoryImage;
for (short j = 0; j < sizeof(LibsForLazyResolver->LibraryName); j++)
LibsForLazyResolver->LibraryName[j] = IPCBuffer->Libraries[i].Name[j];
LibsForLazyResolver->Next =
(struct LibsCollection *)RequestPages(PagesForLibsCollectionStruct);
memset(LibsForLazyResolver->Next, 0, sizeof(struct LibsCollection));
continue;
}
struct LibsCollection *CurrentLib = LibsForLazyResolver;
while (CurrentLib->Next != NULL)
CurrentLib = CurrentLib->Next;
CurrentLib->Valid = true;
CurrentLib->LibraryMemoryImage = (uintptr_t)lib_mm_image;
CurrentLib->ParentMemoryImage = (uintptr_t)IPCBuffer->MemoryImage;
for (short j = 0; j < sizeof(LibsForLazyResolver->LibraryName); j++)
CurrentLib->LibraryName[j] = IPCBuffer->Libraries[i].Name[j];
CurrentLib->Next =
(struct LibsCollection *)RequestPages(PagesForLibsCollectionStruct);
memset(CurrentLib->Next, 0, sizeof(struct LibsCollection));
}
struct LibsCollection *CurrentLib = LibsForLazyResolver;
for (int i = 0; i < sizeof(ParentPath); i++)
ParentPath[i] = IPCBuffer->Path[i];
if (!ELFAddLazyResolverToGOT(IPCBuffer->MemoryImage,
LibsForLazyResolver))
{
PrintNL("Failed to add lazy resolver to GOT");
return -0x607;
}
void *KP = syscall2(_FileOpen, ParentPath, (long)"r");
if (KP == NULL)
{
PrintNL("Failed to open file");
syscall1(_Exit, -0xF17E);
}
Elf64_Ehdr ELFHeader;
syscall3(_FileRead, KP, &ELFHeader, sizeof(Elf64_Ehdr));
Elf64_Addr Entry = ELFHeader.e_entry;
syscall1(_FileClose, KP);
IPC(IPC_DELETE, IPC_TYPE_MessagePassing, IPC_ID, 0, NULL, 0);
FreePages((uintptr_t)IPCBuffer, PagesForIPCDataStruct);
PrintDbgNL("Calling entry point");
return ((int (*)(int, char *[], char *[]))Entry)(argc, argv, envp);
// void *KP = syscall2(sys_FileOpen, ParentPath, (long)"r");
// if (KP == NULL)
// {
// PrintNL("Failed to open file");
// syscall1(sys_Exit, -0xF17E);
// }
// Elf64_Ehdr ELFHeader;
// syscall3(sys_FileRead, KP, &ELFHeader, sizeof(Elf64_Ehdr));
// Elf64_Addr Entry = ELFHeader.e_entry;
// syscall1(sys_FileClose, KP);
// return ((int (*)(int, char *[], char *[]))Entry)(argc, argv, envp);
}

View File

@ -1,6 +1,6 @@
build:
cp -r include/* ../out/usr/include
cp ../../Kernel/syscalls.h ../out/usr/include/sys
cp -r include/* ../out/include
cp ../../Kernel/syscalls.h ../out/include/fennix/syscall.h
make -C runtime build
make -C src build
make -C ElfInterpreter build

6
libc/include/features.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef _FEATURES_H
#define _FEATURES_H
#define __FENNIX_LIBC__ 1
#endif

View File

34
libc/include/setjmp.h Normal file
View File

@ -0,0 +1,34 @@
#ifndef _SETJMP_H
#define _SETJMP_H
#include <stdint.h>
typedef struct
{
uint64_t r15;
uint64_t r14;
uint64_t r13;
uint64_t r12;
uint64_t r11;
uint64_t r10;
uint64_t r9;
uint64_t r8;
uint64_t rbp;
uint64_t rsp;
uint64_t rdi;
uint64_t rsi;
uint64_t rdx;
uint64_t rcx;
uint64_t rbx;
uint64_t rax;
uint64_t rip;
uint64_t rflags;
uint64_t cs;
uint64_t fs;
uint64_t gs;
} jmp_buf[1];
int setjmp(jmp_buf env);
__attribute__((noreturn)) void longjmp(jmp_buf env, int value);
#endif // !_SETJMP_H

6
libc/include/stdint.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef _STDINT_H
#define _STDINT_H
#include <types.h>
#endif // !_STDINT_H

View File

@ -41,8 +41,6 @@ struct _IO_FILE
struct _IO_marker *_markers;
struct _IO_FILE *_chain;
int _fileno;
void *KernelPrivate;
};
typedef struct _IO_FILE FILE;

View File

@ -27,7 +27,7 @@ else ifeq ($(OSARCH), i386)
ASM_ARCH := elf32
endif
CFLAGS := -fvisibility=hidden -fPIC -I../include -I../../out/usr/include
CFLAGS := -fvisibility=hidden -fPIC -I../include -I../../out/include
ifeq ($(DEBUG), 1)
CFLAGS += -DDEBUG -ggdb3 -O0 -fdiagnostics-color=always -fverbose-asm

View File

@ -1,4 +1,4 @@
#include <sys/syscalls.h>
#include <fennix/syscall.h>
#include <sys/types.h> // For PUBLIC
extern void __libc_init_array(void);
@ -17,7 +17,7 @@ PUBLIC void _exit(int Code)
{
__libc_fini_std();
__libc_fini_array();
syscall1(_Exit, (long)Code);
syscall1(sys_Exit, (long)Code);
while (1)
;
}

View File

@ -17,10 +17,10 @@ extern "C" int liballoc_unlock()
extern "C" void *liballoc_alloc(size_t Pages)
{
return (void *)syscall1(_RequestPages, Pages);
return (void *)syscall1(sys_RequestPages, Pages);
}
extern "C" int liballoc_free(void *Address, size_t Pages)
{
return syscall2(_FreePages, (uint64_t)Address, Pages);
return syscall2(sys_FreePages, (uint64_t)Address, Pages);
}

11
libc/src/setjmp.c Normal file
View File

@ -0,0 +1,11 @@
#include <setjmp.h>
PUBLIC int setjmp(jmp_buf env)
{
return 0;
}
PUBLIC __attribute__((noreturn)) void longjmp(jmp_buf env, int value)
{
_exit(value);
}

View File

@ -1,9 +1,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <sys/syscalls.h>
#include <errno.h>
#include <fennix/syscall.h>
#include <sys/types.h> // For PUBLIC
PUBLIC FILE *stdin = NULL;
@ -12,12 +12,12 @@ PUBLIC FILE *stderr = NULL;
PUBLIC FILE *fopen(const char *filename, const char *mode)
{
void *KPrivate = (void *)syscall2(_FileOpen, (uint64_t)filename, (uint64_t)mode);
if (IsSyscallError(KPrivate))
int fd = syscall2(sys_FileOpen, (uint64_t)filename, (uint64_t)mode);
if (fd < 0)
return NULL;
FILE *FilePtr = malloc(sizeof(FILE));
FilePtr->KernelPrivate = KPrivate;
FilePtr->_fileno = fd;
return FilePtr;
}
@ -29,8 +29,8 @@ PUBLIC size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
return 0;
}
syscall3(_FileSeek, stream->KernelPrivate, stream->_offset, SEEK_SET);
return syscall3(_FileRead, (uint64_t)stream->KernelPrivate, (uint64_t)ptr, size * nmemb);
syscall3(sys_FileSeek, stream->_fileno, stream->_offset, SEEK_SET);
return syscall3(sys_FileRead, (uint64_t)stream->_fileno, (uint64_t)ptr, size * nmemb);
}
PUBLIC size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
@ -41,8 +41,8 @@ PUBLIC size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
return 0;
}
syscall3(_FileSeek, stream->KernelPrivate, stream->_offset, SEEK_SET);
return syscall3(_FileWrite, (uint64_t)stream->KernelPrivate, (uint64_t)ptr, size * nmemb);
syscall3(sys_FileSeek, stream->_fileno, stream->_offset, SEEK_SET);
return syscall3(sys_FileWrite, (uint64_t)stream->_fileno, (uint64_t)ptr, size * nmemb);
}
PUBLIC int fclose(FILE *fp)
@ -53,9 +53,7 @@ PUBLIC int fclose(FILE *fp)
return EOF;
}
void *KP = fp->KernelPrivate;
free(fp);
return syscall1(_FileClose, (uint64_t)KP);
return syscall1(sys_FileClose, fp->_fileno);
}
PUBLIC off_t fseek(FILE *stream, off_t offset, int whence)
@ -66,8 +64,8 @@ PUBLIC off_t fseek(FILE *stream, off_t offset, int whence)
return -1;
}
off_t new_offset = syscall3(_FileSeek, stream->KernelPrivate, offset, whence);
if (IsSyscallError(new_offset))
off_t new_offset = syscall3(sys_FileSeek, stream->_fileno, offset, whence);
if (new_offset < 0)
return -1;
stream->_offset = new_offset;
return new_offset;

View File

@ -1,6 +1,6 @@
#include <stdio.h>
#include <stdarg.h>
#include <sys/syscalls.h>
#include <fennix/syscall.h>
#include <sys/types.h> // For PUBLIC
@ -12,8 +12,8 @@ PUBLIC int fputc(int c, FILE *stream)
// errno = EBADF;
// return EOF;
// }
return syscall2(_Print, c, 0);
char str[2] = {c, '\0'};
return syscall3(sys_KernelCTL, KCTL_PRINT, str, 0);
}
PUBLIC int putc(int c, FILE *stream) { return fputc(c, stream); }

View File

@ -2,13 +2,13 @@
#include <stddef.h>
#include <string.h>
#include <sys/syscalls.h>
#include <fennix/syscall.h>
#include "../mem/liballoc_1_1.h"
PUBLIC void abort(void)
{
syscall1(_Exit, -0xAB057);
syscall1(sys_Exit, -0xAB057);
while (1)
;
}

View File

@ -47,5 +47,5 @@ PUBLIC int execve(const char *pathname, char *const argv[], char *const envp[])
PUBLIC pid_t fork(void)
{
return syscall0(_Fork);
return syscall0(sys_Fork);
}

View File

@ -3,12 +3,12 @@
#include <errno.h>
#include "../../../Kernel/syscalls.h"
unsigned int sleep(unsigned int seconds)
PUBLIC unsigned int sleep(unsigned int seconds)
{
return syscall1(_Sleep, seconds * 1000000);
return syscall1(sys_Sleep, seconds * 1000000);
}
int usleep(useconds_t usec)
PUBLIC int usleep(useconds_t usec)
{
return syscall1(_Sleep, usec);
return syscall1(sys_Sleep, usec);
}