adds a utility to dump the gdt, adds serial printing for printf in testing
This commit is contained in:
@ -1,9 +1,14 @@
|
||||
#include <kernel/x86/gdt.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __TESTING__
|
||||
#include <kernel/_kernel.h>
|
||||
#endif
|
||||
|
||||
|
||||
uint64_t gdt[GDT_SIZE];
|
||||
|
||||
uint64_t create_descriptor(uint32_t base, uint32_t limit, uint16_t flag)
|
||||
{
|
||||
uint64_t descriptor;
|
||||
@ -21,7 +26,7 @@ uint64_t create_descriptor(uint32_t base, uint32_t limit, uint16_t flag)
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
void gdt_init(uint64_t* gdt)
|
||||
void gdt_init(void)
|
||||
{
|
||||
#ifdef __TESTING__
|
||||
kinfo("Initializing the GDT");
|
||||
@ -36,5 +41,13 @@ void gdt_init(uint64_t* gdt)
|
||||
reloadSegments();
|
||||
#ifdef __TESTING__
|
||||
kinfo("Initialized the GDT");
|
||||
dump_gdt();
|
||||
#endif
|
||||
}
|
||||
|
||||
void dump_gdt(void)
|
||||
{
|
||||
for (int i = 0; i < GDT_SIZE; i++) {
|
||||
printf("GDT_ENTRY %d: %1 | %2\n", i, gdt[i], gdt[i]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user