mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-25 01:16:18 +04:00
run cargo fmt
This commit is contained in:
parent
3d83f84556
commit
c157890f33
@ -1,4 +1,5 @@
|
||||
use crate::arch::get_sp;
|
||||
use crate::arch::signal::MachineContext;
|
||||
use crate::process::{current_thread, thread_manager};
|
||||
use crate::signal::*;
|
||||
use alloc::vec::Vec;
|
||||
@ -6,7 +7,6 @@ use core::default::Default;
|
||||
use core::fmt;
|
||||
use num::FromPrimitive;
|
||||
use rcore_thread::std_thread::current;
|
||||
use crate::arch::signal::MachineContext;
|
||||
|
||||
#[derive(Clone)]
|
||||
#[repr(C)]
|
||||
|
@ -15,9 +15,9 @@ pub mod ipi;
|
||||
pub mod memory;
|
||||
pub mod paging;
|
||||
pub mod rand;
|
||||
pub mod signal;
|
||||
pub mod syscall;
|
||||
pub mod timer;
|
||||
pub mod signal;
|
||||
|
||||
static AP_CAN_INIT: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
|
@ -66,4 +66,4 @@ impl MachineContext {
|
||||
_reserved1: [0; 8],
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::signal::Signal;
|
||||
use bitflags::*;
|
||||
use bitflags::_core::fmt::Debug;
|
||||
use bitflags::*;
|
||||
use core::fmt::Formatter;
|
||||
|
||||
pub const SIG_ERR: usize = usize::max_value() - 1;
|
||||
@ -66,7 +66,6 @@ impl Debug for SignalAction {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub union SiginfoFields {
|
||||
|
@ -8,13 +8,13 @@ mod action;
|
||||
|
||||
pub use self::action::*;
|
||||
use crate::arch::interrupt::TrapFrame;
|
||||
use crate::arch::signal::MachineContext;
|
||||
use crate::arch::syscall::SYS_RT_SIGRETURN;
|
||||
use crate::arch::{get_sp, set_sp};
|
||||
use crate::processor;
|
||||
use crate::syscall::{SysError, SysResult};
|
||||
use alloc::vec::Vec;
|
||||
use rcore_thread::std_thread::{current, yield_now};
|
||||
use crate::arch::syscall::SYS_RT_SIGRETURN;
|
||||
use crate::arch::signal::MachineContext;
|
||||
|
||||
#[derive(Eq, PartialEq, FromPrimitive, Debug, Copy, Clone)]
|
||||
pub enum Signal {
|
||||
@ -133,8 +133,8 @@ pub struct SignalFrame {
|
||||
pub ret_code_addr: usize, // point to ret_code
|
||||
pub tf: TrapFrame,
|
||||
pub info: Siginfo,
|
||||
pub ucontext: UserContext, // adapt interface, a little bit waste
|
||||
pub ret_code: [u8; 7], // call sys_sigreturn
|
||||
pub ucontext: UserContext, // adapt interface, a little bit waste
|
||||
pub ret_code: [u8; 7], // call sys_sigreturn
|
||||
}
|
||||
|
||||
pub fn has_signal_to_do() -> bool {
|
||||
@ -248,13 +248,15 @@ pub fn do_signal(tf: &mut TrapFrame) {
|
||||
_fpregs_mem: [0; 64],
|
||||
};
|
||||
if action_flags.contains(SignalActionFlags::RESTORER) {
|
||||
frame.ret_code_addr = action.restorer; // legacy
|
||||
frame.ret_code_addr = action.restorer; // legacy
|
||||
} else {
|
||||
frame.ret_code_addr = frame.ret_code.as_ptr() as usize;
|
||||
// mov SYS_RT_SIGRETURN, %eax
|
||||
frame.ret_code[0] = 0xb8;
|
||||
// TODO: ref plz
|
||||
unsafe { *(frame.ret_code.as_ptr().add(1) as *mut u32) = SYS_RT_SIGRETURN as u32; }
|
||||
unsafe {
|
||||
*(frame.ret_code.as_ptr().add(1) as *mut u32) = SYS_RT_SIGRETURN as u32;
|
||||
}
|
||||
// syscall
|
||||
frame.ret_code[5] = 0x0f;
|
||||
frame.ret_code[6] = 0x05;
|
||||
|
@ -21,10 +21,10 @@ use crate::fs::epoll::EpollInstance;
|
||||
use crate::fs::fcntl::{FD_CLOEXEC, F_SETFD, O_CLOEXEC, O_NONBLOCK};
|
||||
use crate::fs::FileLike;
|
||||
use crate::process::Process;
|
||||
use crate::syscall::SysError::{EINVAL, ESPIPE, EINTR};
|
||||
use crate::signal::has_signal_to_do;
|
||||
use crate::syscall::SysError::{EINTR, EINVAL, ESPIPE};
|
||||
use rcore_fs::vfs::PollStatus;
|
||||
use rcore_thread::std_thread::current;
|
||||
use crate::signal::has_signal_to_do;
|
||||
|
||||
impl Syscall<'_> {
|
||||
pub fn sys_read(&mut self, fd: usize, base: *mut u8, len: usize) -> SysResult {
|
||||
|
@ -39,7 +39,7 @@ mod proc;
|
||||
mod signal;
|
||||
mod time;
|
||||
|
||||
use crate::signal::{Signal, SignalAction, SignalStack, Sigset, SignalFrame};
|
||||
use crate::signal::{Signal, SignalAction, SignalFrame, SignalStack, Sigset};
|
||||
#[cfg(feature = "profile")]
|
||||
use alloc::collections::BTreeMap;
|
||||
use rcore_thread::std_thread::yield_now;
|
||||
@ -223,7 +223,9 @@ impl Syscall<'_> {
|
||||
args[2] as *mut Sigset,
|
||||
args[3],
|
||||
),
|
||||
SYS_SIGALTSTACK => self.sys_sigaltstack(args[0] as *const SignalStack, args[1] as *mut SignalStack),
|
||||
SYS_SIGALTSTACK => {
|
||||
self.sys_sigaltstack(args[0] as *const SignalStack, args[1] as *mut SignalStack)
|
||||
}
|
||||
SYS_KILL => self.sys_kill(args[0] as isize, args[1]),
|
||||
|
||||
// schedule
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
use super::*;
|
||||
use crate::fs::FileLike;
|
||||
use crate::signal::{send_signal, Signal, has_signal_to_do};
|
||||
use crate::syscall::SysError::{ESRCH, EINTR};
|
||||
use crate::signal::{has_signal_to_do, send_signal, Signal};
|
||||
use crate::syscall::SysError::{EINTR, ESRCH};
|
||||
use alloc::sync::Weak;
|
||||
|
||||
impl Syscall<'_> {
|
||||
|
@ -1,3 +1,4 @@
|
||||
use crate::arch::interrupt::TrapFrame;
|
||||
use crate::process::{current_thread, process_of, thread_manager, PROCESSES};
|
||||
use crate::process::{process, process_group};
|
||||
use crate::signal::Signal::SIGINT;
|
||||
@ -6,7 +7,6 @@ use crate::syscall::SysError::{EINVAL, ENOMEM, EPERM, ESRCH};
|
||||
use crate::syscall::{SysResult, Syscall};
|
||||
use crate::thread;
|
||||
use num::FromPrimitive;
|
||||
use crate::arch::interrupt::TrapFrame;
|
||||
|
||||
impl Syscall<'_> {
|
||||
pub fn sys_rt_sigaction(
|
||||
@ -22,7 +22,10 @@ impl Syscall<'_> {
|
||||
signal, act, oldact, sigsetsize
|
||||
);
|
||||
use Signal::*;
|
||||
if signal == SIGKILL || signal == SIGSTOP || sigsetsize != core::mem::size_of::<Sigset>() {
|
||||
if signal == SIGKILL
|
||||
|| signal == SIGSTOP
|
||||
|| sigsetsize != core::mem::size_of::<Sigset>()
|
||||
{
|
||||
Err(EINVAL)
|
||||
} else {
|
||||
let mut proc = self.process();
|
||||
@ -53,7 +56,8 @@ impl Syscall<'_> {
|
||||
// frame.info.signo
|
||||
{
|
||||
let mut process = self.process();
|
||||
process.sigaltstack.flags ^= process.sigaltstack.flags & SignalStackFlags::ONSTACK.bits();
|
||||
process.sigaltstack.flags ^=
|
||||
process.sigaltstack.flags & SignalStackFlags::ONSTACK.bits();
|
||||
}
|
||||
|
||||
// *self.tf = TrapFrame::from_mcontext(&frame.ucontext.mcontext);
|
||||
|
@ -10,7 +10,9 @@ pub static mut TICK: usize = 0;
|
||||
|
||||
global_asm!(include_str!("fpe.S"));
|
||||
|
||||
extern "C" { fn fpe(); }
|
||||
extern "C" {
|
||||
fn fpe();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
pub static ref TICK_ACTIVITY: Condvar = Condvar::new();
|
||||
|
2
user
2
user
@ -1 +1 @@
|
||||
Subproject commit 12a9fb7d2509813465c9ffb0220c53f2566b2910
|
||||
Subproject commit 8223437f9ba848fde7ea1794bc4e51a44523352c
|
Loading…
Reference in New Issue
Block a user