refactor: ByteOffset newtype for window/register/ring offsets; named virtio-gpu cmd fields

This commit is contained in:
2026-10-27 21:52:33 +01:00
parent 842d14987c
commit 7b8258b231
13 changed files with 145 additions and 93 deletions

View File

@@ -2,7 +2,7 @@
use libkos::fs::Storage;
use libkos::syscall;
use types::address::{EntryPoint, VirtualAddress};
use types::address::{ByteOffset, EntryPoint, VirtualAddress};
use types::bounded::{CapSlot, PageCount};
use types::budget::Limits;
@@ -53,7 +53,7 @@ pub(crate) fn load_binary(
let page_count = PageCount::new(u16::try_from(seg_pages).ok()?)?;
let local = libkos::window::request(page_count)?;
local.fill_u32(0, seg_pages * PAGE_SIZE / 4, 0);
local.fill_u32(ByteOffset::ZERO, seg_pages * PAGE_SIZE / 4, 0);
let copy_len = segment.file_size.min(segment.mem_size);
let src = segment
@@ -61,7 +61,7 @@ pub(crate) fn load_binary(
.checked_add(copy_len)
.and_then(|end| elf_data.get(segment.file_offset..end));
if let Some(src) = src.filter(|_| copy_len > 0) {
local.copy_from(offset_in_page, src);
local.copy_from(ByteOffset::new(offset_in_page), src);
}
for p in 0..seg_pages {

View File

@@ -68,7 +68,7 @@ fn check_stopped(words: Words, what: &'static str) -> Result<(), &'static str> {
fn run_phases(storage: &mut Storage, scratch: &mut [u8]) -> Result<(), &'static str> {
let page = syscall::create_region(PageCount::new(1).ok_or("page count")?).map_err(|_| "no counter page")?;
let window = libkos::window::map(page, OBSERVE_VA, PagePerms::ReadWrite).map_err(|_| "cannot map the counter page")?;
let words = window.atomics(0, 1 + THREADS);
let words = window.atomics(types::address::ByteOffset::ZERO, 1 + THREADS);
let events = syscall::create_notification().map_err(|_| "no notification")?;
timer_is_on_time(events)?;