diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /third_party/rust/mach2/src/structs.rs | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/mach2/src/structs.rs')
-rw-r--r-- | third_party/rust/mach2/src/structs.rs | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/third_party/rust/mach2/src/structs.rs b/third_party/rust/mach2/src/structs.rs new file mode 100644 index 0000000000..75dc0e8dba --- /dev/null +++ b/third_party/rust/mach2/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 + } +} |