From 7426bf479ff7b1bcaadd0b1fde087a6041f787c2 Mon Sep 17 00:00:00 2001 From: Able Date: Fri, 30 Aug 2024 12:31:45 -0500 Subject: [PATCH 01/13] idl work --- dev/src/idl/mod.rs | 35 ++++++++++++++++++++++++------- dev/src/idl/protocol.rs | 22 +++++++++++++++++++ dev/src/main.rs | 19 +++++++++++++++-- sysdata/idl/abc/src/protocol.aidl | 6 +++++- 4 files changed, 72 insertions(+), 10 deletions(-) create mode 100644 dev/src/idl/protocol.rs diff --git a/dev/src/idl/mod.rs b/dev/src/idl/mod.rs index 69b65238e..a4299aeb9 100644 --- a/dev/src/idl/mod.rs +++ b/dev/src/idl/mod.rs @@ -1,3 +1,7 @@ +pub mod protocol; + +use std::io::Read; + use logos::Logos; #[derive(Logos, Debug, PartialEq)] @@ -7,14 +11,31 @@ enum Token { #[token("protocol")] Protocol, - #[token(".")] - Period, + #[token("{")] + LBrace, - // Or regular expressions. - #[regex("[a-zA-Z]+")] - Text, + #[token("}")] + RBrace, + + #[regex("[a-zA-Z]+", |lex|{lex.slice().to_string()})] + Text(String), + + #[regex(r#"@[a-zA-Z]+\(?[a-zA-Z]+\)?"#, |lex|{lex.slice().to_string()})] + Decorator(String), } -pub fn main() { - let mut lex = Token::lexer("Create ridiculously fast Lexers."); +pub fn build_idl(name: String) { + let contents = open_protocol(name); + let lex = Token::lexer(&contents); + for x in lex { + println!("{:?}", x.unwrap()); + } +} + +fn open_protocol(name: String) -> String { + let path = format!("sysdata/idl/{}/src/protocol.aidl", name); + let mut file = std::fs::File::open(path).unwrap(); + let mut contents = String::new(); + file.read_to_string(&mut contents).unwrap(); + contents } diff --git a/dev/src/idl/protocol.rs b/dev/src/idl/protocol.rs new file mode 100644 index 000000000..191e504a9 --- /dev/null +++ b/dev/src/idl/protocol.rs @@ -0,0 +1,22 @@ +pub enum ProtocolTypes { + Byte, +} + +pub struct Decorator { + pub name: String, + pub value: Option, +} + +pub struct Protocol { + pub name: String, + pub decorators: Vec, +} + +pub struct Field { + pub name: String, + pub ptype: ProtocolTypes, +} + +pub struct Structure { + pub fields: Vec, +} diff --git a/dev/src/main.rs b/dev/src/main.rs index 8e27d7224..42406436c 100644 --- a/dev/src/main.rs +++ b/dev/src/main.rs @@ -1,4 +1,6 @@ use std::io::Write; + +use idl::build_idl; pub mod idl; pub enum Options { @@ -7,7 +9,7 @@ pub enum Options { New, Run, } -#[derive(PartialEq)] +#[derive(PartialEq, Debug)] pub enum DevelopmentType { Program, Library, @@ -24,7 +26,7 @@ fn main() { match subcommand { "build" => { - let name = &args[1]; + let name = &args.pop().unwrap(); build(name.to_string()) } "new" => { @@ -103,8 +105,21 @@ fn run() { fn build(name: String) { println!("building {}", name); + let mut a = name.split("/"); + let dev_type = a.next().unwrap(); + let name = a.next().unwrap().to_string(); + match dev_type { + "programs" => build_program(name), + "idl" => build_idl(name), + _ => { + panic!() + } + } } +pub fn build_program(name: String) {} +pub fn build_library(name: String) {} + fn help() { println!( "========== diff --git a/sysdata/idl/abc/src/protocol.aidl b/sysdata/idl/abc/src/protocol.aidl index b08bdcf1b..8bff36de9 100644 --- a/sysdata/idl/abc/src/protocol.aidl +++ b/sysdata/idl/abc/src/protocol.aidl @@ -1,2 +1,6 @@ + +@visibility(public) protocol abc { - } \ No newline at end of file + + +} \ No newline at end of file From 1855307cd90fa5e31cbc8d006fad1f364f9fa863 Mon Sep 17 00:00:00 2001 From: Able Date: Mon, 2 Sep 2024 21:50:43 -0500 Subject: [PATCH 02/13] IDL tokenization --- dev/src/idl/mod.rs | 35 +++++++++++++++++++++++++++--- dev/src/idl/protocol.rs | 10 +++------ sysdata/idl/abc/src/protocol.aidl | 6 ----- sysdata/idl/{abc => log}/README.md | 0 sysdata/idl/log/src/protocol.aidl | 24 ++++++++++++++++++++ 5 files changed, 59 insertions(+), 16 deletions(-) delete mode 100644 sysdata/idl/abc/src/protocol.aidl rename sysdata/idl/{abc => log}/README.md (100%) create mode 100644 sysdata/idl/log/src/protocol.aidl diff --git a/dev/src/idl/mod.rs b/dev/src/idl/mod.rs index a4299aeb9..438ac8810 100644 --- a/dev/src/idl/mod.rs +++ b/dev/src/idl/mod.rs @@ -17,18 +17,47 @@ enum Token { #[token("}")] RBrace, - #[regex("[a-zA-Z]+", |lex|{lex.slice().to_string()})] + #[token("(")] + LParen, + + #[token(")")] + RParen, + + #[token(":")] + Colon, + #[token(";")] + SemiColon, + + #[token(",")] + Comma, + + #[token("=")] + Equal, + + #[token("->")] + RArrow, + + #[regex("[a-zA-Z_]+", |lex|{lex.slice().to_string()})] Text(String), - #[regex(r#"@[a-zA-Z]+\(?[a-zA-Z]+\)?"#, |lex|{lex.slice().to_string()})] + #[regex("[1234567890]+")] + Number, + + #[regex(r"@[a-zA-Z_]+", |lex|{lex.slice().to_string()})] Decorator(String), + + #[regex(r#"@[a-zA-Z_]+\([a-zA-Z]+\)"#, |lex|{lex.slice().to_string()})] + DecoratorOption(String), } pub fn build_idl(name: String) { let contents = open_protocol(name); let lex = Token::lexer(&contents); for x in lex { - println!("{:?}", x.unwrap()); + match x { + Ok(token) => println!("{:?}", token), + Err(err) => println!("{:?}", err), + } } } diff --git a/dev/src/idl/protocol.rs b/dev/src/idl/protocol.rs index 191e504a9..1d0fa14a9 100644 --- a/dev/src/idl/protocol.rs +++ b/dev/src/idl/protocol.rs @@ -12,11 +12,7 @@ pub struct Protocol { pub decorators: Vec, } -pub struct Field { - pub name: String, - pub ptype: ProtocolTypes, -} - -pub struct Structure { - pub fields: Vec, +pub struct IDLEnum { + pub name: String, + pub accepted_values: Vec<(String, u64)>, } diff --git a/sysdata/idl/abc/src/protocol.aidl b/sysdata/idl/abc/src/protocol.aidl deleted file mode 100644 index 8bff36de9..000000000 --- a/sysdata/idl/abc/src/protocol.aidl +++ /dev/null @@ -1,6 +0,0 @@ - -@visibility(public) -protocol abc { - - -} \ No newline at end of file diff --git a/sysdata/idl/abc/README.md b/sysdata/idl/log/README.md similarity index 100% rename from sysdata/idl/abc/README.md rename to sysdata/idl/log/README.md diff --git a/sysdata/idl/log/src/protocol.aidl b/sysdata/idl/log/src/protocol.aidl new file mode 100644 index 000000000..ec37b5bd4 --- /dev/null +++ b/sysdata/idl/log/src/protocol.aidl @@ -0,0 +1,24 @@ +@auto_increment +enum LogLevel { + Error = 0, + Warn, + Info, + Debug, + Trace, +} + +@auto_increment +enum LogResult { + Err = 0, + Ok, +} + +struct Log { + log_level: LogLevel, +} + +@visibility(public) +protocol Log { + fn log(Log) -> LogResult; + fn flush() -> LogResult; +} \ No newline at end of file From 0594b99a59aa1f86e7d24e0ac2bd043e93570db7 Mon Sep 17 00:00:00 2001 From: Able Date: Tue, 3 Sep 2024 03:34:29 -0500 Subject: [PATCH 03/13] cleanup --- dev/src/idl/mod.rs | 26 ++++++++++++++++++++------ dev/src/idl/protocol.rs | 23 +++++++++++------------ 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/dev/src/idl/mod.rs b/dev/src/idl/mod.rs index 438ac8810..212416c35 100644 --- a/dev/src/idl/mod.rs +++ b/dev/src/idl/mod.rs @@ -2,9 +2,12 @@ pub mod protocol; use std::io::Read; -use logos::Logos; +use { + logos::{Lexer, Logos}, + protocol::Protocol, +}; -#[derive(Logos, Debug, PartialEq)] +#[derive(Logos, Debug, PartialEq, Clone)] #[logos(skip r"[ \t\n\f]+")] // Ignore this regex pattern between tokens enum Token { // Tokens can be literal strings, of any length. @@ -40,25 +43,36 @@ enum Token { #[regex("[a-zA-Z_]+", |lex|{lex.slice().to_string()})] Text(String), - #[regex("[1234567890]+")] - Number, + #[regex("[1234567890]+", |lex|{lex.slice().parse::().unwrap()})] + Number(u64), #[regex(r"@[a-zA-Z_]+", |lex|{lex.slice().to_string()})] Decorator(String), - #[regex(r#"@[a-zA-Z_]+\([a-zA-Z]+\)"#, |lex|{lex.slice().to_string()})] + #[regex(r#"@[a-zA-Z_]+\([a-zA-Z,0-9=]+\)"#, |lex|{lex.slice().to_string()})] DecoratorOption(String), } pub fn build_idl(name: String) { let contents = open_protocol(name); let lex = Token::lexer(&contents); + let mut tokens = vec![]; for x in lex { match x { - Ok(token) => println!("{:?}", token), + Ok(token) => { + println!("{:?}", token); + tokens.push(token); + } Err(err) => println!("{:?}", err), } } + build(tokens); +} + +fn build(a: Vec) { + for toke in a { + println!("{:?}", toke); + } } fn open_protocol(name: String) -> String { diff --git a/dev/src/idl/protocol.rs b/dev/src/idl/protocol.rs index 1d0fa14a9..623a2f71c 100644 --- a/dev/src/idl/protocol.rs +++ b/dev/src/idl/protocol.rs @@ -2,17 +2,16 @@ pub enum ProtocolTypes { Byte, } -pub struct Decorator { - pub name: String, - pub value: Option, -} +pub struct Protocol {} +impl Protocol { + pub fn is_empty(&self) -> bool { + true + } -pub struct Protocol { - pub name: String, - pub decorators: Vec, -} - -pub struct IDLEnum { - pub name: String, - pub accepted_values: Vec<(String, u64)>, + pub fn validate_data(&self, data: Vec) -> bool { + if !data.is_empty() && self.is_empty() { + return false; + } + true + } } From 331cbf5da138ad4b38582c61e87c3e6f9dc0d0ef Mon Sep 17 00:00:00 2001 From: mlokr Date: Tue, 10 Sep 2024 21:52:57 +0200 Subject: [PATCH 04/13] fixing arm compilation errors --- Cargo.lock | 10 +++++----- kernel/src/arch/aarch64/logging.rs | 5 ++++- kernel/src/arch/riscv64/mod.rs | 2 +- kernel/src/holeybytes/ecah.rs | 3 +++ sysdata/programs/fb_driver/src/lib.hb | 4 ++-- sysdata/programs/serial_driver_test/src/main.hb | 2 +- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 77c8bf640..6cb6c3a97 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -442,17 +442,17 @@ dependencies = [ [[package]] name = "hbbytecode" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#9af7bf559f139937529ea7747cd275ed163fb1fa" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#dc418bd5e0b962ec9413af72e5d624e17febcbf2" [[package]] name = "hbbytecode" version = "0.1.0" -source = "git+https://git.ablecorp.us/ableos/holey-bytes#e494785f93dad2722ebd9e5d81c2bcb3c471cc07" +source = "git+https://git.ablecorp.us/ableos/holey-bytes#dc418bd5e0b962ec9413af72e5d624e17febcbf2" [[package]] name = "hblang" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#9af7bf559f139937529ea7747cd275ed163fb1fa" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#dc418bd5e0b962ec9413af72e5d624e17febcbf2" dependencies = [ "hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", ] @@ -460,7 +460,7 @@ dependencies = [ [[package]] name = "hbvm" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#9af7bf559f139937529ea7747cd275ed163fb1fa" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#dc418bd5e0b962ec9413af72e5d624e17febcbf2" dependencies = [ "hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", ] @@ -468,7 +468,7 @@ dependencies = [ [[package]] name = "hbvm" version = "0.1.0" -source = "git+https://git.ablecorp.us/ableos/holey-bytes#e494785f93dad2722ebd9e5d81c2bcb3c471cc07" +source = "git+https://git.ablecorp.us/ableos/holey-bytes#dc418bd5e0b962ec9413af72e5d624e17febcbf2" dependencies = [ "hbbytecode 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes)", ] diff --git a/kernel/src/arch/aarch64/logging.rs b/kernel/src/arch/aarch64/logging.rs index 5db9bc050..0f968b7ec 100644 --- a/kernel/src/arch/aarch64/logging.rs +++ b/kernel/src/arch/aarch64/logging.rs @@ -1,5 +1,5 @@ use {crate::logger::TERMINAL_LOGGER, core::fmt::Write, spin::Mutex}; -const SERIAL_CONSOLE: Mutex = Mutex::new(SerialConsole { +pub static SERIAL_CONSOLE: Mutex = Mutex::new(SerialConsole { uart: 0x09000000 as *mut u8, }); @@ -17,6 +17,9 @@ impl core::fmt::Write for SerialConsole { } } +unsafe impl Sync for SerialConsole {} +unsafe impl Send for SerialConsole {} + pub fn log(args: core::fmt::Arguments<'_>) -> core::fmt::Result { SERIAL_CONSOLE.lock().write_fmt(args)?; TERMINAL_LOGGER.lock().write_fmt(args)?; diff --git a/kernel/src/arch/riscv64/mod.rs b/kernel/src/arch/riscv64/mod.rs index 2caa6c3b0..b78a0e20e 100644 --- a/kernel/src/arch/riscv64/mod.rs +++ b/kernel/src/arch/riscv64/mod.rs @@ -45,7 +45,7 @@ extern "C" { static USABLE_MEMORY_SIZE: usize; } -static SERIAL_CONSOLE: Once> = Once::new(); +pub static SERIAL_CONSOLE: Once> = Once::new(); #[no_mangle] unsafe extern "C" fn _kernel_start() -> ! { diff --git a/kernel/src/holeybytes/ecah.rs b/kernel/src/holeybytes/ecah.rs index 2937205ad..0f488cce4 100644 --- a/kernel/src/holeybytes/ecah.rs +++ b/kernel/src/holeybytes/ecah.rs @@ -88,6 +88,7 @@ pub fn handler(vm: &mut Vm) { } // } + #[cfg(target_arch = "x86_64")] 3 => { unsafe fn x86_in(address: u16) -> u8 { x86_64::instructions::port::Port::new(address).read() @@ -131,6 +132,8 @@ pub fn handler(vm: &mut Vm) { _ => {} } } + #[cfg(not(target_arch = "x86_64"))] + 3 => unimplemented!("TODO: implement whatever buffer 3 does for no x86_64"), buffer_id => { let mut buffs = IPC_BUFFERS.lock(); match buffs.get_mut(&buffer_id) { diff --git a/sysdata/programs/fb_driver/src/lib.hb b/sysdata/programs/fb_driver/src/lib.hb index ddfc3e41c..8b6addb0c 100644 --- a/sysdata/programs/fb_driver/src/lib.hb +++ b/sysdata/programs/fb_driver/src/lib.hb @@ -17,12 +17,12 @@ Point := struct {x: int, y: int} Transform := struct {width: int, height: int} Rect := struct {p1: Point, p2: Point} -front_buffer_ptr := @as(^ColorBGRA, @bitcast(18446603339442421760)) +front_buffer_ptr := @as(^ColorBGRA, @bitcast(0 - 140734267129856)) front_buffer_copy := @as(^[ColorBGRA; COPY_PIXELS], @bitcast(front_buffer_ptr)) get_front_buffer := fn(): Buffer { // trying to return front_buffer_ptr or front_buffer_copy causes reg id leak - return Buffer.{write: @as(^ColorBGRA, @bitcast(18446603339442421760)), copy: @as(^[ColorBGRA; COPY_PIXELS], @bitcast(18446603339442421760))} + return Buffer.{write: @as(^ColorBGRA, @bitcast(0 - 140734267129856)), copy: @as(^[ColorBGRA; COPY_PIXELS], @bitcast(0 - 140734267129856))} } /* this is separate to create_raw_buffer because returning a Buffer from create_raw_buffer causes reg id leak */ diff --git a/sysdata/programs/serial_driver_test/src/main.hb b/sysdata/programs/serial_driver_test/src/main.hb index c1f676189..6a22fbd99 100644 --- a/sysdata/programs/serial_driver_test/src/main.hb +++ b/sysdata/programs/serial_driver_test/src/main.hb @@ -1,7 +1,7 @@ stn := @use("../../../libraries/stn/src/lib.hb"); .{string, memory, buffer} := stn -frame_buffer := @as(^u8, @bitcast(18446603339442421760)) +frame_buffer := @as(^u8, @bitcast(0 - 140734267129856)) log_info := fn(): void { a := buffer.search("XNumber\0") From cd369b39d5ad70fe20635f226c6f4256372ba4cc Mon Sep 17 00:00:00 2001 From: Able Date: Thu, 12 Sep 2024 15:34:28 -0500 Subject: [PATCH 05/13] more changes to make konii so anger --- sysdata/ui_lisp/doc_example.ul | 4 --- sysdata/ui_lisp/documentation.ul | 2 -- sysdata/ui_lisp/sample.uil | 27 +++++++++++++++++++++ sysdata/ui_lisp/ui_lisp.ul | 7 ------ sysdata/ui_lisp/windowing_system_ui_lang.md | 5 ---- 5 files changed, 27 insertions(+), 18 deletions(-) delete mode 100644 sysdata/ui_lisp/doc_example.ul delete mode 100644 sysdata/ui_lisp/documentation.ul create mode 100644 sysdata/ui_lisp/sample.uil delete mode 100644 sysdata/ui_lisp/ui_lisp.ul delete mode 100644 sysdata/ui_lisp/windowing_system_ui_lang.md diff --git a/sysdata/ui_lisp/doc_example.ul b/sysdata/ui_lisp/doc_example.ul deleted file mode 100644 index 6ebdae031..000000000 --- a/sysdata/ui_lisp/doc_example.ul +++ /dev/null @@ -1,4 +0,0 @@ -/// a b c -void main(){} - -// Generated documentation below diff --git a/sysdata/ui_lisp/documentation.ul b/sysdata/ui_lisp/documentation.ul deleted file mode 100644 index fbce28570..000000000 --- a/sysdata/ui_lisp/documentation.ul +++ /dev/null @@ -1,2 +0,0 @@ -(label "Documentation") -(label "") diff --git a/sysdata/ui_lisp/sample.uil b/sysdata/ui_lisp/sample.uil new file mode 100644 index 000000000..c6d2ff0a7 --- /dev/null +++ b/sysdata/ui_lisp/sample.uil @@ -0,0 +1,27 @@ +/* +the following snippet lays out the following. +10 11 +*/ +(vertical + (label "10") + (label "11")) + + +/* +Each button must have an ID. This ID must be unique per button or the buttons with the same +ID will be treated as the same button. +*/ +(button id:8) + + +/* +This unique ID rull applies to any interactable element. +*/ +(label interactive:true id:9) + + +/* +The ID is used to send a message to the buffer of the process that handles UI. +The following code will handle displaying text locally and also sending the delta change to the buffer. +*/ +(line-edit id:10) \ No newline at end of file diff --git a/sysdata/ui_lisp/ui_lisp.ul b/sysdata/ui_lisp/ui_lisp.ul deleted file mode 100644 index bbff2cd23..000000000 --- a/sysdata/ui_lisp/ui_lisp.ul +++ /dev/null @@ -1,7 +0,0 @@ -(vertical - (horizontal - (label "Function main") - (button "goto declaration" (on_click "src/main.c:2"))) - (label "takes void") - (label "returns void") - (label "a b c")) \ No newline at end of file diff --git a/sysdata/ui_lisp/windowing_system_ui_lang.md b/sysdata/ui_lisp/windowing_system_ui_lang.md deleted file mode 100644 index 8c9bf9bc1..000000000 --- a/sysdata/ui_lisp/windowing_system_ui_lang.md +++ /dev/null @@ -1,5 +0,0 @@ -- container - - horizontal - - vertical -- framebuffer -- \ No newline at end of file From 40cc412ab36ec1ed62c9bb469438acc75b42f160 Mon Sep 17 00:00:00 2001 From: Able Date: Fri, 13 Sep 2024 16:40:05 -0500 Subject: [PATCH 06/13] Horizon API work --- sysdata/libraries/horizon_api/src/element.hb | 14 ------------ sysdata/libraries/horizon_api/src/frame.hb | 3 --- sysdata/libraries/horizon_api/src/lib.hb | 22 +++++++++++++++---- sysdata/libraries/horizon_api/src/text.hb | 3 --- sysdata/programs/horizon/README.md | 3 +++ sysdata/programs/horizon/meta.toml | 11 ++++++++++ sysdata/programs/horizon/protocol/lib.idl | 6 +++++ sysdata/programs/horizon/src/main.hb | 12 ++++++++++ .../horizon_testing_program/README.md | 1 + .../horizon_testing_program/meta.toml | 11 ++++++++++ .../horizon_testing_program/src/main.hb | 12 ++++++++++ sysdata/system_config.toml | 7 ++++++ 12 files changed, 81 insertions(+), 24 deletions(-) delete mode 100644 sysdata/libraries/horizon_api/src/element.hb delete mode 100644 sysdata/libraries/horizon_api/src/frame.hb delete mode 100644 sysdata/libraries/horizon_api/src/text.hb create mode 100644 sysdata/programs/horizon/README.md create mode 100644 sysdata/programs/horizon/meta.toml create mode 100644 sysdata/programs/horizon/protocol/lib.idl create mode 100644 sysdata/programs/horizon/src/main.hb create mode 100644 sysdata/programs/horizon_testing_program/README.md create mode 100644 sysdata/programs/horizon_testing_program/meta.toml create mode 100644 sysdata/programs/horizon_testing_program/src/main.hb diff --git a/sysdata/libraries/horizon_api/src/element.hb b/sysdata/libraries/horizon_api/src/element.hb deleted file mode 100644 index 76299cce2..000000000 --- a/sysdata/libraries/horizon_api/src/element.hb +++ /dev/null @@ -1,14 +0,0 @@ -Element := struct { - width: int, - height: int, - - x: u16, - y: u16, - - id: int, -} - -create_element := fn(): Element { - return Element.(0, 0, 0, 0, 0) -} - diff --git a/sysdata/libraries/horizon_api/src/frame.hb b/sysdata/libraries/horizon_api/src/frame.hb deleted file mode 100644 index 61d80629c..000000000 --- a/sysdata/libraries/horizon_api/src/frame.hb +++ /dev/null @@ -1,3 +0,0 @@ -FrameID := struct { - -} \ No newline at end of file diff --git a/sysdata/libraries/horizon_api/src/lib.hb b/sysdata/libraries/horizon_api/src/lib.hb index 81aa0fa41..4611dc4fc 100644 --- a/sysdata/libraries/horizon_api/src/lib.hb +++ b/sysdata/libraries/horizon_api/src/lib.hb @@ -1,12 +1,26 @@ +stn := @use("rel:../../stn/src/lib.hb") +.{string, memory, buffer} := stn + WindowID := struct { host_id: int, window_id: int, } -create_window := fn(): WindowID { - return WindowID.(1, 2) -} +create_window := fn(channel: int): void { + // get the horizon buffer + // request a new window and provide the callback buffer + // wait to recieve a message + + windowing_system_buffer := buffer.search("XHorizon\0") + + + + if windowing_system_buffer == 0 { + } else { + msg := "\{01}\0" + msg_length := 2 + @eca(void, 3, windowing_system_buffer, msg, msg_length) + } -update_ui := fn(window_id: WindowID): void { return } \ No newline at end of file diff --git a/sysdata/libraries/horizon_api/src/text.hb b/sysdata/libraries/horizon_api/src/text.hb deleted file mode 100644 index 22996c3d0..000000000 --- a/sysdata/libraries/horizon_api/src/text.hb +++ /dev/null @@ -1,3 +0,0 @@ -ui_lisp_text_example := "(text id_1)\0"; - - diff --git a/sysdata/programs/horizon/README.md b/sysdata/programs/horizon/README.md new file mode 100644 index 000000000..7451b8ec7 --- /dev/null +++ b/sysdata/programs/horizon/README.md @@ -0,0 +1,3 @@ +# Horizon +The Horizon Windowing system server. This is the component that spawns/layouts and renders windows. +For the api look in libraries/horizon_api. diff --git a/sysdata/programs/horizon/meta.toml b/sysdata/programs/horizon/meta.toml new file mode 100644 index 000000000..ccfe1e2a8 --- /dev/null +++ b/sysdata/programs/horizon/meta.toml @@ -0,0 +1,11 @@ +[package] +name = "horizon" +authors = ["able"] + +[dependants.libraries] + +[dependants.binaries] +hblang.version = "1.0.0" + +[build] +command = "hblang src/main.hb" diff --git a/sysdata/programs/horizon/protocol/lib.idl b/sysdata/programs/horizon/protocol/lib.idl new file mode 100644 index 000000000..92a04820b --- /dev/null +++ b/sysdata/programs/horizon/protocol/lib.idl @@ -0,0 +1,6 @@ +alias HostID = u64; + +struct WindowID { + host_id: HostID, + window_id: u64 +} diff --git a/sysdata/programs/horizon/src/main.hb b/sysdata/programs/horizon/src/main.hb new file mode 100644 index 000000000..3c7c63179 --- /dev/null +++ b/sysdata/programs/horizon/src/main.hb @@ -0,0 +1,12 @@ +stn := @use("../../../libraries/stn/src/lib.hb"); +.{string, memory, buffer} := stn + +horizon_api := @use("../../../libraries/horizon_api/src/lib.hb") + +main := fn(): int { + a := buffer.create("XHorizon\0") + loop { + } + + return 0 +} \ No newline at end of file diff --git a/sysdata/programs/horizon_testing_program/README.md b/sysdata/programs/horizon_testing_program/README.md new file mode 100644 index 000000000..04c8af8f4 --- /dev/null +++ b/sysdata/programs/horizon_testing_program/README.md @@ -0,0 +1 @@ +# horizon_testing_program \ No newline at end of file diff --git a/sysdata/programs/horizon_testing_program/meta.toml b/sysdata/programs/horizon_testing_program/meta.toml new file mode 100644 index 000000000..7e360c901 --- /dev/null +++ b/sysdata/programs/horizon_testing_program/meta.toml @@ -0,0 +1,11 @@ +[package] +name = "horizon_testing_program" +authors = ["able"] + +[dependants.libraries] + +[dependants.binaries] +hblang.version = "1.0.0" + +[build] +command = "hblang src/main.hb" diff --git a/sysdata/programs/horizon_testing_program/src/main.hb b/sysdata/programs/horizon_testing_program/src/main.hb new file mode 100644 index 000000000..f665ae4a2 --- /dev/null +++ b/sysdata/programs/horizon_testing_program/src/main.hb @@ -0,0 +1,12 @@ +stn := @use("../../../libraries/stn/src/lib.hb"); +.{string, memory, buffer} := stn + +horizon_api := @use("../../../libraries/horizon_api/src/lib.hb"); +.{create_window} := horizon_api + +main := fn(): int { + windowing_system_buffer := buffer.create("XHorizon\0") + + create_window(windowing_system_buffer) + return 0 +} \ No newline at end of file diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index f0539ef83..cc80cab14 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -32,3 +32,10 @@ path = "boot:///fb_driver.hbf" [boot.limine.ableos.modules.serial_driver_test] path = "boot:///serial_driver_test.hbf" + + +[boot.limine.ableos.modules.horizon] +path = "boot:///horizon.hbf" + +[boot.limine.ableos.modules.horizon_testing_program] +path = "boot:///horizon_testing_program.hbf" From 96863494761779c303963c50d3da53630f9630fd Mon Sep 17 00:00:00 2001 From: Able Date: Fri, 13 Sep 2024 18:11:23 -0500 Subject: [PATCH 07/13] add support for the device tree --- .../{device_tree.rs => device_tree/mod.rs} | 39 ++++---- kernel/src/holeybytes/ecah.rs | 7 ++ .../kernel_services/dt_msg_handler.rs | 92 +++++++++++++++++++ kernel/src/holeybytes/kernel_services/mod.rs | 1 + sysdata/libraries/dt_api/README.md | 1 + sysdata/libraries/dt_api/src/lib.hb | 8 ++ sysdata/libraries/horizon_api/src/lib.hb | 4 +- sysdata/programs/dt_buffer_test/README.md | 1 + sysdata/programs/dt_buffer_test/meta.toml | 11 +++ sysdata/programs/dt_buffer_test/src/main.hb | 8 ++ sysdata/system_config.toml | 4 + 11 files changed, 155 insertions(+), 21 deletions(-) rename kernel/src/{device_tree.rs => device_tree/mod.rs} (76%) create mode 100644 kernel/src/holeybytes/kernel_services/dt_msg_handler.rs create mode 100644 sysdata/libraries/dt_api/README.md create mode 100644 sysdata/libraries/dt_api/src/lib.hb create mode 100644 sysdata/programs/dt_buffer_test/README.md create mode 100644 sysdata/programs/dt_buffer_test/meta.toml create mode 100644 sysdata/programs/dt_buffer_test/src/main.hb diff --git a/kernel/src/device_tree.rs b/kernel/src/device_tree/mod.rs similarity index 76% rename from kernel/src/device_tree.rs rename to kernel/src/device_tree/mod.rs index 0ec81d113..8d1c64cab 100644 --- a/kernel/src/device_tree.rs +++ b/kernel/src/device_tree/mod.rs @@ -6,6 +6,7 @@ use { core::fmt, hashbrown::HashMap, }; + /// A device object. /// TODO define device pub type Device = xml::XMLElement; @@ -23,27 +24,29 @@ impl DeviceTree { let mut dt = Self { devices: HashMap::new(), }; - device_tree!(dt, [ - "Mice", - "Keyboards", - "Controllers", - "Generic HIDs", - "Disk Drives", - "CD Drives", - "Batteries", - "Monitors", - "GPUs", - "CPUs", - "USB", - "Serial Ports", - "Cameras", - "Biometric Devices", - ]); + device_tree!( + dt, + [ + "Mice", + "Keyboards", + "Controllers", + "Generic HIDs", + "Disk Drives", + "CD Drives", + "Batteries", + "Monitors", + "GPUs", + "CPUs", + "USB", + "Serial Ports", + "Cameras", + "Biometric Devices", + ] + ); dt } } -use crate::{utils::TAB, device_tree}; -use crate::tab; +use crate::{device_tree, tab, utils::TAB}; impl fmt::Display for DeviceTree { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { writeln!(f)?; diff --git a/kernel/src/holeybytes/ecah.rs b/kernel/src/holeybytes/ecah.rs index 0f488cce4..2a69e800c 100644 --- a/kernel/src/holeybytes/ecah.rs +++ b/kernel/src/holeybytes/ecah.rs @@ -6,6 +6,7 @@ use crate::{ allocator, holeybytes::kernel_services::{ block_read, + dt_msg_handler::dt_msg_handler, service_definition_service::{sds_msg_handler, SERVICES}, }, }; @@ -134,6 +135,12 @@ pub fn handler(vm: &mut Vm) { } #[cfg(not(target_arch = "x86_64"))] 3 => unimplemented!("TODO: implement whatever buffer 3 does for no x86_64"), + + 5 => match dt_msg_handler(vm, mem_addr, length) { + Ok(()) => {} + Err(err) => log::error!("Improper dt query"), + }, + buffer_id => { let mut buffs = IPC_BUFFERS.lock(); match buffs.get_mut(&buffer_id) { diff --git a/kernel/src/holeybytes/kernel_services/dt_msg_handler.rs b/kernel/src/holeybytes/kernel_services/dt_msg_handler.rs new file mode 100644 index 000000000..bcd34e0b3 --- /dev/null +++ b/kernel/src/holeybytes/kernel_services/dt_msg_handler.rs @@ -0,0 +1,92 @@ +use { + crate::holeybytes::{kernel_services::block_read, Vm}, + alloc::{ + borrow::ToOwned, + string::{String, ToString}, + vec::Vec, + }, + log::debug, +}; +pub enum DtError { + QueryFailure, +} + +pub fn dt_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), DtError> { + let mut msg_vec = block_read(mem_addr, length); + let mut bytes: Vec = Vec::new(); + for byte in msg_vec { + if byte == 0 { + break; + } + bytes.push(byte) + } + let query_string = String::from_utf8(bytes).unwrap(); + log::trace!("Query {}", query_string); + + let ret = query_parse(query_string); + log::trace!("Query response {}", ret); + + vm.registers[1] = hbvm::value::Value(ret); + + Ok(()) +} + +fn query_parse(query_string: String) -> u64 { + let qt_parse_step_one = query_string.split("/"); + let mut qt_parse_step_two: Vec = Vec::new(); + for a in qt_parse_step_one { + qt_parse_step_two.push(a.to_string()); + } + + let first_fragment: &str = &qt_parse_step_two[0]; + let ret = match first_fragment { + "framebuffer" => framebuffer_parse(qt_parse_step_two), + "cpu" => cpu_parse(qt_parse_step_two), + + _ => 0, + }; + + return ret; +} + +fn cpu_parse(qt_parse_step_two: Vec) -> u64 { + let second_fragment: &str = &qt_parse_step_two[1]; + match second_fragment { + // "architecture" => { + // return 0; + // } + _ => { + return 0; + } + }; +} + +fn framebuffer_parse(qt_parse_step_two: Vec) -> u64 { + use { + crate::kmain::FB_REQ, + limine::{Framebuffer, NonNullPtr}, + }; + let fbs = &FB_REQ.get_response().get().unwrap().framebuffers(); + + let second_fragment: &str = &qt_parse_step_two[1]; + match second_fragment { + "fb0" => { + let fb_front = &fbs[0]; + let third_fragment: &str = &qt_parse_step_two[2]; + let ret = match third_fragment { + "ptr" => { + let ptr = fb_front.address.as_ptr().unwrap(); + ptr as usize as u64 + } + "width" => fb_front.width, + "height" => fb_front.height, + + _ => 0, + }; + return ret; + } + _ => { + return 0; + } + }; +} diff --git a/kernel/src/holeybytes/kernel_services/mod.rs b/kernel/src/holeybytes/kernel_services/mod.rs index 23908efb7..9d0b9fcfe 100644 --- a/kernel/src/holeybytes/kernel_services/mod.rs +++ b/kernel/src/holeybytes/kernel_services/mod.rs @@ -1,5 +1,6 @@ use alloc::{vec, vec::Vec}; +pub mod dt_msg_handler; pub mod mem_serve; pub mod service_definition_service; diff --git a/sysdata/libraries/dt_api/README.md b/sysdata/libraries/dt_api/README.md new file mode 100644 index 000000000..61d4547fe --- /dev/null +++ b/sysdata/libraries/dt_api/README.md @@ -0,0 +1 @@ +# dt_api \ No newline at end of file diff --git a/sysdata/libraries/dt_api/src/lib.hb b/sysdata/libraries/dt_api/src/lib.hb new file mode 100644 index 000000000..bf3e800bd --- /dev/null +++ b/sysdata/libraries/dt_api/src/lib.hb @@ -0,0 +1,8 @@ +stn := @use("rel:../../stn/src/lib.hb"); +.{string, memory, buffer} := stn + +dt_get := fn(query: ^u8): int { + message_length := string.length(query) + + return @eca(int, 3, 5, query, message_length) +} \ No newline at end of file diff --git a/sysdata/libraries/horizon_api/src/lib.hb b/sysdata/libraries/horizon_api/src/lib.hb index 4611dc4fc..543bd14a8 100644 --- a/sysdata/libraries/horizon_api/src/lib.hb +++ b/sysdata/libraries/horizon_api/src/lib.hb @@ -1,4 +1,4 @@ -stn := @use("rel:../../stn/src/lib.hb") +stn := @use("rel:../../stn/src/lib.hb"); .{string, memory, buffer} := stn WindowID := struct { @@ -13,8 +13,6 @@ create_window := fn(channel: int): void { windowing_system_buffer := buffer.search("XHorizon\0") - - if windowing_system_buffer == 0 { } else { msg := "\{01}\0" diff --git a/sysdata/programs/dt_buffer_test/README.md b/sysdata/programs/dt_buffer_test/README.md new file mode 100644 index 000000000..c01a7c5e1 --- /dev/null +++ b/sysdata/programs/dt_buffer_test/README.md @@ -0,0 +1 @@ +# dt_buffer_test \ No newline at end of file diff --git a/sysdata/programs/dt_buffer_test/meta.toml b/sysdata/programs/dt_buffer_test/meta.toml new file mode 100644 index 000000000..f25002e98 --- /dev/null +++ b/sysdata/programs/dt_buffer_test/meta.toml @@ -0,0 +1,11 @@ +[package] +name = "dt_buffer_test" +authors = ["able"] + +[dependants.libraries] + +[dependants.binaries] +hblang.version = "1.0.0" + +[build] +command = "hblang src/main.hb" diff --git a/sysdata/programs/dt_buffer_test/src/main.hb b/sysdata/programs/dt_buffer_test/src/main.hb new file mode 100644 index 000000000..dbc27b402 --- /dev/null +++ b/sysdata/programs/dt_buffer_test/src/main.hb @@ -0,0 +1,8 @@ +dt_api := @use("../../../libraries/dt_api/src/lib.hb") + +main := fn(): int { + dt_api.dt_get("framebuffer/fb0/width\0") + dt_api.dt_get("cpu/architecture\0") + + return 0 +} \ No newline at end of file diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index cc80cab14..90f4ee3b5 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -39,3 +39,7 @@ path = "boot:///horizon.hbf" [boot.limine.ableos.modules.horizon_testing_program] path = "boot:///horizon_testing_program.hbf" + + +[boot.limine.ableos.modules.dt_buffer_test] +path = "boot:///dt_buffer_test.hbf" From 1b5cb54a2be24baf886b364ec8ea36b0966554ec Mon Sep 17 00:00:00 2001 From: Able Date: Fri, 13 Sep 2024 20:17:47 -0500 Subject: [PATCH 08/13] ignim work --- sysdata/libraries/ignim/src/errors.hb | 16 ++++++++++++++++ sysdata/libraries/ignim/src/lib.hb | 12 +++++++----- sysdata/libraries/ignim/src/results.hb | 7 +++++++ sysdata/programs/dt_buffer_test/src/main.hb | 10 ++++++++-- .../programs/horizon_testing_program/src/main.hb | 10 ++++++++++ 5 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 sysdata/libraries/ignim/src/errors.hb create mode 100644 sysdata/libraries/ignim/src/results.hb diff --git a/sysdata/libraries/ignim/src/errors.hb b/sysdata/libraries/ignim/src/errors.hb new file mode 100644 index 000000000..57ef5e9b2 --- /dev/null +++ b/sysdata/libraries/ignim/src/errors.hb @@ -0,0 +1,16 @@ +// the 0- thing is scuffed + +OutOfHostMemory := 0 - 1 +OutOfDeviceMemory := 0 - 2 +InitializationFailed := 0 - 3 +DeviceLost := 0 - 4 +MemoryMapFailed := 0 - 5 + +LayerNotPresent := 0 - 6 +ExtensionNotPresent := 0 - 7 +FeatureNotPresent := 0 - 8 +IncompatibleDriver := 0 - 9 +TooManyObjects := 0 - 10 +FormatNotSupported := 0 - 11 +FragmentedPool := 0 - 12 +Unknown := 0 - 13 \ No newline at end of file diff --git a/sysdata/libraries/ignim/src/lib.hb b/sysdata/libraries/ignim/src/lib.hb index 161d851a1..c6c015ce2 100644 --- a/sysdata/libraries/ignim/src/lib.hb +++ b/sysdata/libraries/ignim/src/lib.hb @@ -1,7 +1,9 @@ -VK_VERSION_MAJOR := 1; -VK_VERSION_MINOR := 0; +results := @use("rel:results.hb") +errors := @use("rel:errors.hb") -init_vulkan := fn(): void { - - return +VK_VERSION_MAJOR := 1 +VK_VERSION_MINOR := 0 + +init_vulkan := fn(): int { + return errors.IncompatibleDriver } \ No newline at end of file diff --git a/sysdata/libraries/ignim/src/results.hb b/sysdata/libraries/ignim/src/results.hb new file mode 100644 index 000000000..9b0094024 --- /dev/null +++ b/sysdata/libraries/ignim/src/results.hb @@ -0,0 +1,7 @@ +// NonErrors +Success := 0 +NotReady := 1 +Timeout := 2 +EventSet := 3 +EventReset := 4 +Incomplete := 5 \ No newline at end of file diff --git a/sysdata/programs/dt_buffer_test/src/main.hb b/sysdata/programs/dt_buffer_test/src/main.hb index dbc27b402..4d4d14c43 100644 --- a/sysdata/programs/dt_buffer_test/src/main.hb +++ b/sysdata/programs/dt_buffer_test/src/main.hb @@ -1,8 +1,14 @@ -dt_api := @use("../../../libraries/dt_api/src/lib.hb") +dt_api := @use("../../../libraries/dt_api/src/lib.hb"); +.{dt_get} := dt_api main := fn(): int { dt_api.dt_get("framebuffer/fb0/width\0") - dt_api.dt_get("cpu/architecture\0") + dt_api.dt_get("cpu/cpu0/architecture\0") + + // Checking if the first detected serial port is memory mapped or port mapped + // 0 -> memory mapped + // 1 -> port mapped + dt_get("serial_ports/sp0/mapping\0") return 0 } \ No newline at end of file diff --git a/sysdata/programs/horizon_testing_program/src/main.hb b/sysdata/programs/horizon_testing_program/src/main.hb index f665ae4a2..15ebc3f2a 100644 --- a/sysdata/programs/horizon_testing_program/src/main.hb +++ b/sysdata/programs/horizon_testing_program/src/main.hb @@ -4,9 +4,19 @@ stn := @use("../../../libraries/stn/src/lib.hb"); horizon_api := @use("../../../libraries/horizon_api/src/lib.hb"); .{create_window} := horizon_api +ignim := @use("../../../libraries/ignim/src/lib.hb"); +.{init_vulkan} := ignim + main := fn(): int { windowing_system_buffer := buffer.create("XHorizon\0") create_window(windowing_system_buffer) + // TODO: get WindowID + + vk_state := init_vulkan() + if vk_state == ignim.errors.IncompatibleDriver { + stn.log.info("Incompatible Vulkan Driver\0") + } + return 0 } \ No newline at end of file From ec25c0f207d0475453a991872db925dc9f4c5377 Mon Sep 17 00:00:00 2001 From: Able Date: Fri, 13 Sep 2024 20:50:12 -0500 Subject: [PATCH 09/13] update on the logger Further changes pending on the IDL --- kernel/src/holeybytes/ecah.rs | 36 +------------ .../kernel_services/logging_service.rs | 54 +++++++++++++++++++ .../holeybytes/kernel_services/mem_serve.rs | 1 - kernel/src/holeybytes/kernel_services/mod.rs | 1 + .../service_definition_service.rs | 8 +-- sysdata/system_config.toml | 16 +++--- 6 files changed, 70 insertions(+), 46 deletions(-) create mode 100644 kernel/src/holeybytes/kernel_services/logging_service.rs diff --git a/kernel/src/holeybytes/ecah.rs b/kernel/src/holeybytes/ecah.rs index 2a69e800c..aca8153dd 100644 --- a/kernel/src/holeybytes/ecah.rs +++ b/kernel/src/holeybytes/ecah.rs @@ -7,6 +7,7 @@ use crate::{ holeybytes::kernel_services::{ block_read, dt_msg_handler::dt_msg_handler, + logging_service::log_msg_handler, service_definition_service::{sds_msg_handler, SERVICES}, }, }; @@ -145,6 +146,7 @@ pub fn handler(vm: &mut Vm) { let mut buffs = IPC_BUFFERS.lock(); match buffs.get_mut(&buffer_id) { Some(buff) => { + use alloc::vec; let mut msg_vec = vec![]; for x in 0..(length as isize) { @@ -222,40 +224,6 @@ pub fn handler(vm: &mut Vm) { } } -fn log_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), LogError> { - // let message_length = 8 + 8 + 8; - // log::info!("Mem Addr 0x{:x?} length {}", mem_addr, length); - let mut msg_vec = block_read(mem_addr, length); - - let log_level = msg_vec.pop().unwrap(); - match String::from_utf8(msg_vec) { - Ok(strr) => { - // use LogLevel::*; - let ll = match log_level { - 0 | 48 => error!("{}", strr), - 1 | 49 => warn!("{}", strr), - 2 | 50 => info!("{}", strr), - 3 | 51 => debug!("{}", strr), - 4 | 52 => trace!("{}", strr), - _ => { - return Err(LogError::InvalidLogFormat); - } - }; - } - Err(e) => { - error!("{:?}", e); - } - } - - Ok(()) -} - -#[derive(Debug)] -pub enum LogError { - InvalidLogFormat, -} -use {alloc::vec, log::Record}; - // fn memory_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), LogError> { // let mut val = alloc::vec::Vec::new(); // for _ in 0..4096 { diff --git a/kernel/src/holeybytes/kernel_services/logging_service.rs b/kernel/src/holeybytes/kernel_services/logging_service.rs new file mode 100644 index 000000000..27392dfa6 --- /dev/null +++ b/kernel/src/holeybytes/kernel_services/logging_service.rs @@ -0,0 +1,54 @@ +use crate::logger::TermLogger; + +use { + crate::holeybytes::{kernel_services::block_read, Vm}, + alloc::string::String, +}; + +#[derive(Debug)] +pub enum LogError { + InvalidLogFormat, +} +use {alloc::vec, log::Record}; + +pub fn log_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), LogError> { + let mut msg_vec = block_read(mem_addr, length); + + let log_level = msg_vec.pop().unwrap(); + + let file_name = "None"; + let line_number = 0; + + match String::from_utf8(msg_vec) { + Ok(strr) => { + use log::Level::*; + let log_level = match log_level { + 0 | 48 => Error, + 1 | 49 => Warn, + 2 | 50 => Info, + 3 | 51 => Debug, + 4 | 52 => Trace, + _ => { + return Err(LogError::InvalidLogFormat); + } + }; + + log::logger().log( + &Record::builder() + .args(format_args!("{}", strr)) + .level(log_level) + .target("Userspace") + .file(Some(file_name)) + .line(Some(line_number)) + .module_path(Some(&file_name)) + .build(), + ); + } + + Err(e) => { + log::error!("{:?}", e); + } + } + + Ok(()) +} diff --git a/kernel/src/holeybytes/kernel_services/mem_serve.rs b/kernel/src/holeybytes/kernel_services/mem_serve.rs index 16ecbe80c..d83322250 100644 --- a/kernel/src/holeybytes/kernel_services/mem_serve.rs +++ b/kernel/src/holeybytes/kernel_services/mem_serve.rs @@ -1,6 +1,5 @@ use { crate::holeybytes::{ - ecah::LogError, kernel_services::{block_read, mem_serve}, Vm, }, diff --git a/kernel/src/holeybytes/kernel_services/mod.rs b/kernel/src/holeybytes/kernel_services/mod.rs index 9d0b9fcfe..58eef2d14 100644 --- a/kernel/src/holeybytes/kernel_services/mod.rs +++ b/kernel/src/holeybytes/kernel_services/mod.rs @@ -1,6 +1,7 @@ use alloc::{vec, vec::Vec}; pub mod dt_msg_handler; +pub mod logging_service; pub mod mem_serve; pub mod service_definition_service; diff --git a/kernel/src/holeybytes/kernel_services/service_definition_service.rs b/kernel/src/holeybytes/kernel_services/service_definition_service.rs index 1a12447b8..0f26960fb 100644 --- a/kernel/src/holeybytes/kernel_services/service_definition_service.rs +++ b/kernel/src/holeybytes/kernel_services/service_definition_service.rs @@ -2,7 +2,7 @@ use { crate::{ alloc::string::ToString, arch::hardware_random_u64, - holeybytes::{ecah::LogError, kernel_services::block_read, Vm}, + holeybytes::{kernel_services::block_read, Vm}, ipc::{ buffer::IpcBuffer, protocol::{self, Protocol}, @@ -20,8 +20,10 @@ pub static SERVICES: Lazy> = Lazy::new(|| { dt.0.insert(0, Protocol::void()); Mutex::new(dt) }); - -pub fn sds_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), LogError> { +pub enum ServiceError { + InvalidFormat, +} +pub fn sds_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), ServiceError> { let mut msg_vec = block_read(mem_addr, length); let sds_event_type: ServiceEventType = msg_vec[0].into(); msg_vec.remove(0); diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index 90f4ee3b5..d45fe5b16 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -19,19 +19,19 @@ resolution = "1024x768x24" # [boot.limine.ableos.modules.tests] # path = "boot:///tests.hbf" -[boot.limine.ableos.modules.a_serial_driver] -path = "boot:///a_serial_driver.hbf" +# [boot.limine.ableos.modules.a_serial_driver] +# path = "boot:///a_serial_driver.hbf" -[boot.limine.ableos.modules.diskio_driver] -path = "boot:///diskio_driver.hbf" +# [boot.limine.ableos.modules.diskio_driver] +# path = "boot:///diskio_driver.hbf" [boot.limine.ableos.modules.fb_driver] path = "boot:///fb_driver.hbf" -[boot.limine.ableos.modules.serial_driver_test] -path = "boot:///serial_driver_test.hbf" +# [boot.limine.ableos.modules.serial_driver_test] +# path = "boot:///serial_driver_test.hbf" [boot.limine.ableos.modules.horizon] @@ -41,5 +41,5 @@ path = "boot:///horizon.hbf" path = "boot:///horizon_testing_program.hbf" -[boot.limine.ableos.modules.dt_buffer_test] -path = "boot:///dt_buffer_test.hbf" +# [boot.limine.ableos.modules.dt_buffer_test] +# path = "boot:///dt_buffer_test.hbf" From 91380539d94e34ec7e56ecfebec117674ae957b7 Mon Sep 17 00:00:00 2001 From: Able Date: Fri, 13 Sep 2024 23:11:50 -0500 Subject: [PATCH 10/13] Ignim work --- sysdata/libraries/ignim/src/extends.hb | 10 ++++ sysdata/libraries/ignim/src/lib.hb | 6 +++ sysdata/libraries/ignim/src/offset.hb | 10 ++++ sysdata/libraries/ignim/src/rect.hb | 7 +++ sysdata/libraries/ignim/src/structures.hb | 61 +++++++++++++++++++++++ sysdata/programs/fb_driver/src/main.hb | 2 +- 6 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 sysdata/libraries/ignim/src/extends.hb create mode 100644 sysdata/libraries/ignim/src/offset.hb create mode 100644 sysdata/libraries/ignim/src/rect.hb create mode 100644 sysdata/libraries/ignim/src/structures.hb diff --git a/sysdata/libraries/ignim/src/extends.hb b/sysdata/libraries/ignim/src/extends.hb new file mode 100644 index 000000000..4600a7e87 --- /dev/null +++ b/sysdata/libraries/ignim/src/extends.hb @@ -0,0 +1,10 @@ +Extent3D := struct { + width: int, + height: int, + depth: int, +} + +Extent2D := struct { + width: int, + height: int, +} \ No newline at end of file diff --git a/sysdata/libraries/ignim/src/lib.hb b/sysdata/libraries/ignim/src/lib.hb index c6c015ce2..647f831a7 100644 --- a/sysdata/libraries/ignim/src/lib.hb +++ b/sysdata/libraries/ignim/src/lib.hb @@ -1,6 +1,12 @@ results := @use("rel:results.hb") errors := @use("rel:errors.hb") +offsets := @use("rel:offset.hb") +extends := @use("rel:extends.hb") + +rect := @use("rel:rect.hb") +structures := @use("rel:structures.hb") + VK_VERSION_MAJOR := 1 VK_VERSION_MINOR := 0 diff --git a/sysdata/libraries/ignim/src/offset.hb b/sysdata/libraries/ignim/src/offset.hb new file mode 100644 index 000000000..d12e34f4c --- /dev/null +++ b/sysdata/libraries/ignim/src/offset.hb @@ -0,0 +1,10 @@ +Offset3D := struct { + x: int, + y: int, + z: int, +} + +Offset2D := struct { + x: int, + y: int, +} \ No newline at end of file diff --git a/sysdata/libraries/ignim/src/rect.hb b/sysdata/libraries/ignim/src/rect.hb new file mode 100644 index 000000000..dbc7afd3c --- /dev/null +++ b/sysdata/libraries/ignim/src/rect.hb @@ -0,0 +1,7 @@ +offsets := @use("rel:offset.hb") +extends := @use("rel:extends.hb") + +Rect2D := struct { + offset: offsets.Offset2D, + extent: extends.Extent2D, +} \ No newline at end of file diff --git a/sysdata/libraries/ignim/src/structures.hb b/sysdata/libraries/ignim/src/structures.hb new file mode 100644 index 000000000..71b1847d1 --- /dev/null +++ b/sysdata/libraries/ignim/src/structures.hb @@ -0,0 +1,61 @@ +ApplicationInfo := 0 +InstanceCreateInfo := 1 +DeviceQueueCreateInfo := 2 +DeviceCreateInfo := 3 +SubmitInfo := 4 +MemoryAllocateInfo := 5 +MappedMemoryRange := 6 +BindSparseInfo := 7 + +FenceCreateInfo := 8 +SemaphoreCreateInfo := 9 +EventCreateInfo := 10 +QueryPoolCreateInfo := 11 + +BufferCreateInfo := 12 +BufferViewCreateInfo := 13 + +ImageCreateInfo := 14 +ImageViewCreateInfo := 15 + +ShaderModuleCreateInfo := 16 + +PipelineCacheCreateInfo := 17 +PipelineShaderStageCreateInfo := 18 +PipelineVertexInputStateCreateInfo := 19 +PipelineInputAssemblyStateCreateInfo := 20 +PipelineTessellationStateCreateInfo := 21 +PipelineViewportStateCreateInfo := 22 +PipelineRasterizationStateCreateInfo := 23 +PipelineMultisampleStateCreateInfo := 24 +PipelineDepthStencilStateCreateInfo := 25 +PipelineColorBlendStateCreateInfo := 26 +PipelineDynamicStateCreateInfo := 27 + +GraphicsPipelineCreateInfo := 28 +ComputePipelineCreateInfo := 29 +PipelineLayoutCreateInfo := 30 +SamplerCreateInfo := 31 + +DescriptorSetLayoutCreateInfo := 32 +DescriptorPoolCreateInfo := 33 + +DescriptorSetAllocateInfo := 34 +WriteDescriptorSet := 35 +CopyDescriptorSet := 36 +FramebufferCreateInfo := 37 + +RenderPassCreateInfo := 38 +CommandPoolCreateInfo := 39 + +CommandBufferAllocateInfo := 40 +CommandBufferInheritanceInfo := 41 +CommandBufferBeginInfo := 42 + +RenderPassBeginInfo := 43 +BufferMemoryBarrier := 44 +ImageMemoryBarrier := 45 +MemoryBarrier := 46 + +LoaderInstanceCreateInfo := 47 +LoaderDeviceCreateInfo := 48 \ No newline at end of file diff --git a/sysdata/programs/fb_driver/src/main.hb b/sysdata/programs/fb_driver/src/main.hb index 0068d1f89..defb90cf4 100644 --- a/sysdata/programs/fb_driver/src/main.hb +++ b/sysdata/programs/fb_driver/src/main.hb @@ -1,5 +1,5 @@ // change "lines.hb" to another example to see it onscreen -example := @use("examples/lines.hb").example +example := @use("examples/square.hb").example main := fn(): int { example() From 028949559b75611f6251d42ee41208a607b2e6d8 Mon Sep 17 00:00:00 2001 From: Able Date: Sat, 14 Sep 2024 00:31:35 -0500 Subject: [PATCH 11/13] ignim checkpoint --- sysdata/libraries/ignim/src/application.hb | 21 +++++++++++ sysdata/libraries/ignim/src/instance.hb | 35 +++++++++++++++++++ sysdata/libraries/ignim/src/lib.hb | 6 ++-- sysdata/libraries/ignim/src/structures.hb | 4 +-- sysdata/libraries/ignim/src/version.hb | 9 +++++ .../horizon_testing_program/src/main.hb | 26 ++++++++++---- 6 files changed, 91 insertions(+), 10 deletions(-) create mode 100644 sysdata/libraries/ignim/src/application.hb create mode 100644 sysdata/libraries/ignim/src/instance.hb create mode 100644 sysdata/libraries/ignim/src/version.hb diff --git a/sysdata/libraries/ignim/src/application.hb b/sysdata/libraries/ignim/src/application.hb new file mode 100644 index 000000000..61d42c667 --- /dev/null +++ b/sysdata/libraries/ignim/src/application.hb @@ -0,0 +1,21 @@ +structures := @use("rel:structures.hb") +version := @use("rel:version.hb") + +// Refer to here https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkApplicationInfo.html +ApplicationInfo := struct { + sType: int, + pNext: ^int, + application_name: ^u8, + application_version: int, + engine_name: int, + engine_version: int, + api_version: int, +} + +new_application_info := fn(app_name: ^u8, app_version: int, engine_name: ^u8, engine_version: int, api_version: int): ApplicationInfo { + app_info_type := structures.ApplicationInfoType + + app_info := ApplicationInfo.(app_info_type, 0, app_name, app_version, engine_name, engine_version, api_version) + + return app_info +} \ No newline at end of file diff --git a/sysdata/libraries/ignim/src/instance.hb b/sysdata/libraries/ignim/src/instance.hb new file mode 100644 index 000000000..0841b98ec --- /dev/null +++ b/sysdata/libraries/ignim/src/instance.hb @@ -0,0 +1,35 @@ +application := @use("rel:application.hb"); +.{ApplicationInfo} := application + +structures := @use("rel:structures.hb") +errors := @use("rel:errors.hb") + +// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkInstanceCreateInfo.html +InstanceCreateInfo := struct { + sType: int, + pNext: int, + flags: int, + application_info: ^ApplicationInfo, + enabled_layer_count: int, + ppEnabledLayerNames: int, + enabled_extension_count: int, + ppEnabledExtensionNames: int, +} + +new_create_info := fn(application_info: ^ApplicationInfo): InstanceCreateInfo { + create_info_type := structures.InstanceCreateInfoType + enabled_layer_count := 0 + + create_info := InstanceCreateInfo.(create_info_type, 0, 0, application_info, enabled_layer_count, 0, 0, 0) + return create_info +} + +// TODO +Instance := struct {inner: int} +void_instance := fn(): Instance { + return Instance.(0) +} + +create_instance := fn(create_info: ^InstanceCreateInfo, allocator_callback: int, new_obj: ^Instance): int { + return errors.IncompatibleDriver +} \ No newline at end of file diff --git a/sysdata/libraries/ignim/src/lib.hb b/sysdata/libraries/ignim/src/lib.hb index 647f831a7..bc9cc1237 100644 --- a/sysdata/libraries/ignim/src/lib.hb +++ b/sysdata/libraries/ignim/src/lib.hb @@ -1,3 +1,5 @@ +application := @use("rel:application.hb") + results := @use("rel:results.hb") errors := @use("rel:errors.hb") @@ -6,9 +8,9 @@ extends := @use("rel:extends.hb") rect := @use("rel:rect.hb") structures := @use("rel:structures.hb") +instance := @use("rel:instance.hb") -VK_VERSION_MAJOR := 1 -VK_VERSION_MINOR := 0 +version := @use("rel:version.hb") init_vulkan := fn(): int { return errors.IncompatibleDriver diff --git a/sysdata/libraries/ignim/src/structures.hb b/sysdata/libraries/ignim/src/structures.hb index 71b1847d1..d9eb2b27e 100644 --- a/sysdata/libraries/ignim/src/structures.hb +++ b/sysdata/libraries/ignim/src/structures.hb @@ -1,5 +1,5 @@ -ApplicationInfo := 0 -InstanceCreateInfo := 1 +ApplicationInfoType := 0 +InstanceCreateInfoType := 1 DeviceQueueCreateInfo := 2 DeviceCreateInfo := 3 SubmitInfo := 4 diff --git a/sysdata/libraries/ignim/src/version.hb b/sysdata/libraries/ignim/src/version.hb new file mode 100644 index 000000000..f8f59983b --- /dev/null +++ b/sysdata/libraries/ignim/src/version.hb @@ -0,0 +1,9 @@ +ApiVersion1_0 := make_api_version(0, 1, 0, 0) + +make_version := fn(major: int, minor: int, patch: int): int { + return major << 22 | minor << 12 | patch +} + +make_api_version := fn(variant: int, major: int, minor: int, patch: int): int { + return variant << 29 | major << 22 | minor << 12 | patch +} \ No newline at end of file diff --git a/sysdata/programs/horizon_testing_program/src/main.hb b/sysdata/programs/horizon_testing_program/src/main.hb index 15ebc3f2a..b04a7fcbb 100644 --- a/sysdata/programs/horizon_testing_program/src/main.hb +++ b/sysdata/programs/horizon_testing_program/src/main.hb @@ -1,21 +1,35 @@ stn := @use("../../../libraries/stn/src/lib.hb"); -.{string, memory, buffer} := stn +.{string, memory, buffer, log} := stn horizon_api := @use("../../../libraries/horizon_api/src/lib.hb"); .{create_window} := horizon_api ignim := @use("../../../libraries/ignim/src/lib.hb"); -.{init_vulkan} := ignim +.{errors} := ignim main := fn(): int { windowing_system_buffer := buffer.create("XHorizon\0") - create_window(windowing_system_buffer) // TODO: get WindowID + create_window(windowing_system_buffer) - vk_state := init_vulkan() - if vk_state == ignim.errors.IncompatibleDriver { - stn.log.info("Incompatible Vulkan Driver\0") + program_name := "Horizon Testing Program\0" + program_version := ignim.version.make_version(0, 1, 0) + engine_name := "None\0" + engine_version := ignim.version.make_version(0, 0, 0) + api_version := ignim.version.make_api_version(0, 1, 0, 0) + + app_info := ignim.application.new_application_info(program_name, program_version, engine_name, engine_version, api_version) + + create_info := ignim.instance.new_create_info(&app_info) + + instance := ignim.instance.void_instance() + + + // TODO: recursively follow this https://vulkan-tutorial.com/Drawing_a_triangle/Setup/Instance + ret := ignim.instance.create_instance(&create_info, 0, &instance) + if ret == errors.IncompatibleDriver { + log.error("Driver Incompatible with Vulkan\0") } return 0 From cc9337348ec269abec6648b65e2505f02e3f9e82 Mon Sep 17 00:00:00 2001 From: Able Date: Sat, 14 Sep 2024 03:51:57 -0500 Subject: [PATCH 12/13] PCI+SVGA skeleton --- sysdata/libraries/pci/README.md | 1 + sysdata/libraries/pci/src/lib.hb | 25 +++++++++++ .../horizon_testing_program/src/main.hb | 1 - sysdata/programs/svga_driver/README.md | 1 + sysdata/programs/svga_driver/meta.toml | 11 +++++ sysdata/programs/svga_driver/src/device.hb | 41 +++++++++++++++++++ sysdata/programs/svga_driver/src/main.hb | 28 +++++++++++++ sysdata/system_config.toml | 16 +++++--- 8 files changed, 117 insertions(+), 7 deletions(-) create mode 100644 sysdata/libraries/pci/README.md create mode 100644 sysdata/libraries/pci/src/lib.hb create mode 100644 sysdata/programs/svga_driver/README.md create mode 100644 sysdata/programs/svga_driver/meta.toml create mode 100644 sysdata/programs/svga_driver/src/device.hb create mode 100644 sysdata/programs/svga_driver/src/main.hb diff --git a/sysdata/libraries/pci/README.md b/sysdata/libraries/pci/README.md new file mode 100644 index 000000000..fadc21bfd --- /dev/null +++ b/sysdata/libraries/pci/README.md @@ -0,0 +1 @@ +# pci \ No newline at end of file diff --git a/sysdata/libraries/pci/src/lib.hb b/sysdata/libraries/pci/src/lib.hb new file mode 100644 index 000000000..54fb294ba --- /dev/null +++ b/sysdata/libraries/pci/src/lib.hb @@ -0,0 +1,25 @@ +PCIAddress := struct { + bus: u8, + device: u8, + function: u8, +} + +find_device := fn(vendor_id: int, device_id: int, pci_address: PCIAddress): int { + return 1 +} + +scan_bus := fn(): void { +} + +config_read32 := fn(bus: u32, device: u32, func: u32, offset: u32): u32 { + // construct address param + address := bus << 16 | device << 11 | func << 8 | offset & 0xFC | 0x80000000 + + // write address + //Port::new(0xCF8).write(address); + + // read data + //Port::new(0xCFC).read() + + return +} \ No newline at end of file diff --git a/sysdata/programs/horizon_testing_program/src/main.hb b/sysdata/programs/horizon_testing_program/src/main.hb index b04a7fcbb..01d57a3cc 100644 --- a/sysdata/programs/horizon_testing_program/src/main.hb +++ b/sysdata/programs/horizon_testing_program/src/main.hb @@ -25,7 +25,6 @@ main := fn(): int { instance := ignim.instance.void_instance() - // TODO: recursively follow this https://vulkan-tutorial.com/Drawing_a_triangle/Setup/Instance ret := ignim.instance.create_instance(&create_info, 0, &instance) if ret == errors.IncompatibleDriver { diff --git a/sysdata/programs/svga_driver/README.md b/sysdata/programs/svga_driver/README.md new file mode 100644 index 000000000..0a996d96d --- /dev/null +++ b/sysdata/programs/svga_driver/README.md @@ -0,0 +1 @@ +# svga_driver \ No newline at end of file diff --git a/sysdata/programs/svga_driver/meta.toml b/sysdata/programs/svga_driver/meta.toml new file mode 100644 index 000000000..3748bd50c --- /dev/null +++ b/sysdata/programs/svga_driver/meta.toml @@ -0,0 +1,11 @@ +[package] +name = "svga_driver" +authors = ["able"] + +[dependants.libraries] + +[dependants.binaries] +hblang.version = "1.0.0" + +[build] +command = "hblang src/main.hb" diff --git a/sysdata/programs/svga_driver/src/device.hb b/sysdata/programs/svga_driver/src/device.hb new file mode 100644 index 000000000..dd697e9dd --- /dev/null +++ b/sysdata/programs/svga_driver/src/device.hb @@ -0,0 +1,41 @@ +pci := @use("../../../libraries/pci/src/lib.hb"); +.{PCIAddress} := pci + +SVGADevice := struct { + pciAddr: PCIAddress, + ioBase: u32, + fifoMem: ^u32, + fbMem: ^u8, + fifoSize: int, + fbSize: int, + vramSize: int, + deviceVersionId: int, + capabilities: int, + width: int, + height: int, + bpp: int, + pitch: int, +} + +svga_device := fn(): SVGADevice { + pci_addr := PCIAddress.(0, 0, 0) + + return SVGADevice.(pci_addr, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) +} + +/* + struct { + uint32 reservedSize; + Bool usingBounceBuffer; + uint8 bounceBuffer[1024 * 1024]; + uint32 nextFence; + } fifo; + + volatile struct { + uint32 pending; + uint32 switchContext; + IntrContext oldContext; + IntrContext newContext; + uint32 count; + } irq; +*/ \ No newline at end of file diff --git a/sysdata/programs/svga_driver/src/main.hb b/sysdata/programs/svga_driver/src/main.hb new file mode 100644 index 000000000..34a9f1e8f --- /dev/null +++ b/sysdata/programs/svga_driver/src/main.hb @@ -0,0 +1,28 @@ +device := @use("rel:device.hb") +pci := @use("../../../libraries/pci/src/lib.hb") + +stn := @use("../../../libraries/stn/src/lib.hb"); +.{string, memory, buffer, log} := stn + +PCI_VENDOR_ID_VMWARE := 0x15AD +PCI_DEVICE_ID_VMWARE_SVGA2 := 0x405 + +init := fn(): void { + svga_struct := device.svga_device() + + if pci.find_device(PCI_VENDOR_ID_VMWARE, PCI_DEVICE_ID_VMWARE_SVGA2, svga_struct.pciAddr) { + log.error("No VMware SVGA device found.\0") + } + return +} + +SVGA_Disable := fn(): void { + //SVGA_WriteReg(SVGA_REG_ENABLE, 0); + return +} + +main := fn(): int { + init() + + return 0 +} \ No newline at end of file diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index d45fe5b16..cee2db581 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -26,20 +26,24 @@ resolution = "1024x768x24" # [boot.limine.ableos.modules.diskio_driver] # path = "boot:///diskio_driver.hbf" -[boot.limine.ableos.modules.fb_driver] -path = "boot:///fb_driver.hbf" +# [boot.limine.ableos.modules.fb_driver] +# path = "boot:///fb_driver.hbf" # [boot.limine.ableos.modules.serial_driver_test] # path = "boot:///serial_driver_test.hbf" -[boot.limine.ableos.modules.horizon] -path = "boot:///horizon.hbf" +# [boot.limine.ableos.modules.horizon] +# path = "boot:///horizon.hbf" -[boot.limine.ableos.modules.horizon_testing_program] -path = "boot:///horizon_testing_program.hbf" +# [boot.limine.ableos.modules.horizon_testing_program] +# path = "boot:///horizon_testing_program.hbf" # [boot.limine.ableos.modules.dt_buffer_test] # path = "boot:///dt_buffer_test.hbf" + + +[boot.limine.ableos.modules.svga_driver] +path = "boot:///svga_driver.hbf" From fcca015866e6de1c89ff2b1c3c5f9bff44e844b5 Mon Sep 17 00:00:00 2001 From: Able Date: Sat, 14 Sep 2024 04:05:40 -0500 Subject: [PATCH 13/13] minor changes --- sysdata/programs/svga_driver/src/main.hb | 9 +++++++-- sysdata/programs/svga_driver/src/reg.hb | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 sysdata/programs/svga_driver/src/reg.hb diff --git a/sysdata/programs/svga_driver/src/main.hb b/sysdata/programs/svga_driver/src/main.hb index 34a9f1e8f..dfd1dd241 100644 --- a/sysdata/programs/svga_driver/src/main.hb +++ b/sysdata/programs/svga_driver/src/main.hb @@ -4,6 +4,8 @@ pci := @use("../../../libraries/pci/src/lib.hb") stn := @use("../../../libraries/stn/src/lib.hb"); .{string, memory, buffer, log} := stn +reg := @use("rel:reg.hb") + PCI_VENDOR_ID_VMWARE := 0x15AD PCI_DEVICE_ID_VMWARE_SVGA2 := 0x405 @@ -16,8 +18,11 @@ init := fn(): void { return } -SVGA_Disable := fn(): void { - //SVGA_WriteReg(SVGA_REG_ENABLE, 0); +write_reg := fn(index: u32, value: u32): void { +} + +SVGA_disable := fn(): void { + write_reg(reg.SVGA_REG_ENABLE, 0) return } diff --git a/sysdata/programs/svga_driver/src/reg.hb b/sysdata/programs/svga_driver/src/reg.hb new file mode 100644 index 000000000..c166c261c --- /dev/null +++ b/sysdata/programs/svga_driver/src/reg.hb @@ -0,0 +1,4 @@ +SVGA_REG_ENABLE_DISABLE := 0 +SVGA_REG_ENABLE_ENABLE := 1 +SVGA_REG_ENABLE_HIDE := 2 +SVGA_REG_ENABLE_ENABLE_HIDE := SVGA_REG_ENABLE_ENABLE | SVGA_REG_ENABLE_HIDE \ No newline at end of file