summaryrefslogtreecommitdiff
path: root/Source/Kernel/SyscallManager
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Kernel/SyscallManager')
-rw-r--r--Source/Kernel/SyscallManager/IDT.ns.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/Source/Kernel/SyscallManager/IDT.ns.cpp b/Source/Kernel/SyscallManager/IDT.ns.cpp
index fcab741..fcdf2ff 100644
--- a/Source/Kernel/SyscallManager/IDT.ns.cpp
+++ b/Source/Kernel/SyscallManager/IDT.ns.cpp
@@ -55,6 +55,7 @@ extern "C" void irq13();
extern "C" void irq14();
extern "C" void irq15();
+extern "C" void int64(); //Main syscall
extern "C" void int65(); //Syscall to request a task switch
extern "C" void int66(); //Syscall to signal that thread ended
@@ -73,6 +74,13 @@ extern "C" void interrupt_handler(registers_t regs) {
Dev::handleIRQ(regs, (regs.int_no - 32));
doSwitch = doSwitch or Task::IRQwakeup(regs.int_no - 32);
}
+ if (regs.int_no == 64) {
+ if (regs.eax == 1) {
+ Task::currProcess()->getVirtualTerminal()->put(WChar(regs.ebx));
+ } else if (regs.eax == 2) {
+ Task::currThread()->sleep(regs.ebx);
+ }
+ }
if (regs.int_no == 66) { //This syscall signals to kernel that thread ended.
Task::currentThreadExits(regs.eax); //DO NOT COUNT ON COMMING BACK FROM HERE
}
@@ -89,7 +97,7 @@ void setGate(u8int num, u32int base, u16int sel, u8int flags) {
idt_entries[num].base_hi = (base >> 16) & 0xFFFF;
idt_entries[num].sel = sel;
- idt_entries[num].flags = flags;
+ idt_entries[num].flags = flags | 0x60;
idt_entries[num].always0 = 0;
}
@@ -161,6 +169,7 @@ void init() {
setGate(46, (u32int)irq14, 0x08, 0x8E);
setGate(47, (u32int)irq15, 0x08, 0x8E);
+ setGate(64, (u32int)int64, 0x08, 0x8E);
setGate(65, (u32int)int65, 0x08, 0x8E);
setGate(66, (u32int)int66, 0x08, 0x8E);