Switch to libredox where applicable (fixed)

This commit is contained in:
Jacob Lorentzon
2024-03-18 22:09:25 +00:00
committed by Jeremy Soller
parent 98078650f8
commit ff956fd3bb
83 changed files with 349 additions and 263 deletions
+2 -2
View File
@@ -105,7 +105,7 @@ impl PhysmapGuard {
let size = page_count * PAGE_SIZE;
let virt = unsafe {
common::physmap(page, size, common::Prot::RO, common::MemoryType::default())
.map_err(|error| std::io::Error::from_raw_os_error(error.errno))?
.map_err(|error| std::io::Error::from_raw_os_error(error.errno()))?
};
Ok(Self {
@@ -124,7 +124,7 @@ impl Deref for PhysmapGuard {
impl Drop for PhysmapGuard {
fn drop(&mut self) {
unsafe {
let _ = syscall::funmap(self.virt as usize, self.size);
let _ = libredox::call::munmap(self.virt as *mut (), self.size);
}
}
}
+1 -1
View File
@@ -35,7 +35,7 @@ impl DerefMut for DrhdPage {
impl Drop for DrhdPage {
fn drop(&mut self) {
unsafe {
let _ = syscall::funmap(self.virt as usize, crate::acpi::PAGE_SIZE);
let _ = libredox::call::munmap(self.virt.cast(), crate::acpi::PAGE_SIZE);
}
}
}
+3 -3
View File
@@ -17,7 +17,7 @@ impl MappedPage {
fn new(phys_page: usize) -> std::io::Result<Self> {
let virt_page = unsafe {
common::physmap(phys_page, PAGE_SIZE, common::Prot::RO, common::MemoryType::default())
.map_err(|error| std::io::Error::from_raw_os_error(error.errno))?
.map_err(|error| std::io::Error::from_raw_os_error(error.errno()))?
} as usize;
Ok(Self {
phys_page,
@@ -29,7 +29,7 @@ impl MappedPage {
impl Drop for MappedPage {
fn drop(&mut self) {
log::trace!("Drop page {:#x}", self.phys_page);
if let Err(e) = unsafe { syscall::funmap(self.virt_page, PAGE_SIZE) } {
if let Err(e) = unsafe { libredox::call::munmap(self.virt_page as *mut (), PAGE_SIZE) } {
log::error!("funmap (phys): {:?}", e);
}
}
@@ -212,7 +212,7 @@ impl aml::Handler for AmlPhysMemHandler {
}
}
// Pio must be enabled via syscall::iopl(3)
// Pio must be enabled via syscall::iopl
fn read_io_u8(&self, port: u16) -> u8 {
Pio::<u8>::new(port).read()
}
+3 -3
View File
@@ -113,8 +113,8 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
let acpi_context = self::acpi::AcpiContext::init(physaddrs_iter);
// TODO: I/O permission bitmap
unsafe { syscall::iopl(3) }.expect("acpid: failed to set I/O privilege level to Ring 3");
// TODO: I/O permission bitmap?
common::acquire_port_io_rights().expect("acpid: failed to set I/O privilege level to Ring 3");
let shutdown_pipe = File::open("kernel.acpi:kstop")
.expect("acpid: failed to open `kernel.acpi:kstop`");
@@ -136,7 +136,7 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
daemon.ready().expect("acpid: failed to notify parent");
syscall::setrens(0, 0).expect("acpid: failed to enter null namespace");
libredox::call::setrens(0, 0).expect("acpid: failed to enter null namespace");
let _ = event_queue.write(&Event {
id: shutdown_pipe.as_raw_fd() as usize,