diff options
author | Alexis211 <alexis211@gmail.com> | 2009-10-17 18:20:46 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-10-17 18:20:46 +0200 |
commit | ae49f59cc96e4ff3709c857b848132e82e6e0b14 (patch) | |
tree | 46c53db51b25c2deea0786d043e53ab09b647ee0 /Source/Kernel/SyscallManager | |
parent | 9520a1a101b264abe700c3f7753f5f55bba4c681 (diff) | |
download | Melon-ae49f59cc96e4ff3709c857b848132e82e6e0b14.tar.gz Melon-ae49f59cc96e4ff3709c857b848132e82e6e0b14.zip |
User mode code can now run !
We have a sample process (hardcoded in ASM in Task.wtf.asm) that
displays a's and sleeps 20ms, but it's on a hidden virtual terminal so
it's useless :D
Diffstat (limited to 'Source/Kernel/SyscallManager')
-rw-r--r-- | Source/Kernel/SyscallManager/IDT.ns.cpp | 11 |
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); |