Switch to cpp

This commit is contained in:
manzerbredes 2015-07-20 16:34:46 +04:00
parent 78f219c0ec
commit 9b856ae4d7
8 changed files with 62 additions and 30 deletions

View file

@ -7,13 +7,13 @@
##Programmers Zone
> Langages utilisés: nasm, C, AT&T ...
> Langages utilisés: nasm, C++, AT&T ...
##Utilitaires requis pour la compilation
> Shell Unix (avec dd, cp etc...)<br />
> Make <br />
> GCC, ld etc...<br/>
> G++, ld etc...<br/>
> Nasm
##Comment utilisé le Noyaux Générer ?

5
kernel/GDT/Makefile Normal file
View file

@ -0,0 +1,5 @@
gdt.o: gdt.cpp
g++ -m32 -c -o gdt.o gdt.cpp
clean:
rm *.o

11
kernel/GDT/gdt.cpp Normal file
View file

@ -0,0 +1,11 @@
#include "gdt.hpp"
#include "../Types/types.hpp"
void initGdtDesc(u32 base, u32 limit, u8 type, u8 param, gdtDescriptorStruct *descriptor){
}
void initGdt(){
}

View file

@ -1,22 +0,0 @@
#ifndef __GDT__
#define __GDT__
#include "../Types/types.h"
struct gdtPointer{
u16 size;
u32 segment;
} __attribute__ ((packed));
struct gdtDescriptor{
u16 limit1;
u16 base1;
u8 base2;
u8 type : 4;
u8 param1 : 4;
u8 limit2 : 4;
u8 param2 : 4;
u8 base3;
} __attribute__ ((packed));
#endif

33
kernel/GDT/gdt.hpp Normal file
View file

@ -0,0 +1,33 @@
#ifndef __GDT__
#define __GDT__
#include "../Types/types.hpp"
//Define GDT pointer
struct gdtPointerStruct{
u16 size;
u32 segment;
} __attribute__ ((packed));
//Define GDT descriptor
struct gdtDescriptorStruct{
u16 limit1;
u16 base1;
u8 base2;
u8 type : 4;
u8 param1 : 4;
u8 limit2 : 4;
u8 param2 : 4;
u8 base3;
} __attribute__ ((packed));
//Typedef :
typedef struct gdtPointerStruct gdtPointerStruct;
typedef struct gdtDescriptorStruct gdtDescriptorStruct;
//Functions :
void initGdtDesc(u32 base, u32 limit, u8 type, u8 param, gdtDescriptorStruct *descriptor);
void initGdt();
#endif

View file

@ -1,12 +1,15 @@
kernel.bin:entry.o main.o
kernel.bin:entry.o main.o GDT/gdt.o
ld -m elf_i386 --entry=_start -Ttext=0x100000 -o $@ $^
entry.o:entry.asm
nasm -f elf $^
main.o:main.c
gcc -m32 -c $^ -o $@
main.o:main.cpp
g++ -Wall -m32 -c $^ -o $@
GDT/gdt.o:
cd GDT && make
clean:
cd ./GDT/ && make clean
rm ./*.o
rm kernel.bin
rm ./kernel.bin

View file

@ -1,8 +1,10 @@
#include "GDT/gdt.hpp"
//----- PiegOS kernel main -----
void main(){
int main(){
while(1);
return 0;
}