Code wash !

This commit is contained in:
manzerbredes 2015-07-22 13:22:53 +04:00
parent 8f248101c0
commit c10137539f
9 changed files with 45 additions and 8 deletions

View file

@ -4,11 +4,24 @@ EXEC=helpers.o
all:$(EXEC) all:$(EXEC)
#----- Helpers ----- #----- Helpers -----
$(EXEC): memory.cpp $(EXEC): memory.o memPrint.o
$(CXX) -c -o $(EXEC) memory.cpp 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 ----- #----- Other -----
.PHONY:clean .PHONY:clean

Binary file not shown.

View file

@ -1,10 +1,11 @@
#include "./memPrint.hpp" #include "./memPrint.hpp"
//Constructor
memPrint::memPrint(){ memPrint::memPrint(){
} }
//Destructor
memPrint::~memPrint(){ memPrint::~memPrint(){
} }

View file

@ -26,13 +26,19 @@ enum colorBios{
//Type def for biosColor //Type def for biosColor
typedef enum colorBios colorBios; typedef enum colorBios colorBios;
//Class to print char on screen using Video Ram mapping
class memPrint{ class memPrint{
private: private:
public: public:
//Constructor
memPrint(); memPrint();
//Destructor
~memPrint(); ~memPrint();
}; };

View file

@ -1,23 +1,31 @@
#include "./memory.hpp" #include "./memory.hpp"
#include "./types.hpp" #include "./types.hpp"
//Fonction to copy data into memory
int memcpy(u32 source, u32 dest, u32 size){ int memcpy(u32 source, u32 dest, u32 size){
//Init source and destination pointer
u32 *sourceTmp=(u32 *)source; u32 *sourceTmp=(u32 *)source;
u32 *destTmp=(u32 *)dest; u32 *destTmp=(u32 *)dest;
//Init progression
u32 progress=0; u32 progress=0;
//Start copy
while(progress != size){ while(progress != size){
//Copy
*destTmp=*sourceTmp; *destTmp=*sourceTmp;
//Update source and destination
sourceTmp++; sourceTmp++;
destTmp++; destTmp++;
//Update progression
progress++; progress++;
} }
//End and return progression
return progress; return progress;
} }

View file

@ -3,7 +3,7 @@
#include "./types.hpp" #include "./types.hpp"
//Fonction to copy data into memory
int memcpy(u32 source, u32 dest, u32 size); int memcpy(u32 source, u32 dest, u32 size);

View file

@ -34,6 +34,7 @@ Helpers/helpers.o:
clean: clean:
cd ./GDT/ && make clean cd ./GDT/ && make clean
cd ./Helpers/ && make clean
-rm ./*.o -rm ./*.o
-rm ./$(EXEC) -rm ./$(EXEC)
#----------------- #-----------------

View file

@ -19,6 +19,7 @@ dd 0x1BADB002
;----- End ----- ;----- End -----
;Run kernel
begin: begin:
call _boot ;Start kernel call _boot ;Start kernel

View file

@ -1,10 +1,17 @@
//To load GDT //To load GDT
#include "GDT/gdt.hpp" #include "GDT/gdt.hpp"
#include "./Helpers/memPrint.hpp"
//----- PiegOS kernel main ----- //----- PiegOS kernel main -----
int main(){ int main(){
//Test print a char
char* letter=(char*)0xB8A00;
*letter='H';
letter++;
*letter=(GREEN << 4) | BLUE;
//Infinite loop //Infinite loop
while(1); while(1);
@ -22,7 +29,7 @@ extern "C" void _boot(){
Gdt gdt; Gdt gdt;
//Load Gdt into memory //Load Gdt into memory
gdt.loadGdt(); //gdt.loadGdt();
//Call main function //Call main function
main(); main();