Replace iopl with either empty or full PIO bitmap.
This commit is contained in:
+4
-22
@@ -2,7 +2,6 @@ use alloc::sync::Arc;
|
||||
|
||||
use crate::{
|
||||
context,
|
||||
interrupt::InterruptStack,
|
||||
paging::VirtualAddress,
|
||||
syscall::error::{Error, Result, EFAULT, EINVAL, EPERM, ESRCH},
|
||||
};
|
||||
@@ -18,32 +17,15 @@ fn enforce_root() -> Result<()> {
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
||||
pub fn iopl(level: usize, stack: &mut InterruptStack) -> Result<usize> {
|
||||
pub fn iopl(level: usize) -> Result<usize> {
|
||||
Err(Error::new(syscall::error::ENOSYS))
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
pub fn iopl(level: usize, stack: &mut InterruptStack) -> Result<usize> {
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
pub fn iopl(level: usize) -> Result<usize> {
|
||||
enforce_root()?;
|
||||
|
||||
if level > 3 {
|
||||
return Err(Error::new(EINVAL));
|
||||
}
|
||||
|
||||
stack.iret.eflags = (stack.iret.eflags & !(3 << 12)) | ((level & 3) << 12);
|
||||
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub fn iopl(level: usize, stack: &mut InterruptStack) -> Result<usize> {
|
||||
enforce_root()?;
|
||||
|
||||
if level > 3 {
|
||||
return Err(Error::new(EINVAL));
|
||||
}
|
||||
|
||||
stack.iret.rflags = (stack.iret.rflags & !(3 << 12)) | ((level & 3) << 12);
|
||||
context::current()?.write().set_userspace_io_allowed(level >= 3);
|
||||
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
+3
-4
@@ -20,9 +20,9 @@ use self::{
|
||||
usercopy::UserSlice,
|
||||
};
|
||||
|
||||
use crate::interrupt::InterruptStack;
|
||||
use crate::{
|
||||
context::{memory::AddrSpace, ContextId},
|
||||
interrupt::InterruptStack,
|
||||
scheme::{memory::MemoryScheme, FileHandle, SchemeNamespace},
|
||||
};
|
||||
|
||||
@@ -69,7 +69,6 @@ pub fn syscall(
|
||||
d: usize,
|
||||
e: usize,
|
||||
f: usize,
|
||||
stack: &mut InterruptStack,
|
||||
) -> Result<usize> {
|
||||
//SYS_* is declared in kernel/syscall/src/number.rs
|
||||
match a & SYS_CLASS {
|
||||
@@ -191,7 +190,7 @@ pub fn syscall(
|
||||
WaitFlags::from_bits_truncate(d),
|
||||
)
|
||||
.map(ContextId::into),
|
||||
SYS_IOPL => iopl(b, stack),
|
||||
SYS_IOPL => iopl(b),
|
||||
SYS_GETEGID => getegid(),
|
||||
SYS_GETENS => getens(),
|
||||
SYS_GETEUID => geteuid(),
|
||||
@@ -283,7 +282,7 @@ pub fn syscall(
|
||||
}
|
||||
}
|
||||
|
||||
let result = inner(a, b, c, d, e, f, stack);
|
||||
let result = inner(a, b, c, d, e, f);
|
||||
|
||||
{
|
||||
let contexts = crate::context::contexts();
|
||||
|
||||
Reference in New Issue
Block a user