On Mon, 15 Jun 2026 at 01:08, Kyle Fox <[email protected]> wrote:
>
> M-profile CCR.BFHFNMIGN lets software executing at a negative execution
> priority (in HardFault/NMI, or with FAULTMASK set) suppress precise data
> BusFaults caused by load/store instructions: the access completes
> returning UNKNOWN data, the fault status is recorded in BFSR/BFAR, but no
> BusFault exception is taken. Software uses this to probe for the presence
> of a device.
Thanks; I've applied this to target-arm.next.
I tweaked the v7m_read_sg_stack_word() slightly so that the return-early
case is the "take fault" one and we fall into the following "return a value"
codepath if we suppressed the fault because of BFHFNMIGN:
/*
* The SG instruction's stack-word load is an AccType_NORMAL data
* access, so CCR.BFHFNMIGN applies: at negative execution priority
* with BFHFNMIGN set, the BusFault is suppressed -- the access
* completes returning UNKNOWN data (status recorded above), with no
* BusFault exception pended.
*/
if (!((env->v7m.ccr[M_REG_NS] & R_V7M_CCR_BFHFNMIGN_MASK) &&
armv7m_nvic_neg_prio_requested(env->nvic, env->v7m.secure))) {
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_BUS, false);
return false;
}
/* BusFault suppressed; data value is UNKNOWN, we choose 0 */
value = 0;
}
[etc]
-- PMM