implements integer printing into printf, and adds some testing logs
This commit is contained in:
@ -1,19 +1,20 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <kernel/_kernel.h>
|
||||
#include <kernel/tty.h>
|
||||
#include <kernel/serial.h>
|
||||
#include <kernel/x86/gdt.h>
|
||||
#include <kernel/x86/idt.h>
|
||||
#include <kernel/x86/pic.h>
|
||||
|
||||
#define GDT_SIZE 5
|
||||
|
||||
uint64_t gdt[GDT_SIZE];
|
||||
|
||||
|
||||
void gdt_init(void)
|
||||
void gdt_init()
|
||||
{
|
||||
#ifdef __TESTING__
|
||||
kinfo("Initializing the GDT");
|
||||
#endif
|
||||
gdt[0] = create_descriptor(0, 0, 0); // null
|
||||
gdt[1] = create_descriptor(0, 0x000FFFFF, (GDT_CODE_PL0)); // kernel code
|
||||
gdt[2] = create_descriptor(0, 0x000FFFFF, (GDT_DATA_PL0)); // kernel data
|
||||
@ -22,25 +23,29 @@ void gdt_init(void)
|
||||
|
||||
setGdt((sizeof(uint64_t) * GDT_SIZE) - 1, &(gdt[0])); // limit, base
|
||||
reloadSegments();
|
||||
#ifdef __TESTING__
|
||||
kinfo("Initialized the GDT");
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef GDT_SIZE
|
||||
|
||||
void kmain(void)
|
||||
{
|
||||
gdt_init();
|
||||
idt_init();
|
||||
|
||||
PIC_remap(0x20, 0x28);
|
||||
|
||||
|
||||
#ifdef __TESTING__ // important components should be declared first, but if we're testing we want to log all of that
|
||||
terminal_initialize();
|
||||
serial_initialize();
|
||||
#endif
|
||||
|
||||
|
||||
terminal_writestring("test");
|
||||
gdt_init();
|
||||
idt_init();
|
||||
PIC_remap(0x20, 0x28);
|
||||
|
||||
serial_writestring("test!");
|
||||
#ifndef __TESTING__
|
||||
terminal_initialize();
|
||||
serial_initialize();
|
||||
#endif
|
||||
|
||||
printf("test..");
|
||||
|
||||
printf("Integer: %d\n", 10);
|
||||
printf("Hex Int: %x\n", 2);
|
||||
}
|
||||
|
Reference in New Issue
Block a user