Skip to content

Commit b484a8d

Browse files
committed
Move user struct into x86_64
1 parent c0844c3 commit b484a8d

File tree

2 files changed

+123
-123
lines changed

2 files changed

+123
-123
lines changed

src/unix/linux_like/android/b64/mod.rs

Lines changed: 0 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -113,61 +113,6 @@ s! {
113113
pub struct pthread_spinlock_t {
114114
__private: i64,
115115
}
116-
117-
pub struct user_regs_struct {
118-
pub r15: ::c_ulong,
119-
pub r14: ::c_ulong,
120-
pub r13: ::c_ulong,
121-
pub r12: ::c_ulong,
122-
pub rbp: ::c_ulong,
123-
pub rbx: ::c_ulong,
124-
pub r11: ::c_ulong,
125-
pub r10: ::c_ulong,
126-
pub r9: ::c_ulong,
127-
pub r8: ::c_ulong,
128-
pub rax: ::c_ulong,
129-
pub rcx: ::c_ulong,
130-
pub rdx: ::c_ulong,
131-
pub rsi: ::c_ulong,
132-
pub rdi: ::c_ulong,
133-
pub orig_rax: ::c_ulong,
134-
pub rip: ::c_ulong,
135-
pub cs: ::c_ulong,
136-
pub eflags: ::c_ulong,
137-
pub rsp: ::c_ulong,
138-
pub ss: ::c_ulong,
139-
pub fs_base: ::c_ulong,
140-
pub gs_base: ::c_ulong,
141-
pub ds: ::c_ulong,
142-
pub es: ::c_ulong,
143-
pub fs: ::c_ulong,
144-
pub gs: ::c_ulong,
145-
}
146-
147-
pub struct user {
148-
pub regs: user_regs_struct,
149-
pub u_fpvalid: ::c_int,
150-
pub i387: user_fpregs_struct,
151-
pub u_tsize: ::c_ulong,
152-
pub u_dsize: ::c_ulong,
153-
pub u_ssize: ::c_ulong,
154-
pub start_code: ::c_ulong,
155-
pub start_stack: ::c_ulong,
156-
pub signal: ::c_long,
157-
__reserved: ::c_int,
158-
#[cfg(target_pointer_width = "32")]
159-
__pad1: u32,
160-
pub u_ar0: *mut user_regs_struct,
161-
#[cfg(target_pointer_width = "32")]
162-
__pad2: u32,
163-
pub u_fpstate: *mut user_fpregs_struct,
164-
pub magic: ::c_ulong,
165-
pub u_comm: [::c_char; 32],
166-
pub u_debugreg: [::c_ulong; 8],
167-
pub error_code: ::c_ulong,
168-
pub fault_address: ::c_ulong,
169-
}
170-
171116
}
172117

173118
s_no_extra_traits! {
@@ -193,20 +138,6 @@ s_no_extra_traits! {
193138
pub struct sigset64_t {
194139
__bits: [::c_ulong; 1]
195140
}
196-
197-
pub struct user_fpregs_struct {
198-
pub cwd: ::c_ushort,
199-
pub swd: ::c_ushort,
200-
pub ftw: ::c_ushort,
201-
pub fop: ::c_ushort,
202-
pub rip: ::c_ulong,
203-
pub rdp: ::c_ulong,
204-
pub mxcsr: ::c_uint,
205-
pub mxcr_mask: ::c_uint,
206-
pub st_space: [::c_uint; 32],
207-
pub xmm_space: [::c_uint; 64],
208-
padding: [::c_uint; 24],
209-
}
210141
}
211142

212143
cfg_if! {
@@ -317,60 +248,6 @@ cfg_if! {
317248
.finish()
318249
}
319250
}
320-
321-
impl PartialEq for user_fpregs_struct {
322-
fn eq(&self, other: &user_fpregs_struct) -> bool {
323-
self.cwd == other.cwd
324-
&& self.swd == other.swd
325-
&& self.ftw == other.ftw
326-
&& self.fop == other.fop
327-
&& self.rip == other.rip
328-
&& self.rdp == other.rdp
329-
&& self.mxcsr == other.mxcsr
330-
&& self.mxcr_mask == other.mxcr_mask
331-
&& self.st_space == other.st_space
332-
&& self
333-
.xmm_space
334-
.iter()
335-
.zip(other.xmm_space.iter())
336-
.all(|(a,b)| a == b)
337-
// Ignore padding field
338-
}
339-
}
340-
341-
impl Eq for user_fpregs_struct {}
342-
343-
impl ::fmt::Debug for user_fpregs_struct {
344-
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
345-
f.debug_struct("user_fpregs_struct")
346-
.field("cwd", &self.cwd)
347-
.field("ftw", &self.ftw)
348-
.field("fop", &self.fop)
349-
.field("rip", &self.rip)
350-
.field("rdp", &self.rdp)
351-
.field("mxcsr", &self.mxcsr)
352-
.field("mxcr_mask", &self.mxcr_mask)
353-
.field("st_space", &self.st_space)
354-
// FIXME: .field("xmm_space", &self.xmm_space)
355-
// Ignore padding field
356-
.finish()
357-
}
358-
}
359-
360-
impl ::hash::Hash for user_fpregs_struct {
361-
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
362-
self.cwd.hash(state);
363-
self.ftw.hash(state);
364-
self.fop.hash(state);
365-
self.rip.hash(state);
366-
self.rdp.hash(state);
367-
self.mxcsr.hash(state);
368-
self.mxcr_mask.hash(state);
369-
self.st_space.hash(state);
370-
self.xmm_space.hash(state);
371-
// Ignore padding field
372-
}
373-
}
374251
}
375252
}
376253

