From c10137539f0e68afd0582ccb6cc320694b8e39a5 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Wed, 22 Jul 2015 13:22:53 +0400 Subject: [PATCH] Code wash ! --- kernel/Helpers/Makefile | 17 +++++++++++++++-- kernel/Helpers/helpers.o | Bin 904 -> 0 bytes kernel/Helpers/memPrint.cpp | 7 ++++--- kernel/Helpers/memPrint.hpp | 8 +++++++- kernel/Helpers/memory.cpp | 8 ++++++++ kernel/Helpers/memory.hpp | 2 +- kernel/Makefile | 1 + kernel/entry.asm | 1 + kernel/main.cpp | 9 ++++++++- 9 files changed, 45 insertions(+), 8 deletions(-) delete mode 100644 kernel/Helpers/helpers.o 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 9141e7d1c4dbe7f382bff1c7bd00f9dd14ce20f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 904 zcmah{&r1SP5T4aFwz9B@AT+R32Kk7x=m$h)FA1VU;iZeLwqev$SvN=tI!KUss6V9t zA|ku>Hw2yP5_s?+)QrAIs}K!*JM+zaJM-r4Uh};jP18V`2447O0I!n7+JXoSf&t0u zd*w4w<3^RYYTRGt&1c@A`p0+;GgxU>0~OxVE4+zlXf@tgN)h{spMk!>q| zYUaW*w!#*o^D~_QU`!rFD<6P%WoSXauHWJrLYOCzt(NVmD~ zMTf6%ceVT00B_ObE+hB$a9)|^1Wrp@0rLQ6^k+(}MQz$^{XbD-SP!d9rER67U zkEHaU7Q_neqo&gLZQrYWL+v^xb?WrCtShH<)0i+2|LJB?L+{KX$f)0BJL){BMp%@- zlLfd_f%IzbuGFd3?~yONwDfC`aYR3213^~D26SG^(H)SE_y|JnfFaZohZIOtbIGfj cR0?5&W)C2!5A_QmsK2}41L`I)r%d(x0nO@Ka{vGU 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();