From 5f136a66af58679b2f861af36ed6e071e0024194 Mon Sep 17 00:00:00 2001 From: Able Date: Sat, 6 Jul 2024 11:23:44 -0500 Subject: [PATCH] patch in the fb stuff --- .../holeybytes/kernel_services/mem_serve.rs | 5 ++++ sysdata/programs/fb_driver/src/main.hb | 26 +++++++------------ sysdata/programs/tests/src/main.hb | 19 +++++++++----- sysdata/system_config.toml | 6 ++--- 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/kernel/src/holeybytes/kernel_services/mem_serve.rs b/kernel/src/holeybytes/kernel_services/mem_serve.rs index 4796faf..16ecbe8 100644 --- a/kernel/src/holeybytes/kernel_services/mem_serve.rs +++ b/kernel/src/holeybytes/kernel_services/mem_serve.rs @@ -54,10 +54,15 @@ pub fn memory_msg_handler( val.push(0); } vm.registers[1] = hbvm::value::Value(val.as_ptr() as u64); + log::debug!("Kernel ptr: {:x}", val.as_ptr() as u64); } 1 => { let page_count = msg_vec[0]; msg_vec.remove(0); + + let mptr_raw: [u8; 8] = msg_vec[0..8].try_into().unwrap(); + let mptr: u64 = u64::from_le_bytes(mptr_raw); + log::debug!("Deallocating {} pages @ {:x}", page_count, mptr); } 2 => { use MemoryQuotaType::*; diff --git a/sysdata/programs/fb_driver/src/main.hb b/sysdata/programs/fb_driver/src/main.hb index 00039da..1b1d3cf 100644 --- a/sysdata/programs/fb_driver/src/main.hb +++ b/sysdata/programs/fb_driver/src/main.hb @@ -1,21 +1,15 @@ -buffer := @as(^u32, @bitcast(18446603339442422060)); - -send_msg := fn(): int { - msg := 10; - @eca(i32, 3, 1, 2, 1); - return 0; -} - -modify := fn(a: ^int): void { - *a = 4294967295; - return; -} main := fn(): int { - @eca(i32, 1, 1, 1); - loop{ - @eca(i32, 1, 1, 1); - modify(&buffer); + frame_buffer := @as(^u32, @bitcast(18446603339442421760)); + color := 0; + loop { + len := 786432*4; + loop if len == 0 break else { + fb := frame_buffer + @as(^u32, @bitcast(len)); + *fb = color; + len -= 1; + color += 100; + } } return 0; } diff --git a/sysdata/programs/tests/src/main.hb b/sysdata/programs/tests/src/main.hb index eb349c3..4b97588 100644 --- a/sysdata/programs/tests/src/main.hb +++ b/sysdata/programs/tests/src/main.hb @@ -22,21 +22,28 @@ trace:= fn(message: ^u8):void return log(message, 4); request_mem_page := fn(page_count: u8): ^u8 { - msg := "\{01}\{01}00000\0"; + msg := "\{00}\{01}xxxxxxxx\0"; msg_mem_page_count := msg + 1; *msg_mem_page_count = page_count; - return @eca(^u8, 3, 2, msg, 8); + return @eca(^u8, 3, 2, msg, 12); } -alloc := fn(): void { - error("Did not allocate.\0"); +release_mem_page := fn(ptr: ^u8, page_count: u8): void { + msg := "\{01}\{00}xxxxxxxx\0"; + + msg_mem_page_count := msg + 1; + *msg_mem_page_count = page_count; + + msg_mem_ptr := @as(^^u8, @bitcast(msg+2)); + *msg_mem_ptr = ptr; + + a := @eca(void, 3, 2, msg, 12); return; } main := fn(): int { buffer := request_mem_page(3); - - alloc(); + release_mem_page(buffer, 3); return 0; } \ No newline at end of file diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index 543e558..553cc87 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -2,7 +2,7 @@ [boot.limine] default_entry = 1 timeout = 0 -verbose = true +verbose = false interface_resolution = "1024x768x24" # Terminal related settings term_wallpaper = "boot:///background.bmp" @@ -24,5 +24,5 @@ path = "boot:///tests.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.fb_driver] +path = "boot:///fb_driver.hbf"