Skip to content

Fix CSEL/CSINC/CSINV/CSNEG treating r15 as PC instead of zero in Thumb legacy decoder#24

Open
mananni-silabs wants to merge 1 commit intoantmicro:masterfrom
SiliconLabsSoftware:bugfix/arm_csel_csinc_csinv_csneg
Open

Fix CSEL/CSINC/CSINV/CSNEG treating r15 as PC instead of zero in Thumb legacy decoder#24
mananni-silabs wants to merge 1 commit intoantmicro:masterfrom
SiliconLabsSoftware:bugfix/arm_csel_csinc_csinv_csneg

Conversation

@mananni-silabs
Copy link
Copy Markdown

Per the Armv8.1-M specification, register field 0b1111 in CSEL/CSINC/CSINV/CSNEG instructions encodes the zero register, not the program counter. The legacy Thumb-32 decoder in arch/arm/translate.c (used by 32-bit ARM targets like Cortex-M55) called load_reg() for these fields, which returns the PC value when the register is 15. This caused CSET (an alias for CSINC with both sources as ZR) to produce PC-derived values instead of the expected 0 or 1.

…b legacy decoder

Per the Armv8.1-M specification, register field 0b1111 in
CSEL/CSINC/CSINV/CSNEG instructions encodes the zero register, not
the program counter. The legacy Thumb-32 decoder in arch/arm/translate.c
(used by 32-bit ARM targets like Cortex-M55) called load_reg() for
these fields, which returns the PC value when the register is 15. This
caused CSET (an alias for CSINC with both sources as ZR) to produce
PC-derived values instead of the expected 0 or 1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant