diff --git a/kernel/Helpers/Makefile b/kernel/Helpers/Makefile index de11d62..76805bd 100644 --- a/kernel/Helpers/Makefile +++ b/kernel/Helpers/Makefile @@ -4,11 +4,24 @@ EXEC=helpers.o all:$(EXEC) #----- Helpers ----- -$(EXEC): memory.cpp - $(CXX) -c -o $(EXEC) memory.cpp +$(EXEC): memory.o memPrint.o + ld -m elf_i386 -r -o $(EXEC) $^ #--------------- +#----- Memory ----- +memory.o: memory.cpp memory.hpp + $(CXX) -c -o $@ $< +#------------------ + + +#----- memPrint ----- +memPrint.o: memPrint.cpp memPrint.hpp + $(CXX) -c -o $@ $< +#------------------- + + + #----- Other ----- .PHONY:clean diff --git a/kernel/Helpers/helpers.o b/kernel/Helpers/helpers.o deleted file mode 100644 index 9141e7d..0000000 Binary files a/kernel/Helpers/helpers.o and /dev/null differ diff --git a/kernel/Helpers/memPrint.cpp b/kernel/Helpers/memPrint.cpp index 92112e9..bde4702 100644 --- a/kernel/Helpers/memPrint.cpp +++ b/kernel/Helpers/memPrint.cpp @@ -1,10 +1,11 @@ #include "./memPrint.hpp" - +//Constructor memPrint::memPrint(){ - + } +//Destructor memPrint::~memPrint(){ - + } diff --git a/kernel/Helpers/memPrint.hpp b/kernel/Helpers/memPrint.hpp index 7b67778..841be86 100644 --- a/kernel/Helpers/memPrint.hpp +++ b/kernel/Helpers/memPrint.hpp @@ -26,13 +26,19 @@ enum colorBios{ //Type def for biosColor typedef enum colorBios colorBios; + +//Class to print char on screen using Video Ram mapping class memPrint{ private: - + public: + + //Constructor memPrint(); + + //Destructor ~memPrint(); }; diff --git a/kernel/Helpers/memory.cpp b/kernel/Helpers/memory.cpp index 741a094..8ace044 100644 --- a/kernel/Helpers/memory.cpp +++ b/kernel/Helpers/memory.cpp @@ -1,23 +1,31 @@ #include "./memory.hpp" #include "./types.hpp" +//Fonction to copy data into memory int memcpy(u32 source, u32 dest, u32 size){ + //Init source and destination pointer u32 *sourceTmp=(u32 *)source; u32 *destTmp=(u32 *)dest; + //Init progression u32 progress=0; + //Start copy while(progress != size){ + //Copy *destTmp=*sourceTmp; + //Update source and destination sourceTmp++; destTmp++; + //Update progression progress++; } + //End and return progression return progress; } diff --git a/kernel/Helpers/memory.hpp b/kernel/Helpers/memory.hpp index 07045c8..ddc522c 100644 --- a/kernel/Helpers/memory.hpp +++ b/kernel/Helpers/memory.hpp @@ -3,7 +3,7 @@ #include "./types.hpp" - +//Fonction to copy data into memory int memcpy(u32 source, u32 dest, u32 size); diff --git a/kernel/Makefile b/kernel/Makefile index 0ad6f60..a5694c4 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -34,6 +34,7 @@ Helpers/helpers.o: clean: cd ./GDT/ && make clean + cd ./Helpers/ && make clean -rm ./*.o -rm ./$(EXEC) #----------------- diff --git a/kernel/entry.asm b/kernel/entry.asm index f1ab9b8..1ec44db 100644 --- a/kernel/entry.asm +++ b/kernel/entry.asm @@ -19,6 +19,7 @@ dd 0x1BADB002 ;----- End ----- +;Run kernel begin: call _boot ;Start kernel diff --git a/kernel/main.cpp b/kernel/main.cpp index 0b80564..c958ac0 100644 --- a/kernel/main.cpp +++ b/kernel/main.cpp @@ -1,10 +1,17 @@ //To load GDT #include "GDT/gdt.hpp" +#include "./Helpers/memPrint.hpp" //----- PiegOS kernel main ----- int main(){ + //Test print a char + char* letter=(char*)0xB8A00; + *letter='H'; + letter++; + *letter=(GREEN << 4) | BLUE; + //Infinite loop while(1); @@ -22,7 +29,7 @@ extern "C" void _boot(){ Gdt gdt; //Load Gdt into memory - gdt.loadGdt(); + //gdt.loadGdt(); //Call main function main();