Remove scheme funmap methods.
This commit is contained in:
@@ -226,7 +226,8 @@ impl AddrSpace {
|
||||
// Same here, we don't really care about errors when schemes respond to unmap events.
|
||||
// The caller wants the memory to be unmapped, period. When already unmapped, what
|
||||
// would we do with error codes anyway?
|
||||
let _ = scheme.funmap(intersection.base.start_address().data(), intersection.count * PAGE_SIZE);
|
||||
// FIXME
|
||||
//let _ = scheme.funmap(intersection.base.start_address().data(), intersection.count * PAGE_SIZE);
|
||||
|
||||
if let Ok(desc) = Arc::try_unwrap(file_ref.description) {
|
||||
let _ = desc.into_inner().try_close();
|
||||
@@ -664,7 +665,7 @@ impl Grant {
|
||||
page_count: span.count,
|
||||
mapped: true,
|
||||
flags,
|
||||
provider: Provider::FmapBorrowed { fmap }
|
||||
provider: Provider::FmapBorrowed { fmap },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,10 +129,6 @@ impl Scheme for MemoryScheme {
|
||||
Ok(intended_handle as usize)
|
||||
}
|
||||
|
||||
fn fmap(&self, id: usize, map: &Map) -> Result<usize> {
|
||||
self.kfmap(id, &AddrSpace::current()?, map, false)
|
||||
}
|
||||
|
||||
fn fcntl(&self, _id: usize, _cmd: usize, _arg: usize) -> Result<usize> {
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
@@ -649,9 +649,6 @@ impl Scheme for ProcScheme {
|
||||
}
|
||||
Ok(0)
|
||||
}
|
||||
fn fmap(&self, id: usize, map: &Map) -> Result<usize> {
|
||||
self.kfmap(id, &AddrSpace::current()?, map, false)
|
||||
}
|
||||
}
|
||||
impl KernelScheme for ProcScheme {
|
||||
fn as_addrspace(&self, number: usize) -> Result<Arc<RwLock<AddrSpace>>> {
|
||||
|
||||
+19
-14
@@ -1,7 +1,7 @@
|
||||
use alloc::sync::{Arc, Weak};
|
||||
use alloc::boxed::Box;
|
||||
use alloc::collections::BTreeMap;
|
||||
use syscall::{SKMSG_FRETURNFD, CallerCtx};
|
||||
use syscall::{SKMSG_FRETURNFD, CallerCtx, SKMSG_PROVIDE_MMAP};
|
||||
use core::num::NonZeroUsize;
|
||||
use core::sync::atomic::{AtomicBool, Ordering};
|
||||
use core::{mem, usize};
|
||||
@@ -359,6 +359,17 @@ impl UserInner {
|
||||
|
||||
self.done.send(packet.id, Response::Fd(desc));
|
||||
}
|
||||
SKMSG_PROVIDE_MMAP => {
|
||||
let offset = u64::from(packet.uid) | (u64::from(packet.gid) << 32);
|
||||
|
||||
if offset % PAGE_SIZE as u64 != 0 {
|
||||
return Err(Error::new(EINVAL));
|
||||
}
|
||||
|
||||
let page_count = packet.c;
|
||||
|
||||
todo!("respond to SKMSG_PROVIDE_MMAP")
|
||||
}
|
||||
_ => return Err(Error::new(EINVAL)),
|
||||
}
|
||||
} else {
|
||||
@@ -395,12 +406,10 @@ impl UserInner {
|
||||
return Err(Error::new(EINVAL));
|
||||
}
|
||||
|
||||
let mode = if map.flags.contains(MapFlags::MAP_PRIVATE) {
|
||||
MmapMode::Cow
|
||||
} else if map.flags.contains(MapFlags::MAP_SHARED) {
|
||||
let mode = if map.flags.contains(MapFlags::MAP_SHARED) {
|
||||
MmapMode::Shared
|
||||
} else {
|
||||
return Err(Error::new(EINVAL));
|
||||
MmapMode::Cow
|
||||
};
|
||||
|
||||
let (pid, desc) = {
|
||||
@@ -430,11 +439,11 @@ impl UserInner {
|
||||
pid: pid.into(),
|
||||
a: KSMSG_MMAP_PREP,
|
||||
b: file,
|
||||
c: map.offset,
|
||||
c: map.flags.bits(),
|
||||
d: page_count,
|
||||
// The uid and gid can be obtained by the proc scheme anyway, if the pid is provided.
|
||||
uid: map.flags.bits() as u32,
|
||||
gid: (map.flags.bits() >> 32) as u32,
|
||||
uid: map.offset as u32,
|
||||
gid: (map.offset >> 32) as u32,
|
||||
})?;
|
||||
|
||||
let _ = match response {
|
||||
@@ -607,12 +616,7 @@ impl Scheme for UserScheme {
|
||||
inner.call(SYS_FEVENT, file, flags.bits(), 0).map(EventFlags::from_bits_truncate)
|
||||
}
|
||||
|
||||
fn fmap(&self, file: usize, map: &Map) -> Result<usize> {
|
||||
let inner = self.inner.upgrade().ok_or(Error::new(ENODEV))?;
|
||||
|
||||
inner.fmap_inner(AddrSpace::current()?, file, map)
|
||||
}
|
||||
|
||||
/*
|
||||
fn funmap(&self, grant_address: usize, size: usize) -> Result<usize> {
|
||||
let requested_span = PageSpan::validate_nonempty(VirtualAddress::new(grant_address), size).ok_or(Error::new(EINVAL))?;
|
||||
|
||||
@@ -655,6 +659,7 @@ impl Scheme for UserScheme {
|
||||
Err(Error::new(EINVAL))
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
fn frename(&self, file: usize, path: &str, _uid: u32, _gid: u32) -> Result<usize> {
|
||||
let inner = self.inner.upgrade().ok_or(Error::new(ENODEV))?;
|
||||
|
||||
+4
-3
@@ -75,11 +75,12 @@ pub fn syscall(a: usize, b: usize, c: usize, d: usize, e: usize, f: usize, stack
|
||||
SYS_ARG_SLICE => match a {
|
||||
SYS_WRITE => file_op_generic(fd, |scheme, _, number| scheme.kwrite(number, UserSlice::ro(c, d)?)),
|
||||
SYS_FMAP => {
|
||||
let addrspace = AddrSpace::current()?;
|
||||
let map = unsafe { UserSlice::ro(c, d)?.read_exact::<Map>()? };
|
||||
if b == !0 {
|
||||
MemoryScheme::fmap_anonymous(&AddrSpace::current()?, &map)
|
||||
MemoryScheme::fmap_anonymous(&addrspace, &map)
|
||||
} else {
|
||||
file_op_generic(fd, |scheme, _, number| scheme.fmap(number, &map))
|
||||
file_op_generic(fd, |scheme, _, number| scheme.kfmap(number, &addrspace, &map, false))
|
||||
}
|
||||
},
|
||||
// SYS_FMAP_OLD is ignored
|
||||
@@ -179,7 +180,7 @@ pub fn syscall(a: usize, b: usize, c: usize, d: usize, e: usize, f: usize, stack
|
||||
let contexts = crate::context::contexts();
|
||||
if let Some(context_lock) = contexts.current() {
|
||||
let context = context_lock.read();
|
||||
if false && context.name.contains("bootstrap") {
|
||||
if context.name.contains("orbital") {
|
||||
if a == SYS_CLOCK_GETTIME || a == SYS_YIELD {
|
||||
false
|
||||
} else if (a == SYS_WRITE || a == SYS_FSYNC) && (b == 1 || b == 2) {
|
||||
|
||||
+1
-1
Submodule syscall updated: eab01c8621...6024e1e1fa
Reference in New Issue
Block a user