Remove SYS_PHYSMAP.

This commit is contained in:
4lDO2
2023-11-17 20:25:10 +01:00
parent 875a130843
commit eda462fd11
4 changed files with 2 additions and 45 deletions
-19
View File
@@ -252,25 +252,6 @@ pub fn format_call(a: usize, b: usize, c: usize, d: usize, e: usize, f: usize) -
c,
d
),
SYS_PHYSALLOC => format!(
"physalloc({})",
b
),
SYS_PHYSALLOC3 => format!(
"physalloc3({}, {}, {})",
b, c, d,
),
SYS_PHYSFREE => format!(
"physfree({:#X}, {})",
b,
c
),
SYS_PHYSMAP => format!(
"physmap({:#X}, {}, {:?})",
b,
c,
PhysmapFlags::from_bits(d)
),
SYS_VIRTTOPHYS => format!(
"virttophys({:#X})",
b
-23
View File
@@ -3,10 +3,7 @@ use alloc::sync::Arc;
use crate::interrupt::InterruptStack;
use crate::paging::VirtualAddress;
use crate::context;
use crate::scheme::memory::{MemoryScheme, MemoryType};
use crate::syscall::error::{Error, EFAULT, EINVAL, EPERM, ESRCH, Result};
use crate::syscall::flag::{MapFlags, PhysmapFlags};
fn enforce_root() -> Result<()> {
let contexts = context::contexts();
let context_lock = contexts.current().ok_or(Error::new(ESRCH))?;
@@ -60,23 +57,3 @@ pub fn virttophys(virtual_address: usize) -> Result<usize> {
None => Err(Error::new(EFAULT))
}
}
// TODO: Remove:
pub fn inner_physmap(physical_address: usize, size: usize, flags: PhysmapFlags) -> Result<usize> {
let mut map_flags = MapFlags::MAP_SHARED | MapFlags::PROT_READ;
map_flags.set(MapFlags::PROT_WRITE, flags.contains(PhysmapFlags::PHYSMAP_WRITE));
let memory_type = if flags.contains(PhysmapFlags::PHYSMAP_NO_CACHE) {
MemoryType::Uncacheable
} else if flags.contains(PhysmapFlags::PHYSMAP_WRITE_COMBINE) {
MemoryType::WriteCombining
} else {
MemoryType::Writeback
};
MemoryScheme::physmap(physical_address, size, map_flags, memory_type)
}
pub fn physmap(physical_address: usize, size: usize, flags: PhysmapFlags) -> Result<usize> {
enforce_root()?;
inner_physmap(physical_address, size, flags)
}
+1 -2
View File
@@ -28,7 +28,7 @@ pub use self::usercopy::validate_region;
use self::data::{Map, SigAction, TimeSpec};
use self::error::{Error, Result, ENOSYS};
use self::flag::{MapFlags, PhysmapFlags, WaitFlags};
use self::flag::{MapFlags, WaitFlags};
use self::number::*;
use crate::context::ContextId;
@@ -169,7 +169,6 @@ pub fn syscall(a: usize, b: usize, c: usize, d: usize, e: usize, f: usize, stack
UserSlice::wo(d, 16)?.none_if_null(),
).map(|()| 0),
SYS_SIGRETURN => sigreturn(),
SYS_PHYSMAP => physmap(b, c, PhysmapFlags::from_bits_truncate(d)),
SYS_UMASK => umask(b),
SYS_VIRTTOPHYS => virttophys(b),
+1 -1
Submodule syscall updated: 5c994f22a9...2ca38a20a0