Skip to content

Commit

Permalink
kernel: fix release mode traversal of video buffer structures
Browse files Browse the repository at this point in the history
  • Loading branch information
Qix- committed Jan 17, 2025
1 parent d06102e commit fa892d5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions oro-kernel/src/iface/root_ring/boot_vbuf_v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl Default for Inner {
// SAFETY: The `response()` method has done as much checking as is possible.
// SAFETY: This is just inherently unsafe.
let buffers = unsafe { vbufs.assume_init_ref() };
let mut current_phys = buffers.next;
let mut current_phys = unsafe { core::ptr::read_volatile(&buffers.next) };

while current_phys != 0 {
let phys = unsafe { Phys::from_address_unchecked(current_phys) };
Expand All @@ -89,6 +89,10 @@ impl Default for Inner {
break;
};

// SAFETY: We assume the buffer is valid here since it comes from the bootloader;
// SAFETY: there's really no way to assure this.
let buffer = unsafe { core::ptr::read_volatile(buffer) };

current_phys = buffer.next;

if buffer.base & 0xFFF != 0 {
Expand All @@ -99,9 +103,9 @@ impl Default for Inner {
continue;
}

this.buffers.push(*buffer);

dbg!("found video buffer: {:#016x}", buffer.base);

this.buffers.push(buffer);
}
}

Expand Down

0 comments on commit fa892d5

Please sign in to comment.