Compare commits

..

No commits in common. "local/yoda-main" and "pre-1.6-merge-20260819" have entirely different histories.

2 changed files with 16 additions and 19 deletions

View file

@ -70,7 +70,7 @@ features = [
]
[target.'cfg(target_os = "redox")'.dependencies]
libredox = "0.1.18"
redox_syscall = "0.5"
[build-dependencies]
cfg_aliases = "0.2.0"

View file

@ -11,24 +11,22 @@ struct OrbitalMap {
}
impl OrbitalMap {
unsafe fn new(fd: usize, size_unaligned: usize) -> std::io::Result<Self> {
// from redox_syscall
const PAGE_SIZE: usize = 4096;
unsafe fn new(fd: usize, size_unaligned: usize) -> syscall::Result<Self> {
// Page align size
let pages = (size_unaligned + PAGE_SIZE - 1) / PAGE_SIZE;
let size = pages * PAGE_SIZE;
let pages = (size_unaligned + syscall::PAGE_SIZE - 1) / syscall::PAGE_SIZE;
let size = pages * syscall::PAGE_SIZE;
// Map window buffer
let address = unsafe {
libredox::call::mmap(libredox::call::MmapArgs {
addr: core::ptr::null_mut(),
length: size,
prot: libredox::flag::PROT_READ | libredox::flag::PROT_WRITE,
flags: libredox::flag::MAP_SHARED,
syscall::fmap(
fd,
offset: 0,
})?
.addr()
&syscall::Map {
offset: 0,
size,
flags: syscall::PROT_READ | syscall::PROT_WRITE | syscall::MAP_SHARED,
address: 0,
},
)?
};
Ok(Self {
@ -51,8 +49,7 @@ impl Drop for OrbitalMap {
fn drop(&mut self) {
unsafe {
// Unmap window buffer on drop
libredox::call::munmap(self.address as _, self.size)
.expect("failed to unmap orbital window");
syscall::funmap(self.address, self.size).expect("failed to unmap orbital window");
}
}
}
@ -111,7 +108,7 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> OrbitalImpl<D, W> {
let mut window_height = 0;
let mut buf: [u8; 4096] = [0; 4096];
let count = libredox::call::fpath(self.window_fd(), &mut buf).unwrap();
let count = syscall::fpath(self.window_fd(), &mut buf).unwrap();
let path = str::from_utf8(&buf[..count]).unwrap();
// orbital:/x/y/w/h/t
let mut parts = path.split('/').skip(3);
@ -226,14 +223,14 @@ impl<'a, D: HasDisplayHandle, W: HasWindowHandle> BufferImpl<'a, D, W> {
// Tell orbital to show the latest window data
if damage.is_empty() {
libredox::call::fsync(self.imp.window_fd()).expect("failed to sync orbital window");
syscall::fsync(self.imp.window_fd()).expect("failed to sync orbital window");
} else {
use std::fmt::Write;
let mut damage_buf = "Y".to_string();
for m in damage {
let _ = write!(damage_buf, ",{},{},{},{}", m.x, m.y, m.width, m.height);
}
libredox::call::write(self.imp.window_fd(), damage_buf.as_bytes())
syscall::write(self.imp.window_fd(), damage_buf.as_bytes())
.expect("failed to sync orbital window");
}