summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-10-28 11:50:09 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-10-28 11:50:09 +0100
commit9bd6fc9b337d760e23ebc9cb9b954a6205bbaa1c (patch)
treef81efe30c84f1880dc8bd222a228132a93044191 /Source
parenteb0efe075de6c27512499bfc81bacb974e6146dd (diff)
downloadMelon-9bd6fc9b337d760e23ebc9cb9b954a6205bbaa1c.tar.gz
Melon-9bd6fc9b337d760e23ebc9cb9b954a6205bbaa1c.zip
Revive Melon
Diffstat (limited to 'Source')
-rw-r--r--Source/Applications/Demos/Makefile4
-rw-r--r--Source/Applications/PaperWork/Makefile4
-rw-r--r--Source/Applications/Shell/Makefile4
-rw-r--r--Source/Kernel/Core/kmain.wtf.cpp2
-rw-r--r--Source/Kernel/Devices/Floppy/FloppyDrive.class.cpp2
-rw-r--r--Source/Kernel/FileSystems/FAT/FATFS.class.cpp6
-rw-r--r--Source/Kernel/Makefile12
-rw-r--r--Source/Kernel/TaskManager/Task.ns.cpp7
-rw-r--r--Source/Kernel/TaskManager/V86/V86Thread.class.cpp2
-rw-r--r--Source/Kernel/common.h1
-rw-r--r--Source/Library/Common/types.h2
-rw-r--r--Source/Library/Makefile4
12 files changed, 26 insertions, 24 deletions
diff --git a/Source/Applications/Demos/Makefile b/Source/Applications/Demos/Makefile
index 82489ba..38c44f4 100644
--- a/Source/Applications/Demos/Makefile
+++ b/Source/Applications/Demos/Makefile
@@ -3,10 +3,10 @@
ASM = nasm
ASMFLAGS = -f bin
-CXX = g++
+CXX = i586-elf-g++
CXXFLAGS = -nostartfiles -nostdlib -ffreestanding -fno-exceptions -fno-rtti -I ../../Library/Common -I ../../Library/Interface -I ../../Library/Userland -D THIS_IS_MELON_USERLAND
-LD = ld
+LD = i586-elf-ld
LDFLAGS = -T ../../Library/App.ld -L ../../Library
Applications = asmdemo cxxdemo GOL
diff --git a/Source/Applications/PaperWork/Makefile b/Source/Applications/PaperWork/Makefile
index 5c379fb..766daa1 100644
--- a/Source/Applications/PaperWork/Makefile
+++ b/Source/Applications/PaperWork/Makefile
@@ -1,9 +1,9 @@
.PHONY: clean, mrproper
-CXX = g++
+CXX = i586-elf-g++
CXXFLAGS = -nostartfiles -nostdlib -ffreestanding -fno-exceptions -fno-rtti -I ../../Library/Common -I ../../Library/Interface -I ../../Library/Userland -D THIS_IS_MELON_USERLAND
-LD = ld
+LD = i586-elf-ld
LDFLAGS = -T ../../Library/App.ld -L ../../Library -Map Map.txt
Objects = PaperWork.o
diff --git a/Source/Applications/Shell/Makefile b/Source/Applications/Shell/Makefile
index 867939f..3d7ca6b 100644
--- a/Source/Applications/Shell/Makefile
+++ b/Source/Applications/Shell/Makefile
@@ -1,9 +1,9 @@
.PHONY: clean, mrproper
-CXX = g++
+CXX = i586-elf-g++
CXXFLAGS = -nostartfiles -nostdlib -ffreestanding -fno-exceptions -fno-rtti -I ../../Library/Common -I ../../Library/Interface -I ../../Library/Userland -D THIS_IS_MELON_USERLAND
-LD = ld
+LD = i586-elf-ld
LDFLAGS = -T ../../Library/App.ld -L ../../Library
Objects = Shell.class.o
diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp
index fd69f39..40388e6 100644
--- a/Source/Kernel/Core/kmain.wtf.cpp
+++ b/Source/Kernel/Core/kmain.wtf.cpp
@@ -73,6 +73,7 @@ void kmain(multiboot_info_t* mbd, u32int magic) {
SB::init();
+
//Create a VT for logging what kernel does
SB::progress("Create kernel VT");
kvt = new ScrollableVT(24, 80, 20, KVT_FGCOLOR, KVT_BGCOLOR);
@@ -102,6 +103,7 @@ void kmain(multiboot_info_t* mbd, u32int magic) {
SB::progress("Timer");
Dev::registerDevice(new Timer()); //Initialize timer
String kcmdline((char*)mbd->cmdline);
+
SB::progress("Multitasking");
Task::initialize(kcmdline, kvt); //Initialize multitasking
SB::gomulti();
diff --git a/Source/Kernel/Devices/Floppy/FloppyDrive.class.cpp b/Source/Kernel/Devices/Floppy/FloppyDrive.class.cpp
index b7fd69b..881154a 100644
--- a/Source/Kernel/Devices/Floppy/FloppyDrive.class.cpp
+++ b/Source/Kernel/Devices/Floppy/FloppyDrive.class.cpp
@@ -229,7 +229,7 @@ bool FloppyDrive::doTrack(u32int cyl, u8int dir) {
int error = 0;
if (st0 & 0xC0) error = 1;
- if (st1 & 0x80) { Log::log(KL_ERROR, "FloppyDrive.class : error while I/O : end of cyilnder."); error = 1; }
+ if (st1 & 0x80) { Log::log(KL_ERROR, "FloppyDrive.class : error while I/O : end of cylinder."); error = 1; }
if (st0 & 0x08) { Log::log(KL_ERROR, "FloppyDrive.class : error while I/O : drive not ready."); error = 1; }
if (st1 & 0x20) { Log::log(KL_ERROR, "FloppyDrive.class : error while I/O : CRC error."); error = 1; }
if (st1 & 0x10) { Log::log(KL_ERROR, "FloppyDrive.class : error while I/O : controller timeout."); error = 1; }
diff --git a/Source/Kernel/FileSystems/FAT/FATFS.class.cpp b/Source/Kernel/FileSystems/FAT/FATFS.class.cpp
index f1d01c5..6e7df9b 100644
--- a/Source/Kernel/FileSystems/FAT/FATFS.class.cpp
+++ b/Source/Kernel/FileSystems/FAT/FATFS.class.cpp
@@ -57,7 +57,7 @@ FileSystem* FATFS::mount(Partition* p, DirectoryNode* mountpoint, bool readwrite
*kvt << "Detected a FAT" << (s64int)fs->m_fatType << " filesystem.\n" <<
"root_dir_sectors:" << fs->m_rootDirSectors << " fat_size:" << fs->m_fatSize << " total_sectors:" <<
fs->m_totalSectors << " data_sectors:" << dataSectors << " count_of_clusters:" << fs->m_countOfClusters <<
- " sizeof(fat_dir_entry_t):" << sizeof(fat_dir_entry_t) << " first_data_sector:" << fs->m_firstDataSector <<
+ " sizeof(fat_dir_entry_t):" << (s64int)sizeof(fat_dir_entry_t) << (const String&)" first_data_sector:" << fs->m_firstDataSector <<
" cluster_size:" << fs->m_clusterSize << "\n";
return fs;
}
@@ -234,12 +234,12 @@ bool FATFS::loadContents(DirectoryNode* dir) {
}
FileNode* FATFS::createFile(DirectoryNode* parent, String name) {
- if (m_readOnly) return false;
+ if (m_readOnly) return 0;
return 0;
}
DirectoryNode* FATFS::createDirectory(DirectoryNode* parent, String name) {
- if (m_readOnly) return false;
+ if (m_readOnly) return 0;
return 0;
}
diff --git a/Source/Kernel/Makefile b/Source/Kernel/Makefile
index cb51309..74c87e4 100644
--- a/Source/Kernel/Makefile
+++ b/Source/Kernel/Makefile
@@ -1,11 +1,11 @@
.PHONY: clean, mrproper
-CC = gcc
-CXX = g++
-LD = ld
-LDFLAGS = -T Kernel.ld -Map Kernel.map --oformat=elf32-i386
-CFLAGS = -nostdlib -nostartfiles -nodefaultlibs -fno-builtin -fno-stack-protector -Wall -Wextra -Werror -I .
-CXXFLAGS = -nostartfiles -nostdlib -fno-exceptions -fno-rtti -I . -I ../Library/Common -I ../Library/Interface -Wall -Werror -Wno-write-strings -funsigned-char -D THIS_IS_MELON_KERNEL -D RANDOM_SEED=1`date +%N`LL -O2
+CC = i586-elf-gcc
+CXX = i586-elf-g++
+LD = i586-elf-ld
+LDFLAGS = -T Kernel.ld -Map Kernel.map --oformat=elf32-i386 -m elf_i386
+CFLAGS = -nostdlib -nostartfiles -nodefaultlibs -fno-builtin -fno-stack-protector -Wall -Wextra -Werror -I . -m32
+CXXFLAGS = -nostartfiles -nostdlib -fno-exceptions -fno-rtti -I . -I ../Library/Common -I ../Library/Interface -Wall -Werror -Wno-write-strings -funsigned-char -Wno-error=unused-but-set-variable -D THIS_IS_MELON_KERNEL -D RANDOM_SEED=1`date +%N`LL -O2 -m32
ASM = nasm
ASMFLAGS = -f elf
diff --git a/Source/Kernel/TaskManager/Task.ns.cpp b/Source/Kernel/TaskManager/Task.ns.cpp
index 75f9c3d..44b5e3a 100644
--- a/Source/Kernel/TaskManager/Task.ns.cpp
+++ b/Source/Kernel/TaskManager/Task.ns.cpp
@@ -97,12 +97,11 @@ void doSwitch() {
t->setKernelStack();
asm volatile(" \
- mov %0, %%ebp; \
- mov %1, %%esp; \
- mov %2, %%ecx; \
+ mov %%eax, %%ebp; \
+ mov %%ebx, %%esp; \
mov $0x12345, %%eax; \
jmp *%%ecx;"
- : : "r"(ebp), "r"(esp), "r"(eip));
+ : : "a"(ebp), "b"(esp), "c"(eip));
}
void triggerSwitch() {
diff --git a/Source/Kernel/TaskManager/V86/V86Thread.class.cpp b/Source/Kernel/TaskManager/V86/V86Thread.class.cpp
index 5002225..63bc2d8 100644
--- a/Source/Kernel/TaskManager/V86/V86Thread.class.cpp
+++ b/Source/Kernel/TaskManager/V86/V86Thread.class.cpp
@@ -79,7 +79,7 @@ bool V86Thread::handleV86GPF(registers_t *regs) {
u16int *ivt = 0;
u16int *stack = (u16int*)FP_TO_LINEAR(regs->ss, (regs->useresp & 0xFFFF));
u32int *stack32 = (u32int*)stack;
- bool is_operand32 = false, is_address32 = false;
+ bool is_operand32 = false;
while (true) {
switch (ip[0]) {
diff --git a/Source/Kernel/common.h b/Source/Kernel/common.h
index d35ba84..482d106 100644
--- a/Source/Kernel/common.h
+++ b/Source/Kernel/common.h
@@ -14,6 +14,7 @@
#include <MemoryManager/Mem.ns.h>
+
//Standard implemenations of operator new/delete
inline void* operator new(size_t, void *p) { return p; }
inline void* operator new[](size_t, void *p) { return p; }
diff --git a/Source/Library/Common/types.h b/Source/Library/Common/types.h
index 843a8ca..5a3f076 100644
--- a/Source/Library/Common/types.h
+++ b/Source/Library/Common/types.h
@@ -12,7 +12,7 @@ typedef long long s64int;
typedef int s32int;
typedef short s16int;
typedef char s8int;
-typedef unsigned int size_t;
+typedef long unsigned int size_t;
#define U64 unsigned long long
#define S64 long long
diff --git a/Source/Library/Makefile b/Source/Library/Makefile
index 6e3e269..4a8d4ea 100644
--- a/Source/Library/Makefile
+++ b/Source/Library/Makefile
@@ -1,12 +1,12 @@
.PHONY: clean, mrproper
-CXX = g++
+CXX = i586-elf-g++
CXXFLAGS = -nostartfiles -nostdlib -ffreestanding -fno-exceptions -fno-rtti -I Common -I Userland -I Interface -D THIS_IS_MELON_USERLAND -D RANDOM_SEED=1`date +%N`LL
ASM = nasm
ASMFLAGS = -f elf
-LD = ld
+LD = i586-elf-ld
Objects = Common/WChar.class.uo \
Common/CMem.ns.uo \