syscall: add FullContextRegs arch types for /proc/{pid}/ctx
This commit is contained in:
@@ -95,6 +95,14 @@ pub struct IntRegisters {
|
||||
pub x0: usize,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
#[repr(C)]
|
||||
pub struct FullContextRegs {
|
||||
pub int: IntRegisters,
|
||||
pub float: FloatRegisters,
|
||||
pub env: EnvRegisters,
|
||||
}
|
||||
|
||||
impl Deref for IntRegisters {
|
||||
type Target = [u8];
|
||||
fn deref(&self) -> &[u8] {
|
||||
@@ -149,6 +157,29 @@ impl DerefMut for FloatRegisters {
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for FullContextRegs {
|
||||
type Target = [u8];
|
||||
fn deref(&self) -> &[u8] {
|
||||
unsafe {
|
||||
slice::from_raw_parts(
|
||||
self as *const FullContextRegs as *const u8,
|
||||
mem::size_of::<FullContextRegs>(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DerefMut for FullContextRegs {
|
||||
fn deref_mut(&mut self) -> &mut [u8] {
|
||||
unsafe {
|
||||
slice::from_raw_parts_mut(
|
||||
self as *mut FullContextRegs as *mut u8,
|
||||
mem::size_of::<FullContextRegs>(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
#[repr(C, packed)]
|
||||
pub struct EnvRegisters {
|
||||
|
||||
@@ -96,6 +96,14 @@ pub struct IntRegisters {
|
||||
pub x1: usize,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
#[repr(C)]
|
||||
pub struct FullContextRegs {
|
||||
pub int: IntRegisters,
|
||||
pub float: FloatRegisters,
|
||||
pub env: EnvRegisters,
|
||||
}
|
||||
|
||||
impl Deref for IntRegisters {
|
||||
type Target = [u8];
|
||||
fn deref(&self) -> &[u8] {
|
||||
@@ -149,6 +157,29 @@ impl DerefMut for FloatRegisters {
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for FullContextRegs {
|
||||
type Target = [u8];
|
||||
fn deref(&self) -> &[u8] {
|
||||
unsafe {
|
||||
slice::from_raw_parts(
|
||||
self as *const FullContextRegs as *const u8,
|
||||
mem::size_of::<FullContextRegs>(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DerefMut for FullContextRegs {
|
||||
fn deref_mut(&mut self) -> &mut [u8] {
|
||||
unsafe {
|
||||
slice::from_raw_parts_mut(
|
||||
self as *mut FullContextRegs as *mut u8,
|
||||
mem::size_of::<FullContextRegs>(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
#[repr(packed)]
|
||||
pub struct EnvRegisters {
|
||||
|
||||
@@ -164,6 +164,14 @@ pub struct IntRegisters {
|
||||
// pub gs: usize
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
#[repr(C)]
|
||||
pub struct FullContextRegs {
|
||||
pub int: IntRegisters,
|
||||
pub float: FloatRegisters,
|
||||
pub env: EnvRegisters,
|
||||
}
|
||||
|
||||
impl Deref for IntRegisters {
|
||||
type Target = [u8];
|
||||
fn deref(&self) -> &[u8] {
|
||||
@@ -227,6 +235,29 @@ impl DerefMut for FloatRegisters {
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for FullContextRegs {
|
||||
type Target = [u8];
|
||||
fn deref(&self) -> &[u8] {
|
||||
unsafe {
|
||||
slice::from_raw_parts(
|
||||
self as *const FullContextRegs as *const u8,
|
||||
mem::size_of::<FullContextRegs>(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DerefMut for FullContextRegs {
|
||||
fn deref_mut(&mut self) -> &mut [u8] {
|
||||
unsafe {
|
||||
slice::from_raw_parts_mut(
|
||||
self as *mut FullContextRegs as *mut u8,
|
||||
mem::size_of::<FullContextRegs>(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
#[repr(C, packed)]
|
||||
pub struct EnvRegisters {
|
||||
|
||||
@@ -81,6 +81,14 @@ pub struct IntRegisters {
|
||||
pub ss: usize,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
#[repr(C)]
|
||||
pub struct FullContextRegs {
|
||||
pub int: IntRegisters,
|
||||
pub float: FloatRegisters,
|
||||
pub env: EnvRegisters,
|
||||
}
|
||||
|
||||
impl Deref for IntRegisters {
|
||||
type Target = [u8];
|
||||
fn deref(&self) -> &[u8] {
|
||||
@@ -133,6 +141,29 @@ impl DerefMut for FloatRegisters {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for FullContextRegs {
|
||||
type Target = [u8];
|
||||
fn deref(&self) -> &[u8] {
|
||||
unsafe {
|
||||
slice::from_raw_parts(
|
||||
self as *const FullContextRegs as *const u8,
|
||||
mem::size_of::<FullContextRegs>(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DerefMut for FullContextRegs {
|
||||
fn deref_mut(&mut self) -> &mut [u8] {
|
||||
unsafe {
|
||||
slice::from_raw_parts_mut(
|
||||
self as *mut FullContextRegs as *mut u8,
|
||||
mem::size_of::<FullContextRegs>(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
#[repr(C, packed)]
|
||||
pub struct EnvRegisters {
|
||||
|
||||
Reference in New Issue
Block a user