Disable PIC
This commit is contained in:
parent
8b13664aca
commit
4951d2c509
3 changed files with 25 additions and 0 deletions
|
@ -14,8 +14,10 @@ use kernel_common::{
|
|||
};
|
||||
use linked_list_allocator::LockedHeap;
|
||||
use log::{error, info};
|
||||
use sys::pic::disable_pic;
|
||||
|
||||
mod cpu;
|
||||
mod sys;
|
||||
|
||||
#[global_allocator]
|
||||
static ALLOC: LockedHeap = LockedHeap::empty();
|
||||
|
@ -53,6 +55,7 @@ extern "C" fn main(temp_loader_struct: *const LoaderStruct) -> ! {
|
|||
setup_gdt();
|
||||
setup_idt();
|
||||
setup_paging(&loader_struct, loader_struct.phys_kernel_start, loader_struct.phys_heap_start);
|
||||
disable_pic();
|
||||
loop {
|
||||
hlt();
|
||||
}
|
||||
|
|
1
kernel/src/sys/mod.rs
Normal file
1
kernel/src/sys/mod.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub mod pic;
|
21
kernel/src/sys/pic.rs
Normal file
21
kernel/src/sys/pic.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
use kernel_common::ioports::outb;
|
||||
|
||||
const PIC1_CMD: u16 = 0x20;
|
||||
const PIC1_DATA: u16 = 0x21;
|
||||
const PIC2_CMD: u16 = 0xa0;
|
||||
const PIC2_DATA: u16 = 0xa1;
|
||||
|
||||
pub fn disable_pic() {
|
||||
unsafe {
|
||||
outb(PIC1_CMD, 0x11);
|
||||
outb(PIC2_CMD, 0x11);
|
||||
outb(PIC1_DATA, 0x20);
|
||||
outb(PIC2_DATA, 0x28);
|
||||
outb(PIC1_DATA, 4);
|
||||
outb(PIC2_DATA, 2);
|
||||
outb(PIC1_DATA, 1);
|
||||
outb(PIC2_DATA, 1);
|
||||
outb(PIC1_DATA, 0xff);
|
||||
outb(PIC2_DATA, 0xff);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue