Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • redox-os/syscall
  • ids1024/syscall
  • microcolonel/syscall
  • liamnprg/syscall
  • rosehuds/syscall
  • jferard/syscall
  • xTibor/syscall
  • sergey-melnychuk/syscall
  • jD91mZM2/syscall
  • NickeZ/syscall
  • ayf/syscall
  • potatogim/syscall
  • 4lDO2/syscall
  • joboet1/syscall
  • tcrawford/syscall
  • henritel/syscall
  • ansg191/syscall
  • saraelsa/syscall
  • Forest0923/syscall
  • rw_van/syscall
  • devnexen/syscall
  • daxpedda/syscall
  • usapmz/syscall
  • gmacd/syscall
  • aaronjanse/syscall
  • jmaine/syscall
  • hasheddan/syscall
  • lygstate/syscall
  • 8tab/syscall
  • coolreader18/syscall
  • poly000/syscall
  • ahmedmasud/syscall
  • enygmator/syscall
  • kamirr/syscall
  • ebalalic/syscall
  • andypython/syscall
  • darley/syscall
37 results
Show changes
Commits on Source (7)
[package]
name = "redox_syscall"
version = "0.5.0"
version = "0.5.1"
description = "A Rust library to access raw Redox system calls"
license = "MIT"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
......
......@@ -27,3 +27,7 @@ pub unsafe fn syscall5(_a: usize, _b: usize, _c: usize, _d: usize, _e: usize, _f
-> Result<usize> {
Err(Error::new(ENOSYS))
}
#[repr(C)]
#[derive(Clone, Copy, Debug, Default)]
pub struct IntRegisters(u8);
......@@ -51,8 +51,6 @@ syscall! {
#[derive(Copy, Clone, Debug, Default)]
#[repr(C)]
pub struct IntRegisters {
// TODO: Some of these don't get set by Redox yet. Should they?
pub r15: usize,
pub r14: usize,
pub r13: usize,
......@@ -68,25 +66,18 @@ pub struct IntRegisters {
pub rdx: usize,
pub rsi: usize,
pub rdi: usize,
// pub orig_rax: usize,
pub rip: usize,
pub cs: usize,
pub rflags: usize,
pub rsp: usize,
pub ss: usize,
// pub fs_base: usize,
// pub gs_base: usize,
// pub ds: usize,
// pub es: usize,
pub fs: usize,
// pub gs: usize
}
impl Deref for IntRegisters {
type Target = [u8];
fn deref(&self) -> &[u8] {
unsafe {
slice::from_raw_parts(self as *const IntRegisters as *const u8, mem::size_of::<IntRegisters>())
slice::from_raw_parts(self as *const Self as *const u8, mem::size_of::<Self>())
}
}
}
......@@ -94,7 +85,7 @@ impl Deref for IntRegisters {
impl DerefMut for IntRegisters {
fn deref_mut(&mut self) -> &mut [u8] {
unsafe {
slice::from_raw_parts_mut(self as *mut IntRegisters as *mut u8, mem::size_of::<IntRegisters>())
slice::from_raw_parts_mut(self as *mut Self as *mut u8, mem::size_of::<Self>())
}
}
}
......
......@@ -244,7 +244,7 @@ pub fn sigaction(sig: usize, act: Option<&SigAction>, oldact: Option<&mut SigAct
}
/// Get and/or set signal masks
pub fn sigprocmask(how: usize, set: Option<&[u64; 2]>, oldset: Option<&mut [u64; 2]>) -> Result<usize> {
pub fn sigprocmask(how: usize, set: Option<&u64>, oldset: Option<&mut u64>) -> Result<usize> {
unsafe { syscall3(SYS_SIGPROCMASK, how,
set.map(|x| x as *const _).unwrap_or_else(ptr::null) as usize,
oldset.map(|x| x as *mut _).unwrap_or_else(ptr::null_mut) as usize) }
......
use core::ops::{Deref, DerefMut};
use core::{mem, slice};
use crate::IntRegisters;
use crate::flag::{EventFlags, MapFlags, PtraceFlags, SigActionFlags};
#[derive(Copy, Clone, Debug, Default)]
......@@ -146,7 +147,7 @@ impl DerefMut for Packet {
#[repr(C)]
pub struct SigAction {
pub sa_handler: Option<extern "C" fn(usize)>,
pub sa_mask: [u64; 2],
pub sa_mask: u64,
pub sa_flags: SigActionFlags,
}
impl Deref for SigAction {
......@@ -362,3 +363,58 @@ impl DerefMut for GrantDesc {
}
}
}
#[derive(Clone, Copy, Debug, Default)]
#[repr(C, align(64))]
pub struct SignalStack {
pub intregs: IntRegisters,
pub old_procmask: u64,
pub sa_mask: u64,
pub sa_flags: u32,
pub sig_num: u32,
pub sa_handler: usize,
// offset = 3*64 bytes from this point.
//
// NOTE: If any new fields are added, make sure 64 byte alignment is maintained (for x86_64
// XSAVE, other arches may not necessarily need that alignment).
}
impl Deref for SignalStack {
type Target = [u8];
fn deref(&self) -> &[u8] {
unsafe {
slice::from_raw_parts(self as *const Self as *const u8, mem::size_of::<Self>())
}
}
}
impl DerefMut for SignalStack {
fn deref_mut(&mut self) -> &mut [u8] {
unsafe {
slice::from_raw_parts_mut(self as *mut Self as *mut u8, mem::size_of::<Self>())
}
}
}
#[derive(Clone, Copy, Debug, Default)]
#[repr(C)]
pub struct SetSighandlerData {
pub entry: usize,
pub altstack_base: usize,
pub altstack_len: usize,
}
impl Deref for SetSighandlerData {
type Target = [u8];
fn deref(&self) -> &[u8] {
unsafe {
slice::from_raw_parts(self as *const Self as *const u8, mem::size_of::<Self>())
}
}
}
impl DerefMut for SetSighandlerData {
fn deref_mut(&mut self) -> &mut [u8] {
unsafe {
slice::from_raw_parts_mut(self as *mut Self as *mut u8, mem::size_of::<Self>())
}
}
}
use core::{fmt, result};
#[derive(Eq, PartialEq)]
#[derive(Clone, Copy, Eq, PartialEq)]
pub struct Error {
pub errno: i32,
}
......@@ -9,7 +9,7 @@ pub type Result<T, E = Error> = result::Result<T, E>;
impl Error {
pub fn new(errno: i32) -> Error {
Error { errno: errno }
Error { errno }
}
pub fn mux(result: Result<usize>) -> usize {
......