diff --git a/src/kernel/svc.c b/src/kernel/svc.c index 1e03262..34ab006 100644 --- a/src/kernel/svc.c +++ b/src/kernel/svc.c @@ -66,6 +66,18 @@ void SVC_Handler(void) { */ clock_svc(args); break; + + case 3: /* FS-related calls + * 0 - open + * 1 - read + * 2 - write + * 3 - close + * 4 - stat + * 5 - seek + * link/unlink? + */ + break; + default: break; } diff --git a/src/kernel/vfs.c b/src/kernel/vfs.c index a0d9bb4..538fbee 100644 --- a/src/kernel/vfs.c +++ b/src/kernel/vfs.c @@ -1,15 +1,30 @@ #include "vfs.h" #include "task.h" +typedef unsigned int size_t; + //static vfs_node vfs_root; -int vfs_open(const char *path, int mode) -{ - (void)path; - (void)mode; -// vfs_node *cd = task_getcwd(); -// if (cd == 0) -// cd = &vfs_root; +int vfs_open(const char *path, int flags, int mode); +size_t vfs_read(int fd, void *buf, size_t count); +size_t vfs_write(int fd, const void *buf, size_t count); +int vfs_close(int fd); - return 0; +void vfs_svc(uint32_t *args) +{ + switch (args[0]) { + case 0: + *((int *)args[4]) = vfs_open(args[1], args[2], args[3]); + break; + case 1: + *((int *)args[4]) = vfs_read(args[1], args[2], args[3]); + break; + case 2: + *((int *)args[4]) = vfs_write(args[1], args[2], args[3]); + break; + case 3: + *((int *)args[2]) = vfs_close(args[1]); + break; + } } +