From 51c7966892c8f3fd1f8f88ea6ee39b11ef5eb9db Mon Sep 17 00:00:00 2001 From: Aaditya Agarwal Date: Wed, 11 Nov 2026 14:22:29 +0530 Subject: [PATCH] cpukit/score/cpu/microblaze: Use a reserved opcode _CPU_Instruction_illegal() emitted ".word 0x0". Major opcode 0 is "add", so the word is "add r0, r0, r0" and retires without an exception unless the core is synthesized with C_OPCODE_0x0_ILLEGAL. Both this option and C_ILL_OPCODE_EXCEPTION are synthesis options of the soft core, and QEMU defaults both to false. Use major opcode 0x3f, which is unallocated in the MicroBlaze architecture. An invalid major opcode requires only C_ILL_OPCODE_EXCEPTION to raise an illegal opcode exception. Close #5759. Signed-off-by: Aaditya Agarwal --- cpukit/score/cpu/microblaze/include/rtems/score/cpuimpl.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cpukit/score/cpu/microblaze/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/microblaze/include/rtems/score/cpuimpl.h index 0a975795ab..38a2683b59 100644 --- a/cpukit/score/cpu/microblaze/include/rtems/score/cpuimpl.h +++ b/cpukit/score/cpu/microblaze/include/rtems/score/cpuimpl.h @@ -91,7 +91,13 @@ void _CPU_Context_validate( uintptr_t pattern ); static inline void _CPU_Instruction_illegal( void ) { - __asm__ volatile ( ".word 0x0" ); + /* + * A ".word 0x0" is an "add r0, r0, r0" on this architecture, which retires + * without an exception unless the core is synthesized with + * C_OPCODE_0x0_ILLEGAL. The major opcode 0x3f is unallocated, so it raises + * the illegal opcode exception requiring only C_ILL_OPCODE_EXCEPTION. + */ + __asm__ volatile ( ".word 0xfc000000" ); } static inline void _CPU_Instruction_no_operation( void )