aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/syscall
diff options
context:
space:
mode:
authorMarvin Borner2020-04-29 19:21:29 +0200
committerMarvin Borner2020-04-29 19:21:29 +0200
commit4546c75d685475d8b9f215b588364e1d1bbd0b79 (patch)
tree2077f72ad46dfe877f7febdd0692edc139fd7937 /src/kernel/syscall
parent396d7d303d3bf0e796d0c817883ec1dec928352a (diff)
MUCH work in libc
Also cleaned up some syscalls etc
Diffstat (limited to 'src/kernel/syscall')
-rw-r--r--src/kernel/syscall/actions/sys_getch.c11
-rw-r--r--src/kernel/syscall/actions/sys_pointers.c11
-rw-r--r--src/kernel/syscall/actions/sys_scancode.c11
-rw-r--r--src/kernel/syscall/syscall.c6
-rw-r--r--src/kernel/syscall/syscall.h2
5 files changed, 16 insertions, 25 deletions
diff --git a/src/kernel/syscall/actions/sys_getch.c b/src/kernel/syscall/actions/sys_getch.c
deleted file mode 100644
index 3ce1f8c..0000000
--- a/src/kernel/syscall/actions/sys_getch.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <stdint.h>
-#include <kernel/lib/stdio.h>
-#include <kernel/io/io.h>
-
-uint32_t sys_getch()
-{
- sti();
- uint32_t key = getch();
- cli();
- return key;
-} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_pointers.c b/src/kernel/syscall/actions/sys_pointers.c
index ced95de..6cf50ae 100644
--- a/src/kernel/syscall/actions/sys_pointers.c
+++ b/src/kernel/syscall/actions/sys_pointers.c
@@ -12,17 +12,8 @@ struct pointers {
uint32_t sys_pointers()
{
- struct vbe_mode_info *ret = (struct vbe_mode_info *)umalloc(sizeof(struct vbe_mode_info));
- ret->attributes = current_mode_info->attributes;
- ret->pitch = current_mode_info->pitch;
- ret->width = current_mode_info->width;
- ret->height = current_mode_info->height;
- ret->bpp = current_mode_info->bpp;
- ret->memory_model = current_mode_info->memory_model;
- ret->framebuffer = current_mode_info->framebuffer;
-
struct pointers *pointers = umalloc(sizeof(struct pointers));
- pointers->current_mode_info = ret;
+ pointers->current_mode_info = current_mode_info;
pointers->font = font;
return pointers;
diff --git a/src/kernel/syscall/actions/sys_scancode.c b/src/kernel/syscall/actions/sys_scancode.c
new file mode 100644
index 0000000..612326a
--- /dev/null
+++ b/src/kernel/syscall/actions/sys_scancode.c
@@ -0,0 +1,11 @@
+#include <stdint.h>
+#include <kernel/input/input.h>
+#include <kernel/io/io.h>
+
+uint32_t sys_scancode()
+{
+ sti();
+ uint32_t key = wait_scancode();
+ cli();
+ return key;
+} \ No newline at end of file
diff --git a/src/kernel/syscall/syscall.c b/src/kernel/syscall/syscall.c
index dec3d38..7433799 100644
--- a/src/kernel/syscall/syscall.c
+++ b/src/kernel/syscall/syscall.c
@@ -11,7 +11,7 @@ typedef uint32_t (*syscall_func)(uint32_t, ...);
uint32_t (*syscalls[])() = { [0] = (uint32_t(*)())halt_loop, // DEBUG!
[1] = sys_exec,
[2] = (uint32_t(*)())sys_putch,
- [3] = sys_getch,
+ [3] = sys_scancode,
[4] = sys_malloc,
[5] = sys_free,
[6] = sys_pointers };
@@ -27,8 +27,8 @@ void syscall_handler(struct regs *r)
if (!location)
return;
- log("[SYSCALL] %s called %d with 0x%x 0x%x 0x%x 0x%x 0x%x", current_proc->name, r->eax,
- location, r->ebx, r->ecx, r->edx, r->esi, r->edi);
+ 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);
diff --git a/src/kernel/syscall/syscall.h b/src/kernel/syscall/syscall.h
index b0a15c4..502064b 100644
--- a/src/kernel/syscall/syscall.h
+++ b/src/kernel/syscall/syscall.h
@@ -11,7 +11,7 @@ uint32_t sys_exec(char *path);
uint32_t sys_putch(char ch);
-uint32_t sys_getch();
+uint32_t sys_scancode();
uint32_t sys_malloc(uint32_t count);