1
- use crate :: { gdt, halt_loop, print , println, time} ;
1
+ use crate :: { gdt, halt_loop, println, time} ;
2
2
use lazy_static:: lazy_static;
3
3
use pic8259:: ChainedPics ;
4
4
use x86_64:: structures:: idt:: { InterruptDescriptorTable , InterruptStackFrame , PageFaultErrorCode } ;
@@ -18,7 +18,6 @@ lazy_static! {
18
18
. set_stack_index( gdt:: DOUBLE_FAULT_IST_INDEX ) ;
19
19
}
20
20
idt[ InterruptIndex :: Timer . as_usize( ) ] . set_handler_fn( timer_interrupt_handler) ;
21
- idt[ InterruptIndex :: Keyboard . as_usize( ) ] . set_handler_fn( keyboard_interrupt_handler) ;
22
21
23
22
idt
24
23
} ;
@@ -50,36 +49,6 @@ extern "x86-interrupt" fn double_fault_handler(
50
49
panic ! ( "EXCEPTION: DOUBLE FAULT\n {:#?}" , stack_frame) ;
51
50
}
52
51
53
- extern "x86-interrupt" fn keyboard_interrupt_handler ( _stack_frame : InterruptStackFrame ) {
54
- use pc_keyboard:: { layouts, DecodedKey , HandleControl , Keyboard , ScancodeSet1 } ;
55
- use spin:: Mutex ;
56
- use x86_64:: instructions:: port:: Port ;
57
-
58
- lazy_static ! {
59
- static ref KEYBOARD : Mutex <Keyboard <layouts:: Us104Key , ScancodeSet1 >> = Mutex :: new(
60
- Keyboard :: new( layouts:: Us104Key , ScancodeSet1 , HandleControl :: Ignore )
61
- ) ;
62
- }
63
-
64
- let mut keyboard = KEYBOARD . lock ( ) ;
65
- let mut port = Port :: new ( 0x60 ) ;
66
-
67
- let scancode: u8 = unsafe { port. read ( ) } ;
68
- if let Ok ( Some ( key_event) ) = keyboard. add_byte ( scancode) {
69
- if let Some ( key) = keyboard. process_keyevent ( key_event) {
70
- match key {
71
- DecodedKey :: Unicode ( character) => print ! ( "{}" , character) ,
72
- DecodedKey :: RawKey ( key) => print ! ( "{:?}" , key) ,
73
- }
74
- }
75
- }
76
-
77
- unsafe {
78
- PICS . lock ( )
79
- . notify_end_of_interrupt ( InterruptIndex :: Keyboard . as_u8 ( ) ) ;
80
- }
81
- }
82
-
83
52
extern "x86-interrupt" fn timer_interrupt_handler ( _stack_frame : InterruptStackFrame ) {
84
53
time:: TICKER . tick ( ) ;
85
54
0 commit comments