diff options
author | Marvin Borner | 2020-05-02 18:17:35 +0200 |
---|---|---|
committer | Marvin Borner | 2020-05-02 18:17:35 +0200 |
commit | e8f1c287a63f0f71fe463f7271834538b45f8c05 (patch) | |
tree | 6eebab2d27e610c8eeb130ddfd6a7f858ece411a /src/kernel/syscall | |
parent | aa8a8811818331cf511681327e3ba95e456f0d33 (diff) |
Some work in the vfs
Diffstat (limited to 'src/kernel/syscall')
-rw-r--r-- | src/kernel/syscall/actions/sys_fork.c | 1 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_read.c | 8 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_write.c | 9 | ||||
-rw-r--r-- | src/kernel/syscall/syscall.c | 5 |
4 files changed, 14 insertions, 9 deletions
diff --git a/src/kernel/syscall/actions/sys_fork.c b/src/kernel/syscall/actions/sys_fork.c index af64ff9..5e2ee80 100644 --- a/src/kernel/syscall/actions/sys_fork.c +++ b/src/kernel/syscall/actions/sys_fork.c @@ -3,6 +3,7 @@ #include <kernel/memory/paging.h> #include <kernel/tasks/process.h> #include <kernel/lib/lib.h> +#include <kernel/system.h> uint32_t sys_fork(struct regs *r) { diff --git a/src/kernel/syscall/actions/sys_read.c b/src/kernel/syscall/actions/sys_read.c index a954f56..8931ede 100644 --- a/src/kernel/syscall/actions/sys_read.c +++ b/src/kernel/syscall/actions/sys_read.c @@ -8,15 +8,15 @@ uint32_t sys_read(char *path, uint32_t offset, uint32_t count, char *buf) { struct fs_node *node = (struct fs_node *)umalloc(sizeof(struct fs_node)); strcpy(node->name, path); - ext2_root->open(node); + fs_open(node); if (node->inode != 0) { uint32_t size = ((struct ext2_file *)node->impl)->inode.size; - ext2_root->read(node, 0, size, buf); + fs_read(node, 0, size, buf); buf[size - 1] = '\0'; - ext2_root->close(node); + fs_close(node); return size; } else { - ext2_root->close(node); + fs_close(node); return -1; } }
\ No newline at end of file diff --git a/src/kernel/syscall/actions/sys_write.c b/src/kernel/syscall/actions/sys_write.c index d79ef37..28a5929 100644 --- a/src/kernel/syscall/actions/sys_write.c +++ b/src/kernel/syscall/actions/sys_write.c @@ -3,20 +3,21 @@ #include <kernel/fs/ext2.h> #include <kernel/lib/stdlib.h> #include <kernel/memory/alloc.h> +#include <kernel/system.h> uint32_t sys_write(char *path, uint32_t offset, uint32_t count, char *buf) { struct fs_node *node = (struct fs_node *)umalloc(sizeof(struct fs_node)); strcpy(node->name, path); - ext2_root->open(node); + fs_open(node); if (node->inode != 0) { uint32_t size = ((struct ext2_file *)node->impl)->inode.size; - ext2_root->write(node, 0, size, buf); + fs_write(node, 0, size, buf); buf[size - 1] = '\0'; - ext2_root->close(node); + fs_close(node); return size; } else { - ext2_root->close(node); + fs_close(node); return -1; } }
\ No newline at end of file diff --git a/src/kernel/syscall/syscall.c b/src/kernel/syscall/syscall.c index d09ee33..53f94cd 100644 --- a/src/kernel/syscall/syscall.c +++ b/src/kernel/syscall/syscall.c @@ -32,7 +32,10 @@ void syscall_handler(struct regs *r) log("[SYSCALL] %d at [0x%x] with 0x%x 0x%x 0x%x 0x%x", r->eax, location, r->ebx, r->ecx, r->edx, r->esi, r->edi); - r->eax = location(r->ebx, r->ecx, r->edx, r->esi, r->edi); + if (r->eax == 2) // TODO: Fix hardcoded fork parameters + r->eax = location(r); + else + r->eax = location(r->ebx, r->ecx, r->edx, r->esi, r->edi); sti(); } |