-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add ucontext_t
and {get,set,make,swap}context
for powerpc64-linux
#3986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -189,6 +189,21 @@ s! { | |
pub ss_flags: c_int, | ||
pub ss_size: size_t, | ||
} | ||
|
||
#[repr(align(8))] | ||
pub struct clone_args { | ||
pub flags: c_ulonglong, | ||
pub pidfd: c_ulonglong, | ||
pub child_tid: c_ulonglong, | ||
pub parent_tid: c_ulonglong, | ||
pub exit_signal: c_ulonglong, | ||
pub stack: c_ulonglong, | ||
pub stack_size: c_ulonglong, | ||
pub tls: c_ulonglong, | ||
pub set_tid: c_ulonglong, | ||
pub set_tid_size: c_ulonglong, | ||
pub cgroup: c_ulonglong, | ||
} | ||
} | ||
|
||
s_no_extra_traits! { | ||
|
@@ -197,6 +212,70 @@ s_no_extra_traits! { | |
pub struct max_align_t { | ||
priv_: [i64; 4], | ||
} | ||
|
||
#[allow(missing_debug_implementations)] | ||
pub struct ucontext_t { | ||
pub uc_flags: c_ulong, | ||
pub uc_link: *mut ucontext_t, | ||
pub uc_stack: crate::stack_t, | ||
pub uc_sigmask: crate::sigset_t, | ||
pub uc_mcontext: mcontext_t, | ||
} | ||
|
||
#[allow(missing_debug_implementations)] | ||
pub struct pt_regs { | ||
pub gpr: [c_ulong; 32], | ||
pub nip: c_ulong, | ||
pub msr: c_ulong, | ||
pub orig_gpr3: c_ulong, | ||
pub ctr: c_ulong, | ||
pub link: c_ulong, | ||
pub xer: c_ulong, | ||
pub ccr: c_ulong, | ||
pub softe: c_ulong, | ||
pub trap: c_ulong, | ||
pub dar: c_ulong, | ||
pub dsisr: c_ulong, | ||
pub result: c_ulong, | ||
} | ||
Comment on lines
+225
to
+240
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you update the PR description with a permalink to the source in UAPI? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Done in the new PR. |
||
|
||
#[allow(missing_debug_implementations)] | ||
#[repr(align(8))] | ||
pub struct mcontext_t { | ||
__glibc_reserved: [c_ulong; 4], | ||
pub signal: c_int, | ||
__pad0: c_int, | ||
pub handler: c_ulong, | ||
pub oldmask: c_ulong, | ||
pub regs: *mut pt_regs, | ||
pub gp_regs: [c_ulong; __NGREG], | ||
pub fp_regs: [c_double; __NFPREG], | ||
pub v_regs: *mut vrregset_t, | ||
pub vmx_reserve: [c_long; __NVRREG + __NVRREG + 1], | ||
} | ||
Comment on lines
+242
to
+255
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a Also is this supposed to have an align repr? I don't see that at https://github.com/bminor/glibc/blob/a6eb8285d9bfb7ec0875b85ca356e833ff964d4f/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h#L120-L150 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Done in the new PR. |
||
|
||
#[allow(missing_debug_implementations)] | ||
#[repr(align(16))] | ||
pub struct vrregset_t { | ||
pub vrregs: [[c_uint; 4]; 32], | ||
pub vscr: vscr_t, | ||
pub vrsave: c_uint, | ||
__pad: [c_uint; 3], | ||
} | ||
|
||
#[allow(missing_debug_implementations)] | ||
#[repr(align(4))] | ||
pub struct vscr_t { | ||
#[cfg(target_endian = "big")] | ||
__pad: [c_uint; 3], | ||
#[cfg(target_endian = "big")] | ||
pub vscr_word: c_uint, | ||
|
||
#[cfg(target_endian = "little")] | ||
pub vscr_word: c_uint, | ||
#[cfg(target_endian = "little")] | ||
__pad: [c_uint; 3], | ||
} | ||
} | ||
|
||
pub const POSIX_FADV_DONTNEED: c_int = 4; | ||
|
@@ -209,6 +288,10 @@ pub const VEOF: usize = 4; | |
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; | ||
pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 32; | ||
|
||
pub const __NGREG: usize = 48; | ||
pub const __NFPREG: usize = 33; | ||
pub const __NVRREG: usize = 34; | ||
|
||
pub const O_APPEND: c_int = 1024; | ||
pub const O_CREAT: c_int = 64; | ||
pub const O_EXCL: c_int = 128; | ||
|
@@ -970,4 +1053,9 @@ extern "C" { | |
newp: *mut c_void, | ||
newlen: size_t, | ||
) -> c_int; | ||
|
||
pub fn getcontext(ucp: *mut ucontext_t) -> c_int; | ||
pub fn setcontext(ucp: *const ucontext_t) -> c_int; | ||
pub fn makecontext(ucp: *mut ucontext_t, func: extern "C" fn(), argc: c_int, ...); | ||
pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> c_int; | ||
Comment on lines
+1057
to
+1060
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just the definitions at https://github.com/bminor/glibc/blob/a6eb8285d9bfb7ec0875b85ca356e833ff964d4f/stdlib/ucontext.h#L34-L52 right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference https://github.com/bminor/glibc/blob/a6eb8285d9bfb7ec0875b85ca356e833ff964d4f/sysdeps/unix/sysv/linux/clone3.h#L34-L64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the reference in the new PR.