summaryrefslogtreecommitdiff
path: root/Source/Kernel
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-08-21 21:16:48 +0200
committerAlexis211 <alexis211@gmail.com>2009-08-21 21:16:48 +0200
commitae803baa4e0ec584c7afd3f6d55f2e6b32010b46 (patch)
treea8d39cdeff28d2ce08ff7485736fef8119669547 /Source/Kernel
parentf93a269f41659d9a33ea6f24411ca691978986cf (diff)
downloadMelon-ae803baa4e0ec584c7afd3f6d55f2e6b32010b46.tar.gz
Melon-ae803baa4e0ec584c7afd3f6d55f2e6b32010b46.zip
System boots up and shows a nice ASCII art logo.
Diffstat (limited to 'Source/Kernel')
-rw-r--r--Source/Kernel/Config.h6
-rw-r--r--Source/Kernel/Core/.kmain.wtf.cpp.swpbin0 -> 12288 bytes
-rw-r--r--Source/Kernel/Core/CMem.ns.cpp35
-rw-r--r--Source/Kernel/Core/CMem.ns.h15
-rw-r--r--Source/Kernel/Core/CMem.ns.obin0 -> 991 bytes
-rw-r--r--Source/Kernel/Core/Sys.ns.cpp66
-rw-r--r--Source/Kernel/Core/Sys.ns.h19
-rw-r--r--Source/Kernel/Core/Sys.ns.obin0 -> 1676 bytes
-rw-r--r--Source/Kernel/Core/common.wtf.h27
-rw-r--r--Source/Kernel/Core/cppsupport.wtf.cpp4
-rw-r--r--Source/Kernel/Core/cppsupport.wtf.obin0 -> 741 bytes
-rw-r--r--Source/Kernel/Core/kmain.wtf.cpp32
-rw-r--r--Source/Kernel/Core/kmain.wtf.obin0 -> 2948 bytes
-rw-r--r--Source/Kernel/Core/loader.wtf.asm59
-rw-r--r--Source/Kernel/Core/loader.wtf.obin0 -> 1312 bytes
-rw-r--r--Source/Kernel/Core/multiboot.wtf.h64
-rw-r--r--Source/Kernel/Devices/Display/Display.proto.h15
-rw-r--r--Source/Kernel/Devices/Display/VGATextOutput.class.cpp29
-rw-r--r--Source/Kernel/Devices/Display/VGATextOutput.class.h15
-rw-r--r--Source/Kernel/Devices/Display/VGATextOutput.class.obin0 -> 1592 bytes
-rw-r--r--Source/Kernel/DisplayManager/Disp.ns.cpp36
-rw-r--r--Source/Kernel/DisplayManager/Disp.ns.h21
-rw-r--r--Source/Kernel/DisplayManager/Disp.ns.obin0 -> 1412 bytes
-rw-r--r--Source/Kernel/Link.ld32
-rw-r--r--Source/Kernel/Makefile50
-rw-r--r--Source/Kernel/Map.txt163
-rwxr-xr-xSource/Kernel/Melon.kebin0 -> 15445 bytes
-rw-r--r--Source/Kernel/Ressources/logo.cd10
28 files changed, 698 insertions, 0 deletions
diff --git a/Source/Kernel/Config.h b/Source/Kernel/Config.h
new file mode 100644
index 0000000..e4726a2
--- /dev/null
+++ b/Source/Kernel/Config.h
@@ -0,0 +1,6 @@
+#ifndef DEF_MELON_KERNEL_CONFIG
+#define DEF_MELON_KERNEL_CONFIG
+
+#define OPT_DEBUG
+
+#endif
diff --git a/Source/Kernel/Core/.kmain.wtf.cpp.swp b/Source/Kernel/Core/.kmain.wtf.cpp.swp
new file mode 100644
index 0000000..bc7a8c6
--- /dev/null
+++ b/Source/Kernel/Core/.kmain.wtf.cpp.swp
Binary files differ
diff --git a/Source/Kernel/Core/CMem.ns.cpp b/Source/Kernel/Core/CMem.ns.cpp
new file mode 100644
index 0000000..c2129ec
--- /dev/null
+++ b/Source/Kernel/Core/CMem.ns.cpp
@@ -0,0 +1,35 @@
+#include <Core/common.wtf.h>
+
+namespace CMem {
+
+//Standard C functions
+u8int *memcpy(u8int *dest, const u8int *src, int count) {
+ for (int i = 0; i < count; i++) {
+ dest[i] = src[i];
+ }
+ return dest;
+}
+
+u8int *memset(u8int *dest, u8int val, int count) {
+ for (int i = 0; i < count; i++) {
+ dest[i] = val;
+ }
+ return dest;
+}
+
+u16int *memsetw(u16int *dest, u16int val, int count) {
+ for (int i = 0; i < count; i++) {
+ dest[i] = val;
+ }
+ return dest;
+}
+
+u32int strlen(const char *str) {
+ u32int i = 0;
+ while (str[i]) {
+ i++;
+ }
+ return i;
+}
+
+}
diff --git a/Source/Kernel/Core/CMem.ns.h b/Source/Kernel/Core/CMem.ns.h
new file mode 100644
index 0000000..98e0b10
--- /dev/null
+++ b/Source/Kernel/Core/CMem.ns.h
@@ -0,0 +1,15 @@
+#ifdef DEF_COMMON
+
+#ifndef DEF_CMEM_NS_H
+#define DEF_CMEM_NS_H
+
+namespace CMem {
+ u8int *memcpy(u8int *dest, const u8int *src, int count);
+ u8int *memset(u8int *dest, u8int val, int count);
+ u16int *memsetw(u16int *dest, u16int val, int count);
+ u32int strlen(const char *str);
+}
+
+#endif
+
+#endif
diff --git a/Source/Kernel/Core/CMem.ns.o b/Source/Kernel/Core/CMem.ns.o
new file mode 100644
index 0000000..b8b6dbb
--- /dev/null
+++ b/Source/Kernel/Core/CMem.ns.o
Binary files differ
diff --git a/Source/Kernel/Core/Sys.ns.cpp b/Source/Kernel/Core/Sys.ns.cpp
new file mode 100644
index 0000000..eca826f
--- /dev/null
+++ b/Source/Kernel/Core/Sys.ns.cpp
@@ -0,0 +1,66 @@
+//This automatically includes Sys.ns.h
+#include <Core/common.wtf.h>
+
+using namespace CMem;
+
+namespace Sys {
+
+void outb (u16int port, u8int value) {
+ asm volatile ("outb %1, %0" : : "dN" (port), "a" (value));
+}
+
+u8int inb (u16int port) {
+ u8int ret;
+ asm volatile ("inb %1, %0" : "=a" (ret) : "dN" (port));
+ return ret;
+}
+
+u16int inw (u16int port) {
+ u16int ret;
+ asm volatile ("inw %1, %0" : "=a" (ret) : "dN" (port));
+ return ret;
+}
+
+//Used by DEBUG() macro (see common.wtf.h)
+void bochs_output(char *message, char *file, u32int line) {
+ for (u32int i = 0; i < strlen(message); i++) {
+ outb(0xE9, message[i]);
+ }
+ char* t = (char*)" (in ";
+ for (u32int i = 0; i < strlen(t); i++) {
+ outb(0xE9, t[i]);
+ }
+ for (u32int i = 0; i < strlen(file); i++) {
+ outb(0xE9, file[i]);
+ }
+ outb(0xE9, ')');
+ outb(0xE9, '\n');
+}
+
+//TODO : make PANIC output a visible message
+
+//Used by PANIC() macro (see common.wtf.h)
+void panic(char *message, char *file, u32int line) {
+ asm volatile("cli");
+
+ bochs_output("PANIC : ", file, 0);
+ bochs_output(message, file, 0);
+
+ while (1); //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);
+ bochs_output(desc, file, 0);
+
+ while (1); //Enter infinite loop for halt
+}
+
+void reboot() {
+ outb(0x64, 0xFE);
+}
+
+}
diff --git a/Source/Kernel/Core/Sys.ns.h b/Source/Kernel/Core/Sys.ns.h
new file mode 100644
index 0000000..9a2975e
--- /dev/null
+++ b/Source/Kernel/Core/Sys.ns.h
@@ -0,0 +1,19 @@
+#ifdef DEF_COMMON
+//This must be included by common.wtf.h
+
+#ifndef DEF_SYS_NS_H
+#define DEF_SYS_NS_H
+
+namespace Sys {
+ void outb(u16int port, u8int value);
+ u8int inb(u16int port);
+ u16int inw(u16int port);
+ void panic(char* message, char *file, u32int line);
+ void panic_assert(char* file, u32int line, char *desc);
+ void bochs_output(char* message, char *file, u32int line);
+ void reboot();
+}
+
+#endif
+
+#endif
diff --git a/Source/Kernel/Core/Sys.ns.o b/Source/Kernel/Core/Sys.ns.o
new file mode 100644
index 0000000..58f3dc8
--- /dev/null
+++ b/Source/Kernel/Core/Sys.ns.o
Binary files differ
diff --git a/Source/Kernel/Core/common.wtf.h b/Source/Kernel/Core/common.wtf.h
new file mode 100644
index 0000000..9b1bc7e
--- /dev/null
+++ b/Source/Kernel/Core/common.wtf.h
@@ -0,0 +1,27 @@
+#ifndef DEF_COMMON
+#define DEF_COMMON
+
+#include <Config.h>
+
+#define NULL 0
+
+typedef unsigned int u32int;
+typedef unsigned short u16int;
+typedef unsigned char u8int;
+typedef int s32int;
+typedef short s16int;
+typedef char s8int;
+
+#include <Core/CMem.ns.h>
+#include <Core/Sys.ns.h>
+
+#define PANIC(msg) Sys::panic(msg, __FILE__, __LINE__)
+#define ASSERT(b) ((b) ? (void)0 : Sys::panic_assert(__FILE__, __LINE__, #b))
+
+#ifdef OPT_DEBUG
+#define DEBUG(m) Sys::bochs_output(m, __FILE__, __LINE__)
+#else
+#define DEBUG(m)
+#endif
+
+#endif
diff --git a/Source/Kernel/Core/cppsupport.wtf.cpp b/Source/Kernel/Core/cppsupport.wtf.cpp
new file mode 100644
index 0000000..77feed3
--- /dev/null
+++ b/Source/Kernel/Core/cppsupport.wtf.cpp
@@ -0,0 +1,4 @@
+extern "C" void __cxa_pure_virtual() {}
+
+void *__dso_handle;
+extern "C" int __cxa_atexit(void (*f)(void*), void *p, void *d) { return 0; }
diff --git a/Source/Kernel/Core/cppsupport.wtf.o b/Source/Kernel/Core/cppsupport.wtf.o
new file mode 100644
index 0000000..4088bfb
--- /dev/null
+++ b/Source/Kernel/Core/cppsupport.wtf.o
Binary files differ
diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp
new file mode 100644
index 0000000..59fa45a
--- /dev/null
+++ b/Source/Kernel/Core/kmain.wtf.cpp
@@ -0,0 +1,32 @@
+#include <Core/common.wtf.h>
+#include <Core/multiboot.wtf.h>
+
+#include <Devices/Display/VGATextOutput.class.h>
+#include <DisplayManager/Disp.ns.h>
+
+#include <Ressources/logo.cd>
+
+extern u32int end; //Placement address
+
+extern "C" void kmain(multiboot_info_t* mbd, u32int magic);
+
+void kmain(multiboot_info_t* mbd, u32int magic) {
+ DEBUG("Entering kmain.");
+
+ VGATextOutput vgaout;
+
+ Disp::setDisplay(&vgaout);
+
+ for (int i = 0; i < melonLogoLines; i++) {
+ int startCol = (Disp::textCols() / 2) - (melonLogoCols / 2);
+ for (int j = 0; j < melonLogoCols; j++) {
+ Disp::putChar(i + 2, j + startCol, melonLogo[i][j], 0x07);
+ }
+ }
+
+ if (magic != MULTIBOOT_BOOTLOADER_MAGIC) {
+ PANIC("Error with multiboot header.");
+ }
+
+ while(1);
+}
diff --git a/Source/Kernel/Core/kmain.wtf.o b/Source/Kernel/Core/kmain.wtf.o
new file mode 100644
index 0000000..19a82cf
--- /dev/null
+++ b/Source/Kernel/Core/kmain.wtf.o
Binary files differ
diff --git a/Source/Kernel/Core/loader.wtf.asm b/Source/Kernel/Core/loader.wtf.asm
new file mode 100644
index 0000000..e5f5839
--- /dev/null
+++ b/Source/Kernel/Core/loader.wtf.asm
@@ -0,0 +1,59 @@
+global loader ; making entry point visible to linker
+extern kmain ; kmain is defined elsewhere
+
+; setting up the Multiboot header - see GRUB docs for details
+MODULEALIGN equ 1<<0 ; align loaded modules on page boundaries
+MEMINFO equ 1<<1 ; provide memory map
+FLAGS equ MODULEALIGN | MEMINFO ; this is the Multiboot 'flag' field
+MAGIC equ 0x1BADB002 ; 'magic number' lets bootloader find the header
+CHECKSUM equ -(MAGIC + FLAGS) ; checksum required
+
+section .text
+align 4
+MultiBootHeader:
+ dd MAGIC
+ dd FLAGS
+ dd CHECKSUM
+
+; reserve initial kernel stack space
+STACKSIZE equ 0x4000 ; that's 16k.
+
+extern start_ctors, end_ctors, start_dtors, end_dtors
+
+loader:
+ mov esp, stack+STACKSIZE ; set up the stack
+ push eax ; pass Multiboot magic number
+ push ebx ; pass Multiboot info structure
+
+static_ctors_loop:
+ mov ebx, start_ctors
+ jmp .test
+.body:
+ call [ebx]
+ add ebx,4
+.test:
+ cmp ebx, end_ctors
+ jb .body
+
+ call kmain ; call kernel proper
+
+ cli
+
+static_dtors_loop: ; useless, kernel should never return
+ mov ebx, start_dtors
+ jmp .test
+.body:
+ call [ebx]
+ add ebx,4
+.test:
+ cmp ebx, end_dtors
+ jb .body
+
+hang:
+ hlt ; halt machine should kernel return
+ jmp hang
+
+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
new file mode 100644
index 0000000..caed8f0
--- /dev/null
+++ b/Source/Kernel/Core/loader.wtf.o
Binary files differ
diff --git a/Source/Kernel/Core/multiboot.wtf.h b/Source/Kernel/Core/multiboot.wtf.h
new file mode 100644
index 0000000..9771893
--- /dev/null
+++ b/Source/Kernel/Core/multiboot.wtf.h
@@ -0,0 +1,64 @@
+#ifndef HDR_MULTIBOOT
+#define HDR_MULTIBOOT
+#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
+#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
+
+struct multiboot_header_t{
+ unsigned long magic;
+ unsigned long flags;
+ unsigned long checksum;
+ unsigned long header_addr;
+ unsigned long load_addr;
+ unsigned long load_end_addr;
+ unsigned long bss_end_addr;
+ unsigned long entry_addr;
+};
+
+struct aout_symbol_table_t {
+ unsigned long tabsize;
+ unsigned long strsize;
+ unsigned long addr;
+ unsigned long reserved;
+};
+
+struct elf_section_header_table_t {
+ unsigned long num;
+ unsigned long size;
+ unsigned long addr;
+ unsigned long shndx;
+};
+
+struct multiboot_info_t {
+ unsigned long flags;
+ unsigned long mem_lower;
+ unsigned long mem_upper;
+ unsigned long boot_device;
+ unsigned long cmdline;
+ unsigned long mods_count;
+ unsigned long mods_addr;
+ union {
+ aout_symbol_table_t aout_sym;
+ elf_section_header_table_t elf_sec;
+ } u;
+ unsigned long mmap_length;
+ unsigned long mmap_addr;
+};
+
+struct module_t {
+ unsigned long mod_start;
+ unsigned long mod_end;
+ unsigned long string;
+ unsigned long reserved;
+};
+
+struct memory_map_t {
+ unsigned long size;
+ unsigned long base_addr_low;
+ unsigned long base_addr_high;
+ unsigned long length_low;
+ unsigned long length_high;
+ unsigned long type;
+};
+
+#endif
+
diff --git a/Source/Kernel/Devices/Display/Display.proto.h b/Source/Kernel/Devices/Display/Display.proto.h
new file mode 100644
index 0000000..8e8e29d
--- /dev/null
+++ b/Source/Kernel/Devices/Display/Display.proto.h
@@ -0,0 +1,15 @@
+#ifndef DEF_DISPLAY_PROTO_H
+#define DEF_DISPLAY_PROTO_H
+
+#include <Core/common.wtf.h>
+
+class Display {
+ public:
+ virtual u16int textCols() = 0;
+ virtual u16int textRows() = 0;
+ virtual void putChar(u16int line, u16int col, char c, char color) = 0; //Color : <bg 4byte><fg 4byte>
+ virtual void moveCursor(u16int line, u16int col) = 0;
+ virtual void clear() = 0;
+};
+
+#endif
diff --git a/Source/Kernel/Devices/Display/VGATextOutput.class.cpp b/Source/Kernel/Devices/Display/VGATextOutput.class.cpp
new file mode 100644
index 0000000..66bffd5
--- /dev/null
+++ b/Source/Kernel/Devices/Display/VGATextOutput.class.cpp
@@ -0,0 +1,29 @@
+#include "VGATextOutput.class.h"
+
+using namespace Sys; //For outb
+
+u16int VGATextOutput::textCols() {
+ return 80;
+}
+
+u16int VGATextOutput::textRows() {
+ return 25;
+}
+
+void VGATextOutput::putChar(u16int line, u16int col, char c, char color) {
+ u16int* where = (u16int*)0xB8000;
+ where[(80 * line) + col] = (color << 8) | c;
+}
+
+void VGATextOutput::moveCursor(u16int line, u16int col) {
+ u16int csrLoc = (line * 80) + col;
+ outb(0x3D4, 14);
+ outb(0x3D5, csrLoc >> 8);
+ outb(0x3D4, 15);
+ outb(0x3D5, csrLoc & 0xFF);
+}
+
+void VGATextOutput::clear() {
+ u16int* where = (u16int*)0xB8000;
+ for (int i = 0; i < 25 * 80; i++) where[i] = 0;
+}
diff --git a/Source/Kernel/Devices/Display/VGATextOutput.class.h b/Source/Kernel/Devices/Display/VGATextOutput.class.h
new file mode 100644
index 0000000..72ad604
--- /dev/null
+++ b/Source/Kernel/Devices/Display/VGATextOutput.class.h
@@ -0,0 +1,15 @@
+#ifndef DEF_VGATEXTOUTPUT_CLASS_H
+#define DEF_VGATEXTOUTPUT_CLASS_H
+
+#include <Devices/Display/Display.proto.h>
+
+class VGATextOutput : public Display {
+ public:
+ u16int textCols();
+ u16int textRows();
+ void putChar(u16int line, u16int col, char c, char color);
+ void moveCursor(u16int line, u16int col);
+ void clear();
+};
+
+#endif
diff --git a/Source/Kernel/Devices/Display/VGATextOutput.class.o b/Source/Kernel/Devices/Display/VGATextOutput.class.o
new file mode 100644
index 0000000..ccd63a1
--- /dev/null
+++ b/Source/Kernel/Devices/Display/VGATextOutput.class.o
Binary files differ
diff --git a/Source/Kernel/DisplayManager/Disp.ns.cpp b/Source/Kernel/DisplayManager/Disp.ns.cpp
new file mode 100644
index 0000000..75344f8
--- /dev/null
+++ b/Source/Kernel/DisplayManager/Disp.ns.cpp
@@ -0,0 +1,36 @@
+#include "Disp.ns.h"
+
+namespace Disp {
+
+mode_t mode;
+
+u16int textCols() {
+ return mode.textCols;
+}
+
+u16int textRows() {
+ return mode.textRows;
+}
+
+void putChar(u16int line, u16int col, char c, char color) {
+ if (line >= mode.textRows or col >= mode.textCols) return;
+ mode.device->putChar(line, col, c, color);
+}
+
+void moveCursor(u16int line, u16int col) {
+ if (line >= mode.textRows or col >= mode.textCols) return;
+ mode.device->moveCursor(line, col);
+}
+
+void clear() {
+ mode.device->clear();
+}
+
+void setDisplay(Display* disp) {
+ mode.device = disp;
+ disp->clear();
+ mode.textCols = disp->textCols();
+ mode.textRows = disp->textRows();
+}
+
+}
diff --git a/Source/Kernel/DisplayManager/Disp.ns.h b/Source/Kernel/DisplayManager/Disp.ns.h
new file mode 100644
index 0000000..76c9f60
--- /dev/null
+++ b/Source/Kernel/DisplayManager/Disp.ns.h
@@ -0,0 +1,21 @@
+#ifndef DEF_DISP_NS_H
+#define DEF_DISP_NS_H
+
+#include <Devices/Display/Display.proto.h>
+
+namespace Disp {
+ struct mode_t {
+ int textCols, textRows;
+ Display *device;
+ };
+
+ u16int textCols();
+ u16int textRows();
+ void putChar(u16int line, u16int col, char c, char color);
+ void moveCursor(u16int line, u16int col);
+ void clear();
+
+ void setDisplay(Display* disp);
+}
+
+#endif
diff --git a/Source/Kernel/DisplayManager/Disp.ns.o b/Source/Kernel/DisplayManager/Disp.ns.o
new file mode 100644
index 0000000..1ac31fd
--- /dev/null
+++ b/Source/Kernel/DisplayManager/Disp.ns.o
Binary files differ
diff --git a/Source/Kernel/Link.ld b/Source/Kernel/Link.ld
new file mode 100644
index 0000000..bcd0b90
--- /dev/null
+++ b/Source/Kernel/Link.ld
@@ -0,0 +1,32 @@
+ENTRY (loader)
+
+SECTIONS{
+ . = 0x00100000;
+
+ .text :{
+ *(.text)
+ }
+
+ .rodata ALIGN (0x1000) : {
+ *(.rodata)
+ }
+
+ .data ALIGN (0x1000) : {
+ start_ctors = .;
+ *(.ctor*)
+ end_ctors = .;
+ start_dtors = .;
+ *(.dtor*)
+ end_dtors = .;
+ *(.data)
+ }
+
+ .bss : {
+ sbss = .;
+ *(COMMON)
+ *(.bss)
+ ebss = .;
+ }
+
+ end = .; _end = .; __end = .;
+}
diff --git a/Source/Kernel/Makefile b/Source/Kernel/Makefile
new file mode 100644
index 0000000..3cc45cc
--- /dev/null
+++ b/Source/Kernel/Makefile
@@ -0,0 +1,50 @@
+.PHONY: clean, mrproper
+
+CC = gcc
+CXX = g++
+LD = ld
+LDFLAGS = -T Link.ld -Map Map.txt --oformat=elf32-i386
+CFLAGS = -nostdlib -nostartfiles -nodefaultlibs -fno-builtin -fno-stack-protector -Wall -Wextra -Werror
+CXXFLAGS = -nostartfiles -nostdlib -fno-rtti -fno-exceptions -I . -Wall -Werror -Wno-write-strings
+ASM = nasm
+ASMFLAGS = -f elf
+
+OutFile = Melon.ke
+Objects = Core/kmain.wtf.o \
+ Core/loader.wtf.o \
+ Core/cppsupport.wtf.o \
+ Core/Sys.ns.o \
+ Core/CMem.ns.o \
+ DisplayManager/Disp.ns.o \
+ Devices/Display/VGATextOutput.class.o
+
+all: $(OutFile)
+ echo "* Done with $(OutFile)."
+
+rebuild: mrproper all
+
+$(OutFile): $(Objects)
+ echo "* Linking executable : $(OutFile)..."
+ $(LD) $(LDFLAGS) -o $(OutFile) $^
+
+%.o: %.c
+ echo "* Compiling $<..."
+ $(CC) -c $< -o $@ $(CFLAGS)
+
+%.o: %.cpp
+ echo "* Compiling $<..."
+ $(CXX) -c $< -o $@ $(CXXFLAGS)
+
+%.o: %.asm
+ echo "* Compiling $<..."
+ $(ASM) $(ASMFLAGS) -o $@ $<
+
+clean:
+ echo "* Removing object files..."
+ rm -rf *.o
+ rm -rf */*.o
+ rm -rf */*/*.o
+
+mrproper: clean
+ echo "* Removing executable : $(OutFile)"
+ rm -rf $(OutFile)
diff --git a/Source/Kernel/Map.txt b/Source/Kernel/Map.txt
new file mode 100644
index 0000000..9049ad0
--- /dev/null
+++ b/Source/Kernel/Map.txt
@@ -0,0 +1,163 @@
+
+Discarded input sections
+
+ .group 0x00000000 0x0 Core/kmain.wtf.o
+ .group 0x00000000 0x0 Core/kmain.wtf.o
+ .group 0x00000000 0x0 Core/kmain.wtf.o
+ .group 0x00000000 0x0 Devices/Display/VGATextOutput.class.o
+
+Memory Configuration
+
+Name Origin Length Attributes
+*default* 0x00000000 0xffffffff
+
+Linker script and memory map
+
+ 0x00100000 . = 0x100000
+
+.text 0x00100000 0x6cf
+ *(.text)
+ .text 0x00100000 0x106 Core/kmain.wtf.o
+ 0x00100000 kmain
+ *fill* 0x00100106 0xa 00
+ .text 0x00100110 0x53 Core/loader.wtf.o
+ 0x0010011c loader
+ *fill* 0x00100163 0x1 00
+ .text 0x00100164 0xf Core/cppsupport.wtf.o
+ 0x00100164 __cxa_pure_virtual
+ 0x00100169 __cxa_atexit
+ *fill* 0x00100173 0x1 00
+ .text 0x00100174 0x1ec Core/Sys.ns.o
+ 0x001001ce Sys::bochs_output(char*, char*, unsigned int)
+ 0x00100192 Sys::inb(unsigned short)
+ 0x001001af Sys::inw(unsigned short)
+ 0x001002c8 Sys::panic(char*, char*, unsigned int)
+ 0x00100344 Sys::reboot()
+ 0x00100174 Sys::outb(unsigned short, unsigned char)
+ 0x00100306 Sys::panic_assert(char*, unsigned int, char*)
+ .text 0x00100360 0xd5 Core/CMem.ns.o
+ 0x00100396 CMem::memset(unsigned char*, unsigned char, int)
+ 0x001003cd CMem::memsetw(unsigned short*, unsigned short, int)
+ 0x00100408 CMem::strlen(char const*)
+ 0x00100360 CMem::memcpy(unsigned char*, unsigned char const*, int)
+ *fill* 0x00100435 0x3 00
+ .text 0x00100438 0x167 DisplayManager/Disp.ns.o
+ 0x0010044c Disp::putChar(unsigned short, unsigned short, char, char)
+ 0x00100442 Disp::textRows()
+ 0x0010052e Disp::clear()
+ 0x00100438 Disp::textCols()
+ 0x0010054c Disp::setDisplay(Display*)
+ 0x001004cd Disp::moveCursor(unsigned short, unsigned short)
+ *fill* 0x0010059f 0x1 00
+ .text 0x001005a0 0x12f Devices/Display/VGATextOutput.class.o
+ 0x001005a0 VGATextOutput::textCols()
+ 0x00100698 VGATextOutput::clear()
+ 0x00100612 VGATextOutput::moveCursor(unsigned short, unsigned short)
+ 0x001005aa VGATextOutput::textRows()
+ 0x001005b4 VGATextOutput::putChar(unsigned short, unsigned short, char, char)
+
+.text._ZN7DisplayC2Ev
+ 0x001006d0 0xe
+ .text._ZN7DisplayC2Ev
+ 0x001006d0 0xe Core/kmain.wtf.o
+ 0x001006d0 Display::Display()
+
+.text._ZN13VGATextOutputC1Ev
+ 0x001006de 0x1c
+ .text._ZN13VGATextOutputC1Ev
+ 0x001006de 0x1c Core/kmain.wtf.o
+ 0x001006de VGATextOutput::VGATextOutput()
+
+.rodata 0x00101000 0x220
+ *(.rodata)
+ .rodata 0x00101000 0x1fd Core/kmain.wtf.o
+ .rodata 0x001011fd 0x23 Core/Sys.ns.o
+
+.rodata._ZTV7Display
+ 0x00101220 0x1c
+ .rodata._ZTV7Display
+ 0x00101220 0x1c Core/kmain.wtf.o
+ 0x00101220 vtable for Display
+
+.rodata._ZTV13VGATextOutput
+ 0x00101240 0x1c
+ .rodata._ZTV13VGATextOutput
+ 0x00101240 0x1c Devices/Display/VGATextOutput.class.o
+ 0x00101240 vtable for VGATextOutput
+
+.rel.dyn 0x0010125c 0x0
+ .rel.text 0x00000000 0x0 Core/kmain.wtf.o
+ .rel.text._ZN7DisplayC2Ev
+ 0x00000000 0x0 Core/kmain.wtf.o
+ .rel.text._ZN13VGATextOutputC1Ev
+ 0x00000000 0x0 Core/kmain.wtf.o
+ .rel.rodata._ZTV7Display
+ 0x00000000 0x0 Core/kmain.wtf.o
+
+.data 0x00102000 0x24
+ 0x00102000 start_ctors = .
+ *(.ctor*)
+ 0x00102000 end_ctors = .
+ 0x00102000 start_dtors = .
+ *(.dtor*)
+ 0x00102000 end_dtors = .
+ *(.data)
+ .data 0x00102000 0x24 Core/kmain.wtf.o
+ 0x00102020 melonLogoCols
+ 0x00102000 melonLogo
+ 0x0010201c melonLogoLines
+ .data 0x00102024 0x0 Core/cppsupport.wtf.o
+ .data 0x00102024 0x0 Core/Sys.ns.o
+ .data 0x00102024 0x0 Core/CMem.ns.o
+ .data 0x00102024 0x0 DisplayManager/Disp.ns.o
+ .data 0x00102024 0x0 Devices/Display/VGATextOutput.class.o
+
+.bss 0x00102024 0x4010
+ 0x00102024 sbss = .
+ *(COMMON)
+ *(.bss)
+ .bss 0x00102024 0x0 Core/kmain.wtf.o
+ .bss 0x00102024 0x4000 Core/loader.wtf.o
+ .bss 0x00106024 0x4 Core/cppsupport.wtf.o
+ 0x00106024 __dso_handle
+ .bss 0x00106028 0x0 Core/Sys.ns.o
+ .bss 0x00106028 0x0 Core/CMem.ns.o
+ .bss 0x00106028 0xc DisplayManager/Disp.ns.o
+ 0x00106028 Disp::mode
+ .bss 0x00106034 0x0 Devices/Display/VGATextOutput.class.o
+ 0x00106034 ebss = .
+ 0x00106034 end = .
+ 0x00106034 _end = .
+ 0x00106034 __end = .
+LOAD Core/kmain.wtf.o
+LOAD Core/loader.wtf.o
+LOAD Core/cppsupport.wtf.o
+LOAD Core/Sys.ns.o
+LOAD Core/CMem.ns.o
+LOAD DisplayManager/Disp.ns.o
+LOAD Devices/Display/VGATextOutput.class.o
+OUTPUT(Melon.ke elf32-i386)
+
+.comment 0x00000000 0x8b
+ .comment 0x00000000 0x12 Core/kmain.wtf.o
+ .comment 0x00000012 0x1f Core/loader.wtf.o
+ .comment 0x00000031 0x12 Core/cppsupport.wtf.o
+ .comment 0x00000043 0x12 Core/Sys.ns.o
+ .comment 0x00000055 0x12 Core/CMem.ns.o
+ .comment 0x00000067 0x12 DisplayManager/Disp.ns.o
+ .comment 0x00000079 0x12 Devices/Display/VGATextOutput.class.o
+
+.note.GNU-stack
+ 0x00000000 0x0
+ .note.GNU-stack
+ 0x00000000 0x0 Core/kmain.wtf.o
+ .note.GNU-stack
+ 0x00000000 0x0 Core/cppsupport.wtf.o
+ .note.GNU-stack
+ 0x00000000 0x0 Core/Sys.ns.o
+ .note.GNU-stack
+ 0x00000000 0x0 Core/CMem.ns.o
+ .note.GNU-stack
+ 0x00000000 0x0 DisplayManager/Disp.ns.o
+ .note.GNU-stack
+ 0x00000000 0x0 Devices/Display/VGATextOutput.class.o
diff --git a/Source/Kernel/Melon.ke b/Source/Kernel/Melon.ke
new file mode 100755
index 0000000..b4a7f39
--- /dev/null
+++ b/Source/Kernel/Melon.ke
Binary files differ
diff --git a/Source/Kernel/Ressources/logo.cd b/Source/Kernel/Ressources/logo.cd
new file mode 100644
index 0000000..6dbcc41
--- /dev/null
+++ b/Source/Kernel/Ressources/logo.cd
@@ -0,0 +1,10 @@
+char *melonLogo[] = {
+" THE //|| //// ",
+" // || // // //==// // /====/ //| // ",
+" // || // // // // // // // //|| // ",
+" // |// // //==// // // // // || // ",
+" // // // // // // // ||// ",
+" // // //==== // /====/ // |// ",
+" OPERATING SYSTEM "
+};
+int melonLogoLines = 7, melonLogoCols = 60;