kernel-zig/src/arch/x86/lib/instructions.zig
Jack Halford 14ff4db74a first commit
boot ok
vga ok
console soon
interrupt mapping ok
isr triggers ok but doesn't iret

still lots to port from rust
2019-05-11 01:11:34 +02:00

39 lines
656 B
Zig

////
// Load a new Task Register.
//
// Arguments:
// desc: Segment selector of the TSS.
//
pub inline fn ltr(desc: u16) void {
asm volatile ("ltr %[desc]"
:
: [desc] "r" (desc)
);
}
////
// Completely stop the computer.
//
pub inline fn hang() noreturn {
asm volatile ("cli");
while (true) {
asm volatile ("hlt");
}
}
pub inline fn sti() void {
asm volatile ("sti");
}
////
// Load a new Interrupt Descriptor Table.
//
// Arguments:
// idtr: Address of the IDTR register.
//
pub inline fn lidt(idtr: usize) void {
asm volatile ("lidt (%[idtr])"
:
: [idtr] "r" (idtr)
);
}