mouse support added back in and premature work on asl
This commit is contained in:
parent
6ba5f35654
commit
53751a7b0b
22
Cargo.lock
generated
22
Cargo.lock
generated
|
@ -114,6 +114,13 @@ version = "1.0.56"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27"
|
||||
|
||||
[[package]]
|
||||
name = "asl"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"logos",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
|
@ -455,18 +462,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "logos"
|
||||
version = "0.12.0"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "427e2abca5be13136da9afdbf874e6b34ad9001dd70f2b103b083a85daa7b345"
|
||||
checksum = "bf8b031682c67a8e3d5446840f9573eb7fe26efe7ec8d195c9ac4c0647c502f1"
|
||||
dependencies = [
|
||||
"logos-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "logos-derive"
|
||||
version = "0.12.0"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56a7d287fd2ac3f75b11f19a1c8a874a7d55744bd91f7a1b3e7cf87d4343c36d"
|
||||
checksum = "a1d849148dbaf9661a6151d1ca82b13bb4c4c128146a88d05253b38d4e2f496c"
|
||||
dependencies = [
|
||||
"beef",
|
||||
"fnv",
|
||||
|
@ -474,7 +481,6 @@ dependencies = [
|
|||
"quote",
|
||||
"regex-syntax",
|
||||
"syn",
|
||||
"utf8-ranges",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -964,12 +970,6 @@ version = "0.2.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||
|
||||
[[package]]
|
||||
name = "utf8-ranges"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fcfc827f90e53a02eaef5e535ee14266c1d569214c6aa70133a624d8a3164ba"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
|
|
10
Cargo.toml
10
Cargo.toml
|
@ -1,3 +1,11 @@
|
|||
[workspace]
|
||||
|
||||
members = ["ableos", "ext2-rs", "kernel", "facepalm", "shadeable", "repbuild"]
|
||||
members = [
|
||||
"ableos",
|
||||
"asl",
|
||||
"ext2-rs",
|
||||
"kernel",
|
||||
"facepalm",
|
||||
"shadeable",
|
||||
"repbuild",
|
||||
]
|
||||
|
|
|
@ -40,6 +40,11 @@ impl InterruptIndex {
|
|||
static IDT: Lazy<InterruptDescriptorTable> = Lazy::new(|| {
|
||||
reset_pit_for_cpu();
|
||||
let mut idt = InterruptDescriptorTable::new();
|
||||
|
||||
for int in 32..=255 {
|
||||
idt[int].set_handler_fn(undefined_handler);
|
||||
}
|
||||
|
||||
idt.breakpoint.set_handler_fn(breakpoint_handler);
|
||||
unsafe {
|
||||
idt.double_fault
|
||||
|
@ -49,7 +54,7 @@ static IDT: Lazy<InterruptDescriptorTable> = Lazy::new(|| {
|
|||
|
||||
idt[InterruptIndex::Timer.as_usize()].set_handler_fn(timer_interrupt_handler);
|
||||
idt[InterruptIndex::Keyboard.as_usize()].set_handler_fn(keyboard_interrupt_handler);
|
||||
// idt[InterruptIndex::Mouse.as_usize()].set_handler_fn(crate::hardware::mouse_interrupt_handler);
|
||||
idt[InterruptIndex::Mouse.as_usize()].set_handler_fn(crate::hardware::mouse_interrupt_handler);
|
||||
|
||||
// run `a + b + l + e + o + s print;` in ablescript and its 54 thats why this seemingly arbitrary number was chosen
|
||||
idt[54].set_handler_fn(software_int_handler);
|
||||
|
@ -57,6 +62,10 @@ static IDT: Lazy<InterruptDescriptorTable> = Lazy::new(|| {
|
|||
idt
|
||||
});
|
||||
|
||||
extern "x86-interrupt" fn undefined_handler(stack_frame: InterruptStackFrame) {
|
||||
error!("{:?}", stack_frame);
|
||||
}
|
||||
|
||||
extern "x86-interrupt" fn software_int_handler(stack_frame: InterruptStackFrame) {
|
||||
trace!("EXCEPTION: SOFTWARE INT\n{:#?}", stack_frame);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
use core::sync::atomic::AtomicU64;
|
||||
|
||||
use crate::arch::{drivers::sysinfo::master, init, sloop};
|
||||
use crate::hardware;
|
||||
use crate::relib::network::socket::{SimpleSock, Socket};
|
||||
use crate::{
|
||||
boot_conf::KernelConfig, scheduler::SCHEDULER, scratchpad, systeminfo::RELEASE_TYPE, TERM,
|
||||
|
@ -32,10 +33,10 @@ pub fn kernel_main() -> ! {
|
|||
// term.draw_term();
|
||||
// drop(term);
|
||||
|
||||
/*
|
||||
x86_64::instructions::interrupts::without_interrupts(|| {
|
||||
hardware::init_mouse();
|
||||
});
|
||||
/*
|
||||
|
||||
// println!("abc");
|
||||
let mut ipc_service = IPC.lock();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::vga_e::VGAE;
|
||||
use crate::{hardware::MOUSE, vga_e::VGAE};
|
||||
use vga::{colors::Color16, writers::GraphicsWriter};
|
||||
|
||||
const TERM_MINUS_ONE_LINE: usize = 4720;
|
||||
|
@ -78,9 +78,8 @@ impl Term {
|
|||
let mode = VGAE.lock();
|
||||
mode.clear_screen(Color16::Black);
|
||||
|
||||
/*
|
||||
let mouse = false;
|
||||
if mouse {
|
||||
// /*
|
||||
const CURSOR_COLOR: Color16 = Color16::Red;
|
||||
let mouse_coord = x86_64::instructions::interrupts::without_interrupts(|| {
|
||||
let cursor = MOUSE.lock();
|
||||
|
||||
|
@ -102,9 +101,8 @@ impl Term {
|
|||
(mouse_coord.0 as isize + 0, mouse_coord.1 as isize + 5),
|
||||
CURSOR_COLOR,
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
// */
|
||||
let mut x = 0;
|
||||
let mut y = 0;
|
||||
|
||||
|
|
9
asl/Cargo.toml
Normal file
9
asl/Cargo.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "asl"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
logos = "0.12.1"
|
10
asl/assets/asl/asl_simple.asl
Normal file
10
asl/assets/asl/asl_simple.asl
Normal file
|
@ -0,0 +1,10 @@
|
|||
DefinitionBlock ("test.aml", "DSDT", 1, "OEMID ", "TABLEID ", 0x00000000)
|
||||
{
|
||||
Scope (_SB)
|
||||
{
|
||||
Device (PCI0)
|
||||
{
|
||||
Name (_HID, EisaId ("PNP0A03"))
|
||||
}
|
||||
}
|
||||
}
|
35
asl/src/lib.rs
Normal file
35
asl/src/lib.rs
Normal file
|
@ -0,0 +1,35 @@
|
|||
use logos::{Lexer, Logos};
|
||||
|
||||
#[derive(Logos, Debug, Clone, Copy, PartialEq)]
|
||||
enum Token {
|
||||
#[regex(r"[ \t\n\f]+", logos::skip)]
|
||||
#[error]
|
||||
Error,
|
||||
|
||||
#[regex("[1-9]+", num_parser)]
|
||||
Num(isize),
|
||||
}
|
||||
fn num_parser(lex: &mut Lexer<Token>) -> isize {
|
||||
let slice = lex.slice();
|
||||
let num_str: String = slice.into();
|
||||
let num = num_str.parse::<isize>();
|
||||
num.unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn num_test() {
|
||||
let mut lex = Token::lexer("5 42 75");
|
||||
assert_eq!(lex.next(), Some(Token::Num(5)));
|
||||
assert_eq!(lex.next(), Some(Token::Num(42)));
|
||||
assert_eq!(lex.next(), Some(Token::Num(75)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn asl_simple_test() {
|
||||
let lex = Token::lexer(include_str!("../assets/asl/asl_simple.asl"));
|
||||
|
||||
for token in lex {
|
||||
// println!("{:?}", token);
|
||||
assert_ne!(Token::Error, token);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue