Skip to main content

starnix_uapi/
x64.rs

1// Copyright 2023 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#![allow(non_camel_case_types)]
6
7use crate::uref;
8use zerocopy::{FromBytes, FromZeros, Immutable, IntoBytes, KnownLayout};
9
10#[repr(C)]
11#[derive(Debug, Copy, Clone, IntoBytes, KnownLayout, FromBytes, Immutable)]
12pub struct user_fpregs_struct {
13    pub cwd: std::os::raw::c_ushort,
14    pub swd: std::os::raw::c_ushort,
15    pub ftw: std::os::raw::c_ushort,
16    pub fop: std::os::raw::c_ushort,
17    pub rip: std::os::raw::c_ulong,
18    pub rdp: std::os::raw::c_ulong,
19    pub mxcsr: std::os::raw::c_uint,
20    pub mxcr_mask: std::os::raw::c_uint,
21    pub st_space: [std::os::raw::c_uint; 32usize],
22    pub xmm_space: [std::os::raw::c_uint; 64usize],
23    pub padding: [std::os::raw::c_uint; 24usize],
24}
25
26impl Default for user_fpregs_struct {
27    fn default() -> Self {
28        Self::new_zeroed()
29    }
30}
31
32#[repr(C)]
33#[derive(Debug, Default, Copy, Clone, IntoBytes, KnownLayout, FromBytes, Immutable)]
34pub struct user_regs_struct {
35    pub r15: std::os::raw::c_ulong,
36    pub r14: std::os::raw::c_ulong,
37    pub r13: std::os::raw::c_ulong,
38    pub r12: std::os::raw::c_ulong,
39    pub rbp: std::os::raw::c_ulong,
40    pub rbx: std::os::raw::c_ulong,
41    pub r11: std::os::raw::c_ulong,
42    pub r10: std::os::raw::c_ulong,
43    pub r9: std::os::raw::c_ulong,
44    pub r8: std::os::raw::c_ulong,
45    pub rax: std::os::raw::c_ulong,
46    pub rcx: std::os::raw::c_ulong,
47    pub rdx: std::os::raw::c_ulong,
48    pub rsi: std::os::raw::c_ulong,
49    pub rdi: std::os::raw::c_ulong,
50    pub orig_rax: std::os::raw::c_ulong,
51    pub rip: std::os::raw::c_ulong,
52    pub cs: std::os::raw::c_ulong,
53    pub eflags: std::os::raw::c_ulong,
54    pub rsp: std::os::raw::c_ulong,
55    pub ss: std::os::raw::c_ulong,
56    pub fs_base: std::os::raw::c_ulong,
57    pub gs_base: std::os::raw::c_ulong,
58    pub ds: std::os::raw::c_ulong,
59    pub es: std::os::raw::c_ulong,
60    pub fs: std::os::raw::c_ulong,
61    pub gs: std::os::raw::c_ulong,
62}
63
64#[repr(C)]
65#[derive(Debug, Copy, Clone, IntoBytes, KnownLayout, FromBytes, Immutable)]
66pub struct user {
67    pub regs: user_regs_struct,
68    pub u_fpvalid: std::os::raw::c_int,
69    pub pad0: std::os::raw::c_int,
70    pub i387: user_fpregs_struct,
71    pub u_tsize: std::os::raw::c_ulong,
72    pub u_dsize: std::os::raw::c_ulong,
73    pub u_ssize: std::os::raw::c_ulong,
74    pub start_code: std::os::raw::c_ulong,
75    pub start_stack: std::os::raw::c_ulong,
76    pub signal: std::os::raw::c_long,
77    pub reserved: std::os::raw::c_int,
78    pub pad1: std::os::raw::c_int,
79    pub u_ar0: uref<user_regs_struct>,
80    pub u_fpstate: uref<user_fpregs_struct>,
81    pub magic: std::os::raw::c_ulong,
82    pub u_comm: [std::os::raw::c_char; 32usize],
83    pub u_debugreg: [std::os::raw::c_ulong; 8usize],
84    pub error_code: std::os::raw::c_ulong,
85    pub fault_address: std::os::raw::c_ulong,
86}
87
88impl Default for user {
89    fn default() -> Self {
90        Self::new_zeroed()
91    }
92}