Disable PIC
This commit is contained in:
parent
43d945b5e8
commit
b3ca9af48a
@ -40,6 +40,11 @@ ulong read_cr4()
|
|||||||
return __asm!ulong("mov %cr4, %rax", "={rax}");
|
return __asm!ulong("mov %cr4, %rax", "={rax}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ubyte in8(ushort ioaddr)
|
||||||
|
{
|
||||||
|
return __asm!ubyte("inb %dx, %al", "={al},{dx}", ioaddr);
|
||||||
|
}
|
||||||
|
|
||||||
ushort in16(ushort ioaddr)
|
ushort in16(ushort ioaddr)
|
||||||
{
|
{
|
||||||
return __asm!ushort("inw %dx, %ax", "={ax},{dx}", ioaddr);
|
return __asm!ushort("inw %dx, %ax", "={ax},{dx}", ioaddr);
|
||||||
@ -50,6 +55,11 @@ ulong in32(ushort ioaddr)
|
|||||||
return __asm!ulong("inl %dx, %eax", "={eax},{dx}", ioaddr);
|
return __asm!ulong("inl %dx, %eax", "={eax},{dx}", ioaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void out8(ushort ioaddr, ubyte v)
|
||||||
|
{
|
||||||
|
__asm("outb %al, %dx", "{dx},{al}", ioaddr, v);
|
||||||
|
}
|
||||||
|
|
||||||
void out16(ushort ioaddr, ushort v)
|
void out16(ushort ioaddr, ushort v)
|
||||||
{
|
{
|
||||||
__asm("outw %ax, %dx", "{dx},{ax}", ioaddr, v);
|
__asm("outw %ax, %dx", "{dx},{ax}", ioaddr, v);
|
||||||
|
@ -17,6 +17,7 @@ import hulk.gdt;
|
|||||||
import hulk.idt;
|
import hulk.idt;
|
||||||
import hos.cpu;
|
import hos.cpu;
|
||||||
import ldc.llvmasm;
|
import ldc.llvmasm;
|
||||||
|
import hulk.pic;
|
||||||
|
|
||||||
extern extern(C) __gshared ubyte _hulk_total_size;
|
extern extern(C) __gshared ubyte _hulk_total_size;
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ void hulk_start()
|
|||||||
|
|
||||||
hippo.initialize(&hulk_header);
|
hippo.initialize(&hulk_header);
|
||||||
pci.initialize();
|
pci.initialize();
|
||||||
|
pic.initialize();
|
||||||
sti();
|
sti();
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
|
16
src/hulk/pic.d
Normal file
16
src/hulk/pic.d
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* PIC (Programmable Interrupt Controller) functionality.
|
||||||
|
*/
|
||||||
|
module hulk.pic;
|
||||||
|
|
||||||
|
import hos.cpu;
|
||||||
|
|
||||||
|
struct pic
|
||||||
|
{
|
||||||
|
public static void initialize()
|
||||||
|
{
|
||||||
|
/* Disable the PIC. */
|
||||||
|
out8(0xA1u, 0xFFu);
|
||||||
|
out8(0x21u, 0xFFu);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user