summaryrefslogtreecommitdiffstats
path: root/vendor/redox_syscall/src/arch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
commit837b550238aa671a591ccf282dddeab29cadb206 (patch)
tree914b6b8862bace72bd3245ca184d374b08d8a672 /vendor/redox_syscall/src/arch
parentAdding debian version 1.70.0+dfsg2-1. (diff)
downloadrustc-837b550238aa671a591ccf282dddeab29cadb206.tar.xz
rustc-837b550238aa671a591ccf282dddeab29cadb206.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/redox_syscall/src/arch')
-rw-r--r--vendor/redox_syscall/src/arch/aarch64.rs32
-rw-r--r--vendor/redox_syscall/src/arch/nonredox.rs3
-rw-r--r--vendor/redox_syscall/src/arch/x86.rs79
-rw-r--r--vendor/redox_syscall/src/arch/x86_64.rs2
4 files changed, 109 insertions, 7 deletions
diff --git a/vendor/redox_syscall/src/arch/aarch64.rs b/vendor/redox_syscall/src/arch/aarch64.rs
index e771396e3..e792427cf 100644
--- a/vendor/redox_syscall/src/arch/aarch64.rs
+++ b/vendor/redox_syscall/src/arch/aarch64.rs
@@ -3,6 +3,8 @@ use core::ops::{Deref, DerefMut};
use super::error::{Error, Result};
+pub const PAGE_SIZE: usize = 4096;
+
macro_rules! syscall {
($($name:ident($a:ident, $($b:ident, $($c:ident, $($d:ident, $($e:ident, $($f:ident, )?)?)?)?)?);)+) => {
$(
@@ -49,13 +51,6 @@ syscall! {
#[derive(Copy, Clone, Debug, Default)]
#[repr(C)]
pub struct IntRegisters {
- pub elr_el1: usize,
- pub tpidr_el0: usize,
- pub tpidrro_el0: usize,
- pub spsr_el1: usize,
- pub esr_el1: usize,
- pub sp_el0: usize, // Shouldn't be used if interrupt occurred at EL1
- pub padding: usize, // To keep the struct even number aligned
pub x30: usize,
pub x29: usize,
pub x28: usize,
@@ -130,3 +125,26 @@ impl DerefMut for FloatRegisters {
}
}
}
+
+#[derive(Clone, Copy, Debug, Default)]
+#[repr(packed)]
+pub struct EnvRegisters {
+ pub tpidr_el0: usize,
+ pub tpidrro_el0: usize,
+}
+impl Deref for EnvRegisters {
+ type Target = [u8];
+ fn deref(&self) -> &[u8] {
+ unsafe {
+ slice::from_raw_parts(self as *const EnvRegisters as *const u8, mem::size_of::<EnvRegisters>())
+ }
+ }
+}
+
+impl DerefMut for EnvRegisters {
+ fn deref_mut(&mut self) -> &mut [u8] {
+ unsafe {
+ slice::from_raw_parts_mut(self as *mut EnvRegisters as *mut u8, mem::size_of::<EnvRegisters>())
+ }
+ }
+}
diff --git a/vendor/redox_syscall/src/arch/nonredox.rs b/vendor/redox_syscall/src/arch/nonredox.rs
index f99a7148c..65c44fcd8 100644
--- a/vendor/redox_syscall/src/arch/nonredox.rs
+++ b/vendor/redox_syscall/src/arch/nonredox.rs
@@ -1,5 +1,8 @@
use super::error::{Error, Result, ENOSYS};
+// Doesn't really matter, but since we will most likely run on an x86_64 host, why not 4096?
+pub const PAGE_SIZE: usize = 4096;
+
pub unsafe fn syscall0(_a: usize) -> Result<usize> {
Err(Error::new(ENOSYS))
}
diff --git a/vendor/redox_syscall/src/arch/x86.rs b/vendor/redox_syscall/src/arch/x86.rs
index 2f9301e0e..54d8c0a93 100644
--- a/vendor/redox_syscall/src/arch/x86.rs
+++ b/vendor/redox_syscall/src/arch/x86.rs
@@ -4,6 +4,8 @@ use core::ops::{Deref, DerefMut};
use super::error::{Error, Result};
+pub const PAGE_SIZE: usize = 4096;
+
macro_rules! syscall {
($($name:ident($a:ident, $($b:ident, $($c:ident, $($d:ident, $($e:ident, $($f:ident, )?)?)?)?)?);)+) => {
$(
@@ -80,6 +82,83 @@ pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f:
Error::demux(a)
}
+#[derive(Copy, Clone, Debug, Default)]
+#[repr(C)]
+pub struct IntRegisters {
+ // TODO: Some of these don't get set by Redox yet. Should they?
+
+ pub ebp: usize,
+ pub esi: usize,
+ pub edi: usize,
+ pub ebx: usize,
+ pub eax: usize,
+ pub ecx: usize,
+ pub edx: usize,
+ // pub orig_rax: usize,
+ pub eip: usize,
+ pub cs: usize,
+ pub eflags: usize,
+ pub esp: 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>())
+ }
+ }
+}
+
+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>())
+ }
+ }
+}
+
+#[derive(Clone, Copy, Debug, Default)]
+#[repr(packed)]
+pub struct FloatRegisters {
+ pub fcw: u16,
+ pub fsw: u16,
+ pub ftw: u8,
+ pub _reserved: u8,
+ pub fop: u16,
+ pub fip: u64,
+ pub fdp: u64,
+ pub mxcsr: u32,
+ pub mxcsr_mask: u32,
+ pub st_space: [u128; 8],
+ pub xmm_space: [u128; 16],
+ // TODO: YMM/ZMM
+}
+
+impl Deref for FloatRegisters {
+ type Target = [u8];
+ fn deref(&self) -> &[u8] {
+ unsafe {
+ slice::from_raw_parts(self as *const FloatRegisters as *const u8, mem::size_of::<FloatRegisters>())
+ }
+ }
+}
+
+impl DerefMut for FloatRegisters {
+ fn deref_mut(&mut self) -> &mut [u8] {
+ unsafe {
+ slice::from_raw_parts_mut(self as *mut FloatRegisters as *mut u8, mem::size_of::<FloatRegisters>())
+ }
+ }
+}
+
#[derive(Clone, Copy, Debug, Default)]
#[repr(packed)]
pub struct EnvRegisters {
diff --git a/vendor/redox_syscall/src/arch/x86_64.rs b/vendor/redox_syscall/src/arch/x86_64.rs
index f71898e90..2ff57bb2d 100644
--- a/vendor/redox_syscall/src/arch/x86_64.rs
+++ b/vendor/redox_syscall/src/arch/x86_64.rs
@@ -4,6 +4,8 @@ use core::ops::{Deref, DerefMut};
use super::error::{Error, Result};
+pub const PAGE_SIZE: usize = 4096;
+
macro_rules! syscall {
($($name:ident($a:ident, $($b:ident, $($c:ident, $($d:ident, $($e:ident, $($f:ident, )?)?)?)?)?);)+) => {
$(