WIP: IDT in rust
This commit is contained in:
parent
ae34f7b5db
commit
dea137be73
10 changed files with 152 additions and 16 deletions
|
|
@ -2,10 +2,35 @@
|
|||
/// It is increcibly unsafe, and should be minimal in nature
|
||||
/// It must create the IDT with the correct entries, those entries are
|
||||
/// defined in other files inside of the `arch` module
|
||||
|
||||
use super::idt::{IDTR, IDT};
|
||||
|
||||
#[naked]
|
||||
#[no_mangle]
|
||||
pub unsafe extern fn kmain() {
|
||||
asm!("xchg bx, bx" : : : : "intel", "volatile");
|
||||
|
||||
loop{}
|
||||
for entry in IDT.iter_mut() {
|
||||
entry.attribute = 1 << 7 | 0xE;
|
||||
entry.selector = 8;
|
||||
entry.set_offset(&blank as *const _ as usize);
|
||||
entry.zero = 0;
|
||||
entry.zero2 = 0;
|
||||
}
|
||||
IDTR.set_slice(&IDT);
|
||||
asm!("lidt [rax]" : : "{rax}"(&IDTR as *const _ as usize) : : "intel", "volatile");
|
||||
|
||||
asm!("xchg bx, bx" : : : : "intel", "volatile");
|
||||
|
||||
asm!("int 0xFF" : : : : "intel", "volatile");
|
||||
|
||||
loop{
|
||||
asm!("hlt" : : : : "intel", "volatile");
|
||||
}
|
||||
}
|
||||
|
||||
#[naked]
|
||||
pub unsafe extern fn blank() {
|
||||
asm!("xchg bx, bx" : : : : "intel", "volatile");
|
||||
asm!("iretq" : : : : "intel", "volatile");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue