Skip to content
This repository was archived by the owner on Mar 20, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 71 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2018"
[dependencies]
volatile = "0.2.6"
spin = "0.5.2"
pc-keyboard = "0.5.0"
pc-keyboard = "0.7.0"
heapless = "0.6.1"
linked_list_allocator = "0.9.0"

Expand All @@ -19,6 +19,20 @@ pic8259 = "0.10.1"
version = "1.0"
features = ["spin_no_std"]

[dependencies.crossbeam-queue]
version = "0.3.11"
default-features = false
features = ["alloc"]

[dependencies.conquer-once]
version = "0.2.0"
default-features = false

[dependencies.futures-util]
version = "0.3.4"
default-features = false
features = ["alloc"]

[package.metadata.bootimage]
test-args = [
"-device",
Expand Down
29 changes: 4 additions & 25 deletions src/kernel/interrupts.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::hlt_loop;
use crate::kernel::{clock, gdt};
use crate::print;
use crate::user;
use lazy_static::lazy_static;
use pic8259::ChainedPics;
use spin;
Expand Down Expand Up @@ -83,34 +82,14 @@ extern "x86-interrupt" fn timer_interrupt_handler(_stack_frame: InterruptStackFr
}
}

extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStackFrame) {
use crate::kernel::layouts;
use pc_keyboard::{DecodedKey, HandleControl, Keyboard, ScancodeSet1};
use spin::Mutex;
extern "x86-interrupt" fn keyboard_interrupt_handler(
_stack_frame: InterruptStackFrame
) {
use x86_64::instructions::port::Port;

lazy_static! {
static ref KEYBOARD: Mutex<Keyboard<layouts::Qwerty104Key, ScancodeSet1>> =
Mutex::new(Keyboard::new(
layouts::Qwerty104Key,
ScancodeSet1,
HandleControl::MapLettersToUnicode
));
}

let mut keyboard = KEYBOARD.lock();
let mut port = Port::new(0x60);

let scancode: u8 = unsafe { port.read() };
if let Ok(Some(key_event)) = keyboard.add_byte(scancode) {
if let Some(key) = keyboard.process_keyevent(key_event) {
//user::shell::key_handle(key);
match key {
DecodedKey::Unicode(c) => user::shell::key_handle(c),
DecodedKey::RawKey(_) => {}
}
}
}
crate::kernel::task::keyboard::add_scancode(scancode);

unsafe {
PICS.lock()
Expand Down
195 changes: 0 additions & 195 deletions src/kernel/layouts.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/kernel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pub mod allocator;
pub mod clock;
pub mod gdt;
pub mod interrupts;
pub mod layouts;
pub mod memory;
pub mod string;
pub mod task;
pub mod vga;
Loading
Loading