summaryrefslogtreecommitdiff
path: root/kernel/syscall.c
diff options
context:
space:
mode:
authorJake Mannens <jake72360@gmail.com>2018-06-23 08:28:19 +1000
committerJake Mannens <jake72360@gmail.com>2018-06-23 08:28:19 +1000
commit2c429f6e1ac51ea27f203005eeef20d2b05c759e (patch)
tree5d9ba6851e87876a97a4780905a3248af165f33e /kernel/syscall.c
parentce9932308abed8000f9f6e06a61f726b29aa9e3a (diff)
Re-wrote interrupt handling. Now, flush_idt only initializes IDT entries
32-255. A separate routine in the new file traps.s initializes the first 32 entries with addresses pointing to exception handlers within said file. Modified the register_isr function to now accept a descriptor privilege level which it will assign to the modified IDT entry. Added a task state segment and corresponding entry to the GDT. The TSS will store the kernel's stack pointer and stack segment when switching to userspace. NOTE: The stack pointer MUST be saved manually before switching to userspace! Added the framework for a system call interface at interrupt vector 0x80 (128).
Diffstat (limited to 'kernel/syscall.c')
-rw-r--r--kernel/syscall.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/syscall.c b/kernel/syscall.c
new file mode 100644
index 0000000..8fa5da0
--- /dev/null
+++ b/kernel/syscall.c
@@ -0,0 +1,12 @@
+#include <kernel/con.h>
+#include <stdarg.h>
+#include <stdint.h>
+
+/* main syscall handler */
+void syscall(va_list ap) {
+ uint8_t call;
+ char *s;
+
+ printf("Call Number: 0x%02x\n", va_arg(ap, uint8_t));
+ printf(va_arg(ap, char*));
+}