diff --git a/repos/base-hw/src/core/spec/arm_v7/mode_transition.s b/repos/base-hw/src/core/spec/arm_v7/mode_transition.s index ad41f5a8c5..52777ed6fe 100644 --- a/repos/base-hw/src/core/spec/arm_v7/mode_transition.s +++ b/repos/base-hw/src/core/spec/arm_v7/mode_transition.s @@ -104,6 +104,14 @@ .endm +/* + * Invalidate all branch predictors + */ +.macro _bpiall + mcr p15, 0, r0, c7, c5, 6 +.endm + + /** * Switch to a given protection domain * @@ -112,6 +120,15 @@ * \param new_ttbr0 new TTBR0 value, read/write reg */ .macro _switch_protection_domain transit_ttbr0, new_cidr, new_ttbr0 + + /* + * FIXME: Fixes instability problems that were observed on the + * PandaBoard only. We neither know why invalidating predictions + * at PD switches is a fix nor wether not doing so is the real + * cause of this instability. + */ + _bpiall + _write_ttbr0 \transit_ttbr0 isb _write_cidr \new_cidr