summaryrefslogtreecommitdiff
path: root/userspace/sys/syscalls.c
diff options
context:
space:
mode:
Diffstat (limited to 'userspace/sys/syscalls.c')
-rw-r--r--userspace/sys/syscalls.c158
1 files changed, 0 insertions, 158 deletions
diff --git a/userspace/sys/syscalls.c b/userspace/sys/syscalls.c
deleted file mode 100644
index 10e035c..0000000
--- a/userspace/sys/syscalls.c
+++ /dev/null
@@ -1,158 +0,0 @@
-#include "kernel/syscalls.h"
-
-extern char **environ;
-//struct _reent *_impure_ptr;
-
-// generic syscall interface!
-
-int __attribute__ ((noinline)) syscall(int call, int p1, int p2, int p3)
-{
- int ebx; // will hold return value;
-
- // select syscall and pass params
- asm("pusha");
-
- asm("mov %0, %%eax"::"m"(call));
-
- asm("mov %0,%%edx"::"m"(p1));
- asm("mov %0,%%ecx"::"m"(p2));
- asm("mov %0,%%ebx"::"m"(p3));
-
- // interrrupt
- asm("int $0x80");
-
- // get return value
- asm("mov %%ebx, %0": "=b" (ebx));
-
- asm("popa");
-
- return ebx;
-}
-
-// fool os custom
-int readdir(const char *name,fs_dirent *dirs,int max)
-{
-
- return syscall(SYSCALL_READDIR,name,dirs,max);
-}
-
-int has_data_waiting()
-{
-
- return syscall(SYSCALL_HAS_DATA,0,0,0);
-}
-
-int fool_tune(int v1, int v2, int v3)
-{
-
- return syscall(SYSCALL_TUNE,v1,v2,v3);
-}
-
-void _exit(int ret)
-{
- _exit2(ret,environ);
-}
-
-void _exit2(int ret,char **environ)
-{
- return syscall(SYSCALL_EXIT,ret,environ,0);
-}
-
-//required by newlibc
-int close(int file)
-{
- return syscall(SYSCALL_CLOSE,file,0,0);
-}
-
-int isatty(int file)
-{
- return syscall(SYSCALL_ISATTY,file,0,0);
-}
-
-int lseek(int file, int ptr, int dir)
-{
- return syscall(SYSCALL_LSEEK,file,ptr,dir);
-}
-
-int read(int file, char *ptr, int len)
-{
-
- return syscall(SYSCALL_READ,file,ptr,len);
-}
-
-int open(const char *name, int flags, int mode)
-{
- return syscall(SYSCALL_OPEN,name,flags,mode);
-}
-
-int write(int file, char *ptr, int len)
-{
- return syscall(SYSCALL_WRITE,file,ptr,len);
-}
-
-int execve(char *name, char **argv, char **env)
-{
- return syscall(SYSCALL_EXECVE,name,argv,env);
-}
-
-uint32_t sbrk(int incr)
-{
- return syscall(SYSCALL_SBRK,incr,0,0);
-}
-
-int gettimeofday(struct timeval *tv, void *tz)
-{
- return syscall(SYSCALL_GETTIMEOFDAY,tv,tz,0);
-}
-
-int fork(void)
-{
- return syscall(SYSCALL_FORK,0,0,0);
-}
-
-int getpid(void)
-{
- return syscall(SYSCALL_GETPID,0,0,0);
-}
-
-int kill(int pid, int sig)
-{
- return syscall(SYSCALL_KILL,pid,sig,0);
-}
-
-int link(char *old, char *ne)
-{
- return syscall(SYSCALL_LINK,old,ne,0);
-}
-
-int unlink(char *name)
-{
- return syscall(SYSCALL_UNLINK,name,0,0);
-}
-
-int times(struct tms *buf)
-{
- return syscall(SYSCALL_TIMES,buf,0,0);
-}
-
-int wait(int *status)
-{
- return syscall(SYSCALL_WAIT,status,0,0);
-}
-
-int stat(const char *file, struct stat *st)
-{
- return syscall(SYSCALL_STAT,file,st,0);
-}
-
-int lstat(const char *file, struct stat *st)
-{
- return syscall(SYSCALL_LSTAT,file,st,0);
-}
-
-int fstat(int file, struct stat *st)
-{
- return syscall(SYSCALL_FSTAT,file,st,0);
-}
-
-