On 5/11/20 11:48 PM, Nick Hudson wrote: > > +#if defined(__NetBSD__) > + /* siginfo_t::si_trap is the FSR value, in which bit 11 is WnR > + * (assuming a v6 or later processor; on v5 we will always report > + * this as a read). > + */ > + is_write = extract32(si->si_trap, 11, 1); > +#else > /* error_code is the FSR value, in which bit 11 is WnR (assuming a v6 or > * later processor; on v5 we will always report this as a read). > */ > is_write = extract32(uc->uc_mcontext.error_code, 11, 1); > +#endif
While this works, I think it might be a bit clearer as uint32_t fsr; #ifdef __NetBSD__ fsr = si->si_trap; #else fsr = uc->uc_mcontext.error_code; #endif /* * In the FSR, bit 11 is WnR, assuming a v6 or * later processor. On v5 we will always report * this as a read, which will fail later. */ is_write = extract32(fsr, 11, 1); r~