diff options
Diffstat (limited to 'src/kernel/task')
-rw-r--r-- | src/kernel/task/idt.cpp | 8 | ||||
-rw-r--r-- | src/kernel/task/sched.cpp | 2 | ||||
-rw-r--r-- | src/kernel/task/syscall.cpp | 34 |
3 files changed, 25 insertions, 19 deletions
diff --git a/src/kernel/task/idt.cpp b/src/kernel/task/idt.cpp index 9008083..c09034e 100644 --- a/src/kernel/task/idt.cpp +++ b/src/kernel/task/idt.cpp @@ -109,14 +109,6 @@ extern "C" void idt_irqHandler(registers regs) { if (doSwitch) schedule(); } -/* Called in idt_.asm on a system call (interrupt 64). - Calls the correct syscall handler (if any). */ -extern "C" void idt_syscallHandler(registers regs) { - if (regs.eax < NUMBER_OF_SYSCALLS && syscalls[regs.eax] != 0) { - syscalls[regs.eax](®s); - } -} - /* For internal use only. Sets up an entry of the IDT with given parameters. */ static void idt_setGate(uint8_t num, uint32_t base, uint16_t sel, uint8_t flags) { idt_entries[num].base_lo = base & 0xFFFF; diff --git a/src/kernel/task/sched.cpp b/src/kernel/task/sched.cpp index e773e97..2629a33 100644 --- a/src/kernel/task/sched.cpp +++ b/src/kernel/task/sched.cpp @@ -3,7 +3,7 @@ #include <mem/mem.h> // Lower priority numbers have high priority. Priorities must start at 0. -#define PRIORITIES 3 // we have 4 priority levels +#define PRIORITIES 3 // we have 3 priority levels #define PRIORITY(t) (t->process->privilege) //get priority for a thread extern thread *idle_thread; diff --git a/src/kernel/task/syscall.cpp b/src/kernel/task/syscall.cpp index 7a83c25..7938e76 100644 --- a/src/kernel/task/syscall.cpp +++ b/src/kernel/task/syscall.cpp @@ -6,16 +6,16 @@ #define CALL0(name, scname) static void scname(registers* r) { r->eax = name(); } #define CALL1(name, scname) static void scname(registers* r) { \ - r->eax = name(r->ebx); } + r->eax = name(r->ecx); } #define CALL2(name, scname) static void scname(registers* r) { \ - r->eax = name(r->ebx, r->ecx); } + r->eax = name(r->ecx, r->edx); } #define CALL3(name, scname) static void scname(registers* r) { \ - r->eax = name(r->ebx, r->ecx, r->edx); } + r->eax = name(r->ecx, r->edx, r->esi); } #define CALL0V(name, scname) static void scname(registers* r) { name(); } -#define CALL1V(name, scname) static void scname(registers* r) { name(r->ebx); } -#define CALL2V(name, scname) static void scname(registers* r) { name(r->ebx, r->ecx); } -#define CALL3V(name, scname) static void scname(registers* r) { name(r->ebx, r->ecx, r->edx); } -#define CALL4V(name, scname) static void scname(registers* r) { name(r->ebx, r->ecx, r->edx, r->esi); } +#define CALL1V(name, scname) static void scname(registers* r) { name(r->ecx); } +#define CALL2V(name, scname) static void scname(registers* r) { name(r->ecx, r->edx); } +#define CALL3V(name, scname) static void scname(registers* r) { name(r->ecx, r->edx, r->esi); } +#define CALL4V(name, scname) static void scname(registers* r) { name(r->ecx, r->edx, r->esi, r->edi); } CALL0V(thread_exit, thread_exit_sc); CALL0V(schedule, schedule_sc); @@ -27,16 +27,17 @@ CALL1(process_sbrk, proc_sbrk_sc); CALL1V(process_brk, proc_brk_sc); static void printk_sc(registers *r) { - monitor_write((char*)r->ebx); + monitor_write((char*)r->ecx); } static void thread_new_sc(registers* r) { cli(); - new thread(current_thread->process, (thread_entry)r->ebx, (void*)r->ecx, (void*)r->edx); + new thread(current_thread->process, (thread_entry)r->ecx, (void*)r->edx, (void*)r->esi); sti(); } -int_callback syscalls[NUMBER_OF_SYSCALLS] = { +int_callback syscalls[NUMBER_OF_SYSCALLS] = { // This must correspond to common/include/tce/syscalls.h + 0, thread_exit_sc, //0 schedule_sc, thread_sleep_sc, @@ -48,3 +49,16 @@ int_callback syscalls[NUMBER_OF_SYSCALLS] = { proc_sbrk_sc, proc_brk_sc, 0 }; + + +/* Called in idt_.asm on a system call (interrupt 64). + Calls the correct syscall handler (if any). */ +extern "C" void idt_syscallHandler(registers regs) { + if (regs.eax == 0) { + if (regs.ebx < NUMBER_OF_SYSCALLS && syscalls[regs.ebx] != 0) { + syscalls[regs.ebx](®s); + } + } else { + monitor_write("Hello. Object calls not implemented.\n"); + } +} |