Enable interrupts and halt CPU

This commit is contained in:
Josh Holtrop 2022-09-04 23:03:20 -04:00
parent bc7fd3f2fc
commit 43d945b5e8
2 changed files with 13 additions and 0 deletions

View File

@ -5,6 +5,16 @@ void cli()
__asm("cli", ""); __asm("cli", "");
} }
void sti()
{
__asm("sti", "");
}
void hlt()
{
__asm("hlt", "");
}
ulong read_cr0() ulong read_cr0()
{ {
return __asm!ulong("mov %cr0, %rax", "={rax}"); return __asm!ulong("mov %cr0, %rax", "={rax}");

View File

@ -16,6 +16,7 @@ import hulk.pci;
import hulk.gdt; import hulk.gdt;
import hulk.idt; import hulk.idt;
import hos.cpu; import hos.cpu;
import ldc.llvmasm;
extern extern(C) __gshared ubyte _hulk_total_size; extern extern(C) __gshared ubyte _hulk_total_size;
@ -46,8 +47,10 @@ void hulk_start()
hippo.initialize(&hulk_header); hippo.initialize(&hulk_header);
pci.initialize(); pci.initialize();
sti();
for (;;) for (;;)
{ {
hlt();
} }
} }