main.rs 829 Bytes
Newer Older
1 2
#![feature(asm)]

Jeremy Soller's avatar
Jeremy Soller committed
3 4 5
#[macro_use]
extern crate bitflags;
extern crate io;
Jeremy Soller's avatar
Jeremy Soller committed
6
extern crate orbclient;
7 8 9 10 11 12
extern crate syscall;

use std::thread;

use syscall::iopl;

Jeremy Soller's avatar
Jeremy Soller committed
13 14
mod controller;
mod keyboard;
Jeremy Soller's avatar
Jeremy Soller committed
15
mod keymap;
Jeremy Soller's avatar
Jeremy Soller committed
16
mod mouse;
17

Jeremy Soller's avatar
Jeremy Soller committed
18 19 20 21
fn main() {
    unsafe {
        iopl(3).expect("ps2d: failed to get I/O permission");
        asm!("cli" :::: "intel", "volatile");
Jeremy Soller's avatar
Jeremy Soller committed
22
    }
23

Jeremy Soller's avatar
Jeremy Soller committed
24
    let extra_packet = controller::Ps2::new().init();
Jeremy Soller's avatar
Jeremy Soller committed
25

26
    thread::spawn(|| {
27
        unsafe {
Jeremy Soller's avatar
Jeremy Soller committed
28
            iopl(3).expect("ps2d: failed to get I/O permission");
29 30 31
            asm!("cli" :::: "intel", "volatile");
        }

Jeremy Soller's avatar
Jeremy Soller committed
32
        keyboard::keyboard();
Jeremy Soller's avatar
Jeremy Soller committed
33
    });
34

Jeremy Soller's avatar
Jeremy Soller committed
35
    thread::spawn(move || {
Jeremy Soller's avatar
Jeremy Soller committed
36
        unsafe {
Jeremy Soller's avatar
Jeremy Soller committed
37
            iopl(3).expect("ps2d: failed to get I/O permission");
Jeremy Soller's avatar
Jeremy Soller committed
38
            asm!("cli" :::: "intel", "volatile");
39
        }
40

Jeremy Soller's avatar
Jeremy Soller committed
41
        mouse::mouse(extra_packet);
Jeremy Soller's avatar
Jeremy Soller committed
42
    });
43
}