implements integer printing into printf, and adds some testing logs
This commit is contained in:
@ -16,4 +16,3 @@ uint64_t create_descriptor(uint32_t base, uint32_t limit, uint16_t flag)
|
||||
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __TESTING__
|
||||
#include <kernel/_kernel.h>
|
||||
#endif
|
||||
#include <kernel/x86/idt.h>
|
||||
|
||||
__attribute__((aligned(0x10)))
|
||||
@ -29,6 +32,9 @@ void idt_set_descriptor(uint8_t vector, void *isr, uint8_t flags)
|
||||
extern void* isr_stub_table[];
|
||||
void idt_init(void)
|
||||
{
|
||||
#ifdef __TESTING__
|
||||
kinfo("Initializing the IDT");
|
||||
#endif
|
||||
idtr.base = (uintptr_t)&idt[0];
|
||||
idtr.limit = (uint16_t) sizeof(idt_entry_t) * IDT_MAX_DESCRIPTORS - 1;
|
||||
|
||||
@ -40,5 +46,8 @@ void idt_init(void)
|
||||
// The "m" indicates actual data, not a pointer
|
||||
__asm__ volatile("lidt %0" : : "m"(idtr)); // load the new IDT
|
||||
__asm__ volatile("sti"); // set the interrupt flag
|
||||
#ifdef __TESTING__
|
||||
kinfo("Initialized the IDT");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifdef __TESTING__
|
||||
#include <kernel/_kernel.h>
|
||||
#endif
|
||||
#include <kernel/x86/io.h>
|
||||
#include <kernel/x86/pic.h>
|
||||
|
||||
@ -10,6 +13,9 @@ void PIC_sendEOI(uint8_t irq)
|
||||
|
||||
void PIC_remap(int offset1, int offset2)
|
||||
{
|
||||
#ifdef __TESTING__
|
||||
kinfo("Remapping the PIC...");
|
||||
#endif
|
||||
// The io_wait calls are necessary for older machines, to give the PIC time to react
|
||||
//
|
||||
// After the init, the PIC requires 3 init words
|
||||
@ -38,12 +44,19 @@ void PIC_remap(int offset1, int offset2)
|
||||
// Unmask the PICs
|
||||
outb(PIC1_DATA, 0);
|
||||
outb(PIC2_DATA, 0);
|
||||
|
||||
#ifdef __TESTING__
|
||||
kinfo("Remapped the PIC!");
|
||||
#endif
|
||||
}
|
||||
|
||||
void pic_disable(void)
|
||||
{ // Mask the PIC interrupts to disable them
|
||||
outb(PIC1_DATA, 0xFF);
|
||||
outb(PIC2_DATA, 0xFF);
|
||||
#ifdef __TESTING__
|
||||
kinfo("Disabled the PIC");
|
||||
#endif
|
||||
}
|
||||
|
||||
void IRQ_set_mask(uint8_t IRQline) // Masked IRQlines are ignored by the PIC, masked IRQ2 will fully ignore the slave
|
||||
|
Reference in New Issue
Block a user