aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/syscall
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/syscall')
-rw-r--r--src/kernel/syscall/actions/sys_exec.c7
-rw-r--r--src/kernel/syscall/actions/sys_exit.c8
-rw-r--r--src/kernel/syscall/actions/sys_free.c8
-rw-r--r--src/kernel/syscall/actions/sys_get.c7
-rw-r--r--src/kernel/syscall/actions/sys_get_pid.c7
-rw-r--r--src/kernel/syscall/actions/sys_malloc.c7
-rw-r--r--src/kernel/syscall/actions/sys_map.c8
-rw-r--r--src/kernel/syscall/actions/sys_read.c7
-rw-r--r--src/kernel/syscall/actions/sys_spawn.c7
-rw-r--r--src/kernel/syscall/actions/sys_wait.c10
-rw-r--r--src/kernel/syscall/actions/sys_write.c7
-rw-r--r--src/kernel/syscall/syscall.c44
-rw-r--r--src/kernel/syscall/syscall.h33
13 files changed, 0 insertions, 160 deletions
diff --git a/src/kernel/syscall/actions/sys_exec.c b/src/kernel/syscall/actions/sys_exec.c
deleted file mode 100644
index 049d085..0000000
--- a/src/kernel/syscall/actions/sys_exec.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <stdint.h>
-#include <tasks/process.h>
-
-u32 sys_exec(char *path)
-{
- return uexec(path);
-} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_exit.c b/src/kernel/syscall/actions/sys_exit.c
deleted file mode 100644
index eb019ab..0000000
--- a/src/kernel/syscall/actions/sys_exit.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <stdint.h>
-#include <tasks/process.h>
-
-u32 sys_exit(u32 code)
-{
- process_suspend(current_proc->pid);
- return code;
-} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_free.c b/src/kernel/syscall/actions/sys_free.c
deleted file mode 100644
index 32e9ba8..0000000
--- a/src/kernel/syscall/actions/sys_free.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <memory/alloc.h>
-#include <stdint.h>
-
-u32 sys_free(u32 ptr)
-{
- free((void *)ptr);
- return 0;
-} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_get.c b/src/kernel/syscall/actions/sys_get.c
deleted file mode 100644
index 8a4a643..0000000
--- a/src/kernel/syscall/actions/sys_get.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <stdint.h>
-
-u32 sys_get(u32 id)
-{
- // TODO: Implement get syscall
- return -1;
-} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_get_pid.c b/src/kernel/syscall/actions/sys_get_pid.c
deleted file mode 100644
index 1184ce7..0000000
--- a/src/kernel/syscall/actions/sys_get_pid.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <stdint.h>
-#include <tasks/process.h>
-
-u32 sys_get_pid()
-{
- return current_proc->pid;
-} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_malloc.c b/src/kernel/syscall/actions/sys_malloc.c
deleted file mode 100644
index c68606b..0000000
--- a/src/kernel/syscall/actions/sys_malloc.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <memory/alloc.h>
-#include <stdint.h>
-
-u32 sys_malloc(u32 count)
-{
- return (u32)malloc(count);
-} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_map.c b/src/kernel/syscall/actions/sys_map.c
deleted file mode 100644
index 5af2c2a..0000000
--- a/src/kernel/syscall/actions/sys_map.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <events/event.h>
-#include <stdint.h>
-
-u32 sys_map(u32 id, u8 *function)
-{
- event_map(id, function);
- return -1;
-} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_read.c b/src/kernel/syscall/actions/sys_read.c
deleted file mode 100644
index b0428a8..0000000
--- a/src/kernel/syscall/actions/sys_read.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <fs/fs.h>
-#include <stdint.h>
-
-u32 sys_read(char *path, u32 offset, u32 count, u8 *buf)
-{
- return read(path, offset, count, buf);
-} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_spawn.c b/src/kernel/syscall/actions/sys_spawn.c
deleted file mode 100644
index e3fa790..0000000
--- a/src/kernel/syscall/actions/sys_spawn.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <stdint.h>
-#include <tasks/process.h>
-
-u32 sys_spawn(char *path)
-{
- return uspawn(path);
-} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_wait.c b/src/kernel/syscall/actions/sys_wait.c
deleted file mode 100644
index 23d4639..0000000
--- a/src/kernel/syscall/actions/sys_wait.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <io/io.h>
-#include <stdint.h>
-#include <tasks/process.h>
-
-u32 sys_wait(u32 pid, u32 *status, u32 options)
-{
- /* if (pid > 0) */
- /* return process_wait_pid(pid, status); */
- 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
deleted file mode 100644
index 585a545..0000000
--- a/src/kernel/syscall/actions/sys_write.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <fs/fs.h>
-#include <stdint.h>
-
-u32 sys_write(char *path, u32 offset, u32 count, u8 *buf)
-{
- return write(path, offset, count, buf);
-} \ No newline at end of file
diff --git a/src/kernel/syscall/syscall.c b/src/kernel/syscall/syscall.c
deleted file mode 100644
index 21738f8..0000000
--- a/src/kernel/syscall/syscall.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#include <common.h>
-#include <interrupts/interrupts.h>
-#include <io/io.h>
-#include <lib/stdio.h>
-#include <stdint.h>
-#include <syscall/syscall.h>
-#include <system.h>
-#include <tasks/process.h>
-
-typedef u32 (*syscall_func)(u32, ...);
-
-u32 (*syscalls[])() = { [SYS_HALT] = (u32(*)())halt_loop, // DEBUG!
- [SYS_EXIT] = sys_exit,
- [SYS_READ] = sys_read,
- [SYS_WRITE] = sys_write,
- [SYS_EXEC] = sys_exec,
- [SYS_SPAWN] = sys_spawn,
- [SYS_WAIT] = sys_wait,
- [SYS_GET_PID] = sys_get_pid,
- [SYS_MALLOC] = sys_malloc,
- [SYS_FREE] = sys_free,
- [SYS_GET] = sys_get,
- [SYS_MAP] = sys_map };
-
-void syscall_handler(struct regs *r)
-{
- if (r->eax >= sizeof(syscalls) / sizeof(*syscalls))
- return;
-
- syscall_func location = (syscall_func)syscalls[r->eax];
- if (!location)
- return;
-
- 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);
- debug("Finished syscall");
-}
-
-void syscalls_install()
-{
- isr_install_handler(0x80, syscall_handler);
-} \ No newline at end of file
diff --git a/src/kernel/syscall/syscall.h b/src/kernel/syscall/syscall.h
deleted file mode 100644
index d2c50c0..0000000
--- a/src/kernel/syscall/syscall.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef MELVIX_SYSCALL_H
-#define MELVIX_SYSCALL_H
-
-#include <interrupts/interrupts.h>
-#include <stdint.h>
-
-extern void idt_syscall();
-
-void syscalls_install();
-
-u32 sys_exit(u32 code);
-
-u32 sys_read(char *path, u32 offset, u32 count, u8 *buf);
-
-u32 sys_write(char *path, u32 offset, u32 count, u8 *buf);
-
-u32 sys_exec(char *path);
-
-u32 sys_spawn(char *path);
-
-u32 sys_wait(u32 pid, u32 *status, u32 options);
-
-u32 sys_get_pid();
-
-u32 sys_malloc(u32 count);
-
-u32 sys_free(u32 ptr);
-
-u32 sys_get(u32 id);
-
-u32 sys_map(u32 id, u8 *function);
-
-#endif \ No newline at end of file