File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ pub mod idt;
33use crate :: arch:: amd64:: apic:: APIC ;
44use crate :: arch:: amd64:: { ports:: outb, read_cr2} ;
55use crate :: dpc:: dispatch_dpcs;
6- use crate :: drivers:: ps2:: keyboard:: keyboard ;
6+ use crate :: drivers:: ps2:: keyboard:: keyboard_handler ;
77use crate :: sched:: context:: TrapFrame ;
88use core:: arch:: asm;
99use core:: sync:: atomic:: { compiler_fence, Ordering } ;
@@ -26,7 +26,7 @@ pub fn init() {
2626 handlers[ 0xF0 ] = IRQHandler :: Handler ( apic_spurious_interrupt) ;
2727 // TODO: allocate vectors accordingly or manually set all known interrupt handlers here
2828 handlers[ 0x2f ] = IRQHandler :: Handler ( dispatch_dpcs) ;
29- handlers[ 0xd0 ] = IRQHandler :: Handler ( keyboard ) ;
29+ handlers[ 0xd0 ] = IRQHandler :: Handler ( keyboard_handler ) ;
3030}
3131
3232#[ no_mangle]
Original file line number Diff line number Diff line change 1- use crate :: { arch :: amd64 :: ports :: inb , sched :: context :: TrapFrame } ;
1+ use alloc :: boxed :: Box ;
22
3- pub fn keyboard ( _: & mut TrapFrame ) {
3+ use crate :: {
4+ arch:: amd64:: ports:: inb,
5+ dpc:: { enqueue_dpc, Dpc } ,
6+ sched:: context:: TrapFrame ,
7+ } ;
8+
9+ pub fn keyboard_handler ( _: & mut TrapFrame ) {
10+ let dpc = Dpc :: new ( keyboard, ( ) ) ;
11+
12+ enqueue_dpc ( Box :: new ( dpc) ) ;
13+ }
14+
15+ pub fn keyboard < T > ( _: T ) {
416 dbg ! ( "keyboard hit" ) ;
517 let scancode = unsafe { inb ( 0x60 ) } ;
618 dbg ! ( "scancode: {}" , scancode) ;
You can’t perform that action at this time.
0 commit comments