aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/core
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-02-13 22:44:10 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2015-02-13 22:44:10 +0100
commit706c69d40fcc46e7d7f170dab932d3c7fcc7c34e (patch)
tree5248ff8712eced5bc4fdd76e9399654ce5224a37 /src/kernel/core
parent47e6cd42f0744f6c04b8347093f6549339a856c9 (diff)
downloadkogata-706c69d40fcc46e7d7f170dab932d3c7fcc7c34e.tar.gz
kogata-706c69d40fcc46e7d7f170dab932d3c7fcc7c34e.zip
Begin implementation of syscalls.
Diffstat (limited to 'src/kernel/core')
-rw-r--r--src/kernel/core/idt.c10
-rw-r--r--src/kernel/core/interrupt.s4
-rw-r--r--src/kernel/core/kmain.c3
3 files changed, 10 insertions, 7 deletions
diff --git a/src/kernel/core/idt.c b/src/kernel/core/idt.c
index e1862c9..0459a21 100644
--- a/src/kernel/core/idt.c
+++ b/src/kernel/core/idt.c
@@ -4,6 +4,7 @@
#include <string.h>
#include <dbglog.h>
#include <thread.h>
+#include <syscall.h>
struct idt_entry {
uint16_t base_lo; //Low part of address to jump to
@@ -89,7 +90,7 @@ static isr_handler_t irq_handlers[16] = {0};
static isr_handler_t ex_handlers[32] = {0};
/* Called in interrupt.s when an exception fires (interrupt 0 to 31) */
-void idt_exHandler(registers_t *regs) {
+void idt_ex_handler(registers_t *regs) {
if (ex_handlers[regs->int_no] != 0) {
ex_handlers[regs->int_no](regs);
} else {
@@ -105,7 +106,7 @@ void idt_exHandler(registers_t *regs) {
}
/* Called in interrupt.s when an IRQ fires (interrupt 32 to 47) */
-void idt_irqHandler(registers_t *regs) {
+void idt_irq_handler(registers_t *regs) {
if (regs->err_code > 7) {
outb(0xA0, 0x20);
}
@@ -117,9 +118,8 @@ void idt_irqHandler(registers_t *regs) {
}
/* Caled in interrupt.s when a syscall is called */
-void idt_syscallHandler(registers_t *regs) {
- dbg_printf("Syscall %i (not implemented yet)\n", regs->int_no);
- // do nothing, yet.
+void idt_syscall_handler(registers_t *regs) {
+ syscall_handler(regs);
}
/* For internal use only. Sets up an entry of the IDT with given parameters. */
diff --git a/src/kernel/core/interrupt.s b/src/kernel/core/interrupt.s
index d40fff0..8fb71e8 100644
--- a/src/kernel/core/interrupt.s
+++ b/src/kernel/core/interrupt.s
@@ -1,7 +1,7 @@
;************************************************************************************
%macro COMMONSTUB 1
-[EXTERN idt_%1Handler]
+[EXTERN idt_%1_handler]
%1_common_stub:
pusha ; Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax
@@ -19,7 +19,7 @@
; (passing it directly results in GCC trashing the data when doing optimisations)
mov eax, esp
push eax
- call idt_%1Handler
+ call idt_%1_handler
add esp, 4
pop eax ; reload the original data segment descriptor
diff --git a/src/kernel/core/kmain.c b/src/kernel/core/kmain.c
index 5572ac4..ee6d8b2 100644
--- a/src/kernel/core/kmain.c
+++ b/src/kernel/core/kmain.c
@@ -17,6 +17,7 @@
#include <nullfs.h>
#include <process.h>
#include <elf.h>
+#include <syscall.h>
#include <slab_alloc.h>
#include <hashtbl.h>
@@ -270,6 +271,8 @@ void kmain(multiboot_info_t *mbd, int32_t mb_magic) {
kmalloc_setup();
kmalloc_test(kernel_data_end);
+ setup_syscalls();
+
// enter multi-threading mode
// interrupts are enabled at this moment, so all
// code run from now on should be preemtible (ie thread-safe)