chore(core): mock irq_lock functionality in emulator
What changed, and why it matters
This commit only adds stub (mock) implementations of interrupt-locking functions for the Trezor emulator build. It also fixes a typo in a comment. There is no security-relevant code change.
No action required; this is a benign emulator-only build stub with no security relevance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds #else branch implementations of irq_lock() and irq_unlock() that do nothing for non-target (emulator) builds, plus corrects a comment typo (‘efore’ -> ‘before’). The real interrupt-disable logic remains unchanged for actual hardware builds. No vulnerability is introduced or fixed.
Changed components
core/embed/sys/irq/inc/sys/irq.hInspect captured patch +7 / −1
diff --git a/core/embed/sys/irq/inc/sys/irq.h b/core/embed/sys/irq/inc/sys/irq.h
index 195037c1..3562eab5 100644
--- a/core/embed/sys/irq/inc/sys/irq.h
+++ b/core/embed/sys/irq/inc/sys/irq.h
@@ -55,7 +55,7 @@ static inline irq_key_t query_irq(void) { return __get_PRIMASK(); }
// Important:
// - The `"memory"` clobber is included to prevent the compiler from reordering
// memory operations across this function, ensuring that all memory accesses
-// efore `irq_lock()` are completed before interrupts are disabled.
+// before `irq_lock()` are completed before interrupts are disabled.
// - The order of operations on non-volatile variables relative to this
// function is not guaranteed without memory barriers or other
// synchronization mechanisms.
@@ -101,6 +101,12 @@ static inline void irq_unlock(irq_key_t key) {
// Lowest priority in the system used by SVC and PENDSV exception handlers
#define IRQ_PRI_LOWEST NVIC_EncodePriority(NVIC_PRIORITYGROUP_4, 15, 0)
+#else
+
+static inline irq_key_t irq_lock(void) { return 0; }
+
+static inline void irq_unlock(irq_key_t key) {}
+
#endif
// functions for rust exposure, same behavior as the macros above
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.