1
0
Fork 0
forked from koniifer/ableos

patch in the fb stuff

This commit is contained in:
Able 2024-07-06 11:23:44 -05:00
parent 54d7e6b02b
commit 5f136a66af
4 changed files with 31 additions and 25 deletions

View file

@ -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::*;

View file

@ -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);
frame_buffer := @as(^u32, @bitcast(18446603339442421760));
color := 0;
loop {
@eca(i32, 1, 1, 1);
modify(&buffer);
len := 786432*4;
loop if len == 0 break else {
fb := frame_buffer + @as(^u32, @bitcast(len));
*fb = color;
len -= 1;
color += 100;
}
}
return 0;
}

View file

@ -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;
}

View file

@ -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"