src/unix/linux_like/android/b64/x86_64/mod.rs

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,61 @@ s! {
4747
pub struct _libc_xmmreg {
4848
pub element: [u32; 4],
4949
}
50+
51+
pub struct user_regs_struct {
52+
pub r15: ::c_ulong,
53+
pub r14: ::c_ulong,
54+
pub r13: ::c_ulong,
55+
pub r12: ::c_ulong,
56+
pub rbp: ::c_ulong,
57+
pub rbx: ::c_ulong,
58+
pub r11: ::c_ulong,
59+
pub r10: ::c_ulong,
60+
pub r9: ::c_ulong,
61+
pub r8: ::c_ulong,
62+
pub rax: ::c_ulong,
63+
pub rcx: ::c_ulong,
64+
pub rdx: ::c_ulong,
65+
pub rsi: ::c_ulong,
66+
pub rdi: ::c_ulong,
67+
pub orig_rax: ::c_ulong,
68+
pub rip: ::c_ulong,
69+
pub cs: ::c_ulong,
70+
pub eflags: ::c_ulong,
71+
pub rsp: ::c_ulong,
72+
pub ss: ::c_ulong,
73+
pub fs_base: ::c_ulong,
74+
pub gs_base: ::c_ulong,
75+
pub ds: ::c_ulong,
76+
pub es: ::c_ulong,
77+
pub fs: ::c_ulong,
78+
pub gs: ::c_ulong,
79+
}
80+
81+
pub struct user {
82+
pub regs: user_regs_struct,
83+
pub u_fpvalid: ::c_int,
84+
pub i387: user_fpregs_struct,
85+
pub u_tsize: ::c_ulong,
86+
pub u_dsize: ::c_ulong,
87+
pub u_ssize: ::c_ulong,
88+
pub start_code: ::c_ulong,
89+
pub start_stack: ::c_ulong,
90+
pub signal: ::c_long,
91+
__reserved: ::c_int,
92+
#[cfg(target_pointer_width = "32")]
93+
__pad1: u32,
94+
pub u_ar0: *mut user_regs_struct,
95+
#[cfg(target_pointer_width = "32")]
96+
__pad2: u32,
97+
pub u_fpstate: *mut user_fpregs_struct,
98+
pub magic: ::c_ulong,
99+
pub u_comm: [::c_char; 32],
100+
pub u_debugreg: [::c_ulong; 8],
101+
pub error_code: ::c_ulong,
102+
pub fault_address: ::c_ulong,
103+
}
104+
50105
}
51106

52107
cfg_if! {
@@ -118,6 +173,20 @@ s_no_extra_traits! {
118173
pub uc_sigmask64: __c_anonymous_uc_sigmask,
119174
__fpregs_mem: _libc_fpstate,
120175
}
176+
177+
pub struct user_fpregs_struct {
178+
pub cwd: ::c_ushort,
179+
pub swd: ::c_ushort,
180+
pub ftw: ::c_ushort,
181+
pub fop: ::c_ushort,
182+
pub rip: ::c_ulong,
183+
pub rdp: ::c_ulong,
184+
pub mxcsr: ::c_uint,
185+
pub mxcr_mask: ::c_uint,
186+
pub st_space: [::c_uint; 32],
187+
pub xmm_space: [::c_uint; 64],
188+
padding: [::c_uint; 24],
189+
}
121190
}
122191

123192
cfg_if! {
@@ -254,6 +323,60 @@ cfg_if! {
254323
// Ignore padding field
255324
}
256325
}
326+
327+
impl PartialEq for user_fpregs_struct {
328+
fn eq(&self, other: &user_fpregs_struct) -> bool {
329+
self.cwd == other.cwd
330+
&& self.swd == other.swd
331+
&& self.ftw == other.ftw
332+
&& self.fop == other.fop
333+
&& self.rip == other.rip
334+
&& self.rdp == other.rdp
335+
&& self.mxcsr == other.mxcsr
336+
&& self.mxcr_mask == other.mxcr_mask
337+
&& self.st_space == other.st_space
338+
&& self
339+
.xmm_space
340+
.iter()
341+
.zip(other.xmm_space.iter())
342+
.all(|(a,b)| a == b)
343+
// Ignore padding field
344+
}
345+
}
346+
347+
impl Eq for user_fpregs_struct {}
348+
349+
impl ::fmt::Debug for user_fpregs_struct {
350+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
351+
f.debug_struct("user_fpregs_struct")
352+
.field("cwd", &self.cwd)
353+
.field("ftw", &self.ftw)
354+
.field("fop", &self.fop)
355+
.field("rip", &self.rip)
356+
.field("rdp", &self.rdp)
357+
.field("mxcsr", &self.mxcsr)
358+
.field("mxcr_mask", &self.mxcr_mask)
359+
.field("st_space", &self.st_space)
360+
// FIXME: .field("xmm_space", &self.xmm_space)
361+
// Ignore padding field
362+
.finish()
363+
}
364+
}
365+
366+
impl ::hash::Hash for user_fpregs_struct {
367+
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
368+
self.cwd.hash(state);
369+
self.ftw.hash(state);
370+
self.fop.hash(state);
371+
self.rip.hash(state);
372+
self.rdp.hash(state);
373+
self.mxcsr.hash(state);
374+
self.mxcr_mask.hash(state);
375+
self.st_space.hash(state);
376+
self.xmm_space.hash(state);
377+
// Ignore padding field
378+
}
379+
}
257380
}
258381
}
259382

0 commit comments

Comments
 (0)