diff options
| -rw-r--r-- | kernel/config.h | 2 | ||||
| -rw-r--r-- | kernel/syscalls.h | 38 | ||||
| -rw-r--r-- | userspace/Makefile | 3 | ||||
| -rw-r--r-- | userspace/crt0.S | 4 | ||||
| -rw-r--r-- | userspace/smalltest.c | 4 | ||||
| -rw-r--r-- | userspace/sys.c | 55 | ||||
| -rw-r--r-- | userspace/syscalls.c | 46 |
7 files changed, 143 insertions, 9 deletions
diff --git a/kernel/config.h b/kernel/config.h index e48c63c..ef0fa71 100644 --- a/kernel/config.h +++ b/kernel/config.h @@ -6,7 +6,7 @@ //#define FOOLOS_COMPILE_FLOPPY // compile floppy drivers #define FOOLOS_CONSOLE_AUTOBREAK // add newline automatically at end of line -#define FOOLOS_LOG_OFF // do not log anything +//#define FOOLOS_LOG_OFF // do not log anything #define FOOLOS_CONSOLE // otherwise VESA will be used! #define MEM_PRINT_MEMORYMAP #define LOG_BUF_SIZE 4069 diff --git a/kernel/syscalls.h b/kernel/syscalls.h index eb9f854..6868033 100644 --- a/kernel/syscalls.h +++ b/kernel/syscalls.h @@ -1,3 +1,7 @@ +#include <sys/time.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <stdint.h> #include "fs/fs.h" //fool-os syscalls @@ -15,7 +19,19 @@ #define SYSCALL_LSEEK 69 #define SYSCALL_SBRK 70 -int syscall_readdir(const char *name,fs_dirent *dirs,int max); +// stubs only so far! +#define SYSCALL_GETTIMEOFDAY 71 +#define SYSCALL_FORK 72 +#define SYSCALL_KILL 73 +#define SYSCALL_LINK 73 +#define SYSCALL_STAT 74 +#define SYSCALL_TIMES 75 +#define SYSCALL_UNLINK 76 +#define SYSCALL_WAIT 77 +#define SYSCALL_GETPID 78 + + +int syscall_readdir(const char *name,struct fs_dirent *dirs,int max); int syscall_exit(int ret, int none1, int none2); int syscall_open(char *name, int flags, int len); @@ -28,4 +44,22 @@ int syscall_isatty(int file,int none1,int none2); int syscall_lseek(int file,int ptr,int dir); int syscall_sbrk(int incr, int none1, int none2); -//fork, getpid, kill, link, stat, times, unlink, wait; +int syscall_gettimeofday(struct timeval *tv, struct timezone *tz); +int syscall_fork(void); +int syscall_getpid(void); +int syscall_kill(int pid, int sig); +int syscall_link(char *old, char *ne); +int syscall_stat(char *file, struct stat *st); +int syscall_times(struct tms *buf); +int syscall_unlink(char *name); +int syscall_wait(int *status); + + + + + + + + + + diff --git a/userspace/Makefile b/userspace/Makefile index 7ae91ee..ad2ae1e 100644 --- a/userspace/Makefile +++ b/userspace/Makefile @@ -9,7 +9,7 @@ CFLAGS+=--no-builtin-free LDFLAGS=-L/home/miguel/temp/fool-os-stuff/newlib-build-clean-new/i686-elf/newlib ext2.img: shell simple brainfuck add - dd if=/dev/zero of=ext2.img bs=512 count=500 + dd if=/dev/zero of=ext2.img bs=512 count=3500 sudo mkfs.ext2 -O none ext2.img -F mkdir mnt sudo mount ext2.img mnt @@ -21,6 +21,7 @@ ext2.img: shell simple brainfuck add cp simple mnt cp brainfuck mnt cp add mnt + cp ~/temp/fool-os-stuff/binutils-fool-build/binutils/ar.bin mnt sync sudo umount mnt rm mnt -rf diff --git a/userspace/crt0.S b/userspace/crt0.S index e3bfa3b..48eadd9 100644 --- a/userspace/crt0.S +++ b/userspace/crt0.S @@ -8,8 +8,8 @@ _start: push $0 call sbrk -push $[_BSS_END_] -call sbrk +#push $[_BSS_END_] +#call sbrk call main diff --git a/userspace/smalltest.c b/userspace/smalltest.c new file mode 100644 index 0000000..905869d --- /dev/null +++ b/userspace/smalltest.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/userspace/sys.c b/userspace/sys.c new file mode 100644 index 0000000..7dcfaee --- /dev/null +++ b/userspace/sys.c @@ -0,0 +1,55 @@ +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> + + +// building binutils required this stubs! +long sysconf(int name) +{ + return 0; +} + + +mode_t umask(mode_t mask) +{ + return mask; +} + +int chmod(const char * path, mode_t mode) +{ + return 0; +} + +int fcntl(int fd, int cmd, ...) +{ + return -1; +} + +int lstat(const char *path, struct stat *buf) +{ + return -1; +} + +char *getwd(char *buf) +{ + return buf; +} +int access(const char *pathname, int mode) +{ + return 0; +} + +int utime(const char *filename, const int *x) +{ + return 0; +} + +int rmdir (const char *pathname) +{ + return -1; +} + +int chown(const char *path, uid_t owner, gid_t group) +{ + return 0; +} diff --git a/userspace/syscalls.c b/userspace/syscalls.c index 8c8bfc9..51436fb 100644 --- a/userspace/syscalls.c +++ b/userspace/syscalls.c @@ -1,6 +1,3 @@ -#include <sys/stat.h> -#include <string.h> -#include <stdint.h> #include "../kernel/syscalls.h" /* @@ -93,4 +90,47 @@ 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 stat(const char *file, struct stat *st) +{ + return syscall(SYSCALL_STAT,file,st,0); +} + +int times(struct tms *buf) +{ + return syscall(SYSCALL_TIMES,buf,0,0); +} + +int unlink(char *name) +{ + return syscall(SYSCALL_UNLINK,name,0,0); +} + +int wait(int *status) +{ + return syscall(SYSCALL_WAIT,status,0,0); +} |
