diff options
Diffstat (limited to 'Source/Kernel/Core')
-rw-r--r-- | Source/Kernel/Core/Sys.ns.cpp | 9 | ||||
-rw-r--r-- | Source/Kernel/Core/kmain.wtf.cpp | 11 |
2 files changed, 19 insertions, 1 deletions
diff --git a/Source/Kernel/Core/Sys.ns.cpp b/Source/Kernel/Core/Sys.ns.cpp index c0218d8..a8a6c91 100644 --- a/Source/Kernel/Core/Sys.ns.cpp +++ b/Source/Kernel/Core/Sys.ns.cpp @@ -93,7 +93,14 @@ void panic(char *message, registers_t *regs, char *file, u32int line) { vt << "eax=" << (u32int)regs->eax << ", ebx=" << (u32int)regs->ebx << ", ecx=" << (u32int)regs->ecx << ", edx=" << (u32int)regs->edx << "\n"; vt << "int_no=" << (s32int)regs->int_no << ", err_code=" << (u32int)regs->err_code << "\n"; - vt << "eflags=" << (u32int)regs->eflags << ", useresp=" << (u32int)regs->useresp << ", ss=" << (u32int)regs->ss << "\n\n"; + vt << "eflags=" << (u32int)regs->eflags << ", useresp=" << (u32int)regs->useresp << ", ss=" << (u32int)regs->ss << "\n"; + if (regs->int_no == 14) { + u32int cr2; + asm volatile("mov %%cr2, %0" : "=r"(cr2)); + vt << "cr2=" << (u32int)cr2 << "\n"; + } + vt << "\n"; + while (1) asm volatile("cli; hlt"); u32int *v = (u32int*)regs->ebp; diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp index c7b47e1..655bd8b 100644 --- a/Source/Kernel/Core/kmain.wtf.cpp +++ b/Source/Kernel/Core/kmain.wtf.cpp @@ -35,6 +35,9 @@ extern u32int end; //Placement address extern "C" void kmain(multiboot_info_t* mbd, u32int magic); +extern "C" void sample_task(); +extern u32int sample_task_size; + #define INFO(vt) vt->setColor(KVT_FGCOLOR); *vt << " - "; vt->setColor(KVT_LIGHTCOLOR); #define PROCESSING(vt, m) vt->setColor(KVT_BLECOLOR); *vt << " > "; vt->setColor(KVT_FGCOLOR); *vt << m; \ vt->setCursorCol(60); vt->setColor(KVT_LIGHTCOLOR); *vt << ": "; @@ -164,6 +167,14 @@ void kmain(multiboot_info_t* mbd, u32int magic) { FloppyController::detect(); Log::log(KL_STATUS, "kmain : Floppy drives detected"); + //Create dummy process, for testing user mode + Process* p; + p = new Process("dummy task", 0); + u8int *ptr = (u8int*)p->heap().alloc(sample_task_size); + memcpy(ptr, (const u8int*)sample_task, sample_task_size); + new Thread(p, (thread_entry_t)ptr, 0); + kernelPageDirectory->switchTo(); + asm volatile("sti"); Log::log(KL_STATUS, "kmain : Interrupts enabled."); |