diff options
author | Alexis211 <alexis211@gmail.com> | 2009-08-21 23:59:19 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-08-21 23:59:19 +0200 |
commit | 74e721676ddd5d996ccf2e1d35da57320f658609 (patch) | |
tree | b39d766c8e27a654c89c2435131e5eaf193125d8 /Source/Kernel/Core | |
parent | ae803baa4e0ec584c7afd3f6d55f2e6b32010b46 (diff) | |
download | Melon-74e721676ddd5d996ccf2e1d35da57320f658609.tar.gz Melon-74e721676ddd5d996ccf2e1d35da57320f658609.zip |
Kernel now loads in higher half, and uses a VT for output.
Diffstat (limited to 'Source/Kernel/Core')
-rw-r--r-- | Source/Kernel/Core/.kmain.wtf.cpp.swp | bin | 12288 -> 12288 bytes | |||
-rw-r--r-- | Source/Kernel/Core/CMem.ns.o | bin | 991 -> 0 bytes | |||
-rw-r--r-- | Source/Kernel/Core/Sys.ns.cpp | 15 | ||||
-rw-r--r-- | Source/Kernel/Core/Sys.ns.o | bin | 1676 -> 0 bytes | |||
-rw-r--r-- | Source/Kernel/Core/common.wtf.h | 13 | ||||
-rw-r--r-- | Source/Kernel/Core/cppsupport.wtf.o | bin | 741 -> 0 bytes | |||
-rw-r--r-- | Source/Kernel/Core/kmain.wtf.cpp | 14 | ||||
-rw-r--r-- | Source/Kernel/Core/kmain.wtf.o | bin | 2948 -> 0 bytes | |||
-rw-r--r-- | Source/Kernel/Core/loader.wtf.asm | 28 | ||||
-rw-r--r-- | Source/Kernel/Core/loader.wtf.o | bin | 1312 -> 0 bytes |
10 files changed, 63 insertions, 7 deletions
diff --git a/Source/Kernel/Core/.kmain.wtf.cpp.swp b/Source/Kernel/Core/.kmain.wtf.cpp.swp Binary files differindex bc7a8c6..bf1668b 100644 --- a/Source/Kernel/Core/.kmain.wtf.cpp.swp +++ b/Source/Kernel/Core/.kmain.wtf.cpp.swp diff --git a/Source/Kernel/Core/CMem.ns.o b/Source/Kernel/Core/CMem.ns.o Binary files differdeleted file mode 100644 index b8b6dbb..0000000 --- a/Source/Kernel/Core/CMem.ns.o +++ /dev/null diff --git a/Source/Kernel/Core/Sys.ns.cpp b/Source/Kernel/Core/Sys.ns.cpp index eca826f..361dda6 100644 --- a/Source/Kernel/Core/Sys.ns.cpp +++ b/Source/Kernel/Core/Sys.ns.cpp @@ -1,5 +1,8 @@ //This automatically includes Sys.ns.h #include <Core/common.wtf.h> +#include <VTManager/VirtualTerminal.class.h> + +#define DEBUGVT(x) VirtualTerminal *x = new VirtualTerminal(5, 46, 0, 15); x->map(); x->put('\n'); using namespace CMem; @@ -43,20 +46,24 @@ void bochs_output(char *message, char *file, u32int line) { void panic(char *message, char *file, u32int line) { asm volatile("cli"); - bochs_output("PANIC : ", file, 0); + DEBUGVT(vt); + bochs_output("PANIC : ", file, line); bochs_output(message, file, 0); + *vt << " PANIC : " << message << "\n In " << file << ":" << (s32int)line << "\n"; - while (1); //Enter infinite loop for halt + while (1) asm volatile("hlt"); //Enter infinite loop for halt } //Used by ASSERT() macro (see common.wtf.h) void panic_assert(char *file, u32int line, char *desc) { asm volatile("cli"); - bochs_output("ASSERTION FAILED : ", file, 0); + DEBUGVT(vt); + bochs_output("ASSERTION FAILED : ", file, line); bochs_output(desc, file, 0); + *vt << " ASSERTION FAILED : " << desc << "\n In " << file << ":" << (s32int)line << "\n"; - while (1); //Enter infinite loop for halt + while (1) asm volatile("hlt"); //Enter infinite loop for halt } void reboot() { diff --git a/Source/Kernel/Core/Sys.ns.o b/Source/Kernel/Core/Sys.ns.o Binary files differdeleted file mode 100644 index 58f3dc8..0000000 --- a/Source/Kernel/Core/Sys.ns.o +++ /dev/null diff --git a/Source/Kernel/Core/common.wtf.h b/Source/Kernel/Core/common.wtf.h index 9b1bc7e..617a73c 100644 --- a/Source/Kernel/Core/common.wtf.h +++ b/Source/Kernel/Core/common.wtf.h @@ -24,4 +24,17 @@ typedef char s8int; #define DEBUG(m) #endif +#include <MemoryManager/Mem.ns.h> + +//Standard implemenations of operator new/delete +inline void* operator new(u32int, void *p) { return p; } +inline void* operator new[](u32int, void *p) { return p; } +inline void operator delete(void*, void*) { } +inline void operator delete[](void*, void*) { } + +inline void* operator new(u32int sz) { return Mem::kalloc(sz); } +inline void* operator new[](u32int sz) { return Mem::kalloc(sz); } +inline void operator delete(void *ptr) { Mem::kfree(ptr); } +inline void operator delete[](void *ptr) { Mem::kfree(ptr); } + #endif diff --git a/Source/Kernel/Core/cppsupport.wtf.o b/Source/Kernel/Core/cppsupport.wtf.o Binary files differdeleted file mode 100644 index 4088bfb..0000000 --- a/Source/Kernel/Core/cppsupport.wtf.o +++ /dev/null diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp index 59fa45a..e201a07 100644 --- a/Source/Kernel/Core/kmain.wtf.cpp +++ b/Source/Kernel/Core/kmain.wtf.cpp @@ -3,6 +3,7 @@ #include <Devices/Display/VGATextOutput.class.h> #include <DisplayManager/Disp.ns.h> +#include <VTManager/VirtualTerminal.class.h> #include <Ressources/logo.cd> @@ -13,9 +14,11 @@ extern "C" void kmain(multiboot_info_t* mbd, u32int magic); void kmain(multiboot_info_t* mbd, u32int magic) { DEBUG("Entering kmain."); - VGATextOutput vgaout; + Mem::placementAddress = (u32int)&end; - Disp::setDisplay(&vgaout); + VGATextOutput *vgaout = new VGATextOutput(); + + Disp::setDisplay(vgaout); for (int i = 0; i < melonLogoLines; i++) { int startCol = (Disp::textCols() / 2) - (melonLogoCols / 2); @@ -24,6 +27,13 @@ void kmain(multiboot_info_t* mbd, u32int magic) { } } + VirtualTerminal *kvt = new VirtualTerminal(12, 40, 0, 2); + kvt->map(melonLogoLines + 4); + + *kvt << "Kernel initializing in HIGHER HALF!\n"; + + *kvt << "Lower ram : " << (s32int)mbd->mem_lower << "k, upper : " << (s32int)mbd->mem_upper << "k.\n"; + if (magic != MULTIBOOT_BOOTLOADER_MAGIC) { PANIC("Error with multiboot header."); } diff --git a/Source/Kernel/Core/kmain.wtf.o b/Source/Kernel/Core/kmain.wtf.o Binary files differdeleted file mode 100644 index 19a82cf..0000000 --- a/Source/Kernel/Core/kmain.wtf.o +++ /dev/null diff --git a/Source/Kernel/Core/loader.wtf.asm b/Source/Kernel/Core/loader.wtf.asm index e5f5839..c5248e9 100644 --- a/Source/Kernel/Core/loader.wtf.asm +++ b/Source/Kernel/Core/loader.wtf.asm @@ -21,8 +21,21 @@ STACKSIZE equ 0x4000 ; that's 16k. extern start_ctors, end_ctors, start_dtors, end_dtors loader: + lgdt [trickgdt] + mov cx, 0x10; + mov ds, cx; + mov es, cx; + mov fs, cx; + mov gs, cx; + mov ss, cx; + + jmp 0x08:higherhalf + + +higherhalf: mov esp, stack+STACKSIZE ; set up the stack push eax ; pass Multiboot magic number + add ebx, 0xC0000000 ; update the MB info structure so that it is in the new seg. push ebx ; pass Multiboot info structure static_ctors_loop: @@ -52,8 +65,21 @@ static_dtors_loop: ; useless, kernel should never return hang: hlt ; halt machine should kernel return jmp hang + +[section .setup] + +trickgdt: + dw gdt_end - gdt - 1 + dd gdt + +gdt: + dd 0, 0 + db 0xFF, 0xFF, 0, 0, 0, 10011010b, 11001111b, 0x40 + db 0xFF, 0xFF, 0, 0, 0, 10010010b, 11001111b, 0x40 + +gdt_end: -section .bss +[section .bss] align 32 stack: resb STACKSIZE ; reserve 16k stack on a quadword boundary diff --git a/Source/Kernel/Core/loader.wtf.o b/Source/Kernel/Core/loader.wtf.o Binary files differdeleted file mode 100644 index caed8f0..0000000 --- a/Source/Kernel/Core/loader.wtf.o +++ /dev/null |