From c712d7f6f801b073920c7b914ee1b95358113893 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Sun, 8 Nov 2009 16:51:30 +0100 Subject: Introduced V86 mode. It really fits in nicely :) --- Source/Kernel/Core/Sys.ns.cpp | 21 +++++++++++++-------- Source/Kernel/Core/Sys.ns.h | 2 ++ Source/Kernel/Core/kmain.wtf.cpp | 15 +++++++++++++++ 3 files changed, 30 insertions(+), 8 deletions(-) (limited to 'Source/Kernel/Core') diff --git a/Source/Kernel/Core/Sys.ns.cpp b/Source/Kernel/Core/Sys.ns.cpp index e5dbdc0..30d9755 100644 --- a/Source/Kernel/Core/Sys.ns.cpp +++ b/Source/Kernel/Core/Sys.ns.cpp @@ -71,6 +71,16 @@ void bochs_output_hex(u32int i) { } } +void dumpRegs(registers_t *regs, VirtualTerminal& vt) { + vt << "ds=" << (u32int)regs->ds << ", eip=" << (u32int)regs->eip << ", cs=" << (u32int)regs->cs << "\n"; + vt << "edi=" << (u32int)regs->edi << ", esi=" << (u32int)regs->esi << ", ebp=" << (u32int)regs->ebp << + ", esp=" << (u32int)regs->esp << "\n"; + 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"; +} + //Used by PANIC() macro (see common.wtf.h) void panic(char *message, char *file, u32int line) { asm volatile("cli"); @@ -91,19 +101,14 @@ void panic(char *message, registers_t *regs, char *file, u32int line) { vt.write("\n"); vt << "PANIC : " << message << "\n => in " << file << " at " << (s32int)line << "\n\n"; - vt << "ds=" << (u32int)regs->ds << ", eip=" << (u32int)regs->eip << ", cs=" << (u32int)regs->cs << "\n"; - vt << "edi=" << (u32int)regs->edi << ", esi=" << (u32int)regs->esi << ", ebp=" << (u32int)regs->ebp << - ", esp=" << (u32int)regs->esp << "\n"; - 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"; + dumpRegs(regs, vt); + if (regs->int_no == 14) { u32int cr2; asm volatile("mov %%cr2, %0" : "=r"(cr2)); vt << "cr2=" << (u32int)cr2 << "\n"; } - vt << "\n"; + vt << "\n\n"; while (1) asm volatile("cli; hlt"); diff --git a/Source/Kernel/Core/Sys.ns.h b/Source/Kernel/Core/Sys.ns.h index 1ed446c..c5e4400 100644 --- a/Source/Kernel/Core/Sys.ns.h +++ b/Source/Kernel/Core/Sys.ns.h @@ -18,12 +18,14 @@ //This file contains system-relative functions class String; +class VirtualTerminal; struct registers_t; namespace Sys { void outb(u16int port, u8int value); u8int inb(u16int port); u16int inw(u16int port); + void dumpRegs(registers_t *regs, VirtualTerminal& vt); void panic(char* message, char *file, u32int line); void panic(char* message, registers_t *regs, char *file, u32int line); void panic_assert(char* file, u32int line, char *desc); diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp index 62f96d5..26afdfd 100644 --- a/Source/Kernel/Core/kmain.wtf.cpp +++ b/Source/Kernel/Core/kmain.wtf.cpp @@ -31,6 +31,18 @@ #include +#include +extern v86_function_t v86test; + +void testV86() { + VirtualTerminal* vt = new ScrollableVT(15, 76, 200, SHELL_FGCOLOR, SHELL_BGCOLOR); + Task::currProcess()->setOutVT(vt); + v86_retval_t r; + new V86Thread(&v86test, &r, 0); + while (!r.finished); + PANIC("V86 TEST END"); +} + extern u32int end; //Placement address extern "C" void kmain(multiboot_info_t* mbd, u32int magic); @@ -184,10 +196,13 @@ void kmain(multiboot_info_t* mbd, u32int magic) { Sys::halt(); */ + testV86(); + Process* p = Process::run("/System/Applications/PaperWork.app", 0); if (p == 0) { PANIC("Could not launch PaperWork !"); } else { + Log::log(KL_STATUS, "kmain : Starting PaperWork (init)"); VirtualTerminal* vt = new ScrollableVT(15, 76, 200, SHELL_FGCOLOR, SHELL_BGCOLOR); Kbd::setFocus(vt); ((ScrollableVT*)vt)->map(9); -- cgit v1.2.3