start implementing APIC utils

This commit is contained in:
2025-08-29 18:35:22 +03:00
parent 9e21167bd3
commit fb8dd43dd3
9 changed files with 176 additions and 15 deletions
+24 -11
View File
@@ -14,18 +14,11 @@
#include "../include/kheap.h"
#include "../include/exec_from_file.h"
#include "../include/atapi.h"
#include "../include/lib9660.h"
#include "../include/vfs.h"
#include "../include/apic.h"
#include <stdint.h>
void apply_pic_masks()
{
//0x21 is master pic, 0xa1 is slave pic
outb(0x21,0xfc);//0b11111100 (bit 0 is PIT, bit 1 is keyboard and so on)
outb(0xa1,0xff);
}
void kmain(unsigned int magic, unsigned int info)
{
struct multiboot_info mbi;
@@ -52,10 +45,30 @@ void kmain(unsigned int magic, unsigned int info)
printf("done\n");
isr_install();
pic_remap(0x20, 0x28);
pit_init(100);
apply_pic_masks();
if(cpuHasMSR())
{
printf("CPU has MSR\n");
}
if(check_apic() && cpuHasMSR())
{
printf("APIC is present\n");
lapic_enabled = true;
}
if(!lapic_enabled)
{
pic_remap(0x20, 0x28);
pit_init(100);
pic_apply_masks();
}
else
{
pic_disable();
enable_apic();
}
printf("done fucking with pages and memory map!\n");
char *test_str;