aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/syscall
diff options
context:
space:
mode:
authorMarvin Borner2019-12-01 15:47:35 +0100
committerMarvin Borner2019-12-01 15:47:35 +0100
commite9407b091b34d93014b89660601da62f13df37aa (patch)
treed60f14946e96d7e1bd72657522682032f0a99e84 /src/kernel/syscall
parent50f949d994c33ab23d63bdb9e8a438560ab0b4c4 (diff)
Semi-working C-based userspace syscalls
Diffstat (limited to 'src/kernel/syscall')
-rw-r--r--src/kernel/syscall/actions/sys_write.c2
-rw-r--r--src/kernel/syscall/syscall.c3
-rw-r--r--src/kernel/syscall/syscall.h1
3 files changed, 6 insertions, 0 deletions
diff --git a/src/kernel/syscall/actions/sys_write.c b/src/kernel/syscall/actions/sys_write.c
index c537d12..fceaaab 100644
--- a/src/kernel/syscall/actions/sys_write.c
+++ b/src/kernel/syscall/actions/sys_write.c
@@ -1,8 +1,10 @@
#include <stdint-gcc.h>
#include <mlibc/stdio.h>
+#include <kernel/io/io.h>
uint32_t sys_write(char *buf, uint32_t count)
{
+ serial_write("WRITE");
for (uint32_t i = 0; i < count; i++)
writec(*(buf++));
return count;
diff --git a/src/kernel/syscall/syscall.c b/src/kernel/syscall/syscall.c
index 289274b..bb32965 100644
--- a/src/kernel/syscall/syscall.c
+++ b/src/kernel/syscall/syscall.c
@@ -1,6 +1,7 @@
#include <stdint.h>
#include <kernel/syscall/syscall.h>
#include <kernel/interrupts/interrupts.h>
+#include <kernel/io/io.h>
void syscalls_install()
{
@@ -10,6 +11,8 @@ void syscalls_install()
uint32_t syscall_handler(uint32_t id, uint32_t arg0, uint32_t arg1, uint32_t arg2)
{
+ serial_write("Received syscall!\n");
+
switch (id) {
case 1:
return sys_write((char *) arg0, arg1);
diff --git a/src/kernel/syscall/syscall.h b/src/kernel/syscall/syscall.h
index 7fe7862..304008d 100644
--- a/src/kernel/syscall/syscall.h
+++ b/src/kernel/syscall/syscall.h
@@ -2,6 +2,7 @@
#define MELVIX_SYSCALL_H
extern void idt_syscall();
+
void syscalls_install();
uint32_t sys_write(char *buf, uint32_t count);