43 lines
720 B
C
43 lines
720 B
C
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include "hal/hal.h"
|
|
#include "kprintf.h"
|
|
#include "serial.h"
|
|
#include "gdt.h"
|
|
#include "acpi.h"
|
|
#include "intr.h"
|
|
#include "pic.h"
|
|
#include "apic.h"
|
|
#include "pit.h"
|
|
#include "syscall.h"
|
|
|
|
void hal_init(void) {
|
|
if (!serial_init()) {
|
|
hal_hang(); // going further makes no sense
|
|
}
|
|
LOG("hal", "serial init\n");
|
|
gdt_init();
|
|
}
|
|
|
|
__attribute__((noreturn)) void hal_hang(void) {
|
|
for(;;) {
|
|
asm("hlt");
|
|
}
|
|
}
|
|
|
|
void hal_init_withmalloc(void) {
|
|
acpi_init();
|
|
pic_init();
|
|
apic_init();
|
|
intr_init();
|
|
pit_init();
|
|
ioapic_setentry(IOAPIC, acpi_remapirq(0x00), INTR_TIMER);
|
|
hal_intr_disable();
|
|
hal_syscall_init();
|
|
}
|
|
|
|
void hal_wait(uint32_t ms) {
|
|
pit_wait(ms);
|
|
}
|
|
|