This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use core::marker::PhantomData; | |
pub use crate::structures::port::{PortRead, PortWrite, PortReadWrite}; | |
impl PortRead for u8 { | |
#[inline] | |
unsafe fn read_from_port(port: u16) -> u8 { | |
let value: u8; | |
asm!("inb %dx, %al" : "={al}"(value) : "{dx}"(port) :: "volatile"); | |
value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{ | |
borrow::BorrowMut, | |
error::Error | |
}; | |
use winapi::{ | |
shared::{ | |
basetsd::{DWORD_PTR, UINT_PTR}, | |
minwindef::{LPARAM, LRESULT, UINT, WPARAM}, | |
windef::HWND |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod vga; | |
mod vga_configurations; | |
mod vga_fonts; | |
mod vga_registers; | |
pub use vga::VideoMode; | |
pub use vga::VGA; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add new interrupt to the idt | |
idt[InterruptIndex::Mouse.into()].set_handler_fn(mouse_interrupt_handler); | |
// Basic example interrupt handler | |
extern "x86-interrupt" fn mouse_interrupt_handler(_stack_frame: &mut InterruptStackFrame) { | |
let mut port = PortReadOnly::new(0x60); | |
let packet = unsafe { port.read() }; | |
MOUSE.lock().process_packets(packet); | |
unsafe { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern "x86-interrupt" fn mouse_interrupt_handler(_stack_frame: &mut InterruptStackFrame) { | |
let mut port = PortReadOnly::new(0x60); | |
let packet = unsafe { port.read() }; | |
crate::task::mouse::add_mouse_packet(packet); | |
unsafe { | |
PICS.lock() | |
.notify_end_of_interrupt(InterruptIndex::Mouse.into()); | |
} | |
} |