aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/syscall
diff options
context:
space:
mode:
authorMarvin Borner2019-12-17 21:50:02 +0100
committerMarvin Borner2019-12-17 21:50:02 +0100
commit025709e8643eb24e3360e575564b34ebd8062fd7 (patch)
tree16e45f68a958419a3e497e7b01e6472e92ffe94c /src/kernel/syscall
parent6188eed3863e6087a7d5b7d988e91d711b45064b (diff)
Finally fixed text input syscalls!
I guess I can officially call me dumb now as I just forgot to return the actual value from the syscall handler...
Diffstat (limited to 'src/kernel/syscall')
-rw-r--r--src/kernel/syscall/actions/sys_read.c7
-rw-r--r--src/kernel/syscall/actions/sys_write.c6
-rw-r--r--src/kernel/syscall/syscall.c5
-rw-r--r--src/kernel/syscall/syscall.h4
4 files changed, 9 insertions, 13 deletions
diff --git a/src/kernel/syscall/actions/sys_read.c b/src/kernel/syscall/actions/sys_read.c
index 02960f6..83e645c 100644
--- a/src/kernel/syscall/actions/sys_read.c
+++ b/src/kernel/syscall/actions/sys_read.c
@@ -16,10 +16,7 @@ uint32_t sys_read(char *buf)
return strlen(buf);
}
-uint32_t sys_readc(char *ch)
+uint32_t sys_readc()
{
- char buf = getch();
- ch = &buf;
- serial_put(*ch);
- return (uint32_t) ch;
+ return (uint32_t) getch();
} \ 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 8531e85..6377473 100644
--- a/src/kernel/syscall/actions/sys_write.c
+++ b/src/kernel/syscall/actions/sys_write.c
@@ -9,10 +9,8 @@ uint32_t sys_write(char *buf)
return strlen((const char *) buf);
}
-uint32_t sys_writec(char *ch)
+uint32_t sys_writec(char ch)
{
- serial_write_hex(*ch);
- serial_write("\n\n");
- writec((char) *ch);
+ writec((char) ch);
return 0;
} \ No newline at end of file
diff --git a/src/kernel/syscall/syscall.c b/src/kernel/syscall/syscall.c
index 24f2445..16d1ce4 100644
--- a/src/kernel/syscall/syscall.c
+++ b/src/kernel/syscall/syscall.c
@@ -11,7 +11,7 @@ uint32_t (*syscalls[])() = {
[0] = (uint32_t (*)()) halt_loop, // DEBUG!
[1] = sys_write,
[2] = sys_read,
- [3] = sys_writec,
+ [3] = (uint32_t (*)()) sys_writec,
[4] = sys_readc,
[5] = sys_get_pointers,
[6] = sys_paging_alloc,
@@ -29,7 +29,8 @@ void syscall_handler(struct regs *r)
if (!location)
return;
- location(r->ebx, r->ecx, r->edx, r->esi, r->edi);
+ uint32_t ret = location(r->ebx, r->ecx, r->edx, r->esi, r->edi);
+ r->eax = ret;
}
void syscalls_install()
diff --git a/src/kernel/syscall/syscall.h b/src/kernel/syscall/syscall.h
index 378b5e3..ae69800 100644
--- a/src/kernel/syscall/syscall.h
+++ b/src/kernel/syscall/syscall.h
@@ -7,9 +7,9 @@ void syscalls_install();
uint32_t sys_write(char *buf);
-uint32_t sys_writec(char *ch);
+uint32_t sys_writec(char ch);
-uint32_t sys_read(char *buf);
+uint32_t sys_read();
uint32_t sys_readc(char *ch);