Litrally amlmost functional PS/2 driver. #19

Open
peony wants to merge 29 commits from peony/ableos:master into master
2 changed files with 125 additions and 1 deletions
Showing only changes of commit d78878a12f - Show all commits

View file

@ -0,0 +1,122 @@
2 1 48 Node { kind: Then, inputs: [47], outputs: [90], peep_triggers: [], clobbers: [], ty: Id(5), pos: 0, depth: Cell { value: 10 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 1 }, aclass: 0 }
2 1 88 Node { kind: Region, inputs: [70, 87], outputs: [89, 90], peep_triggers: [], clobbers: [], ty: Id(5), pos: 0, depth: Cell { value: 18 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 1 }, aclass: 0 }
2 1 87 Node { kind: Else, inputs: [69], outputs: [88], peep_triggers: [], clobbers: [], ty: Id(5), pos: 0, depth: Cell { value: 17 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 1 }, aclass: 0 }
2 1 69 Node { kind: If, inputs: [64, 68], outputs: [70, 87], peep_triggers: [], clobbers: [], ty: Id(5), pos: 0, depth: Cell { value: 16 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 1 }, aclass: 0 }
2 1 64 Node { kind: Call { func: Func(18), args: Tuple(193) }, inputs: [63, 5, 39, 40], outputs: [69, 66, 68, 66], peep_triggers: [], clobbers: [0, 1], ty: Id(7), pos: 0, depth: Cell { value: 15 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 1 }, aclass: 0 }
2 1 63 Node { kind: Then, inputs: [62], outputs: [64], peep_triggers: [], clobbers: [], ty: Id(5), pos: 0, depth: Cell { value: 14 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 1 }, aclass: 0 }
2 1 70 Node { kind: Then, inputs: [69], outputs: [88, 86, 82, 81, 80, 76, 85, 75, 74, 84, 71, 73], peep_triggers: [], clobbers: [], ty: Id(5), pos: 0, depth: Cell { value: 17 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 1 }, aclass: 0 }
3 1 48 Node { kind: Then, inputs: [47], outputs: [90], peep_triggers: [], clobbers: [], ty: Id(5), pos: 0, depth: Cell { value: 10 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 1 }, aclass: 0 }
3 1 88 Node { kind: Region, inputs: [70, 87], outputs: [89, 90], peep_triggers: [], clobbers: [], ty: Id(5), pos: 0, depth: Cell { value: 18 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 1 }, aclass: 0 }
3 1 87 Node { kind: Else, inputs: [69], outputs: [88], peep_triggers: [], clobbers: [], ty: Id(5), pos: 0, depth: Cell { value: 17 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 1 }, aclass: 0 }
3 1 69 Node { kind: If, inputs: [64, 68], outputs: [70, 87], peep_triggers: [], clobbers: [], ty: Id(5), pos: 0, depth: Cell { value: 16 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 1 }, aclass: 0 }
3 1 64 Node { kind: Call { func: Func(18), args: Tuple(193) }, inputs: [63, 5, 39, 40], outputs: [69, 66, 68, 66], peep_triggers: [], clobbers: [0, 1], ty: Id(7), pos: 0, depth: Cell { value: 15 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 1 }, aclass: 0 }
3 1 63 Node { kind: Then, inputs: [62], outputs: [64], peep_triggers: [], clobbers: [], ty: Id(5), pos: 0, depth: Cell { value: 14 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 1 }, aclass: 0 }
3 2 62 Node { kind: If, inputs: [59, 61], outputs: [63, 92], peep_triggers: [], clobbers: [], ty: Id(5), pos: 0, depth: Cell { value: 13 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 2 }, aclass: 0 }
3 2 59 Node { kind: Call { func: Func(17), args: Tuple(417) }, inputs: [57, 58, 40], outputs: [62, 61, 61], peep_triggers: [82], clobbers: [1], ty: Id(805306369), pos: 0, depth: Cell { value: 12 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 2 }, aclass: 0 }
3 2 57 Node { kind: Call { func: Func(4294967295), args: Tuple(292) }, inputs: [49, 7, 7, 51, 33, 40, 56], outputs: [59, 82, 94, 58], peep_triggers: [], clobbers: [1, 3], ty: Id(8), pos: 0, depth: Cell { value: 11 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 2 }, aclass: 0 }
3 2 49 Node { kind: Else, inputs: [47], outputs: [57], peep_triggers: [], clobbers: [], ty: Id(5), pos: 0, depth: Cell { value: 10 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 2 }, aclass: 0 }
3 1 70 Node { kind: Then, inputs: [69], outputs: [88, 86, 82, 81, 80, 76, 85, 75, 74, 84, 71, 73], peep_triggers: [], clobbers: [], ty: Id(5), pos: 0, depth: Cell { value: 17 }, lock_rc: Cell { value: 0 }, loop_depth: Cell { value: 1 }, aclass: 0 }
thread 'main' panicked at /home/b0c1/.cargo/git/checkouts/holey-bytes-7306cae1e59cf4dd/37dd13c/lang/src/son.rs:1761:13:
explicit panic
stack backtrace:
0: 0x607c994845ba - std::backtrace_rs::backtrace::libunwind::trace::h504b0125eda6b384
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
1: 0x607c994845ba - std::backtrace_rs::backtrace::trace_unsynchronized::hc81f5dfa1a7e52fe
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x607c994845ba - std::sys::backtrace::_print_fmt::ha179fab1a0be4c59
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/sys/backtrace.rs:66:9
3: 0x607c994845ba - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hf209b603f512c5df
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/sys/backtrace.rs:39:26
4: 0x607c994ae4b3 - core::fmt::rt::Argument::fmt::h04f1d73255100c6c
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/core/src/fmt/rt.rs:177:76
5: 0x607c994ae4b3 - core::fmt::write::hb7459499d17d36c1
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/core/src/fmt/mod.rs:1189:21
6: 0x607c99480003 - std::io::Write::write_fmt::h4275802de0932d6f
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/io/mod.rs:1884:15
7: 0x607c99484402 - std::sys::backtrace::BacktraceLock::print::hfbfa2f755b02b3d5
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/sys/backtrace.rs:42:9
8: 0x607c9948557c - std::panicking::default_hook::{{closure}}::h807768543f95a41b
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/panicking.rs:268:22
9: 0x607c994853c2 - std::panicking::default_hook::h7a17744703ed785c
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/panicking.rs:295:9
10: 0x607c99485bb7 - std::panicking::rust_panic_with_hook::h4fba84c8b130fcc8
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/panicking.rs:801:13
11: 0x607c99485a4a - std::panicking::begin_panic_handler::{{closure}}::h9a05dc892413e069
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/panicking.rs:674:13
12: 0x607c99484a99 - std::sys::backtrace::__rust_end_short_backtrace::hb562433a6e41eea6
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/sys/backtrace.rs:170:18
13: 0x607c994856dc - rust_begin_unwind
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/panicking.rs:665:5
14: 0x607c994ac660 - core::panicking::panic_fmt::hb2b4d3a454bfbc1d
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/core/src/panicking.rs:76:14
15: 0x607c994ac7e6 - core::panicking::panic_display::h1590d2675ff6c7bf
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/core/src/panicking.rs:269:5
16: 0x607c994ac7e6 - core::panicking::panic_explicit::h703879b59c53c7df
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/core/src/panicking.rs:240:5
17: 0x607c9930378a - hblang::son::Nodes::check_loop_depth_integrity::panic_cold_explicit::h6e60a5356c746729
at /home/b0c1/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic.rs:88:13
18: 0x607c992de896 - hblang::son::Nodes::check_loop_depth_integrity::had2b0c27d2c39985
at /home/b0c1/.cargo/git/checkouts/holey-bytes-7306cae1e59cf4dd/37dd13c/lang/src/son.rs:1761:13
19: 0x607c992fc774 - hblang::son::Codegen::finalize::h13f123c7cd0da7a9
at /home/b0c1/.cargo/git/checkouts/holey-bytes-7306cae1e59cf4dd/37dd13c/lang/src/son.rs:4730:13
20: 0x607c992fc155 - hblang::son::Codegen::emit_func::h15c8dc591b00f53d
at /home/b0c1/.cargo/git/checkouts/holey-bytes-7306cae1e59cf4dd/37dd13c/lang/src/son.rs:4663:12
21: 0x607c992fb4f0 - hblang::son::Codegen::complete_call_graph::h8657dc9690902fa0
at /home/b0c1/.cargo/git/checkouts/holey-bytes-7306cae1e59cf4dd/37dd13c/lang/src/son.rs:4584:13
22: 0x607c992e2e76 - hblang::son::Codegen::generate::h1b2054aee9ce9790
at /home/b0c1/.cargo/git/checkouts/holey-bytes-7306cae1e59cf4dd/37dd13c/lang/src/son.rs:2496:9
23: 0x607c993a5ec8 - hblang::fs::run_compiler::h5f6a41b732f9e970
at /home/b0c1/.cargo/git/checkouts/holey-bytes-7306cae1e59cf4dd/37dd13c/lang/src/fs.rs:110:9
24: 0x607c98ea4e6d - repbuild::dev::Package::build::hdae17d117d475784
at /home/b0c1/peo-able/repbuild/src/dev.rs:99:13
25: 0x607c98ecb684 - repbuild::get_fs::{{closure}}::h632dfb970319db7a
at /home/b0c1/peo-able/repbuild/src/main.rs:225:27
26: 0x607c98ed46c8 - core::iter::adapters::map::map_fold::{{closure}}::ha6a4808f4323eba7
at /home/b0c1/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:88:28
27: 0x607c98e928c8 - core::iter::traits::iterator::Iterator::fold::h1aebe574af7a3edc
at /home/b0c1/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2546:21
28: 0x607c98ed3e6a - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold::h5f00813cbd913ca4
at /home/b0c1/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:128:9
29: 0x607c98ed4476 - core::iter::traits::iterator::Iterator::for_each::h50c08b7e4fd54442
at /home/b0c1/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:800:9
30: 0x607c98edeec2 - repbuild::get_fs::hf28ffbf58ae795af
at /home/b0c1/peo-able/repbuild/src/main.rs:211:9
31: 0x607c98edf79c - repbuild::build::hce2c223cc2728d29
at /home/b0c1/peo-able/repbuild/src/main.rs:314:14
32: 0x607c98edb62a - repbuild::main::hb96a470eed1f6457
at /home/b0c1/peo-able/repbuild/src/main.rs:71:13
33: 0x607c98e8de2b - core::ops::function::FnOnce::call_once::h378a33339d4a24f0
at /home/b0c1/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
34: 0x607c98ed3ddd - std::sys::backtrace::__rust_begin_short_backtrace::hdd497f77b8d07378
at /home/b0c1/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:154:18
35: 0x607c98ebf9a1 - std::rt::lang_start::{{closure}}::hae9e3782edfc8e36
at /home/b0c1/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:195:18
36: 0x607c99479b47 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hebb10914f9a99bfc
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/core/src/ops/function.rs:284:13
37: 0x607c99479b47 - std::panicking::try::do_call::he587bea39635f003
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/panicking.rs:557:40
38: 0x607c99479b47 - std::panicking::try::h066d0ac22ca08454
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/panicking.rs:520:19
39: 0x607c99479b47 - std::panic::catch_unwind::hc9ca199833b3a11d
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/panic.rs:358:14
40: 0x607c99479b47 - std::rt::lang_start_internal::{{closure}}::hadaa4544f6d8e710
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/rt.rs:174:48
41: 0x607c99479b47 - std::panicking::try::do_call::h53342b4fc8ceaf09
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/panicking.rs:557:40
42: 0x607c99479b47 - std::panicking::try::h51410bd76f769cad
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/panicking.rs:520:19
43: 0x607c99479b47 - std::panic::catch_unwind::h1b027fc305be26d2
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/panic.rs:358:14
44: 0x607c99479b47 - std::rt::lang_start_internal::h4f9aa9060ab8cedd
at /rustc/917a50a03931a9861c19a46f3e2a02a28f1da936/library/std/src/rt.rs:174:20
45: 0x607c98ebf97a - std::rt::lang_start::h0aff8b9ad9d9f551
at /home/b0c1/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:194:17
46: 0x607c98ee23ae - main
47: 0x7b317e02a1ca - __libc_start_call_main
at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
48: 0x7b317e02a28b - __libc_start_main_impl
at ./csu/../csu/libc-start.c:360:3
49: 0x607c98e89025 - _start
50: 0x0 - <unknown>
sysdata/programs/ps2_driver/src/main.hb:13:17: panic occured here
send_command := fn(port: ^controller.Port, byte: u8): void {

View file

@ -11,7 +11,8 @@ keyboard_buffer := 0
info := controller.Info.(0) info := controller.Info.(0)
send_command := fn(port: ^controller.Port, byte: u8): void { send_command := fn(port: ^controller.Port, byte: u8): void {
loop { tries := 3
loop if tries == 0 break else {
controller.send_byte(port, byte) controller.send_byte(port, byte)
loop { loop {
info = controller.get_info() info = controller.get_info()
@ -32,6 +33,7 @@ send_command := fn(port: ^controller.Port, byte: u8): void {
break break
} }
} }
tries -= 1
} }
} }