impl sys_arch_prctl set fs

master
WangRunji 6 years ago
parent 7a704673d7
commit 4404982a55

@ -0,0 +1,14 @@
use super::*;
pub fn sys_arch_prctl(code: i32, addr: usize, tf: &mut TrapFrame) -> SysResult {
const ARCH_SET_FS: i32 = 0x1002;
match code {
#[cfg(target_arch = "x86_64")]
ARCH_SET_FS => {
info!("sys_arch_prctl: set FS to {:#x}", addr);
tf.fsbase = addr;
Ok(0)
}
_ => Err(SysError::Inval),
}
}

@ -17,11 +17,13 @@ use self::fs::*;
use self::mem::*;
use self::proc::*;
use self::time::*;
use self::ctrl::*;
mod fs;
mod mem;
mod proc;
mod time;
mod ctrl;
/// System call dispatcher
pub fn syscall(id: usize, args: [usize; 6], tf: &mut TrapFrame) -> isize {
@ -102,10 +104,7 @@ pub fn syscall(id: usize, args: [usize; 6], tf: &mut TrapFrame) -> isize {
warn!("sys_sigaltstack is unimplemented");
Ok(0)
}
158 => {
warn!("sys_arch_prctl is unimplemented");
Ok(0)
}
158 => sys_arch_prctl(args[0] as i32, args[1], tf),
218 => {
warn!("sys_set_tid_address is unimplemented");
Ok(0)

Loading…
Cancel
Save