From bf534139e35b78535d4c9d8522376a1df5db84b4 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Tue, 21 Jul 2015 17:25:36 +0400 Subject: [PATCH] Add some comment --- kernel/Drivers/memPrint/memPrint.hpp | 4 +++- kernel/GDT/gdt.cpp | 9 +++++++-- kernel/main.cpp | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/kernel/Drivers/memPrint/memPrint.hpp b/kernel/Drivers/memPrint/memPrint.hpp index 7d9a4bc..71d934b 100644 --- a/kernel/Drivers/memPrint/memPrint.hpp +++ b/kernel/Drivers/memPrint/memPrint.hpp @@ -1,7 +1,7 @@ #ifndef __memPrint__ #define __memPrint__ - +//Define the bios color enum colorBios{ BLACK=0x0, @@ -23,8 +23,10 @@ enum colorBios{ }; +//Type def for biosColor typedef enum colorBios colorBios; + // Define class to print text on screen #endif diff --git a/kernel/GDT/gdt.cpp b/kernel/GDT/gdt.cpp index 3b84e71..8c6d9d9 100644 --- a/kernel/GDT/gdt.cpp +++ b/kernel/GDT/gdt.cpp @@ -2,7 +2,7 @@ #include "../Helpers/types.hpp" #include "../Helpers/memory.hpp" - +//Constructor Gdt::Gdt(){ //Init conventional segment @@ -25,10 +25,12 @@ Gdt::Gdt(){ } +//Destructor Gdt::~Gdt(){ } +//Adapt parameter to the gdt descriptor structure void Gdt::initGdtDesc(u32 base, u32 limit, u8 access, u8 flags, gdtDescriptorStruct *Descriptor){ Descriptor->limit1 = limit & 0xFFFF; Descriptor->base1 = base & 0xFFFF; @@ -39,11 +41,14 @@ void Gdt::initGdtDesc(u32 base, u32 limit, u8 access, u8 flags, gdtDescriptorStr Descriptor->base3 = (base & 0xFF000000) >> 24; } +//Copy the gdt into mémory and load it void Gdt::loadGdt(){ - int *gdtAdress=(int *)&m_Pointer; //Copy Gdt into memory and init registers memcpy((u32)m_Descriptors, (u32)m_Pointer.segment, (u32)m_Pointer.size); + //Put m_Pointer in a var to pass it to assembly code + int *gdtAdress=(int *)&m_Pointer; + __asm__("lgdtl (%0);" : :"r"(gdtAdress) diff --git a/kernel/main.cpp b/kernel/main.cpp index 15eb154..1b62de8 100644 --- a/kernel/main.cpp +++ b/kernel/main.cpp @@ -1,4 +1,7 @@ +//To load GDT #include "GDT/gdt.hpp" + +//To print text #include "Drivers/memPrint/memPrint.hpp" @@ -15,7 +18,6 @@ int main(){ //----- PiegOS kernel boot ----- - //Mangling the _boot function extern "C" void _boot(){