armv7 support: add ucontext struct definition (#297)
* add uncontext and mcontext struct defs for armv7 * formatting * merge import lines
This commit is contained in:
parent
55c4b0c778
commit
f0d5c2f708
@ -84,13 +84,13 @@ use std::{
|
|||||||
use backtrace::Backtrace;
|
use backtrace::Backtrace;
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use crate::bolts::os::unix_signals::{setup_signal_handler, siginfo_t, Handler, Signal};
|
use crate::bolts::os::unix_signals::{
|
||||||
|
setup_signal_handler, siginfo_t, ucontext_t, Handler, Signal,
|
||||||
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
bolts::shmem::{ShMem, ShMemDescription, ShMemId, ShMemProvider},
|
bolts::shmem::{ShMem, ShMemDescription, ShMemId, ShMemProvider},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
#[cfg(unix)]
|
|
||||||
use libc::ucontext_t;
|
|
||||||
#[cfg(all(unix, feature = "std"))]
|
#[cfg(all(unix, feature = "std"))]
|
||||||
use nix::sys::socket::{self, sockopt::ReusePort};
|
use nix::sys::socket::{self, sockopt::ReusePort};
|
||||||
#[cfg(all(unix, feature = "std"))]
|
#[cfg(all(unix, feature = "std"))]
|
||||||
|
@ -12,10 +12,51 @@ use core::{
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
|
||||||
|
/// armv7 `libc` does not feature a `uncontext_t` implementation
|
||||||
|
#[cfg(target_arch = "arm")]
|
||||||
|
pub use libc::c_ulong;
|
||||||
|
|
||||||
|
#[cfg(target_arch = "arm")]
|
||||||
|
pub struct mcontext_t {
|
||||||
|
pub trap_no: c_ulong,
|
||||||
|
pub error_code: c_ulong,
|
||||||
|
pub oldmask: c_ulong,
|
||||||
|
pub arm_r0: c_ulong,
|
||||||
|
pub arm_r1: c_ulong,
|
||||||
|
pub arm_r2: c_ulong,
|
||||||
|
pub arm_r3: c_ulong,
|
||||||
|
pub arm_r4: c_ulong,
|
||||||
|
pub arm_r5: c_ulong,
|
||||||
|
pub arm_r6: c_ulong,
|
||||||
|
pub arm_r7: c_ulong,
|
||||||
|
pub arm_r8: c_ulong,
|
||||||
|
pub arm_r9: c_ulong,
|
||||||
|
pub arm_r10: c_ulong,
|
||||||
|
pub arm_fp: c_ulong,
|
||||||
|
pub arm_ip: c_ulong,
|
||||||
|
pub arm_sp: c_ulong,
|
||||||
|
pub arm_lr: c_ulong,
|
||||||
|
pub arm_pc: c_ulong,
|
||||||
|
pub arm_cpsr: c_ulong,
|
||||||
|
pub fault_address: c_ulong,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_arch = "arm")]
|
||||||
|
pub struct ucontext_t {
|
||||||
|
pub uc_flags: u32,
|
||||||
|
pub uc_link: *mut ucontext_t,
|
||||||
|
pub uc_stack: stack_t,
|
||||||
|
pub uc_mcontext: mcontext_t,
|
||||||
|
pub uc_sigmask: nix::sys::signal::SigSet,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "arm"))]
|
||||||
|
pub use libc::ucontext_t;
|
||||||
|
|
||||||
use libc::{
|
use libc::{
|
||||||
c_int, malloc, sigaction, sigaltstack, sigemptyset, stack_t, ucontext_t, SA_NODEFER,
|
c_int, malloc, sigaction, sigaltstack, sigemptyset, stack_t, SA_NODEFER, SA_ONSTACK,
|
||||||
SA_ONSTACK, SA_SIGINFO, SIGABRT, SIGALRM, SIGBUS, SIGFPE, SIGHUP, SIGILL, SIGINT, SIGKILL,
|
SA_SIGINFO, SIGABRT, SIGALRM, SIGBUS, SIGFPE, SIGHUP, SIGILL, SIGINT, SIGKILL, SIGPIPE,
|
||||||
SIGPIPE, SIGQUIT, SIGSEGV, SIGTERM, SIGTRAP, SIGUSR2,
|
SIGQUIT, SIGSEGV, SIGTERM, SIGTRAP, SIGUSR2,
|
||||||
};
|
};
|
||||||
use num_enum::{IntoPrimitive, TryFromPrimitive};
|
use num_enum::{IntoPrimitive, TryFromPrimitive};
|
||||||
|
|
||||||
|
@ -289,12 +289,12 @@ pub static mut GLOBAL_STATE: InProcessExecutorHandlerData = InProcessExecutorHan
|
|||||||
mod unix_signal_handler {
|
mod unix_signal_handler {
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use core::{mem::transmute, ptr};
|
use core::{mem::transmute, ptr};
|
||||||
use libc::{siginfo_t, ucontext_t};
|
use libc::siginfo_t;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use std::io::{stdout, Write};
|
use std::io::{stdout, Write};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bolts::os::unix_signals::{Handler, Signal},
|
bolts::os::unix_signals::{ucontext_t, Handler, Signal},
|
||||||
corpus::{Corpus, Testcase},
|
corpus::{Corpus, Testcase},
|
||||||
events::{Event, EventFirer, EventRestarter},
|
events::{Event, EventFirer, EventRestarter},
|
||||||
executors::{
|
executors::{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user