forked from AbleOS/ableos
auto framebuffer ptr
This commit is contained in:
parent
022c1c196a
commit
c2183d5138
|
@ -158,6 +158,7 @@ pub fn handler(vm: &mut Vm) {
|
|||
vm.registers[1] =
|
||||
hbvm::value::Value(crate::arch::hardware_random_u64() & 0xFFFFFFFF);
|
||||
}
|
||||
// get arch
|
||||
5 => {
|
||||
if cfg!(target_arch = "x86_64") {
|
||||
vm.registers[1] = hbvm::value::Value(0);
|
||||
|
@ -167,6 +168,19 @@ pub fn handler(vm: &mut Vm) {
|
|||
vm.registers[1] = hbvm::value::Value(u64::MAX)
|
||||
}
|
||||
}
|
||||
// AbleCode™ (get fb ptr)
|
||||
6 => {
|
||||
use {
|
||||
crate::kmain::FB_REQ,
|
||||
limine::{Framebuffer, NonNullPtr},
|
||||
};
|
||||
let fb1: &NonNullPtr<Framebuffer> =
|
||||
&FB_REQ.get_response().get().unwrap().framebuffers()[0];
|
||||
let fb_front = fb1.address.as_ptr().unwrap() as *const u8;
|
||||
log::info!("Graphics front ptr {:?}", fb_front);
|
||||
|
||||
vm.registers[1] = hbvm::value::Value(fb_front as u64);
|
||||
}
|
||||
buffer_id => {
|
||||
let mut buffs = IPC_BUFFERS.lock();
|
||||
match buffs.get_mut(&buffer_id) {
|
||||
|
|
|
@ -236,18 +236,10 @@ set_dimensions := fn(new: IVec2): void {
|
|||
init := fn(): void {
|
||||
back_buffer := create_back_buffer()
|
||||
ctx = Context.{
|
||||
fb: @as(^Color, @bitcast(0xFFFF8000C0000000)),
|
||||
fb: @as(^Color, @bitcast(@eca(uint, 3, 6))),
|
||||
bb: back_buffer,
|
||||
buf: back_buffer,
|
||||
double_buffer: true,
|
||||
}
|
||||
// 0: x86_64, 1: aarch64, 2: riscv, (2^64)-1: other
|
||||
arch := @eca(int, 3, 5)
|
||||
if arch == 1 {
|
||||
ctx.fb = @as(^Color, @bitcast(0xFFFF8000BC430000))
|
||||
return
|
||||
} else {
|
||||
// good luck
|
||||
return
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue