From cfbea995295bab291bb9418ba9156c4289dcf3b2 Mon Sep 17 00:00:00 2001 From: shibedrill Date: Mon, 10 Feb 2025 10:27:57 -0500 Subject: [PATCH] Initial text mode stuff --- Cargo.lock | 92 +++++++++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 1 + src/boot.rs | 5 +-- src/display.rs | 28 +++++++++++++++ src/lib.rs | 4 ++- src/main.rs | 9 ++++- 6 files changed, 134 insertions(+), 5 deletions(-) create mode 100644 src/display.rs diff --git a/Cargo.lock b/Cargo.lock index e1a970f..1180c20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,18 +8,51 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +[[package]] +name = "bit_field" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" +[[package]] +name = "conquer-once" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c6d3a9775a69f6d1fe2cc888999b67ed30257d3da4d2af91984e722f2ec918a" +dependencies = [ + "conquer-util", +] + +[[package]] +name = "conquer-util" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e763eef8846b13b380f37dfecda401770b0ca4e56e95170237bd7c25c7db3582" + [[package]] name = "flagset" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3ea1ec5f8307826a5b71094dd91fc04d4ae75d5709b20ad351c7fb4815c86ec" +[[package]] +name = "font8x8" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "875488b8711a968268c7cf5d139578713097ca4635a76044e8fe8eedf831d07e" + [[package]] name = "gila" version = "0.1.0" @@ -29,6 +62,7 @@ dependencies = [ "limine", "spin", "talc", + "vga", ] [[package]] @@ -46,7 +80,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ca87cab008b8efeebdbe037cd4d1438037d48c5cb6fed939ffa5aa06315a321" dependencies = [ - "bitflags", + "bitflags 2.8.0", ] [[package]] @@ -59,6 +93,21 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "rustversion" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" + [[package]] name = "scopeguard" version = "1.2.0" @@ -74,6 +123,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spinning_top" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b9eb1a2f4c41445a3a0ff9abc5221c5fcd28e1f13cd7c0397706f9ac938ddb0" +dependencies = [ + "lock_api", +] + [[package]] name = "talc" version = "4.4.2" @@ -82,3 +140,35 @@ checksum = "3fcad3be1cfe36eb7d716a04791eba36a197da9d9b6ea1e28e64ac569da3701d" dependencies = [ "lock_api", ] + +[[package]] +name = "vga" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5dd163a9cf938e0406e1ee29e3b71ac7d8f5ffe6c1321fe74797ebef1299bc6" +dependencies = [ + "bitflags 1.3.2", + "conquer-once", + "font8x8", + "num-traits", + "spinning_top", + "x86_64", +] + +[[package]] +name = "volatile" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "442887c63f2c839b346c192d047a7c87e73d0689c9157b00b53dcc27dd5ea793" + +[[package]] +name = "x86_64" +version = "0.14.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c101112411baafbb4bf8d33e4c4a80ab5b02d74d2612331c61e8192fc9710491" +dependencies = [ + "bit_field", + "bitflags 2.8.0", + "rustversion", + "volatile", +] diff --git a/Cargo.toml b/Cargo.toml index c4fe782..eaf645c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ lazy_static = { version = "1.5.0", features = ["spin_no_std"] } limine = "0.3.1" spin = "0.9.8" talc = "4.4.2" +vga = "0.2.9" [[bin]] name = "gila" diff --git a/src/boot.rs b/src/boot.rs index ccfacb7..1453c3a 100644 --- a/src/boot.rs +++ b/src/boot.rs @@ -1,5 +1,6 @@ #![allow(dead_code)] -use limine::BaseRevision; +use limine::{request::SmpRequest, BaseRevision}; -static BASE: BaseRevision = limine::BaseRevision::new(); \ No newline at end of file +pub static BASE_REVISION: BaseRevision = limine::BaseRevision::new(); +pub static SMP_REQUEST: SmpRequest = limine::request::SmpRequest::new(); \ No newline at end of file diff --git a/src/display.rs b/src/display.rs new file mode 100644 index 0000000..d9d3d7b --- /dev/null +++ b/src/display.rs @@ -0,0 +1,28 @@ + +use vga; +pub use vga::writers::TextWriter; + +struct TextDisplay { + writer: vga::writers::Text80x25, + column: usize, + row: usize, +} + +impl TextDisplay { + pub const fn new() -> Self { + TextDisplay { + writer: vga::writers::Text80x25::new(), + column: 0, + row: 0, + } + } + pub fn writeline(text: &str, colors: vga::colors::TextModeColor) { + + } + + pub fn write(text: &str, colors: vga::colors::TextModeColor) { + + } +} + +pub static TEXT_DISPLAY: TextDisplay = TextDisplay::new(); \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index f4ebe96..4820649 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,4 +10,6 @@ pub mod panic; /// Boot services, handled by the Limine boot protocol. pub mod boot; /// Resources accessible from many parts of the code. -pub mod resources; \ No newline at end of file +pub mod resources; +/// Display facilities. +pub mod display; \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index c040271..91f9338 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,11 +5,18 @@ #![allow(dead_code)] #![allow(unused_imports)] +use gila::boot::*; use gila::process; use gila::memory; use gila::panic; +use gila::boot; +use gila::display::{self, TextWriter}; #[unsafe(no_mangle)] pub extern "C" fn main() { - + + assert!(BASE_REVISION.is_supported()); + + let _smp_response = SMP_REQUEST.get_response(); + }