summaryrefslogtreecommitdiffstats
path: root/third_party/rust/mach/src/structs.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /third_party/rust/mach/src/structs.rs
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/mach/src/structs.rs')
-rw-r--r--third_party/rust/mach/src/structs.rs62
1 files changed, 62 insertions, 0 deletions
diff --git a/third_party/rust/mach/src/structs.rs b/third_party/rust/mach/src/structs.rs
new file mode 100644
index 0000000000..75dc0e8dba
--- /dev/null
+++ b/third_party/rust/mach/src/structs.rs
@@ -0,0 +1,62 @@
+//! This module corresponds to `mach/_structs.h`.
+
+use mem;
+use message::mach_msg_type_number_t;
+
+#[repr(C)]
+#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
+pub struct x86_thread_state64_t {
+ pub __rax: u64,
+ pub __rbx: u64,
+ pub __rcx: u64,
+ pub __rdx: u64,
+ pub __rdi: u64,
+ pub __rsi: u64,
+ pub __rbp: u64,
+ pub __rsp: u64,
+ pub __r8: u64,
+ pub __r9: u64,
+ pub __r10: u64,
+ pub __r11: u64,
+ pub __r12: u64,
+ pub __r13: u64,
+ pub __r14: u64,
+ pub __r15: u64,
+ pub __rip: u64,
+ pub __rflags: u64,
+ pub __cs: u64,
+ pub __fs: u64,
+ pub __gs: u64,
+}
+
+impl x86_thread_state64_t {
+ pub fn new() -> Self {
+ Self {
+ __rax: 0,
+ __rbx: 0,
+ __rcx: 0,
+ __rdx: 0,
+ __rdi: 0,
+ __rsi: 0,
+ __rbp: 0,
+ __rsp: 0,
+ __r8: 0,
+ __r9: 0,
+ __r10: 0,
+ __r11: 0,
+ __r12: 0,
+ __r13: 0,
+ __r14: 0,
+ __r15: 0,
+ __rip: 0,
+ __rflags: 0,
+ __cs: 0,
+ __fs: 0,
+ __gs: 0,
+ }
+ }
+
+ pub fn count() -> mach_msg_type_number_t {
+ (mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
+ }
+}