Commit c47c68f4 authored by Jeremy Soller's avatar Jeremy Soller

Update fmap support

parent fb9b6840
This diff is collapsed.
......@@ -9,7 +9,7 @@ use std::{env, usize};
use std::fs::File;
use std::io::{Read, Write};
use std::os::unix::io::FromRawFd;
use syscall::{EVENT_READ, MAP_WRITE, Event, Packet, Scheme};
use syscall::{EVENT_READ, PHYSMAP_WRITE, Event, Packet, Scheme};
use scheme::DiskScheme;
......@@ -32,7 +32,7 @@ fn main() {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
let address = unsafe { syscall::physmap(bar, 4096, MAP_WRITE).expect("ahcid: failed to map address") };
let address = unsafe { syscall::physmap(bar, 4096, PHYSMAP_WRITE).expect("ahcid: failed to map address") };
{
let scheme_name = format!("disk/{}", name);
let socket_fd = syscall::open(
......
......@@ -16,7 +16,7 @@ use std::os::unix::io::{AsRawFd, FromRawFd};
use std::sync::Arc;
use event::EventQueue;
use syscall::{Packet, SchemeMut, MAP_WRITE};
use syscall::{Packet, SchemeMut, PHYSMAP_WRITE};
use syscall::error::EWOULDBLOCK;
pub mod device;
......@@ -43,7 +43,7 @@ fn main() {
let mut irq_file = File::open(format!("irq:{}", irq)).expect("alxd: failed to open IRQ file");
let address = unsafe { syscall::physmap(bar, 128*1024, MAP_WRITE).expect("alxd: failed to map address") };
let address = unsafe { syscall::physmap(bar, 128*1024, PHYSMAP_WRITE).expect("alxd: failed to map address") };
{
let device = Arc::new(RefCell::new(unsafe { device::Alx::new(address).expect("alxd: failed to allocate device") }));
......
......@@ -12,7 +12,7 @@ use std::os::unix::io::{AsRawFd, FromRawFd};
use std::sync::Arc;
use event::EventQueue;
use syscall::{Packet, SchemeMut, MAP_WRITE};
use syscall::{Packet, SchemeMut, PHYSMAP_WRITE};
use syscall::error::EWOULDBLOCK;
pub mod device;
......@@ -38,7 +38,7 @@ fn main() {
let mut irq_file = File::open(format!("irq:{}", irq)).expect("e1000d: failed to open IRQ file");
let address = unsafe { syscall::physmap(bar, 128*1024, MAP_WRITE).expect("e1000d: failed to map address") };
let address = unsafe { syscall::physmap(bar, 128*1024, PHYSMAP_WRITE).expect("e1000d: failed to map address") };
{
let device = Arc::new(RefCell::new(unsafe { device::Intel8254x::new(address).expect("e1000d: failed to allocate device") }));
......
......@@ -14,7 +14,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
extern crate syscall;
use syscall::MAP_WRITE;
use syscall::PHYSMAP_WRITE;
use syscall::error::{Error, EACCES, EBADF, Result, EINVAL};
use syscall::flag::{SEEK_SET, SEEK_CUR, SEEK_END};
use syscall::io::{Mmio, Io};
......@@ -184,7 +184,7 @@ impl IntelHDA {
let buff_desc_virt = unsafe {
syscall::physmap(buff_desc_phys, 0x1000, MAP_WRITE)
syscall::physmap(buff_desc_phys, 0x1000, PHYSMAP_WRITE)
.expect("ihdad: failed to map address for buffer descriptor list.")
};
......@@ -201,7 +201,7 @@ impl IntelHDA {
};
let cmd_buff_virt = unsafe { syscall::physmap(cmd_buff_address, 0x1000, MAP_WRITE).expect("ihdad: failed to map address for CORB/RIRB buff") };
let cmd_buff_virt = unsafe { syscall::physmap(cmd_buff_address, 0x1000, PHYSMAP_WRITE).expect("ihdad: failed to map address for CORB/RIRB buff") };
print!("Virt: {:016X}, Phys: {:016X}\n", cmd_buff_virt, cmd_buff_address);
let mut module = IntelHDA {
......
use syscall::MAP_WRITE;
use syscall::PHYSMAP_WRITE;
use syscall::error::{Error, EACCES, EWOULDBLOCK, EIO, Result};
use syscall::flag::O_NONBLOCK;
use syscall::io::{Dma, Mmio, Io, ReadOnly};
......@@ -310,7 +310,7 @@ impl StreamBuffer {
};
let addr = match unsafe {
syscall::physmap(phys, block_length * block_count, MAP_WRITE)
syscall::physmap(phys, block_length * block_count, PHYSMAP_WRITE)
} {
Ok(addr) => addr,
Err(err) => {
......
......@@ -10,7 +10,7 @@ use std::{env, usize, u16, thread};
use std::fs::File;
use std::io::{Read, Write, Result};
use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
use syscall::{EVENT_READ, MAP_WRITE, Event, Packet, Scheme, SchemeMut};
use syscall::{EVENT_READ, PHYSMAP_WRITE, Event, Packet, Scheme, SchemeMut};
use std::cell::RefCell;
use std::sync::Arc;
......@@ -52,7 +52,7 @@ fn main() {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
let address = unsafe { syscall::physmap(bar, 0x4000, MAP_WRITE).expect("ihdad: failed to map address") };
let address = unsafe { syscall::physmap(bar, 0x4000, PHYSMAP_WRITE).expect("ihdad: failed to map address") };
{
let mut irq_file = File::open(format!("irq:{}", irq)).expect("IHDA: failed to open IRQ file");
......
......@@ -9,7 +9,7 @@ use std::{env, usize};
use std::fs::File;
use std::io::{Read, Write};
use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
use syscall::{EVENT_READ, MAP_WRITE, Event, Packet, Result, Scheme};
use syscall::{EVENT_READ, PHYSMAP_WRITE, Event, Packet, Result, Scheme};
use self::nvme::Nvme;
......@@ -42,7 +42,7 @@ fn main() {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
let address = unsafe { syscall::physmap(bar, 4096, MAP_WRITE).expect("nvmed: failed to map address") };
let address = unsafe { syscall::physmap(bar, 4096, PHYSMAP_WRITE).expect("nvmed: failed to map address") };
{
let mut nvme = Nvme::new(address);
nvme.init();
......
......@@ -12,7 +12,7 @@ use std::os::unix::io::{AsRawFd, FromRawFd};
use std::sync::Arc;
use event::EventQueue;
use syscall::{Packet, SchemeMut, MAP_WRITE};
use syscall::{Packet, SchemeMut, PHYSMAP_WRITE};
use syscall::error::EWOULDBLOCK;
pub mod device;
......@@ -38,7 +38,7 @@ fn main() {
let mut irq_file = File::open(format!("irq:{}", irq)).expect("rtl8168d: failed to open IRQ file");
let address = unsafe { syscall::physmap(bar, 256, MAP_WRITE).expect("rtl8168d: failed to map address") };
let address = unsafe { syscall::physmap(bar, 256, PHYSMAP_WRITE).expect("rtl8168d: failed to map address") };
{
let device = Arc::new(RefCell::new(unsafe { device::Rtl8168::new(address).expect("rtl8168d: failed to allocate device") }));
......
......@@ -9,7 +9,7 @@ use std::{env, mem};
use std::os::unix::io::AsRawFd;
use std::fs::File;
use std::io::{Result, Read, Write};
use syscall::flag::MAP_WRITE;
use syscall::flag::PHYSMAP_WRITE;
use syscall::io::{Dma, Io, Mmio, Pio};
use syscall::iopl;
......@@ -217,7 +217,7 @@ fn main() {
let mut irq_file = File::open(format!("irq:{}", irq)).expect("vboxd: failed to open IRQ file");
let mut port = Pio::<u32>::new(bar0 as u16);
let address = unsafe { syscall::physmap(bar1, 4096, MAP_WRITE).expect("vboxd: failed to map address") };
let address = unsafe { syscall::physmap(bar1, 4096, PHYSMAP_WRITE).expect("vboxd: failed to map address") };
{
let vmmdev = unsafe { &mut *(address as *mut VboxVmmDev) };
......
......@@ -8,7 +8,7 @@ extern crate syscall;
use std::env;
use std::fs::File;
use std::io::{Read, Write};
use syscall::{physmap, physunmap, Packet, SchemeMut, EVENT_READ, MAP_WRITE, MAP_WRITE_COMBINE};
use syscall::{physmap, physunmap, Packet, SchemeMut, EVENT_READ, PHYSMAP_WRITE, PHYSMAP_WRITE_COMBINE};
use mode_info::VBEModeInfo;
use primitive::fast_set64;
......@@ -55,7 +55,7 @@ fn main() {
let size = width * height;
//TODO: Remap on resize
let largest_size = 8 * 1024 * 1024;
let onscreen = unsafe { physmap(physbaseptr, largest_size * 4, MAP_WRITE | MAP_WRITE_COMBINE).expect("vesad: failed to map VBE LFB") };
let onscreen = unsafe { physmap(physbaseptr, largest_size * 4, PHYSMAP_WRITE | PHYSMAP_WRITE_COMBINE).expect("vesad: failed to map VBE LFB") };
unsafe { fast_set64(onscreen as *mut u64, 0, size/2) };
let mut scheme = DisplayScheme::new(width, height, onscreen, &spec);
......
......@@ -2,7 +2,7 @@ use std::collections::BTreeMap;
use std::{mem, slice, str};
use orbclient::{Event, EventOption};
use syscall::{Result, Error, EACCES, EBADF, EINVAL, ENOENT, O_NONBLOCK, SchemeMut};
use syscall::{Result, Error, EACCES, EBADF, EINVAL, ENOENT, O_NONBLOCK, Map, SchemeMut};
use display::Display;
use screen::{Screen, GraphicScreen, TextScreen};
......@@ -145,12 +145,12 @@ impl SchemeMut for DisplayScheme {
}
}
fn fmap(&mut self, id: usize, offset: usize, size: usize) -> Result<usize> {
fn fmap(&mut self, id: usize, map: &Map) -> Result<usize> {
let handle = self.handles.get(&id).ok_or(Error::new(EBADF))?;
if let HandleKind::Screen(screen_i) = handle.kind {
if let Some(screen) = self.screens.get(&screen_i) {
return screen.map(offset, size);
return screen.map(map.offset, map.size);
}
}
......
......@@ -41,7 +41,7 @@ fn main() {
let mut irq_file = File::open(format!("irq:{}", irq)).expect("xhcid: failed to open IRQ file");
let address = unsafe { syscall::physmap(bar, 65536, syscall::MAP_WRITE).expect("xhcid: failed to map address") };
let address = unsafe { syscall::physmap(bar, 65536, syscall::PHYSMAP_WRITE).expect("xhcid: failed to map address") };
{
let hci = Arc::new(RefCell::new(Xhci::new(address).expect("xhcid: failed to allocate device")));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment