boot ok vga ok console soon interrupt mapping ok isr triggers ok but doesn't iret still lots to port from rust
39 lines
656 B
Zig
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)
|
|
);
|
|
}
|