GDT is running again
This commit is contained in:
parent
5fb55367ca
commit
32909aaed9
6
Makefile
6
Makefile
@ -5,7 +5,7 @@ CC = ${HOME}/opt/cross/bin/i686-elf-gcc
|
||||
CPP = ${HOME}/opt/cross/bin/i686-elf-g++
|
||||
CFLAGS = -ffreestanding -O2 -Wall -Wextra
|
||||
|
||||
OFILES = $(BUILD_DIR)/boot.o $(BUILD_DIR)/kterm.o $(BUILD_DIR)/kernel.o $(BUILD_DIR)/PhysicalMemoryManager.o $(BUILD_DIR)/io.o $(BUILD_DIR)/PageDirectory.o $(BUILD_DIR)/idt.o $(BUILD_DIR)/pic.o $(BUILD_DIR)/string.o
|
||||
OFILES = $(BUILD_DIR)/boot.o $(BUILD_DIR)/kterm.o $(BUILD_DIR)/kernel.o $(BUILD_DIR)/PhysicalMemoryManager.o $(BUILD_DIR)/io.o $(BUILD_DIR)/PageDirectory.o $(BUILD_DIR)/gdtc.o $(BUILD_DIR)/idt.o $(BUILD_DIR)/pic.o $(BUILD_DIR)/string.o
|
||||
|
||||
SRC_DIR = src
|
||||
BUILD_DIR = build
|
||||
@ -77,6 +77,10 @@ $(BUILD_DIR)/PageDirectory.o:
|
||||
$(BUILD_DIR)/idt.o:
|
||||
$(CPP) -c $(SRC_DIR)/kernel/arch/i386/idt/idt.cpp -o $(BUILD_DIR)/idt.o $(CFLAGS) -fno-exceptions -fno-rtti
|
||||
|
||||
$(BUILD_DIR)/gdtc.o:
|
||||
$(CPP) -c $(SRC_DIR)/kernel/arch/i386/gdt/gdtc.cpp -o $(BUILD_DIR)/gdtc.o $(CFLAGS) -fno-exceptions -fno-rtti
|
||||
|
||||
|
||||
$(BUILD_DIR)/pic.o:
|
||||
$(CPP) -c $(SRC_DIR)/kernel/arch/i386/pic/pic.cpp -o $(BUILD_DIR)/pic.o $(CFLAGS) -fno-exceptions -fno-rtti
|
||||
|
||||
|
@ -46,7 +46,7 @@ _start:
|
||||
|
||||
call early_main
|
||||
cli
|
||||
|
||||
.global load_gdt
|
||||
load_gdt:
|
||||
lgdt gdt
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
#include "../tty/kterm.h"
|
||||
|
||||
gdtEntry_t gdt[3];
|
||||
gdtSegmentPointer gdtPointer{};
|
||||
|
||||
|
||||
|
||||
void gdtSetGate(int num, uint64_t base, uint64_t limit, uint8_t access,
|
||||
@ -18,14 +20,12 @@ void gdtSetGate(int num, uint64_t base, uint64_t limit, uint8_t access,
|
||||
}
|
||||
|
||||
void setupGdt(){
|
||||
|
||||
printf("setupGdt is called!");
|
||||
gdtPointer.limit = (sizeof(gdtEntry_t) * 3) - 1;
|
||||
gdtPointer.base = &gdt;
|
||||
gdtPointer.base = (uint32_t) &gdt;
|
||||
|
||||
gdtSetGate(0, 0, 0, 0, 0);
|
||||
gdtSetGate(1, 0, 0xFFFFFFFF, 0x9A, 0xCF);
|
||||
gdtSetGate(2, 0, 0xFFFFFFFF, 0x92, 0xCF);
|
||||
|
||||
loadGdt();
|
||||
printf("call to load gdt\n");
|
||||
load_gdt();
|
||||
}
|
||||
|
@ -10,11 +10,13 @@ typedef struct {
|
||||
uint8_t hBase;
|
||||
} gdtEntry_t;
|
||||
|
||||
struct {
|
||||
struct gdtSegmentPointer {
|
||||
uint16_t limit;
|
||||
uint32_t base;
|
||||
} gdtPointer;
|
||||
};
|
||||
|
||||
extern void loadGdt();
|
||||
extern gdtSegmentPointer gdtPointer;
|
||||
|
||||
extern void load_gdt();
|
||||
void setupGdt();
|
||||
}
|
@ -26,17 +26,18 @@
|
||||
printf("kernel: 0x%x - 0x%x\n", &kernel_begin , &kernel_end);
|
||||
}
|
||||
|
||||
|
||||
//setupGdt();
|
||||
printf("Call to setupGdt!\n");
|
||||
setupGdt();
|
||||
|
||||
|
||||
}
|
||||
|
||||
extern "C" void kernel_main (void) {
|
||||
|
||||
printf("call to init serial\n");
|
||||
init_serial();
|
||||
|
||||
while (false){
|
||||
while (true){
|
||||
//Read time indefinetely
|
||||
read_rtc();
|
||||
printf( "UTC time: %02d-%02d-%02d %02d:%02d:%02d [ Formatted as YY-MM-DD h:mm:ss]\r" ,year, month, day, hour, minute, second);
|
||||
|
Loading…
Reference in New Issue
Block a user