summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-10-18 15:27:34 +0200
committerAlexis211 <alexis211@gmail.com>2009-10-18 15:27:34 +0200
commit323e12f1f9ab33df15dcfed210e807561d98fa8c (patch)
tree7d76e6932d4a979a1f2bfafc94478b66b1479bbc /Source
parentbc2eccdd11c27029096fb3e891073503eb269e27 (diff)
downloadMelon-323e12f1f9ab33df15dcfed210e807561d98fa8c.tar.gz
Melon-323e12f1f9ab33df15dcfed210e807561d98fa8c.zip
Re-organized everything
Diffstat (limited to 'Source')
-rw-r--r--Source/Applications/SampleApps/Makefile20
-rwxr-xr-xSource/Applications/SampleApps/asmdemobin4725 -> 0 bytes
-rw-r--r--Source/Applications/SampleApps/cxxdemo.cpp10
-rw-r--r--Source/Kernel/Core/Sys.ns.cpp2
-rw-r--r--Source/Kernel/Core/cppsupport.wtf.cpp2
-rw-r--r--Source/Kernel/Core/kmain.wtf.cpp6
-rw-r--r--Source/Kernel/DeviceManager/Dev.ns.h2
-rw-r--r--Source/Kernel/DeviceManager/Disp.ns.h2
-rw-r--r--Source/Kernel/DeviceManager/Kbd.ns.cpp2
-rw-r--r--Source/Kernel/DeviceManager/Kbd.ns.h4
-rw-r--r--Source/Kernel/Devices/Device.proto.h2
-rw-r--r--Source/Kernel/Devices/Display/Display.proto.h4
-rw-r--r--Source/Kernel/Linker/ElfBinary.class.h2
-rw-r--r--Source/Kernel/Makefile14
-rw-r--r--Source/Kernel/MemoryManager/GDT.ns.h2
-rw-r--r--Source/Kernel/MemoryManager/Heap.class.h2
-rw-r--r--Source/Kernel/MemoryManager/Mem.ns.cpp2
-rw-r--r--Source/Kernel/MemoryManager/PageAlloc.ns.h2
-rw-r--r--Source/Kernel/MemoryManager/PageDirectory.class.h2
-rw-r--r--Source/Kernel/MemoryManager/PhysMem.ns.cpp2
-rw-r--r--Source/Kernel/Ressources/Keymaps/Keymap.h2
-rwxr-xr-xSource/Kernel/Ressources/Keymaps/MakeMKM.sh4
-rw-r--r--Source/Kernel/Shell/KernelShell.class.cpp3
-rw-r--r--Source/Kernel/Shell/KernelShell.class.h2
-rw-r--r--Source/Kernel/SyscallManager/IDT.ns.h2
-rw-r--r--Source/Kernel/TaskManager/Mutex.class.h2
-rw-r--r--Source/Kernel/TaskManager/Process.class.h6
-rw-r--r--Source/Kernel/TaskManager/Task.ns.cpp1
-rw-r--r--Source/Kernel/TaskManager/Task.ns.h2
-rw-r--r--Source/Kernel/VFS/DirectoryNode.class.h2
-rw-r--r--Source/Kernel/VFS/FSNode.proto.h4
-rw-r--r--Source/Kernel/VFS/File.class.h2
-rw-r--r--Source/Kernel/VFS/Part.ns.h2
-rw-r--r--Source/Kernel/VTManager/VT.ns.cpp2
-rw-r--r--Source/Kernel/VTManager/VT.ns.h2
-rw-r--r--Source/Kernel/VTManager/VirtualTerminal.proto.h6
-rw-r--r--Source/Kernel/common.h (renamed from Source/Kernel/Core/common.wtf.h)4
-rw-r--r--Source/Library/Common/BasicString.class.cpp (renamed from Source/Kernel/Library/BasicString.class.cpp)2
-rw-r--r--Source/Library/Common/BasicString.class.h (renamed from Source/Kernel/Library/BasicString.class.h)2
-rw-r--r--Source/Library/Common/Bitset.class.cpp (renamed from Source/Kernel/Library/Bitset.class.cpp)0
-rw-r--r--Source/Library/Common/Bitset.class.h (renamed from Source/Kernel/Library/Bitset.class.h)2
-rw-r--r--Source/Library/Common/ByteArray.class.cpp (renamed from Source/Kernel/Library/ByteArray.class.cpp)4
-rw-r--r--Source/Library/Common/ByteArray.class.h (renamed from Source/Kernel/Library/ByteArray.class.h)5
-rw-r--r--Source/Library/Common/CMem.ns.cpp (renamed from Source/Kernel/Core/CMem.ns.cpp)2
-rw-r--r--Source/Library/Common/CMem.ns.h (renamed from Source/Kernel/Core/CMem.ns.h)0
-rw-r--r--Source/Library/Common/OrderedArray.class.cpp (renamed from Source/Kernel/Library/OrderedArray.class.cpp)0
-rw-r--r--Source/Library/Common/OrderedArray.class.h (renamed from Source/Kernel/Library/OrderedArray.class.h)2
-rw-r--r--Source/Library/Common/Rand.ns.cpp (renamed from Source/Kernel/Library/Rand.ns.cpp)0
-rw-r--r--Source/Library/Common/Rand.ns.h (renamed from Source/Kernel/Library/Rand.ns.h)2
-rw-r--r--Source/Library/Common/SimpleList.class.h (renamed from Source/Kernel/Library/SimpleList.class.h)0
-rw-r--r--Source/Library/Common/String.class.cpp (renamed from Source/Kernel/Library/String.class.cpp)2
-rw-r--r--Source/Library/Common/String.class.h (renamed from Source/Kernel/Library/String.class.h)5
-rw-r--r--Source/Library/Common/Vector.class.cpp (renamed from Source/Kernel/Library/Vector.class.cpp)0
-rw-r--r--Source/Library/Common/Vector.class.h (renamed from Source/Kernel/Library/Vector.class.h)2
-rw-r--r--Source/Library/Common/WChar.class.cpp (renamed from Source/Kernel/Library/WChar.class.cpp)6
-rw-r--r--Source/Library/Common/WChar.class.h (renamed from Source/Kernel/Library/WChar.class.h)4
-rw-r--r--Source/Library/Common/types.h (renamed from Source/Kernel/Core/types.wtf.h)0
-rw-r--r--Source/Library/Makefile33
-rw-r--r--Source/Library/Userland/Syscall/Syscall.wtf.cpp20
-rw-r--r--Source/Library/Userland/Syscall/Syscall.wtf.h9
-rw-r--r--Source/Library/Userland/common.h10
-rwxr-xr-xSource/Tools/MakeRamFS/MakeRamFSbin12483 -> 0 bytes
62 files changed, 164 insertions, 80 deletions
diff --git a/Source/Applications/SampleApps/Makefile b/Source/Applications/SampleApps/Makefile
index 28dad49..6d12f3f 100644
--- a/Source/Applications/SampleApps/Makefile
+++ b/Source/Applications/SampleApps/Makefile
@@ -2,23 +2,31 @@
ASM = nasm
ASMFLAGS = -f elf
+
+CXX = g++
+CXXFLAGS = -nostartfiles -nostdlib -fno-exceptions -fno-rtti -I ../../Library/Common -I ../../Library/Userland -D THIS_IS_MELON_USERLAND
+
LD = ld
LDFLAGS = --entry=start -Ttext=40000000
-Applications = asmdemo
+Applications = asmdemo cxxdemo
all: $(Applications)
echo "* Done with applications : $(Applications)"
rebuild: mrproper all
-%: %.o
- echo "* Linking $<..."
- $(LD) $(LDFLAGS) $< -o $@
+%: %.cpp
+ echo "* Compiling $<..."
+ $(CXX) $(CXXFLAGS) -c $< -o $@.o
+ echo "* Linking $@.o..."
+ $(LD) $(LDFLAGS) ../../Library/Melon.o $@.o -o $@
-%.o: %.asm
+%: %.asm
echo "* Compiling $<..."
- $(ASM) $(ASMFLAGS) -o $@ $<
+ $(ASM) $(ASMFLAGS) -o $@.o $<
+ echo "* Linking $@.o..."
+ $(LD) $(LDFLAGS) $@.o -o $@
clean:
echo "* Removing object files..."
diff --git a/Source/Applications/SampleApps/asmdemo b/Source/Applications/SampleApps/asmdemo
deleted file mode 100755
index 9e6822d..0000000
--- a/Source/Applications/SampleApps/asmdemo
+++ /dev/null
Binary files differ
diff --git a/Source/Applications/SampleApps/cxxdemo.cpp b/Source/Applications/SampleApps/cxxdemo.cpp
new file mode 100644
index 0000000..5d95d28
--- /dev/null
+++ b/Source/Applications/SampleApps/cxxdemo.cpp
@@ -0,0 +1,10 @@
+#include <Syscall/Syscall.wtf.h>
+#include <WChar.class.h>
+
+int main() {
+ for (char c = ' '; c <= 'z'; c++) {
+ syscall(0xFFFFFF02, (unsigned int)c);
+ putch(c);
+ }
+ putch('\n');
+}
diff --git a/Source/Kernel/Core/Sys.ns.cpp b/Source/Kernel/Core/Sys.ns.cpp
index a8a6c91..c99544b 100644
--- a/Source/Kernel/Core/Sys.ns.cpp
+++ b/Source/Kernel/Core/Sys.ns.cpp
@@ -1,5 +1,5 @@
//This automatically includes Sys.ns.h
-#include <Core/common.wtf.h>
+#include <common.h>
#include <Core/Log.ns.h>
#include <VTManager/SimpleVT.class.h>
#include <SyscallManager/IDT.ns.h>
diff --git a/Source/Kernel/Core/cppsupport.wtf.cpp b/Source/Kernel/Core/cppsupport.wtf.cpp
index bad28f2..2cefc39 100644
--- a/Source/Kernel/Core/cppsupport.wtf.cpp
+++ b/Source/Kernel/Core/cppsupport.wtf.cpp
@@ -1,5 +1,5 @@
//This file just contains a few methods required for some C++ things to work
-#include <Core/types.wtf.h>
+#include <types.h>
extern "C" void __cxa_pure_virtual() {} //Required when using abstract classes
diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp
index 87e95de..a8fb002 100644
--- a/Source/Kernel/Core/kmain.wtf.cpp
+++ b/Source/Kernel/Core/kmain.wtf.cpp
@@ -1,6 +1,6 @@
//This file contains the kernel's main procedure
-#include <Core/common.wtf.h>
+#include <common.h>
#include <Core/multiboot.wtf.h>
#include <Devices/Display/VGATextOutput.class.h>
@@ -18,8 +18,8 @@
#include <MemoryManager/GDT.ns.h>
#include <TaskManager/Task.ns.h>
#include <SyscallManager/IDT.ns.h>
-#include <Library/String.class.h>
-#include <Library/ByteArray.class.h>
+#include <String.class.h>
+#include <ByteArray.class.h>
#include <VFS/Part.ns.h>
#include <FileSystems/RamFS/RamFS.class.h>
#include <VFS/FileNode.class.h>
diff --git a/Source/Kernel/DeviceManager/Dev.ns.h b/Source/Kernel/DeviceManager/Dev.ns.h
index 7dda56b..aa52e81 100644
--- a/Source/Kernel/DeviceManager/Dev.ns.h
+++ b/Source/Kernel/DeviceManager/Dev.ns.h
@@ -2,7 +2,7 @@
#define DEF_DEV_NS_H
#include <Devices/Device.proto.h>
-#include <Library/Vector.class.h>
+#include <Vector.class.h>
namespace Dev {
void handleIRQ(registers_t regs, int irq);
diff --git a/Source/Kernel/DeviceManager/Disp.ns.h b/Source/Kernel/DeviceManager/Disp.ns.h
index 5a92e69..0eea51d 100644
--- a/Source/Kernel/DeviceManager/Disp.ns.h
+++ b/Source/Kernel/DeviceManager/Disp.ns.h
@@ -2,7 +2,7 @@
#define DEF_DISP_NS_H
#include <Devices/Display/Display.proto.h>
-#include <Library/WChar.class.h>
+#include <WChar.class.h>
namespace Disp {
struct mode_t {
diff --git a/Source/Kernel/DeviceManager/Kbd.ns.cpp b/Source/Kernel/DeviceManager/Kbd.ns.cpp
index 3db0d34..4fbf511 100644
--- a/Source/Kernel/DeviceManager/Kbd.ns.cpp
+++ b/Source/Kernel/DeviceManager/Kbd.ns.cpp
@@ -1,6 +1,6 @@
#include "Kbd.ns.h"
#include <DeviceManager/Dev.ns.h>
-#include <Library/Vector.class.h>
+#include <Vector.class.h>
#include <Devices/Keyboard/Keyboard.proto.h>
#include <VTManager/VirtualTerminal.proto.h>
#include <Ressources/Keymaps/Keymap.h>
diff --git a/Source/Kernel/DeviceManager/Kbd.ns.h b/Source/Kernel/DeviceManager/Kbd.ns.h
index 50cd746..2934474 100644
--- a/Source/Kernel/DeviceManager/Kbd.ns.h
+++ b/Source/Kernel/DeviceManager/Kbd.ns.h
@@ -1,8 +1,8 @@
#ifndef DEF_KBD_NS_H
#define DEF_KBD_NS_H
-#include <Core/common.wtf.h>
-#include <Library/WChar.class.h>
+#include <common.h>
+#include <WChar.class.h>
//Used by variable kbdstatus
#define STATUS_SCRL 0x40
diff --git a/Source/Kernel/Devices/Device.proto.h b/Source/Kernel/Devices/Device.proto.h
index 4f216ec..b0db514 100644
--- a/Source/Kernel/Devices/Device.proto.h
+++ b/Source/Kernel/Devices/Device.proto.h
@@ -1,7 +1,7 @@
#ifndef DEF_DEVICE_PROTO_H
#define DEF_DEVICE_PROTO_H
-#include <Library/String.class.h>
+#include <String.class.h>
#include <SyscallManager/IDT.ns.h>
diff --git a/Source/Kernel/Devices/Display/Display.proto.h b/Source/Kernel/Devices/Display/Display.proto.h
index d4bd8fc..2cec616 100644
--- a/Source/Kernel/Devices/Display/Display.proto.h
+++ b/Source/Kernel/Devices/Display/Display.proto.h
@@ -1,9 +1,9 @@
#ifndef DEF_DISPLAY_PROTO_H
#define DEF_DISPLAY_PROTO_H
-#include <Core/common.wtf.h>
+#include <common.h>
#include <Devices/Device.proto.h>
-#include <Library/WChar.class.h>
+#include <WChar.class.h>
class Display : public Device {
public:
diff --git a/Source/Kernel/Linker/ElfBinary.class.h b/Source/Kernel/Linker/ElfBinary.class.h
index 311e2e6..1fb9929 100644
--- a/Source/Kernel/Linker/ElfBinary.class.h
+++ b/Source/Kernel/Linker/ElfBinary.class.h
@@ -2,7 +2,7 @@
#define DEF_ELFBINARY_CLASS_H
#include <Linker/Binary.proto.h>
-#include <Library/SimpleList.class.h>
+#include <SimpleList.class.h>
/* p_type */
#define PT_NULL 0
diff --git a/Source/Kernel/Makefile b/Source/Kernel/Makefile
index af1f9db..257c53d 100644
--- a/Source/Kernel/Makefile
+++ b/Source/Kernel/Makefile
@@ -5,7 +5,7 @@ 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 -I .
-CXXFLAGS = -nostartfiles -nostdlib -fno-exceptions -fno-rtti -I . -Wall -Werror -Wno-write-strings -funsigned-char -D THIS_IS_MELON -D RANDOM_SEED=1`date +%N`LL -g
+CXXFLAGS = -nostartfiles -nostdlib -fno-exceptions -fno-rtti -I . -I ../Library/Common -Wall -Werror -Wno-write-strings -funsigned-char -D THIS_IS_MELON_KERNEL -D RANDOM_SEED=1`date +%N`LL -g
ASM = nasm
ASMFLAGS = -f elf
@@ -14,7 +14,6 @@ Objects = Core/loader.wtf.o \
Core/kmain.wtf.o \
Core/cppsupport.wtf.o \
Core/Sys.ns.o \
- Core/CMem.ns.o \
Core/Log.ns.o \
MemoryManager/Mem.ns.o \
MemoryManager/Heap.class.o \
@@ -46,11 +45,12 @@ Objects = Core/loader.wtf.o \
Linker/Binary.proto.o \
Linker/MelonBinary.class.o \
Linker/ElfBinary.class.o \
- Library/Bitset.class.o \
- Library/String.class.o \
- Library/ByteArray.class.o \
- Library/WChar.class.o \
- Library/Rand.ns.o \
+ ../Library/Common/Bitset.class.o \
+ ../Library/Common/String.class.o \
+ ../Library/Common/ByteArray.class.o \
+ ../Library/Common/WChar.class.o \
+ ../Library/Common/Rand.ns.o \
+ ../Library/Common/CMem.ns.o \
VFS/Partition.class.o \
VFS/Part.ns.o \
VFS/VFS.ns.o \
diff --git a/Source/Kernel/MemoryManager/GDT.ns.h b/Source/Kernel/MemoryManager/GDT.ns.h
index 94306a4..9505433 100644
--- a/Source/Kernel/MemoryManager/GDT.ns.h
+++ b/Source/Kernel/MemoryManager/GDT.ns.h
@@ -1,7 +1,7 @@
#ifndef DEF_GDT_NS_H
#define DEF_GDT_NS_H
-#include <Core/common.wtf.h>
+#include <common.h>
namespace GDT {
struct gdt_entry_t {
diff --git a/Source/Kernel/MemoryManager/Heap.class.h b/Source/Kernel/MemoryManager/Heap.class.h
index 930a589..291c9ce 100644
--- a/Source/Kernel/MemoryManager/Heap.class.h
+++ b/Source/Kernel/MemoryManager/Heap.class.h
@@ -1,7 +1,7 @@
#ifndef DEF_HEAP_CLASS_H
#define DEF_HEAP_CLASS_H
-#include <Core/common.wtf.h>
+#include <common.h>
#include <TaskManager/Mutex.class.h>
//Heap minimum size : 2M
diff --git a/Source/Kernel/MemoryManager/Mem.ns.cpp b/Source/Kernel/MemoryManager/Mem.ns.cpp
index 0698a12..6c64a53 100644
--- a/Source/Kernel/MemoryManager/Mem.ns.cpp
+++ b/Source/Kernel/MemoryManager/Mem.ns.cpp
@@ -1,4 +1,4 @@
-#include <Core/common.wtf.h>
+#include <common.h>
#include <MemoryManager/PhysMem.ns.h>
#include <MemoryManager/Heap.class.h>
diff --git a/Source/Kernel/MemoryManager/PageAlloc.ns.h b/Source/Kernel/MemoryManager/PageAlloc.ns.h
index 894defa..d0b376a 100644
--- a/Source/Kernel/MemoryManager/PageAlloc.ns.h
+++ b/Source/Kernel/MemoryManager/PageAlloc.ns.h
@@ -1,7 +1,7 @@
#ifndef DEF_PAGEALLOC_NS_H
#define DEF_PAGEALLOC_NS_H
-#include <Core/common.wtf.h>
+#include <common.h>
namespace PageAlloc {
void init();
diff --git a/Source/Kernel/MemoryManager/PageDirectory.class.h b/Source/Kernel/MemoryManager/PageDirectory.class.h
index e06b546..14b78ca 100644
--- a/Source/Kernel/MemoryManager/PageDirectory.class.h
+++ b/Source/Kernel/MemoryManager/PageDirectory.class.h
@@ -1,7 +1,7 @@
#ifndef DEF_PAGEDIRECTORY_CLASS_H
#define DEF_PAGEDIRECTORY_CLASS_H
-#include <Core/common.wtf.h>
+#include <common.h>
struct page_t {
u32int present : 1;
diff --git a/Source/Kernel/MemoryManager/PhysMem.ns.cpp b/Source/Kernel/MemoryManager/PhysMem.ns.cpp
index 9e4b36a..25869f1 100644
--- a/Source/Kernel/MemoryManager/PhysMem.ns.cpp
+++ b/Source/Kernel/MemoryManager/PhysMem.ns.cpp
@@ -1,5 +1,5 @@
#include "PhysMem.ns.h"
-#include <Library/Bitset.class.h>
+#include <Bitset.class.h>
#include <VTManager/VirtualTerminal.proto.h>
PageDirectory* kernelPageDirectory;
diff --git a/Source/Kernel/Ressources/Keymaps/Keymap.h b/Source/Kernel/Ressources/Keymaps/Keymap.h
index 304e52c..9d1079d 100644
--- a/Source/Kernel/Ressources/Keymaps/Keymap.h
+++ b/Source/Kernel/Ressources/Keymaps/Keymap.h
@@ -1,4 +1,4 @@
-#include <Library/WChar.class.h>
+#include <WChar.class.h>
struct melon_keymap_t {
WChar normal[128];
diff --git a/Source/Kernel/Ressources/Keymaps/MakeMKM.sh b/Source/Kernel/Ressources/Keymaps/MakeMKM.sh
index ac54ce8..056abe2 100755
--- a/Source/Kernel/Ressources/Keymaps/MakeMKM.sh
+++ b/Source/Kernel/Ressources/Keymaps/MakeMKM.sh
@@ -7,11 +7,11 @@
for KM in `ls | grep cxd`; do
echo "#define THIS_IS_NOT_MELON" > kmtemp.cpp
echo "#include <cstring>" >> kmtemp.cpp
- echo "#include <Library/WChar.class.cpp>" >> kmtemp.cpp
+ echo "#include <WChar.class.cpp>" >> kmtemp.cpp
echo "#include \"$KM\"" >> kmtemp.cpp
cat WriteKeymap.cpp >> kmtemp.cpp
- g++ kmtemp.cpp -o kmtemp -I ../..
+ g++ kmtemp.cpp -o kmtemp -I ../../../Library/Common
./kmtemp
done
diff --git a/Source/Kernel/Shell/KernelShell.class.cpp b/Source/Kernel/Shell/KernelShell.class.cpp
index cb6246d..d90fc4c 100644
--- a/Source/Kernel/Shell/KernelShell.class.cpp
+++ b/Source/Kernel/Shell/KernelShell.class.cpp
@@ -1,8 +1,7 @@
#include "KernelShell.class.h"
#include <VTManager/ScrollableVT.class.h>
#include <DeviceManager/Kbd.ns.h>
-#include <Library/Rand.ns.h>
-#include <Library/SimpleList.class.h>
+#include <SimpleList.class.h>
#include <MemoryManager/PhysMem.ns.h>
#include <VFS/VFS.ns.h>
#include <TaskManager/Task.ns.h>
diff --git a/Source/Kernel/Shell/KernelShell.class.h b/Source/Kernel/Shell/KernelShell.class.h
index 48d9704..e7549c2 100644
--- a/Source/Kernel/Shell/KernelShell.class.h
+++ b/Source/Kernel/Shell/KernelShell.class.h
@@ -4,7 +4,7 @@
#include <VTManager/VirtualTerminal.proto.h>
#include <VFS/DirectoryNode.class.h>
#include <TaskManager/Thread.class.h>
-#include <Library/Vector.class.h>
+#include <Vector.class.h>
class KernelShell {
friend u32int shellRun(void* ks);
diff --git a/Source/Kernel/SyscallManager/IDT.ns.h b/Source/Kernel/SyscallManager/IDT.ns.h
index 52f1ed5..e73a885 100644
--- a/Source/Kernel/SyscallManager/IDT.ns.h
+++ b/Source/Kernel/SyscallManager/IDT.ns.h
@@ -1,7 +1,7 @@
#ifndef DEF_IDT_NS_H
#define DEF_IDT_NS_H
-#include <Core/common.wtf.h>
+#include <common.h>
struct registers_t {
u32int ds; // Data segment selector
diff --git a/Source/Kernel/TaskManager/Mutex.class.h b/Source/Kernel/TaskManager/Mutex.class.h
index 5545559..1e3f63d 100644
--- a/Source/Kernel/TaskManager/Mutex.class.h
+++ b/Source/Kernel/TaskManager/Mutex.class.h
@@ -1,7 +1,7 @@
#ifndef DEF_MUTEX_CLASS_H
#define DEF_MUTEX_CLASS_H
-#include <Core/common.wtf.h>
+#include <common.h>
#define MUTEX_FALSE 0
#define MUTEX_TRUE 1
diff --git a/Source/Kernel/TaskManager/Process.class.h b/Source/Kernel/TaskManager/Process.class.h
index 7cd78fc..fdd1377 100644
--- a/Source/Kernel/TaskManager/Process.class.h
+++ b/Source/Kernel/TaskManager/Process.class.h
@@ -1,9 +1,9 @@
#ifndef DEF_PROCESS_CLASS_H
#define DEF_PROCESS_CLASS_H
-#include <Library/String.class.h>
-#include <Library/Vector.class.h>
-#include <Library/SimpleList.class.h>
+#include <String.class.h>
+#include <Vector.class.h>
+#include <SimpleList.class.h>
#include <MemoryManager/PageDirectory.class.h>
#include <MemoryManager/Heap.class.h>
#include <VTManager/VirtualTerminal.proto.h>
diff --git a/Source/Kernel/TaskManager/Task.ns.cpp b/Source/Kernel/TaskManager/Task.ns.cpp
index 437d5b4..aef07f3 100644
--- a/Source/Kernel/TaskManager/Task.ns.cpp
+++ b/Source/Kernel/TaskManager/Task.ns.cpp
@@ -1,5 +1,4 @@
#include "Task.ns.h"
-#include <Library/Vector.class.h>
#include <MemoryManager/PhysMem.ns.h>
#define INVALID_TASK_MAGIC 0xBEEFFEED
diff --git a/Source/Kernel/TaskManager/Task.ns.h b/Source/Kernel/TaskManager/Task.ns.h
index c7c3d23..056e4c0 100644
--- a/Source/Kernel/TaskManager/Task.ns.h
+++ b/Source/Kernel/TaskManager/Task.ns.h
@@ -3,7 +3,7 @@
#include <TaskManager/Thread.class.h>
#include <VTManager/VirtualTerminal.proto.h>
-#include <Library/SimpleList.class.h>
+#include <SimpleList.class.h>
namespace Task {
Thread* currThread();
diff --git a/Source/Kernel/VFS/DirectoryNode.class.h b/Source/Kernel/VFS/DirectoryNode.class.h
index 2130458..346c4ab 100644
--- a/Source/Kernel/VFS/DirectoryNode.class.h
+++ b/Source/Kernel/VFS/DirectoryNode.class.h
@@ -2,7 +2,7 @@
#define DEF_DIRECTORYNODE_CLASS_H
#include <VFS/FileNode.class.h>
-#include <Library/Vector.class.h>
+#include <Vector.class.h>
class DirectoryNode : public FSNode {
protected:
diff --git a/Source/Kernel/VFS/FSNode.proto.h b/Source/Kernel/VFS/FSNode.proto.h
index 8773543..c3cd1c1 100644
--- a/Source/Kernel/VFS/FSNode.proto.h
+++ b/Source/Kernel/VFS/FSNode.proto.h
@@ -1,8 +1,8 @@
#ifndef DEF_FSNODE_PROTO_H
#define DEF_FSNODE_PROTO_H
-#include <Core/common.wtf.h>
-#include <Library/String.class.h>
+#include <common.h>
+#include <String.class.h>
class FSNode;
#include <VFS/FileSystem.proto.h>
diff --git a/Source/Kernel/VFS/File.class.h b/Source/Kernel/VFS/File.class.h
index 7831fb5..f5d0c56 100644
--- a/Source/Kernel/VFS/File.class.h
+++ b/Source/Kernel/VFS/File.class.h
@@ -2,7 +2,7 @@
#define DEF_FILE_CLASS_H
#include <VFS/FileNode.class.h>
-#include <Library/ByteArray.class.h>
+#include <ByteArray.class.h>
enum {
FM_READ = 0, //Open for read, put cursor at beginning
diff --git a/Source/Kernel/VFS/Part.ns.h b/Source/Kernel/VFS/Part.ns.h
index 07a45f9..40a0fb2 100644
--- a/Source/Kernel/VFS/Part.ns.h
+++ b/Source/Kernel/VFS/Part.ns.h
@@ -2,7 +2,7 @@
#define DEF_PART_NS_H
#include <Devices/BlockDevice.proto.h>
-#include <Library/Vector.class.h>
+#include <Vector.class.h>
#include <VFS/Partition.class.h>
namespace Part {
diff --git a/Source/Kernel/VTManager/VT.ns.cpp b/Source/Kernel/VTManager/VT.ns.cpp
index 87586bc..ee7299d 100644
--- a/Source/Kernel/VTManager/VT.ns.cpp
+++ b/Source/Kernel/VTManager/VT.ns.cpp
@@ -1,5 +1,5 @@
#include "VT.ns.h"
-#include <Library/Vector.class.h>
+#include <Vector.class.h>
#include <DeviceManager/Disp.ns.h>
namespace VT {
diff --git a/Source/Kernel/VTManager/VT.ns.h b/Source/Kernel/VTManager/VT.ns.h
index 55556b9..9390636 100644
--- a/Source/Kernel/VTManager/VT.ns.h
+++ b/Source/Kernel/VTManager/VT.ns.h
@@ -1,7 +1,7 @@
#ifndef DEF_VT_NS_H
#define DEF_VT_NS_H
-#include <Core/common.wtf.h>
+#include <common.h>
#include <VTManager/SimpleVT.class.h>
namespace VT {
diff --git a/Source/Kernel/VTManager/VirtualTerminal.proto.h b/Source/Kernel/VTManager/VirtualTerminal.proto.h
index ea6284f..9d0afa0 100644
--- a/Source/Kernel/VTManager/VirtualTerminal.proto.h
+++ b/Source/Kernel/VTManager/VirtualTerminal.proto.h
@@ -1,11 +1,11 @@
#ifndef DEF_VIRTUALTERMINAL_CLASS_H
#define DEF_VIRTUALTERMINAL_CLASS_H
-#include <Core/common.wtf.h>
-#include <Library/String.class.h>
+#include <common.h>
+#include <String.class.h>
#include <TaskManager/Mutex.class.h>
#include <DeviceManager/Kbd.ns.h>
-#include <Library/Vector.class.h>
+#include <Vector.class.h>
struct vtchr {
u8int color;
diff --git a/Source/Kernel/Core/common.wtf.h b/Source/Kernel/common.h
index 5fb67b4..c6da25e 100644
--- a/Source/Kernel/Core/common.wtf.h
+++ b/Source/Kernel/common.h
@@ -7,9 +7,9 @@
#define NULL 0
-#include <Core/types.wtf.h>
+#include <types.h>
-#include <Core/CMem.ns.h>
+#include <CMem.ns.h>
#include <Core/Sys.ns.h>
#include <MemoryManager/Mem.ns.h>
diff --git a/Source/Kernel/Library/BasicString.class.cpp b/Source/Library/Common/BasicString.class.cpp
index ae89fe4..ceab60b 100644
--- a/Source/Kernel/Library/BasicString.class.cpp
+++ b/Source/Library/Common/BasicString.class.cpp
@@ -1,4 +1,4 @@
-#include <Library/Vector.class.h>
+#include <Vector.class.h>
#define FREE if (m_string != 0) delete m_string;
#define ALLOC m_string = new T[m_length];
diff --git a/Source/Kernel/Library/BasicString.class.h b/Source/Library/Common/BasicString.class.h
index 5c69d00..17055e8 100644
--- a/Source/Kernel/Library/BasicString.class.h
+++ b/Source/Library/Common/BasicString.class.h
@@ -1,7 +1,7 @@
#ifndef DEF_BASICSTRING_CLASS_H
#define DEF_BASICSTRING_CLASS_H
-#include <Core/common.wtf.h>
+#include <common.h>
template <typename T> class Vector;
diff --git a/Source/Kernel/Library/Bitset.class.cpp b/Source/Library/Common/Bitset.class.cpp
index ec4e62c..ec4e62c 100644
--- a/Source/Kernel/Library/Bitset.class.cpp
+++ b/Source/Library/Common/Bitset.class.cpp
diff --git a/Source/Kernel/Library/Bitset.class.h b/Source/Library/Common/Bitset.class.h
index 75fde24..8a0707d 100644
--- a/Source/Kernel/Library/Bitset.class.h
+++ b/Source/Library/Common/Bitset.class.h
@@ -1,7 +1,7 @@
#ifndef DEF_BITSET_CLASS_H
#define DEF_BITSET_CLASS_H
-#include <Core/common.wtf.h>
+#include <common.h>
#define INDEX_FROM_BIT(a) (a/(8*4))
#define OFFSET_FROM_BIT(a) (a%(8*4))
diff --git a/Source/Kernel/Library/ByteArray.class.cpp b/Source/Library/Common/ByteArray.class.cpp
index 9972493..2a42702 100644
--- a/Source/Kernel/Library/ByteArray.class.cpp
+++ b/Source/Library/Common/ByteArray.class.cpp
@@ -49,10 +49,6 @@ void ByteArray::resize(u32int size) {
m_length = size;
}
-void ByteArray::dump(VirtualTerminal *vt) {
- vt->hexDump(m_string, m_length);
-}
-
String ByteArray::toString (u8int encoding) {
char* c = new char[m_length + 1];
memcpy((u8int*)c, m_string, m_length);
diff --git a/Source/Kernel/Library/ByteArray.class.h b/Source/Library/Common/ByteArray.class.h
index a6d594f..339e0d4 100644
--- a/Source/Kernel/Library/ByteArray.class.h
+++ b/Source/Library/Common/ByteArray.class.h
@@ -1,8 +1,7 @@
#ifndef DEF_BYTEARRAY_CLASS_H
#define DEF_BYTEARRAY_CLASS_H
-#include <Library/String.class.h>
-#include <VTManager/VirtualTerminal.proto.h>
+#include <String.class.h>
class ByteArray : public BasicString<u8int> {
public:
@@ -21,8 +20,6 @@ class ByteArray : public BasicString<u8int> {
void affect(const String& string, u8int encoding = UE_UTF8);
void resize(u32int size);
- void dump(VirtualTerminal *vt);
-
String toString(u8int encoding = UE_UTF8);
operator u8int* () { return m_string; }
};
diff --git a/Source/Kernel/Core/CMem.ns.cpp b/Source/Library/Common/CMem.ns.cpp
index c2129ec..37cdf0c 100644
--- a/Source/Kernel/Core/CMem.ns.cpp
+++ b/Source/Library/Common/CMem.ns.cpp
@@ -1,4 +1,4 @@
-#include <Core/common.wtf.h>
+#include <common.h>
namespace CMem {
diff --git a/Source/Kernel/Core/CMem.ns.h b/Source/Library/Common/CMem.ns.h
index f0c15da..f0c15da 100644
--- a/Source/Kernel/Core/CMem.ns.h
+++ b/Source/Library/Common/CMem.ns.h
diff --git a/Source/Kernel/Library/OrderedArray.class.cpp b/Source/Library/Common/OrderedArray.class.cpp
index 8b8f24f..8b8f24f 100644
--- a/Source/Kernel/Library/OrderedArray.class.cpp
+++ b/Source/Library/Common/OrderedArray.class.cpp
diff --git a/Source/Kernel/Library/OrderedArray.class.h b/Source/Library/Common/OrderedArray.class.h
index 2a5acdd..3091249 100644
--- a/Source/Kernel/Library/OrderedArray.class.h
+++ b/Source/Library/Common/OrderedArray.class.h
@@ -1,7 +1,7 @@
#ifndef DEF_ORDARRAY_CLASS
#define DEF_ORDARRAY_CLASS
-#include <Core/common.wtf.h>
+#include <common.h>
template <typename T>
class OrderedArray {
diff --git a/Source/Kernel/Library/Rand.ns.cpp b/Source/Library/Common/Rand.ns.cpp
index e568678..e568678 100644
--- a/Source/Kernel/Library/Rand.ns.cpp
+++ b/Source/Library/Common/Rand.ns.cpp
diff --git a/Source/Kernel/Library/Rand.ns.h b/Source/Library/Common/Rand.ns.h
index 3598de0..71d4f60 100644
--- a/Source/Kernel/Library/Rand.ns.h
+++ b/Source/Library/Common/Rand.ns.h
@@ -1,7 +1,7 @@
#ifndef DEF_RAND_NS_H
#define DEF_RAND_NS_H
-#include <Core/common.wtf.h>
+#include <common.h>
namespace Rand {
u64int rand();
diff --git a/Source/Kernel/Library/SimpleList.class.h b/Source/Library/Common/SimpleList.class.h
index 64e37aa..64e37aa 100644
--- a/Source/Kernel/Library/SimpleList.class.h
+++ b/Source/Library/Common/SimpleList.class.h
diff --git a/Source/Kernel/Library/String.class.cpp b/Source/Library/Common/String.class.cpp
index 693a11a..d8913d9 100644
--- a/Source/Kernel/Library/String.class.cpp
+++ b/Source/Library/Common/String.class.cpp
@@ -1,5 +1,5 @@
#include "String.class.h"
-#include <Library/Vector.class.h>
+#include <Vector.class.h>
using namespace CMem; //strlen and memcpy
diff --git a/Source/Kernel/Library/String.class.h b/Source/Library/Common/String.class.h
index db274c9..3e50d35 100644
--- a/Source/Kernel/Library/String.class.h
+++ b/Source/Library/Common/String.class.h
@@ -1,9 +1,8 @@
#ifndef DEF_STRING_CLASS
#define DEF_STRING_CLASS
-#include <Core/common.wtf.h>
-#include <Library/WChar.class.h>
-#include <Library/BasicString.class.h>
+#include <BasicString.class.h>
+#include <WChar.class.h>
class String : public BasicString<WChar> {
public:
diff --git a/Source/Kernel/Library/Vector.class.cpp b/Source/Library/Common/Vector.class.cpp
index 02ae9be..02ae9be 100644
--- a/Source/Kernel/Library/Vector.class.cpp
+++ b/Source/Library/Common/Vector.class.cpp
diff --git a/Source/Kernel/Library/Vector.class.h b/Source/Library/Common/Vector.class.h
index 61c26a4..436e2f9 100644
--- a/Source/Kernel/Library/Vector.class.h
+++ b/Source/Library/Common/Vector.class.h
@@ -1,7 +1,7 @@
#ifndef DEF_VECTOR_CLASS
#define DEF_VECTOR_CLASS
-#include <Core/common.wtf.h>
+#include <common.h>
template <typename T>
class Vector {
diff --git a/Source/Kernel/Library/WChar.class.cpp b/Source/Library/Common/WChar.class.cpp
index ee42849..5485bb8 100644
--- a/Source/Kernel/Library/WChar.class.cpp
+++ b/Source/Library/Common/WChar.class.cpp
@@ -1,6 +1,10 @@
#include "WChar.class.h"
-#ifdef THIS_IS_MELON
+#ifdef THIS_IS_MELON_KERNEL
+using namespace CMem;
+#endif
+
+#ifdef THIS_IS_MELON_USERLAND
using namespace CMem;
#endif
diff --git a/Source/Kernel/Library/WChar.class.h b/Source/Library/Common/WChar.class.h
index e4da603..3eca3d3 100644
--- a/Source/Kernel/Library/WChar.class.h
+++ b/Source/Library/Common/WChar.class.h
@@ -1,10 +1,10 @@
#ifndef DEF_UCHAR_CLASS_H
#define DEF_UCHAR_CLASS_H
-#include <Core/types.wtf.h>
+#include <types.h>
#ifndef THIS_IS_NOT_MELON
-#include <Core/common.wtf.h>
+#include <common.h>
#endif
enum {
diff --git a/Source/Kernel/Core/types.wtf.h b/Source/Library/Common/types.h
index ca6f73d..ca6f73d 100644
--- a/Source/Kernel/Core/types.wtf.h
+++ b/Source/Library/Common/types.h
diff --git a/Source/Library/Makefile b/Source/Library/Makefile
new file mode 100644
index 0000000..f7d337b
--- /dev/null
+++ b/Source/Library/Makefile
@@ -0,0 +1,33 @@
+.PHONY: clean, mrproper
+
+CXX = g++
+CXXFLAGS = -nostartfiles -nostdlib -fno-exceptions -fno-rtti -I Common -I Userland -D THIS_IS_MELON_USERLAND
+
+LDFLAGS = -r
+LD = ld
+
+Library = Melon.o
+Objects = Common/WChar.class.uo \
+ Common/CMem.ns.uo \
+ Userland/Syscall/Syscall.wtf.uo
+
+all: $(Library)
+ echo "* Done with library"
+
+rebuild: mrproper all
+
+$(Library): $(Objects)
+ echo "* Linking melon library $(Library)..."
+ $(LD) $(LDFLAGS) $^ -o $@
+
+%.uo: %.cpp
+ echo "* Compiling $<..."
+ $(CXX) $(CXXFLAGS) -c $< -o $@
+
+clean:
+ echo "* Removing object files..."
+ rm -rf $(Objects)
+
+mrproper: clean
+ echo "* Removing library..."
+ rm -rf $(Library)
diff --git a/Source/Library/Userland/Syscall/Syscall.wtf.cpp b/Source/Library/Userland/Syscall/Syscall.wtf.cpp
new file mode 100644
index 0000000..2c03b20
--- /dev/null
+++ b/Source/Library/Userland/Syscall/Syscall.wtf.cpp
@@ -0,0 +1,20 @@
+#include "Syscall.wtf.h"
+
+int main();
+
+unsigned int syscall(unsigned int n, unsigned int a, unsigned int b, unsigned int c) {
+ unsigned int r;
+ asm volatile ("int $64;"
+ : "=a"(r) : "a"(n), "b"(a), "c"(b), "d"(c));
+ return r;
+}
+
+extern "C" void start() {
+ unsigned int r = main();
+ asm volatile("int $66" : : "a"(r));
+}
+
+void putch(char c) {
+ unsigned int x = c;
+ syscall(0xFFFFFF01, x);
+}
diff --git a/Source/Library/Userland/Syscall/Syscall.wtf.h b/Source/Library/Userland/Syscall/Syscall.wtf.h
new file mode 100644
index 0000000..b220d14
--- /dev/null
+++ b/Source/Library/Userland/Syscall/Syscall.wtf.h
@@ -0,0 +1,9 @@
+#ifndef DEF_SYSCALL_WTF_H
+#define DEF_SYSCALL_WTF_H
+
+#include <types.h>
+
+void putch(char);
+unsigned int syscall(unsigned int n, unsigned int a, unsigned int b = 0, unsigned int c = 0);
+
+#endif
diff --git a/Source/Library/Userland/common.h b/Source/Library/Userland/common.h
new file mode 100644
index 0000000..27218f7
--- /dev/null
+++ b/Source/Library/Userland/common.h
@@ -0,0 +1,10 @@
+#ifndef DEF_COMMON
+#define DEF_COMMON
+
+#define NULL 0
+
+#include <types.h>
+
+#include <CMem.ns.h>
+
+#endif
diff --git a/Source/Tools/MakeRamFS/MakeRamFS b/Source/Tools/MakeRamFS/MakeRamFS
deleted file mode 100755
index be1dc1a..0000000
--- a/Source/Tools/MakeRamFS/MakeRamFS
+++ /dev/null
Binary files differ