diff --git a/kernel/Makefile b/kernel/Makefile index 45ffa7f..7f3131a 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -1,13 +1,13 @@ include ../kernel.settings SRCS = $(shell find hal/$(arch) -name '*.cpp' -o -name '*.[cS]') KERNSRCS = $(shell find kernel -name '*.cpp' -o -name '*.c') -OBJS = $(addsuffix .o,$(basename $(SRCS))) -OBJS += $(addsuffix .o,$(basename $(KERNSRCS))) +#OBJS = $(addsuffix .o,$(basename $(SRCS))) +OBJS = $(addsuffix .o,$(basename $(KERNSRCS))) LD = $(PREFIX)g++ -LDFLAGS = -nostdlib -nodefaultlibs -nostdlib -fno-builtin $(ARCHFLAGS) -T kernel-$(arch).ld -z max-page-size=0x1000 -lgcc +LDFLAGS = -nostdlib -nodefaultlibs -nostdlib -fno-builtin $(ARCHFLAGS) -T kernel-$(arch).ld -z max-page-size=0x1000 all: hal kernel - $(LD) $(LDFLAGS) -o mtgos $(OBJS) + $(LD) $(LDFLAGS) -o mtgos $(OBJS) libhal.a -lgcc hal: make -C hal kernel: diff --git a/kernel/hal/Makefile b/kernel/hal/Makefile index 87a14a6..7b4efac 100644 --- a/kernel/hal/Makefile +++ b/kernel/hal/Makefile @@ -1,6 +1,9 @@ include ../../kernel.settings -all: +SRCS = $(shell find $(arch) -name '*.cpp' -o -name '*.[cS]') +OBJS = $(addsuffix .o,$(basename $(SRCS))) +all: make -C $(arch) + ar rcs ../libhal.a $(OBJS) clean: rm -rf hal.o make -C $(arch) clean diff --git a/kernel/hal/x86/Makefile b/kernel/hal/x86/Makefile index 3de515e..2a8b17e 100644 --- a/kernel/hal/x86/Makefile +++ b/kernel/hal/x86/Makefile @@ -4,6 +4,7 @@ OBJS = $(addsuffix .o,$(basename $(SRCS))) CPP = $(PREFIX)g++ CC = $(PREFIX)gcc +AR = $(PREFIX)ar ASFLAGS = -m32 CFLAGS += -m32 -Wall -fno-stack-protector -nostdinc -Ic_include/ -I../../kernel/c_include -ffreestanding -std=c11 -fno-builtin -Werror -nostdlib -g -fpie CPPFLAGS += -m32 -Wall -fno-stack-protector -nostdinc -std=c++14 -Iinclude/ -Ic_include/ -I../../kernel/c_include -I../../kernel/include -fno-rtti -fno-exceptions -ffreestanding -fno-builtin -Werror -nostdlib -fno-use-cxa-atexit -Wextra -Wno-unused -g -fno-pie -Wno-reorder diff --git a/kernel/hal/x86/include/textDISP.hpp b/kernel/hal/x86/include/textDISP.hpp index ca18f3a..2dd893b 100644 --- a/kernel/hal/x86/include/textDISP.hpp +++ b/kernel/hal/x86/include/textDISP.hpp @@ -43,20 +43,23 @@ namespace MTGosHAL { YELLOW=0xFFFF55, WHITE=0xFFFFFF }; - class Screen: public Output { + + class Screen { private: FG_color fg; BG_color bg; uint32_t* lfb; auto putChar(char c) -> void; + int base; public: - Screen(): fg(FG_color::WHITE), bg(BG_color::BLACK) { + auto puts(const char *s) -> void; + Screen(): fg(FG_color::WHITE), bg(BG_color::BLACK), base(10) { } Screen(struct multiboot_info* mb_info): Screen() {init(mb_info);} auto init(struct multiboot_info*) -> void; template auto operator<< (T output) -> Screen & { - Output::operator<<(output); + puts(output); return *this; } auto clrscr() -> void; @@ -69,5 +72,15 @@ namespace MTGosHAL { auto Screen::operator<<(FG_color fg) -> Screen &; template <> auto Screen::operator<<(BG_color bg) -> Screen &; + template <> + auto Screen::operator<<(Base output) -> Screen &; + template <> + auto Screen::operator<<(int output) -> Screen &; + template <> + auto Screen::operator<<(long int output) -> Screen &; + template <> + auto Screen::operator<<(char output) -> Screen &; + template <> + auto Screen::operator<<(char* output) -> Screen &; } #endif diff --git a/kernel/hal/x86/init/init.cpp b/kernel/hal/x86/init/init.cpp index e823bf6..cfe89cb 100644 --- a/kernel/hal/x86/init/init.cpp +++ b/kernel/hal/x86/init/init.cpp @@ -10,7 +10,8 @@ #include #include extern "C" void intr_stub_0(void); -void main(void ** programs); +void main(void ** programs, MTGosHAL::Serial &debug, MTGosHAL::PMM &mm, MTGosHAL::Screen &out, + MTGosHAL::Screen &err, MTGosHAL::Keyboard &in, MTGosHAL::Multitasking &tasks, MTGosHAL::BlockDevice &disk); void** progs; namespace MTGosHAL { Serial debug; @@ -77,7 +78,7 @@ namespace MTGosHAL { progs[i]=(void*)(mods[i].mod_start); debug << "Found module!\n"; } - ::main(progs); + ::main(progs, debug, mm, out, err, in, tasks, disk); uint8_t buf[512]; disk.readSector(disk.getDriveNumByName("ATA0m1"),0,buf); out << (char*)buf; diff --git a/kernel/kernel/io/output.cpp b/kernel/hal/x86/io/output.cpp similarity index 100% rename from kernel/kernel/io/output.cpp rename to kernel/hal/x86/io/output.cpp diff --git a/kernel/hal/x86/io/textDISP.cpp b/kernel/hal/x86/io/textDISP.cpp index 52bc3ee..7ef9259 100644 --- a/kernel/hal/x86/io/textDISP.cpp +++ b/kernel/hal/x86/io/textDISP.cpp @@ -2,9 +2,91 @@ #include #include #include +#include +#include +#include +int x=0, y=0; namespace MTGosHAL { + auto Screen::putChar(char c) -> void { + switch(c) { + case '\n': + x=0; y++; + break; + case '\r': + x=0; + + break; + case '\b': + x--; + if(x<0) x=0; + putChar(' '); + x--; + if(x<0) x=0; + break; + case '\0': + break; + default: + for(int lx=0;lx<8;lx++) { + for(int ly=0;ly<8;ly++) { + if(font[(int)((uint8_t)c)][ly]&(1<(fg); + } else { + lfb[(x*8+lx)+(y*8+ly)*1024]=0x000000;//static_cast(bg); + } + } + } + x++; + if(x==SCREEN_WIDTH) { + x=0; y++; + } + break; + } + if(y>SCREEN_HEIGHT) + scroll(); + } + auto Screen::clrscr() -> void { + for(int p=0;p<1024*786;p++) { + lfb[p]=0x000000;//static_cast(bg); + } + x=y=0; + } + auto Screen::scroll() -> void { + for(int ly=0;ly<786-8;ly++) { + for(int lx=0;lx<1024;lx++) { + lfb[lx+ly*1024]=lfb[lx+(ly+8)*1024]; + } + } + for(int ly=786-8;ly<786;ly++) { + for(int lx=0;lx<1024;lx++) { + lfb[lx+ly*1024]=0x000000;//static_cast(bg); + } + } + y--; + } + template <> + auto Screen::operator<<(FG_color fg) -> Screen &{ + this->fg=fg; + return *this; + } + template <> + auto Screen::operator<<(BG_color bg) -> Screen &{ + this->bg=bg; + return *this; + } + auto Screen::setColor(FG_color fg) -> Screen &{ + this->fg=fg; + return *this; + } + auto Screen::setColor(BG_color bg) -> Screen &{ + this->bg=bg; + return *this; + } + auto Screen::setColor(FG_color fg, BG_color bg) -> Screen &{ + return (*this).setColor(fg).setColor(bg); + } + auto Screen::init(struct multiboot_info* mb_info) -> void { - lfb=(uint32_t*)((uint32_t)mb_info->framebuffer_addr); + lfb=(uint32_t*)((uintptr_t)mb_info->framebuffer_addr); //clrscr(); //Render '\001' character for(int tx=0;tx<16;tx++) { @@ -18,4 +100,52 @@ namespace MTGosHAL { } } } + auto Screen::puts(const char* s) -> void { + int i=0; + while(s[i]!='\0') + putChar(s[i++]); + } + template <> + auto Screen::operator<<(Base output) -> Screen & { + base=static_cast(output); + return *this; + } + template <> + auto Screen::operator<<(int op) -> Screen & { + uintptr_t output=op; + const char* chars="0123456789ABCDEF"; + char buf[33]; + buf[32]='\0'; + char* ptr=buf+31; + do { + *(ptr--)=chars[output%base]; + output/=base; + } while(output && (ptr!=buf)); + puts(ptr+1); + return *this; + } + template <> + auto Screen::operator<<(long int op) -> Screen & { + uint64_t output=op; + const char* chars="0123456789ABCDEF"; + char buf[65]; + buf[64]='\0'; + char* ptr=buf+63; + do { + *(ptr--)=chars[output%base]; + output/=base; + } while(output && (ptr!=buf)); + puts(ptr+1); + return *this; + } + template <> + auto Screen::operator<<(char output) -> Screen & { + putChar(output); + return *this; + } + template <> + auto Screen::operator<<(char* output) -> Screen & { + puts(output); + return *this; + } } diff --git a/kernel/hal/x86/mm/pmm.cpp b/kernel/hal/x86/mm/pmm.cpp index d9cbd66..c49412d 100644 --- a/kernel/hal/x86/mm/pmm.cpp +++ b/kernel/hal/x86/mm/pmm.cpp @@ -1,9 +1,111 @@ #include #include #include +#define PAGESIZE 4096 +#define UNSHIFT(a) ((a)>>12) +#define SHIFT(a) ((a)<<12) +#define FLAGS 0xfff extern "C" const int kernel_start; extern "C" const int kernel_end; //those are voids actually +void *operator new(size_t size) { + return MTGosHAL::mm.alloc(size); +} +void *operator new[](size_t size) { + return MTGosHAL::mm.alloc(size); +} +void operator delete(void* p) { + MTGosHAL::mm.free(p); +} +void operator delete[](void* p) { + MTGosHAL::mm.free(p); +} +void operator delete(void* p, size_t size) { + MTGosHAL::mm.free(p); +} +void operator delete[](void* p, size_t size) { + MTGosHAL::mm.free(p); +} namespace MTGosHAL { + auto PMM::alloc(size_t length) -> void * { + if(!head) { + //Alloc space for head + if(length+sizeof(malloc_t)<=PAGESIZE) { //Small optimization. The routine for allocating more than one continuous page is terribly slow. + void *tmp; + *this >> tmp; + head=(malloc_t*)tmp; + } else + head=(malloc_t*)(*this)(UNSHIFT((length+sizeof(malloc_t)))+1); + if(!head) //The alloc() didn't work! We're out of RAM! + return nullptr; + head->len=length; + head->next=head->last=nullptr; + malloc_t* tmp=head; + tmp++; + return (void*)tmp; + } + malloc_t* curr=head; + malloc_t* last=nullptr; + do { + uintptr_t loc=(uintptr_t)curr+sizeof(malloc_t)+curr->len; + if((loc+length+sizeof(malloc_t))<((loc&(~FLAGS))+PAGESIZE) && + ((!curr->next) || (loc+length+sizeof(malloc_t))<((uintptr_t)(curr->next)))) { + malloc_t *allocd=(malloc_t *)loc; + allocd->len=length; + allocd->last=curr; + allocd->next=curr->next; //Set double linked list + curr->next=allocd; + if(allocd->next) + allocd->next->last=allocd; + malloc_t *tmp=allocd; + tmp++; + return (void*)tmp; + } + last=curr; + curr=curr->next; + } while(curr); + malloc_t *allocd=nullptr; + if(length+sizeof(malloc_t)<=PAGESIZE) { //Small optimization. The routine for allocating more than one continuous page is terribly slow. + void *tmp; + *this >> tmp; + allocd=(malloc_t*)tmp; + } else + allocd=(malloc_t*)(*this)(UNSHIFT(length+sizeof(malloc_t))+1); + if(!allocd) //The alloc() didn't work! We're out of RAM! + return nullptr; + last->next=allocd; + allocd->len=length; + allocd->last=last; + allocd->next=nullptr; + malloc_t *tmp=allocd; + tmp++; + return (void*)tmp; + } + auto PMM::free(void* ptr) -> bool { + if(!ptr) + return false; + malloc_t* curr=head; + malloc_t* chk=(malloc_t*)ptr; + chk--; + do { + if(curr==chk) { + uintptr_t start=((uintptr_t)chk)&(~FLAGS); + uintptr_t end=start+PAGESIZE; + if((((uintptr_t)(curr->last)last)>=end))&&(((uintptr_t)(curr->next)>=end)||((uintptr_t)(curr->next)last) + curr->last->next=curr->next; + else { + head=curr->next; + } + if(curr->next) + curr->next->last=curr->last; + return true; + } + curr=curr->next; + } while(curr); + return false; + } PMM::PMM(): head(nullptr), pmm2() {} auto PMM::init(struct multiboot_info* mb_info) -> void { pmm2.init(mb_info); diff --git a/kernel/hal/x86_64/Makefile b/kernel/hal/x86_64/Makefile index a492974..7d172a9 100644 --- a/kernel/hal/x86_64/Makefile +++ b/kernel/hal/x86_64/Makefile @@ -4,6 +4,7 @@ OBJS = $(addsuffix .o,$(basename $(SRCS))) CPP = $(PREFIX)g++ CC = $(PREFIX)gcc +AR = $(PREFIX)ar ASFLAGS = -m64 CFLAGS += -m64 -Wall -fno-stack-protector -nostdinc -Ic_include/ -I../../kernel/c_include -ffreestanding -std=c11 -fno-builtin -Werror -nostdlib -g -fpie -ffreestanding -mcmodel=large -mno-mmx -mno-sse -mno-sse2 CPPFLAGS += -m64 -Wall -fno-stack-protector -nostdinc -std=c++14 -Iinclude/ -Ic_include/ -I../../kernel/c_include -I../../kernel/include -fno-rtti -fno-exceptions -ffreestanding -fno-builtin -Werror -nostdlib -fno-use-cxa-atexit -Wextra -Wno-unused -g -fno-pie -Wno-reorder -ffreestanding -mcmodel=large -mno-mmx -mno-sse -mno-sse2 diff --git a/kernel/hal/x86_64/blk/BlockDevice.cpp b/kernel/hal/x86_64/blk/BlockDevice.cpp new file mode 100644 index 0000000..c4f40e8 --- /dev/null +++ b/kernel/hal/x86_64/blk/BlockDevice.cpp @@ -0,0 +1,5 @@ +#include +namespace MTGosHAL { + BlockDevice::BlockDevice() {} + BlockDevice::~BlockDevice() {} +} diff --git a/kernel/hal/x86_64/include/textDISP.hpp b/kernel/hal/x86_64/include/textDISP.hpp index ca18f3a..5caefd0 100644 --- a/kernel/hal/x86_64/include/textDISP.hpp +++ b/kernel/hal/x86_64/include/textDISP.hpp @@ -43,20 +43,23 @@ namespace MTGosHAL { YELLOW=0xFFFF55, WHITE=0xFFFFFF }; - class Screen: public Output { + + class Screen { private: FG_color fg; BG_color bg; uint32_t* lfb; + int base; auto putChar(char c) -> void; public: - Screen(): fg(FG_color::WHITE), bg(BG_color::BLACK) { + auto puts(const char *s) -> void; + Screen(): fg(FG_color::WHITE), bg(BG_color::BLACK), base(10) { } Screen(struct multiboot_info* mb_info): Screen() {init(mb_info);} auto init(struct multiboot_info*) -> void; template auto operator<< (T output) -> Screen & { - Output::operator<<(output); + puts(output); return *this; } auto clrscr() -> void; @@ -69,5 +72,15 @@ namespace MTGosHAL { auto Screen::operator<<(FG_color fg) -> Screen &; template <> auto Screen::operator<<(BG_color bg) -> Screen &; + template <> + auto Screen::operator<<(Base output) -> Screen &; + template <> + auto Screen::operator<<(int output) -> Screen &; + template <> + auto Screen::operator<<(long int output) -> Screen &; + template <> + auto Screen::operator<<(char output) -> Screen &; + template <> + auto Screen::operator<<(char* output) -> Screen &; } #endif diff --git a/kernel/hal/x86_64/init/init.cpp b/kernel/hal/x86_64/init/init.cpp index 7d06b38..e94d139 100644 --- a/kernel/hal/x86_64/init/init.cpp +++ b/kernel/hal/x86_64/init/init.cpp @@ -10,7 +10,8 @@ #include #include extern "C" void intr_stub_0(void); -void main(void ** programs); +void main(void ** programs, MTGosHAL::Serial debug, MTGosHAL::PMM mm, MTGosHAL::Screen out, + MTGosHAL::Screen err, MTGosHAL::Keyboard in, MTGosHAL::Multitasking tasks, MTGosHAL::BlockDevice disk); void** progs; namespace MTGosHAL { Serial debug; @@ -21,6 +22,7 @@ namespace MTGosHAL { Screen err; Keyboard in; Multitasking tasks; + BlockDevice disk; struct multiboot_info* ebx; void main(long eax, struct multiboot_info* mb, uint64_t**** pt) { ebx=mb; @@ -57,12 +59,30 @@ namespace MTGosHAL { auto startup() -> void { //asm volatile("ltr %%ax" : : "a"(5<<3)); - debug << "Init MM\n"; + out << "Init MM\n"; new (&mm) PMM(ebx); - debug << "Init Keyboard\n"; + out << "Init Keyboard\n"; new (&in) Keyboard(); + + out << "Init Multitasking\n"; + new (&tasks) Multitasking(); + + out << "Init blockdev\n"; + new (&disk) BlockDevice(); + out << "Kernel initialized\n"; + multiboot_mod_list *mods = (multiboot_mod_list*) (uint64_t)(ebx->mods_addr); + progs=(void**)mm.alloc(8192); + for(int i=0;i<1024;i++) { + progs[i]=nullptr; + } + for(uint32_t i=0;i<(ebx->mods_count<1023?ebx->mods_count:1023);i++) { //Basically until MIN(ebx->mods_count, 1023), as we only support loading up to 1023 programs directly. + progs[i]=(void*)((uint64_t)mods[i].mod_start); + out << "Found module!\n"; + } + ::main(progs, debug, mm, out, err, in, tasks, disk); + } } typedef void (*constructor)(); diff --git a/kernel/hal/x86_64/io/output.cpp b/kernel/hal/x86_64/io/output.cpp new file mode 100644 index 0000000..e909c75 --- /dev/null +++ b/kernel/hal/x86_64/io/output.cpp @@ -0,0 +1,54 @@ +#include +#include +#include +#include +namespace MTGosHAL { + auto Output::puts(const char* s) -> void { + int i=0; + while(s[i]!='\0') + putChar(s[i++]); + } + template <> + auto Output::operator<<(Base output) -> Output & { + base=static_cast(output); + return *this; + } + template <> + auto Output::operator<<(int op) -> Output & { + uintptr_t output=op; + const char* chars="0123456789ABCDEF"; + char buf[33]; + buf[32]='\0'; + char* ptr=buf+31; + do { + *(ptr--)=chars[output%base]; + output/=base; + } while(output && (ptr!=buf)); + puts(ptr+1); + return *this; + } + template <> + auto Output::operator<<(long int op) -> Output & { + uint64_t output=op; + const char* chars="0123456789ABCDEF"; + char buf[65]; + buf[64]='\0'; + char* ptr=buf+63; + do { + *(ptr--)=chars[output%base]; + output/=base; + } while(output && (ptr!=buf)); + puts(ptr+1); + return *this; + } + template <> + auto Output::operator<<(char output) -> Output & { + putChar(output); + return *this; + } + template <> + auto Output::operator<<(char* output) -> Output & { + puts(output); + return *this; + } +} diff --git a/kernel/hal/x86_64/io/textDISP.cpp b/kernel/hal/x86_64/io/textDISP.cpp index 155dc76..38d3331 100644 --- a/kernel/hal/x86_64/io/textDISP.cpp +++ b/kernel/hal/x86_64/io/textDISP.cpp @@ -2,7 +2,89 @@ #include #include #include +#include +#include +#include +int x=0, y=0; namespace MTGosHAL { + auto Screen::putChar(char c) -> void { + switch(c) { + case '\n': + x=0; y++; + break; + case '\r': + x=0; + + break; + case '\b': + x--; + if(x<0) x=0; + putChar(' '); + x--; + if(x<0) x=0; + break; + case '\0': + break; + default: + for(int lx=0;lx<8;lx++) { + for(int ly=0;ly<8;ly++) { + if(font[(int)((uint8_t)c)][ly]&(1<(fg); + } else { + lfb[(x*8+lx)+(y*8+ly)*1024]=0x000000;//static_cast(bg); + } + } + } + x++; + if(x==SCREEN_WIDTH) { + x=0; y++; + } + break; + } + if(y>SCREEN_HEIGHT) + scroll(); + } + auto Screen::clrscr() -> void { + for(int p=0;p<1024*786;p++) { + lfb[p]=0x000000;//static_cast(bg); + } + x=y=0; + } + auto Screen::scroll() -> void { + for(int ly=0;ly<786-8;ly++) { + for(int lx=0;lx<1024;lx++) { + lfb[lx+ly*1024]=lfb[lx+(ly+8)*1024]; + } + } + for(int ly=786-8;ly<786;ly++) { + for(int lx=0;lx<1024;lx++) { + lfb[lx+ly*1024]=0x000000;//static_cast(bg); + } + } + y--; + } + template <> + auto Screen::operator<<(FG_color fg) -> Screen &{ + this->fg=fg; + return *this; + } + template <> + auto Screen::operator<<(BG_color bg) -> Screen &{ + this->bg=bg; + return *this; + } + auto Screen::setColor(FG_color fg) -> Screen &{ + this->fg=fg; + return *this; + } + auto Screen::setColor(BG_color bg) -> Screen &{ + this->bg=bg; + return *this; + } + auto Screen::setColor(FG_color fg, BG_color bg) -> Screen &{ + return (*this).setColor(fg).setColor(bg); + } + auto Screen::init(struct multiboot_info* mb_info) -> void { lfb=(uint32_t*)((uintptr_t)mb_info->framebuffer_addr); //clrscr(); @@ -18,4 +100,52 @@ namespace MTGosHAL { } } } + auto Screen::puts(const char* s) -> void { + int i=0; + while(s[i]!='\0') + putChar(s[i++]); + } + template <> + auto Screen::operator<<(Base output) -> Screen & { + base=static_cast(output); + return *this; + } + template <> + auto Screen::operator<<(int op) -> Screen & { + uintptr_t output=op; + const char* chars="0123456789ABCDEF"; + char buf[33]; + buf[32]='\0'; + char* ptr=buf+31; + do { + *(ptr--)=chars[output%base]; + output/=base; + } while(output && (ptr!=buf)); + puts(ptr+1); + return *this; + } + template <> + auto Screen::operator<<(long int op) -> Screen & { + uint64_t output=op; + const char* chars="0123456789ABCDEF"; + char buf[65]; + buf[64]='\0'; + char* ptr=buf+63; + do { + *(ptr--)=chars[output%base]; + output/=base; + } while(output && (ptr!=buf)); + puts(ptr+1); + return *this; + } + template <> + auto Screen::operator<<(char output) -> Screen & { + putChar(output); + return *this; + } + template <> + auto Screen::operator<<(char* output) -> Screen & { + puts(output); + return *this; + } } diff --git a/kernel/hal/x86_64/mm/pmm.cpp b/kernel/hal/x86_64/mm/pmm.cpp index b2bd820..fb7fddb 100644 --- a/kernel/hal/x86_64/mm/pmm.cpp +++ b/kernel/hal/x86_64/mm/pmm.cpp @@ -2,7 +2,109 @@ #include extern "C" const int kernel_start; extern "C" const int kernel_end; //those are voids actually +#define PAGESIZE 0x200000 +#define UNSHIFT(a) ((a)>>20) +#define SHIFT(a) ((a)<<20) +#define FLAGS 0x7ffff +void *operator new(size_t size) { + return MTGosHAL::mm.alloc(size); +} +void *operator new[](size_t size) { + return MTGosHAL::mm.alloc(size); +} +void operator delete(void* p) { + MTGosHAL::mm.free(p); +} +void operator delete[](void* p) { + MTGosHAL::mm.free(p); +} +void operator delete(void* p, size_t size) { + MTGosHAL::mm.free(p); +} +void operator delete[](void* p, size_t size) { + MTGosHAL::mm.free(p); +} namespace MTGosHAL { + auto PMM::alloc(size_t length) -> void * { + if(!head) { + //Alloc space for head + if(length+sizeof(malloc_t)<=PAGESIZE) { //Small optimization. The routine for allocating more than one continuous page is terribly slow. + void *tmp; + *this >> tmp; + head=(malloc_t*)tmp; + } else + head=(malloc_t*)(*this)(UNSHIFT((length+sizeof(malloc_t)))+1); + if(!head) //The alloc() didn't work! We're out of RAM! + return nullptr; + head->len=length; + head->next=head->last=nullptr; + malloc_t* tmp=head; + tmp++; + return (void*)tmp; + } + malloc_t* curr=head; + malloc_t* last=nullptr; + do { + uintptr_t loc=(uintptr_t)curr+sizeof(malloc_t)+curr->len; + if((loc+length+sizeof(malloc_t))<((loc&(~FLAGS))+PAGESIZE) && + ((!curr->next) || (loc+length+sizeof(malloc_t))<((uintptr_t)(curr->next)))) { + malloc_t *allocd=(malloc_t *)loc; + allocd->len=length; + allocd->last=curr; + allocd->next=curr->next; //Set double linked list + curr->next=allocd; + if(allocd->next) + allocd->next->last=allocd; + malloc_t *tmp=allocd; + tmp++; + return (void*)tmp; + } + last=curr; + curr=curr->next; + } while(curr); + malloc_t *allocd=nullptr; + if(length+sizeof(malloc_t)<=PAGESIZE) { //Small optimization. The routine for allocating more than one continuous page is terribly slow. + void *tmp; + *this >> tmp; + allocd=(malloc_t*)tmp; + } else + allocd=(malloc_t*)(*this)(UNSHIFT(length+sizeof(malloc_t))+1); + if(!allocd) //The alloc() didn't work! We're out of RAM! + return nullptr; + last->next=allocd; + allocd->len=length; + allocd->last=last; + allocd->next=nullptr; + malloc_t *tmp=allocd; + tmp++; + return (void*)tmp; + } + auto PMM::free(void* ptr) -> bool { + if(!ptr) + return false; + malloc_t* curr=head; + malloc_t* chk=(malloc_t*)ptr; + chk--; + do { + if(curr==chk) { + uintptr_t start=((uintptr_t)chk)&(~FLAGS); + uintptr_t end=start+PAGESIZE; + if((((uintptr_t)(curr->last)last)>=end))&&(((uintptr_t)(curr->next)>=end)||((uintptr_t)(curr->next)last) + curr->last->next=curr->next; + else { + head=curr->next; + } + if(curr->next) + curr->next->last=curr->last; + return true; + } + curr=curr->next; + } while(curr); + return false; + } PMM::PMM(): head(nullptr), pmm2() {} auto PMM::init(struct multiboot_info* mb_info) -> void { pmm2.init(mb_info); diff --git a/kernel/hal/x86_64/mm/pmm2.cpp b/kernel/hal/x86_64/mm/pmm2.cpp index f6d13c4..bca4d80 100644 --- a/kernel/hal/x86_64/mm/pmm2.cpp +++ b/kernel/hal/x86_64/mm/pmm2.cpp @@ -16,6 +16,8 @@ namespace MTGosHAL { PMM2::PMM2(): pmm3() { } auto PMM2::markUsed(const void * addr, uint32_t length) -> bool { + if(length<0x200000) + length=0x200000; uintptr_t add=(uintptr_t)addr; uint64_t pagetid = SPLIT1_UNSHIFT(add); diff --git a/kernel/kernel/include/textDISP.hpp b/kernel/kernel/include/textDISP.hpp index 6a18f40..75a9e6d 100644 --- a/kernel/kernel/include/textDISP.hpp +++ b/kernel/kernel/include/textDISP.hpp @@ -42,18 +42,21 @@ namespace MTGosHAL { YELLOW=0xFFFF55, WHITE=0xFFFFFF }; - class Screen: public Output { + + class Screen { private: FG_color fg; BG_color bg; uint32_t* lfb; + int base; auto putChar(char c) -> void; public: - Screen(): fg(FG_color::WHITE), bg(BG_color::BLACK) { + auto puts(const char *s) -> void; + Screen(): fg(FG_color::WHITE), bg(BG_color::BLACK), base(10) { } template auto operator<< (T output) -> Screen & { - Output::operator<<(output); + puts(output); return *this; } auto clrscr() -> void; @@ -66,5 +69,15 @@ namespace MTGosHAL { auto Screen::operator<<(FG_color fg) -> Screen &; template <> auto Screen::operator<<(BG_color bg) -> Screen &; + template <> + auto Screen::operator<<(Base output) -> Screen &; + template <> + auto Screen::operator<<(int output) -> Screen &; + template <> + auto Screen::operator<<(long int output) -> Screen &; + template <> + auto Screen::operator<<(char output) -> Screen &; + template <> + auto Screen::operator<<(char* output) -> Screen &; } #endif diff --git a/kernel/kernel/init.cpp b/kernel/kernel/init.cpp index f0b92fd..a64dc91 100644 --- a/kernel/kernel/init.cpp +++ b/kernel/kernel/init.cpp @@ -6,6 +6,7 @@ #include #include #include +#include void * operator new (size_t, void * p) { return p ; } void * operator new[] (size_t, void * p) { return p ; } void operator delete (void *, void *) { } @@ -16,28 +17,29 @@ void pid_null() { } void task_a() { while(true) - MTGosHAL::out << "a"; + out << "a"; } void task_b() { while(true) - MTGosHAL::out << "b"; + out << "b"; } void task_c() { while(true) - MTGosHAL::out << "c"; + out << "c"; } void task_d() { while(true) - MTGosHAL::out << "d"; + out << "d"; } -void main(void** files) { - MTGosHAL::out << "Initializing Kernel!\n"; +void main(void ** files, MTGosHAL::Serial &debug, MTGosHAL::PMM &mm, MTGosHAL::Screen &out, + MTGosHAL::Screen &err, MTGosHAL::Keyboard &in, MTGosHAL::Multitasking &tasks, MTGosHAL::BlockDevice &disk) { + out << "Initializing Kernel!\n"; Elf32_Ehdr** programs=(Elf32_Ehdr**)files; - MTGosHAL::tasks.initTask(&pid_null); + tasks.initTask(&pid_null); for(int i=0;programs[i];i++) { void(*start)()=(void(*)())load(programs[i]); if(!start) continue; - MTGosHAL::tasks.initTask(start); + tasks.initTask(start); } } diff --git a/kernel/kernel/io/textDISP.cpp b/kernel/kernel/io/textDISP.cpp deleted file mode 100644 index dd142c7..0000000 --- a/kernel/kernel/io/textDISP.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include -#include -#include -#include -int x=0, y=0; -namespace MTGosHAL { - auto Screen::putChar(char c) -> void { - switch(c) { - case '\n': - x=0; y++; - break; - case '\r': - x=0; - - break; - case '\b': - x--; - if(x<0) x=0; - putChar(' '); - x--; - if(x<0) x=0; - break; - case '\0': - break; - default: - for(int lx=0;lx<8;lx++) { - for(int ly=0;ly<8;ly++) { - if(font[(int)((uint8_t)c)][ly]&(1<(fg); - } else { - lfb[(x*8+lx)+(y*8+ly)*1024]=0x000000;//static_cast(bg); - } - } - } - x++; - if(x==SCREEN_WIDTH) { - x=0; y++; - } - break; - } - if(y>SCREEN_HEIGHT) - scroll(); - } - auto Screen::clrscr() -> void { - for(int p=0;p<1024*786;p++) { - lfb[p]=0x000000;//static_cast(bg); - } - x=y=0; - } - auto Screen::scroll() -> void { - for(int ly=0;ly<786-8;ly++) { - for(int lx=0;lx<1024;lx++) { - lfb[lx+ly*1024]=lfb[lx+(ly+8)*1024]; - } - } - for(int ly=786-8;ly<786;ly++) { - for(int lx=0;lx<1024;lx++) { - lfb[lx+ly*1024]=0x000000;//static_cast(bg); - } - } - y--; - } - template <> - auto Screen::operator<<(FG_color fg) -> Screen &{ - this->fg=fg; - return *this; - } - template <> - auto Screen::operator<<(BG_color bg) -> Screen &{ - this->bg=bg; - return *this; - } - auto Screen::setColor(FG_color fg) -> Screen &{ - this->fg=fg; - return *this; - } - auto Screen::setColor(BG_color bg) -> Screen &{ - this->bg=bg; - return *this; - } - auto Screen::setColor(FG_color fg, BG_color bg) -> Screen &{ - return (*this).setColor(fg).setColor(bg); - } -} diff --git a/kernel/kernel/mm/pmm.cpp b/kernel/kernel/mm/pmm.cpp deleted file mode 100644 index 15cfa1a..0000000 --- a/kernel/kernel/mm/pmm.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include -#include -#ifdef __LP64 -#define PAGESIZE 0x200000 -#define UNSHIFT(a) ((a)>>20) -#define SHIFT(a) ((a)<<20) -#define FLAGS 0x7ffff -#else -#define PAGESIZE 4096 -#define UNSHIFT(a) ((a)>>12) -#define SHIFT(a) ((a)<<12) -#define FLAGS 0xfff -#endif -void *operator new(size_t size) { - return MTGosHAL::mm.alloc(size); -} -void *operator new[](size_t size) { - return MTGosHAL::mm.alloc(size); -} -void operator delete(void* p) { - MTGosHAL::mm.free(p); -} -void operator delete[](void* p) { - MTGosHAL::mm.free(p); -} -void operator delete(void* p, size_t size) { - MTGosHAL::mm.free(p); -} -void operator delete[](void* p, size_t size) { - MTGosHAL::mm.free(p); -} -namespace MTGosHAL { - - auto PMM::alloc(size_t length) -> void * { - if(!head) { - //Alloc space for head - if(length+sizeof(malloc_t)<=PAGESIZE) { //Small optimization. The routine for allocating more than one continuous page is terribly slow. - void *tmp; - *this >> tmp; - head=(malloc_t*)tmp; - } else - head=(malloc_t*)(*this)(UNSHIFT((length+sizeof(malloc_t)))+1); - if(!head) //The alloc() didn't work! We're out of RAM! - return nullptr; - head->len=length; - head->next=head->last=nullptr; - malloc_t* tmp=head; - tmp++; - return (void*)tmp; - } - malloc_t* curr=head; - malloc_t* last=nullptr; - do { - uintptr_t loc=(uintptr_t)curr+sizeof(malloc_t)+curr->len; - if((loc+length+sizeof(malloc_t))<((loc&(~FLAGS))+PAGESIZE) && - ((!curr->next) || (loc+length+sizeof(malloc_t))<((uintptr_t)(curr->next)))) { - malloc_t *allocd=(malloc_t *)loc; - allocd->len=length; - allocd->last=curr; - allocd->next=curr->next; //Set double linked list - curr->next=allocd; - if(allocd->next) - allocd->next->last=allocd; - malloc_t *tmp=allocd; - tmp++; - return (void*)tmp; - } - last=curr; - curr=curr->next; - } while(curr); - malloc_t *allocd=nullptr; - if(length+sizeof(malloc_t)<=PAGESIZE) { //Small optimization. The routine for allocating more than one continuous page is terribly slow. - void *tmp; - *this >> tmp; - allocd=(malloc_t*)tmp; - } else - allocd=(malloc_t*)(*this)(UNSHIFT(length+sizeof(malloc_t))+1); - if(!allocd) //The alloc() didn't work! We're out of RAM! - return nullptr; - last->next=allocd; - allocd->len=length; - allocd->last=last; - allocd->next=nullptr; - malloc_t *tmp=allocd; - tmp++; - return (void*)tmp; - } - auto PMM::free(void* ptr) -> bool { - if(!ptr) - return false; - malloc_t* curr=head; - malloc_t* chk=(malloc_t*)ptr; - chk--; - do { - if(curr==chk) { - uintptr_t start=((uintptr_t)chk)&(~FLAGS); - uintptr_t end=start+PAGESIZE; - if((((uintptr_t)(curr->last)last)>=end))&&(((uintptr_t)(curr->next)>=end)||((uintptr_t)(curr->next)last) - curr->last->next=curr->next; - else { - head=curr->next; - } - if(curr->next) - curr->next->last=curr->last; - return true; - } - curr=curr->next; - } while(curr); - return false; - } -} diff --git a/kernel/kernel/string.c b/kernel/kernel/string.c index eaea754..69589e7 100644 --- a/kernel/kernel/string.c +++ b/kernel/kernel/string.c @@ -13,6 +13,9 @@ void memmove(void* dst, void* src, uint32_t size) { to[i]=from[i]; //This would get optimized by gcc to memmove(dst, src, size); if optimizations are enabled. } } +void memcpy(void* dest, void* src, uint32_t size) { + memmove(dest, src, size); +} uint32_t strlen(const char* str) { uint32_t i=0; char* str2=(char*)((uintptr_t)str); diff --git a/kernel/libhal.a b/kernel/libhal.a new file mode 100644 index 0000000..03b79d3 Binary files /dev/null and b/kernel/libhal.a differ diff --git a/mtgos.sym b/mtgos.sym index a75c326..b0c0a48 100644 --- a/mtgos.sym +++ b/mtgos.sym @@ -1,366 +1,377 @@ -00202890 __cxa_pure_virtual -00200063 enterPaging -00203ad6 handleINT -0020282d init -002000a0 intr_stub_0 -002000c0 intr_stub_1 -002001e0 intr_stub_10 -00200d20 intr_stub_100 -00200d40 intr_stub_101 -00200d60 intr_stub_102 -00200d80 intr_stub_103 -00200da0 intr_stub_104 -00200dc0 intr_stub_105 -00200de0 intr_stub_106 -00200e00 intr_stub_107 -00200e20 intr_stub_108 -00200e40 intr_stub_109 -00200200 intr_stub_11 -00200e60 intr_stub_110 -00200e80 intr_stub_111 -00200ea0 intr_stub_112 -00200ec0 intr_stub_113 -00200ee0 intr_stub_114 -00200f00 intr_stub_115 -00200f20 intr_stub_116 -00200f40 intr_stub_117 -00200f60 intr_stub_118 -00200f80 intr_stub_119 -00200220 intr_stub_12 -00200fa0 intr_stub_120 -00200fc0 intr_stub_121 -00200fe0 intr_stub_122 -00201000 intr_stub_123 -00201020 intr_stub_124 -00201040 intr_stub_125 -00201060 intr_stub_126 -00201080 intr_stub_127 -002010a0 intr_stub_128 -002010c0 intr_stub_129 -00200240 intr_stub_13 -002010e0 intr_stub_130 -00201100 intr_stub_131 -00201120 intr_stub_132 -00201140 intr_stub_133 -00201160 intr_stub_134 -00201180 intr_stub_135 -002011a0 intr_stub_136 -002011c0 intr_stub_137 -002011e0 intr_stub_138 -00201200 intr_stub_139 -00200260 intr_stub_14 -00201220 intr_stub_140 -00201240 intr_stub_141 -00201260 intr_stub_142 -00201280 intr_stub_143 -002012a0 intr_stub_144 -002012c0 intr_stub_145 -002012e0 intr_stub_146 -00201300 intr_stub_147 -00201320 intr_stub_148 -00201340 intr_stub_149 -00200280 intr_stub_15 -00201360 intr_stub_150 -00201380 intr_stub_151 -002013a0 intr_stub_152 -002013c0 intr_stub_153 -002013e0 intr_stub_154 -00201400 intr_stub_155 -00201420 intr_stub_156 -00201440 intr_stub_157 -00201460 intr_stub_158 -00201480 intr_stub_159 -002002a0 intr_stub_16 -002014a0 intr_stub_160 -002014c0 intr_stub_161 -002014e0 intr_stub_162 -00201500 intr_stub_163 -00201520 intr_stub_164 -00201540 intr_stub_165 -00201560 intr_stub_166 -00201580 intr_stub_167 -002015a0 intr_stub_168 -002015c0 intr_stub_169 -002002c0 intr_stub_17 -002015e0 intr_stub_170 -00201600 intr_stub_171 -00201620 intr_stub_172 -00201640 intr_stub_173 -00201660 intr_stub_174 -00201680 intr_stub_175 -002016a0 intr_stub_176 -002016c0 intr_stub_177 -002016e0 intr_stub_178 -00201700 intr_stub_179 -002002e0 intr_stub_18 -00201720 intr_stub_180 -00201740 intr_stub_181 -00201760 intr_stub_182 -00201780 intr_stub_183 -002017a0 intr_stub_184 -002017c0 intr_stub_185 -002017e0 intr_stub_186 -00201800 intr_stub_187 -00201820 intr_stub_188 -00201840 intr_stub_189 -00200300 intr_stub_19 -00201860 intr_stub_190 -00201880 intr_stub_191 -002018a0 intr_stub_192 -002018c0 intr_stub_193 -002018e0 intr_stub_194 -00201900 intr_stub_195 -00201920 intr_stub_196 -00201940 intr_stub_197 -00201960 intr_stub_198 -00201980 intr_stub_199 -002000e0 intr_stub_2 -00200320 intr_stub_20 -002019a0 intr_stub_200 -002019c0 intr_stub_201 -002019e0 intr_stub_202 -00201a00 intr_stub_203 -00201a20 intr_stub_204 -00201a40 intr_stub_205 -00201a60 intr_stub_206 -00201a80 intr_stub_207 -00201aa0 intr_stub_208 -00201ac0 intr_stub_209 -00200340 intr_stub_21 -00201ae0 intr_stub_210 -00201b00 intr_stub_211 -00201b20 intr_stub_212 -00201b40 intr_stub_213 -00201b60 intr_stub_214 -00201b80 intr_stub_215 -00201ba0 intr_stub_216 -00201bc0 intr_stub_217 -00201be0 intr_stub_218 -00201c00 intr_stub_219 -00200360 intr_stub_22 -00201c20 intr_stub_220 -00201c40 intr_stub_221 -00201c60 intr_stub_222 -00201c80 intr_stub_223 -00201ca0 intr_stub_224 -00201cc0 intr_stub_225 -00201ce0 intr_stub_226 -00201d00 intr_stub_227 -00201d20 intr_stub_228 -00201d40 intr_stub_229 -00200380 intr_stub_23 -00201d60 intr_stub_230 -00201d80 intr_stub_231 -00201da0 intr_stub_232 -00201dc0 intr_stub_233 -00201de0 intr_stub_234 -00201e00 intr_stub_235 -00201e20 intr_stub_236 -00201e40 intr_stub_237 -00201e60 intr_stub_238 -00201e80 intr_stub_239 -002003a0 intr_stub_24 -00201ea0 intr_stub_240 -00201ec0 intr_stub_241 -00201ee0 intr_stub_242 -00201f00 intr_stub_243 -00201f20 intr_stub_244 -00201f40 intr_stub_245 -00201f60 intr_stub_246 -00201f80 intr_stub_247 -00201fa0 intr_stub_248 -00201fc0 intr_stub_249 -002003c0 intr_stub_25 -00201fe0 intr_stub_250 -00202000 intr_stub_251 -00202020 intr_stub_252 -00202040 intr_stub_253 -00202060 intr_stub_254 -00202080 intr_stub_255 -002003e0 intr_stub_26 -00200400 intr_stub_27 -00200420 intr_stub_28 -00200440 intr_stub_29 -00200100 intr_stub_3 -00200460 intr_stub_30 -00200480 intr_stub_31 -002004a0 intr_stub_32 -002004c0 intr_stub_33 -002004e0 intr_stub_34 -00200500 intr_stub_35 -00200520 intr_stub_36 -00200540 intr_stub_37 -00200560 intr_stub_38 -00200580 intr_stub_39 -00200120 intr_stub_4 -002005a0 intr_stub_40 -002005c0 intr_stub_41 -002005e0 intr_stub_42 -00200600 intr_stub_43 -00200620 intr_stub_44 -00200640 intr_stub_45 -00200660 intr_stub_46 -00200680 intr_stub_47 -002006a0 intr_stub_48 -002006c0 intr_stub_49 -00200140 intr_stub_5 -002006e0 intr_stub_50 -00200700 intr_stub_51 -00200720 intr_stub_52 -00200740 intr_stub_53 -00200760 intr_stub_54 -00200780 intr_stub_55 -002007a0 intr_stub_56 -002007c0 intr_stub_57 -002007e0 intr_stub_58 -00200800 intr_stub_59 -00200160 intr_stub_6 -00200820 intr_stub_60 -00200840 intr_stub_61 -00200860 intr_stub_62 -00200880 intr_stub_63 -002008a0 intr_stub_64 -002008c0 intr_stub_65 -002008e0 intr_stub_66 -00200900 intr_stub_67 -00200920 intr_stub_68 -00200940 intr_stub_69 -00200180 intr_stub_7 -00200960 intr_stub_70 -00200980 intr_stub_71 -002009a0 intr_stub_72 -002009c0 intr_stub_73 -002009e0 intr_stub_74 -00200a00 intr_stub_75 -00200a20 intr_stub_76 -00200a40 intr_stub_77 -00200a60 intr_stub_78 -00200a80 intr_stub_79 -002001a0 intr_stub_8 -00200aa0 intr_stub_80 -00200ac0 intr_stub_81 -00200ae0 intr_stub_82 -00200b00 intr_stub_83 -00200b20 intr_stub_84 -00200b40 intr_stub_85 -00200b60 intr_stub_86 -00200b80 intr_stub_87 -00200ba0 intr_stub_88 -00200bc0 intr_stub_89 -002001c0 intr_stub_9 -00200be0 intr_stub_90 -00200c00 intr_stub_91 -00200c20 intr_stub_92 -00200c40 intr_stub_93 -00200c60 intr_stub_94 -00200c80 intr_stub_95 -00200ca0 intr_stub_96 -00200cc0 intr_stub_97 -00200ce0 intr_stub_98 -00200d00 intr_stub_99 +00200364 _Z4loadP10Elf32_Ehdr +00200240 _Z6task_av +0020025c _Z6task_bv +00200278 _Z6task_cv +00200294 _Z6task_dv +00200775 _Z7syscalljPvS_ +0020023a _Z8pid_nullv +00204364 _ZN8MTGosHAL11BlockDeviceC1Ev +00204364 _ZN8MTGosHAL11BlockDeviceC2Ev +00204370 _ZN8MTGosHAL11BlockDeviceD1Ev +00204370 _ZN8MTGosHAL11BlockDeviceD2Ev +00201334 _ZN8MTGosHAL12Multitasking8initTaskEPFvvE +0020148e _ZN8MTGosHAL12Multitasking8scheduleEPNS_9cpu_stateE +0020127e _ZN8MTGosHAL12MultitaskingC1Ev +0020127e _ZN8MTGosHAL12MultitaskingC2Ev +0020686e _ZN8MTGosHAL3GDT5applyEv +00206722 _ZN8MTGosHAL3GDT8setEntryEijji +002066ac _ZN8MTGosHAL3GDTC1Ev +002066ac _ZN8MTGosHAL3GDTC2Ev +002017ca _ZN8MTGosHAL3IDT5applyEv +0020182e _ZN8MTGosHAL3IDT6handleEPNS_9cpu_stateE +002022fa _ZN8MTGosHAL3IDT7requestEhPFPNS_9cpu_stateES2_E +0020163e _ZN8MTGosHAL3IDT8setEntryEiPvth +00201552 _ZN8MTGosHAL3IDTC1Ev +00201552 _ZN8MTGosHAL3IDTC2Ev +00203c40 _ZN8MTGosHAL3PMM4freeEPv +00203da0 _ZN8MTGosHAL3PMM4initEP14multiboot_info +002039a0 _ZN8MTGosHAL3PMM5allocEm +00203dd2 _ZN8MTGosHAL3PMM8markUsedEPKvm +00203d6e _ZN8MTGosHAL3PMMC1Ev +00203d6e _ZN8MTGosHAL3PMMC2Ev +00203e74 _ZN8MTGosHAL3PMMclEi +00203e40 _ZN8MTGosHAL3PMMlsEPKv +00203e0c _ZN8MTGosHAL3PMMrsERPv +0020413a _ZN8MTGosHAL4PMM24initEP14multiboot_info +00203ec8 _ZN8MTGosHAL4PMM28markUsedEPKvj +00203ea2 _ZN8MTGosHAL4PMM2C1Ev +00203ea2 _ZN8MTGosHAL4PMM2C2Ev +002040d0 _ZN8MTGosHAL4PMM2clEi +0020402a _ZN8MTGosHAL4PMM2lsEPKv +00203fd4 _ZN8MTGosHAL4PMM2rsERPv +002068d6 _ZN8MTGosHAL4PMM34initEP14multiboot_info +00206ab6 _ZN8MTGosHAL4PMM38markUsedEPKv +002068ca _ZN8MTGosHAL4PMM3C1Ev +002068ca _ZN8MTGosHAL4PMM3C2Ev +00206bee _ZN8MTGosHAL4PMM3lsEPKv +00206b16 _ZN8MTGosHAL4PMM3rsERPv +002005ca _ZN8MTGosHAL4Task5pauseEPNS_9cpu_stateE +002005ec _ZN8MTGosHAL4Task7addTaskEPS0_ +00200630 _ZN8MTGosHAL4Task7hasNextEv +002005b8 _ZN8MTGosHAL4Task7unpauseEv +00200592 _ZN8MTGosHAL4TaskC1EPNS_9cpu_stateE +00200592 _ZN8MTGosHAL4TaskC2EPNS_9cpu_stateE +00200899 _ZN8MTGosHAL4mainElP14multiboot_infoPPPPm +0020437c _ZN8MTGosHAL6Output4putsEPKc +002043da _ZN8MTGosHAL6OutputlsINS_4BaseEEERS0_T_ +00204592 _ZN8MTGosHAL6OutputlsIPcEERS0_T_ +00204562 _ZN8MTGosHAL6OutputlsIcEERS0_T_ +002043f6 _ZN8MTGosHAL6OutputlsIiEERS0_T_ +002044ac _ZN8MTGosHAL6OutputlsIlEERS0_T_ +002028fa _ZN8MTGosHAL6Screen4initEP14multiboot_info +00202a00 _ZN8MTGosHAL6Screen4putsEPKc +002026fe _ZN8MTGosHAL6Screen6clrscrEv +00202762 _ZN8MTGosHAL6Screen6scrollEv +00202456 _ZN8MTGosHAL6Screen7putCharEc +0020289a _ZN8MTGosHAL6Screen8setColorENS_8BG_colorE +00202880 _ZN8MTGosHAL6Screen8setColorENS_8FG_colorE +002028b6 _ZN8MTGosHAL6Screen8setColorENS_8FG_colorENS_8BG_colorE +00202a5e _ZN8MTGosHAL6ScreenlsINS_4BaseEEERS0_T_ +00202864 _ZN8MTGosHAL6ScreenlsINS_8BG_colorEEERS0_T_ +0020284a _ZN8MTGosHAL6ScreenlsINS_8FG_colorEEERS0_T_ +00202c16 _ZN8MTGosHAL6ScreenlsIPcEERS0_T_ +00202be6 _ZN8MTGosHAL6ScreenlsIcEERS0_T_ +00202a7a _ZN8MTGosHAL6ScreenlsIiEERS0_T_ +00202b30 _ZN8MTGosHAL6ScreenlsIlEERS0_T_ +0020336e _ZN8MTGosHAL6Serial15isTransmitEmptyEv +00203448 _ZN8MTGosHAL6Serial15serial_receivedEv +002036c4 _ZN8MTGosHAL6Serial5debugEv +00203478 _ZN8MTGosHAL6Serial7getCharEv +0020339e _ZN8MTGosHAL6Serial7putCharEc +0020354c _ZN8MTGosHAL6SerialC1Ev +0020354c _ZN8MTGosHAL6SerialC2Ev +00200ce8 _ZN8MTGosHAL7startupEv +00202d62 _ZN8MTGosHAL8Keyboard10handleIRQ1EPNS_9cpu_stateE +00202d14 _ZN8MTGosHAL8Keyboard11sendCommandEh +00202ca6 _ZN8MTGosHAL8Keyboard7getCharEv +002031ba _ZN8MTGosHAL8KeyboardC1Ev +002031ba _ZN8MTGosHAL8KeyboardC2Ev +00201252 _ZN8MTGosHAL8scheduleEPNS_9cpu_stateE +00202c7b _ZN8MTGosHAL9handleIRQEPNS_9cpu_stateE +002006be _ZN9ScreenOut6clrscrEv +002006fc _ZN9ScreenOut8setColorE7BGColor7FGColor +00200648 _ZN9ScreenOutC1Eb +00200648 _ZN9ScreenOutC2Eb +0020076a _ZN9ScreenOutD1Ev +0020076a _ZN9ScreenOutD2Ev +00200662 _ZN9ScreenOutlsEPc +0020353b _ZThn16_N8MTGosHAL6Serial7getCharEv +00203914 _ZdaPv +0020022b _ZdaPvS_ +00203970 _ZdaPvm +002038e8 _ZdlPv +0020021c _ZdlPvS_ +00203940 _ZdlPvm +002038bd _Znam +0020020a _ZnamPv +00203892 _Znwm +002001f8 _ZnwmPv +002010e0 __cxa_pure_virtual +002023a7 _start +00204603 enterPaging +0020237c handleINT +0020107d init +00204640 intr_stub_0 +00204660 intr_stub_1 +00204780 intr_stub_10 +002052c0 intr_stub_100 +002052e0 intr_stub_101 +00205300 intr_stub_102 +00205320 intr_stub_103 +00205340 intr_stub_104 +00205360 intr_stub_105 +00205380 intr_stub_106 +002053a0 intr_stub_107 +002053c0 intr_stub_108 +002053e0 intr_stub_109 +002047a0 intr_stub_11 +00205400 intr_stub_110 +00205420 intr_stub_111 +00205440 intr_stub_112 +00205460 intr_stub_113 +00205480 intr_stub_114 +002054a0 intr_stub_115 +002054c0 intr_stub_116 +002054e0 intr_stub_117 +00205500 intr_stub_118 +00205520 intr_stub_119 +002047c0 intr_stub_12 +00205540 intr_stub_120 +00205560 intr_stub_121 +00205580 intr_stub_122 +002055a0 intr_stub_123 +002055c0 intr_stub_124 +002055e0 intr_stub_125 +00205600 intr_stub_126 +00205620 intr_stub_127 +00205640 intr_stub_128 +00205660 intr_stub_129 +002047e0 intr_stub_13 +00205680 intr_stub_130 +002056a0 intr_stub_131 +002056c0 intr_stub_132 +002056e0 intr_stub_133 +00205700 intr_stub_134 +00205720 intr_stub_135 +00205740 intr_stub_136 +00205760 intr_stub_137 +00205780 intr_stub_138 +002057a0 intr_stub_139 +00204800 intr_stub_14 +002057c0 intr_stub_140 +002057e0 intr_stub_141 +00205800 intr_stub_142 +00205820 intr_stub_143 +00205840 intr_stub_144 +00205860 intr_stub_145 +00205880 intr_stub_146 +002058a0 intr_stub_147 +002058c0 intr_stub_148 +002058e0 intr_stub_149 +00204820 intr_stub_15 +00205900 intr_stub_150 +00205920 intr_stub_151 +00205940 intr_stub_152 +00205960 intr_stub_153 +00205980 intr_stub_154 +002059a0 intr_stub_155 +002059c0 intr_stub_156 +002059e0 intr_stub_157 +00205a00 intr_stub_158 +00205a20 intr_stub_159 +00204840 intr_stub_16 +00205a40 intr_stub_160 +00205a60 intr_stub_161 +00205a80 intr_stub_162 +00205aa0 intr_stub_163 +00205ac0 intr_stub_164 +00205ae0 intr_stub_165 +00205b00 intr_stub_166 +00205b20 intr_stub_167 +00205b40 intr_stub_168 +00205b60 intr_stub_169 +00204860 intr_stub_17 +00205b80 intr_stub_170 +00205ba0 intr_stub_171 +00205bc0 intr_stub_172 +00205be0 intr_stub_173 +00205c00 intr_stub_174 +00205c20 intr_stub_175 +00205c40 intr_stub_176 +00205c60 intr_stub_177 +00205c80 intr_stub_178 +00205ca0 intr_stub_179 +00204880 intr_stub_18 +00205cc0 intr_stub_180 +00205ce0 intr_stub_181 +00205d00 intr_stub_182 +00205d20 intr_stub_183 +00205d40 intr_stub_184 +00205d60 intr_stub_185 +00205d80 intr_stub_186 +00205da0 intr_stub_187 +00205dc0 intr_stub_188 +00205de0 intr_stub_189 +002048a0 intr_stub_19 +00205e00 intr_stub_190 +00205e20 intr_stub_191 +00205e40 intr_stub_192 +00205e60 intr_stub_193 +00205e80 intr_stub_194 +00205ea0 intr_stub_195 +00205ec0 intr_stub_196 +00205ee0 intr_stub_197 +00205f00 intr_stub_198 +00205f20 intr_stub_199 +00204680 intr_stub_2 +002048c0 intr_stub_20 +00205f40 intr_stub_200 +00205f60 intr_stub_201 +00205f80 intr_stub_202 +00205fa0 intr_stub_203 +00205fc0 intr_stub_204 +00205fe0 intr_stub_205 +00206000 intr_stub_206 +00206020 intr_stub_207 +00206040 intr_stub_208 +00206060 intr_stub_209 +002048e0 intr_stub_21 +00206080 intr_stub_210 +002060a0 intr_stub_211 +002060c0 intr_stub_212 +002060e0 intr_stub_213 +00206100 intr_stub_214 +00206120 intr_stub_215 +00206140 intr_stub_216 +00206160 intr_stub_217 +00206180 intr_stub_218 +002061a0 intr_stub_219 +00204900 intr_stub_22 +002061c0 intr_stub_220 +002061e0 intr_stub_221 +00206200 intr_stub_222 +00206220 intr_stub_223 +00206240 intr_stub_224 +00206260 intr_stub_225 +00206280 intr_stub_226 +002062a0 intr_stub_227 +002062c0 intr_stub_228 +002062e0 intr_stub_229 +00204920 intr_stub_23 +00206300 intr_stub_230 +00206320 intr_stub_231 +00206340 intr_stub_232 +00206360 intr_stub_233 +00206380 intr_stub_234 +002063a0 intr_stub_235 +002063c0 intr_stub_236 +002063e0 intr_stub_237 +00206400 intr_stub_238 +00206420 intr_stub_239 +00204940 intr_stub_24 +00206440 intr_stub_240 +00206460 intr_stub_241 +00206480 intr_stub_242 +002064a0 intr_stub_243 +002064c0 intr_stub_244 +002064e0 intr_stub_245 +00206500 intr_stub_246 +00206520 intr_stub_247 +00206540 intr_stub_248 +00206560 intr_stub_249 +00204960 intr_stub_25 +00206580 intr_stub_250 +002065a0 intr_stub_251 +002065c0 intr_stub_252 +002065e0 intr_stub_253 +00206600 intr_stub_254 +00206620 intr_stub_255 +00204980 intr_stub_26 +002049a0 intr_stub_27 +002049c0 intr_stub_28 +002049e0 intr_stub_29 +002046a0 intr_stub_3 +00204a00 intr_stub_30 +00204a20 intr_stub_31 +00204a40 intr_stub_32 +00204a60 intr_stub_33 +00204a80 intr_stub_34 +00204aa0 intr_stub_35 +00204ac0 intr_stub_36 +00204ae0 intr_stub_37 +00204b00 intr_stub_38 +00204b20 intr_stub_39 +002046c0 intr_stub_4 +00204b40 intr_stub_40 +00204b60 intr_stub_41 +00204b80 intr_stub_42 +00204ba0 intr_stub_43 +00204bc0 intr_stub_44 +00204be0 intr_stub_45 +00204c00 intr_stub_46 +00204c20 intr_stub_47 +00204c40 intr_stub_48 +00204c60 intr_stub_49 +002046e0 intr_stub_5 +00204c80 intr_stub_50 +00204ca0 intr_stub_51 +00204cc0 intr_stub_52 +00204ce0 intr_stub_53 +00204d00 intr_stub_54 +00204d20 intr_stub_55 +00204d40 intr_stub_56 +00204d60 intr_stub_57 +00204d80 intr_stub_58 +00204da0 intr_stub_59 +00204700 intr_stub_6 +00204dc0 intr_stub_60 +00204de0 intr_stub_61 +00204e00 intr_stub_62 +00204e20 intr_stub_63 +00204e40 intr_stub_64 +00204e60 intr_stub_65 +00204e80 intr_stub_66 +00204ea0 intr_stub_67 +00204ec0 intr_stub_68 +00204ee0 intr_stub_69 +00204720 intr_stub_7 +00204f00 intr_stub_70 +00204f20 intr_stub_71 +00204f40 intr_stub_72 +00204f60 intr_stub_73 +00204f80 intr_stub_74 +00204fa0 intr_stub_75 +00204fc0 intr_stub_76 +00204fe0 intr_stub_77 +00205000 intr_stub_78 +00205020 intr_stub_79 +00204740 intr_stub_8 +00205040 intr_stub_80 +00205060 intr_stub_81 +00205080 intr_stub_82 +002050a0 intr_stub_83 +002050c0 intr_stub_84 +002050e0 intr_stub_85 +00205100 intr_stub_86 +00205120 intr_stub_87 +00205140 intr_stub_88 +00205160 intr_stub_89 +00204760 intr_stub_9 +00205180 intr_stub_90 +002051a0 intr_stub_91 +002051c0 intr_stub_92 +002051e0 intr_stub_93 +00205200 intr_stub_94 +00205220 intr_stub_95 +00205240 intr_stub_96 +00205260 intr_stub_97 +00205280 intr_stub_98 +002052a0 intr_stub_99 00200000 kernel_start -00200040 loadGDT -0020005c loadIDT -00205ad5 main -0020526c memmove -00203b01 _start -00205350 strcmp -0020531e strlen -00205b84 _Z4loadP10Elf32_Ehdr -00205a65 _Z6task_av -00205a81 _Z6task_bv -00205a9d _Z6task_cv -00205ab9 _Z6task_dv -00206425 _Z7syscalljPvS_ -00205a5f _Z8pid_nullv -00205ed5 _ZdaPv -00205f23 _ZdaPvm -00205a50 _ZdaPvS_ -00205eb0 _ZdlPv -00205efa _ZdlPvm -00205a41 _ZdlPvS_ -00202a8e _ZN8MTGosHAL12Multitasking8initTaskEPFvvE -00202be8 _ZN8MTGosHAL12Multitasking8scheduleEPNS_9cpu_stateE -002029d8 _ZN8MTGosHAL12MultitaskingC1Ev -002029d8 _ZN8MTGosHAL12MultitaskingC2Ev -002022ce _ZN8MTGosHAL3GDT5applyEv -00202182 _ZN8MTGosHAL3GDT8setEntryEijji -0020210c _ZN8MTGosHAL3GDTC1Ev -0020210c _ZN8MTGosHAL3GDTC2Ev -00202f24 _ZN8MTGosHAL3IDT5applyEv -00202f88 _ZN8MTGosHAL3IDT6handleEPNS_9cpu_stateE -00203a54 _ZN8MTGosHAL3IDT7requestEhPFPNS_9cpu_stateES2_E -00202d98 _ZN8MTGosHAL3IDT8setEntryEiPvth -00202cac _ZN8MTGosHAL3IDTC1Ev -00202cac _ZN8MTGosHAL3IDTC2Ev -002061d0 _ZN8MTGosHAL3PMM4freeEPv -00204934 _ZN8MTGosHAL3PMM4initEP14multiboot_info -00205f4c _ZN8MTGosHAL3PMM5allocEm -00204966 _ZN8MTGosHAL3PMM8markUsedEPKvm -00204902 _ZN8MTGosHAL3PMMC1Ev -00204902 _ZN8MTGosHAL3PMMC2Ev -00204a08 _ZN8MTGosHAL3PMMclEi -002049d4 _ZN8MTGosHAL3PMMlsEPKv -002049a0 _ZN8MTGosHAL3PMMrsERPv -0020232a _ZN8MTGosHAL4mainElP14multiboot_infoPPPPm -00205042 _ZN8MTGosHAL4PMM24initEP14multiboot_info -00204de0 _ZN8MTGosHAL4PMM28markUsedEPKvj -00204dba _ZN8MTGosHAL4PMM2C1Ev -00204dba _ZN8MTGosHAL4PMM2C2Ev -00204fd8 _ZN8MTGosHAL4PMM2clEi -00204f32 _ZN8MTGosHAL4PMM2lsEPKv -00204edc _ZN8MTGosHAL4PMM2rsERPv -00204a42 _ZN8MTGosHAL4PMM34initEP14multiboot_info -00204c22 _ZN8MTGosHAL4PMM38markUsedEPKv -00204a36 _ZN8MTGosHAL4PMM3C1Ev -00204a36 _ZN8MTGosHAL4PMM3C2Ev -00204d5a _ZN8MTGosHAL4PMM3lsEPKv -00204c82 _ZN8MTGosHAL4PMM3rsERPv -00205dea _ZN8MTGosHAL4Task5pauseEPNS_9cpu_stateE -00205e0c _ZN8MTGosHAL4Task7addTaskEPS0_ -00205e50 _ZN8MTGosHAL4Task7hasNextEv -00205dd8 _ZN8MTGosHAL4Task7unpauseEv -00205db2 _ZN8MTGosHAL4TaskC1EPNS_9cpu_stateE -00205db2 _ZN8MTGosHAL4TaskC2EPNS_9cpu_stateE -002057f2 _ZN8MTGosHAL6Output4putsEPKc -002059c4 _ZN8MTGosHAL6OutputlsIcEERS0_T_ -0020586c _ZN8MTGosHAL6OutputlsIiEERS0_T_ -00205918 _ZN8MTGosHAL6OutputlsIlEERS0_T_ -00205850 _ZN8MTGosHAL6OutputlsINS_4BaseEEERS0_T_ -002059f4 _ZN8MTGosHAL6OutputlsIPcEERS0_T_ -00203bb0 _ZN8MTGosHAL6Screen4initEP14multiboot_info -0020561e _ZN8MTGosHAL6Screen6clrscrEv -00205670 _ZN8MTGosHAL6Screen6scrollEv -00205408 _ZN8MTGosHAL6Screen7putCharEc -002057a0 _ZN8MTGosHAL6Screen8setColorENS_8BG_colorE -00205784 _ZN8MTGosHAL6Screen8setColorENS_8FG_colorE -002057bc _ZN8MTGosHAL6Screen8setColorENS_8FG_colorENS_8BG_colorE -00205768 _ZN8MTGosHAL6ScreenlsINS_8BG_colorEEERS0_T_ -0020574c _ZN8MTGosHAL6ScreenlsINS_8FG_colorEEERS0_T_ -002043de _ZN8MTGosHAL6Serial15isTransmitEmptyEv -002044b8 _ZN8MTGosHAL6Serial15serial_receivedEv -00204734 _ZN8MTGosHAL6Serial5debugEv -002044e8 _ZN8MTGosHAL6Serial7getCharEv -0020440e _ZN8MTGosHAL6Serial7putCharEc -002045bc _ZN8MTGosHAL6SerialC1Ev -002045bc _ZN8MTGosHAL6SerialC2Ev -00202779 _ZN8MTGosHAL7startupEv -00203dd2 _ZN8MTGosHAL8Keyboard10handleIRQ1EPNS_9cpu_stateE -00203d84 _ZN8MTGosHAL8Keyboard11sendCommandEh -00203d16 _ZN8MTGosHAL8Keyboard7getCharEv -0020422a _ZN8MTGosHAL8KeyboardC1Ev -0020422a _ZN8MTGosHAL8KeyboardC2Ev -002029ac _ZN8MTGosHAL8scheduleEPNS_9cpu_stateE -00203ceb _ZN8MTGosHAL9handleIRQEPNS_9cpu_stateE -0020636e _ZN9ScreenOut6clrscrEv -002063ac _ZN9ScreenOut8setColorE7BGColor7FGColor -002062f8 _ZN9ScreenOutC1Eb -002062f8 _ZN9ScreenOutC2Eb -0020641a _ZN9ScreenOutD1Ev -0020641a _ZN9ScreenOutD2Ev -00206312 _ZN9ScreenOutlsEPc -00205e8c _Znam -00205a2f _ZnamPv -00205e68 _Znwm -00205a1d _ZnwmPv -002045ab _ZThn16_N8MTGosHAL6Serial7getCharEv +002045e0 loadGDT +002045fc loadIDT +002002b0 main +002000e2 memcpy +00200030 memmove +00200140 strcmp +0020010e strlen