summaryrefslogtreecommitdiff
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
parenteb0efe075de6c27512499bfc81bacb974e6146dd (diff)
downloadMelon-9bd6fc9b337d760e23ebc9cb9b954a6205bbaa1c.tar.gz
Melon-9bd6fc9b337d760e23ebc9cb9b954a6205bbaa1c.zip
Revive Melon
-rw-r--r--Bochs.cfg22
-rw-r--r--HDD.imgbin20643840 -> 20643840 bytes
-rw-r--r--Makefile8
-rw-r--r--Melon.imgbin1474560 -> 1474560 bytes
-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
16 files changed, 38 insertions, 42 deletions
diff --git a/Bochs.cfg b/Bochs.cfg
index 2a1bf42..c47c998 100644
--- a/Bochs.cfg
+++ b/Bochs.cfg
@@ -1,6 +1,8 @@
# configuration file generated by Bochs
-config_interface: textconfig
-display_library: x
+# config_interface: textconfig
+display_library: x, options="gui_debug"
+magic_break: enabled=1
+
megs: 8
romimage: file="/usr/share/bochs/BIOS-bochs-latest"
vgaromimage: file="/usr/share/bochs/VGABIOS-lgpl-latest"
@@ -19,29 +21,19 @@ com1: enabled=1, mode=null, dev=""
com2: enabled=0
com3: enabled=0
com4: enabled=0
-i440fxsupport: enabled=0
-vga_update_interval: 40000
vga: extension=vbe
cpu: count=1, ips=2000000, reset_on_triple_fault=1
-text_snapshot_check: enabled=0
-private_colormap: enabled=0
clock: sync=none, time0=local
-# no cmosimage
-ne2k: enabled=0
-pnic: enabled=0
-sb16: enabled=0
-# no loader
-log: -
-logprefix: %t%e%d
-debugger_log: -
+
panic: action=ask
error: action=report
info: action=report
debug: action=ignore
-pass: action=fatal
+
keyboard_type: mf
keyboard_serial_delay: 250
keyboard_paste_delay: 100000
keyboard_mapping: enabled=1, map=/usr/share/bochs/keymaps/x11-pc-fr.map
+
user_shortcut: keys=none
mouse: enabled=0, type=ps2
diff --git a/HDD.img b/HDD.img
index 66c7354..2aadf20 100644
--- a/HDD.img
+++ b/HDD.img
Binary files differ
diff --git a/Makefile b/Makefile
index 7a20bdb..7cf12d8 100644
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,8 @@ Files = $(Kernel) $(RamFS)
Floppy = Melon.img
HDD = HDD.img
+QemuCmd = qemu-system-i386
+
all:
for p in $(Projects); do \
echo "=> Building $$p"; \
@@ -81,13 +83,13 @@ bochs: $(Floppy)
bochs -f Bochs.cfg
qemu: $(Floppy)
- qemu -fda $(Floppy) -hda $(HDD) -boot a -m 16
+ $(QemuCmd) -fda $(Floppy) -hda $(HDD) -boot a -m 16
qemu-hdd: $(HDD)
- qemu -fda $(Floppy) -hda $(HDD) -boot c -m 16
+ $(QemuCmd) -fda $(Floppy) -hda $(HDD) -boot c -m 16
qemu_debug:
- qemu -fda $(Floppy) -hda $(HDD) -boot a -m 16 -s -S & gdb Source/Kernel/Melon.ke -x Qemu-GDB-Debug-CMD
+ $(QemuCmd) -fda $(Floppy) -hda $(HDD) -boot a -m 16 -s -S & gdb Source/Kernel/Melon.ke -x Qemu-GDB-Debug-CMD
stats:
echo; echo " ** Statistics for project O3S ** "; \
diff --git a/Melon.img b/Melon.img
index 221a056..80bac38 100644
--- a/Melon.img
+++ b/Melon.img
Binary files differ
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 \