@@ -571,10 +571,11 @@ __NAKED void ARM_FaultSave (void) {
571
571
572
572
/* If additional state information is available then clear the R4 .. R7 */
573
573
#if (ARM_FAULT_ARCH_ARMV8x_M != 0 ) // If arch is Armv8/8.1-M
574
- "ldrh r0, [r4,%[Content_ofs]]\n" // Load Content value
574
+ "ldr r0, =%c[Content_addr]\n" // Load Content address
575
+ "ldrh r0, [r0]\n" // Load Content value
575
576
"movs r1, %[AdditionalContext_bit]\n" // Load AdditionalContext bit
576
577
"ands r0, r1\n" // AND Content with AdditionalContext bit to determine if additional state context was saved
577
- "bne restore_regs_done\n" // If additional state context was not saved, do not clear R4 .. R7 and exit section
578
+ "beq restore_regs_done\n" // If additional state context was not saved, do not clear R4 .. R7 and exit section
578
579
"movs r4, #0\n" // Else if additional state context was saved, clear R4 .. R7
579
580
"movs r5, #0\n"
580
581
"movs r6, #0\n"
@@ -593,7 +594,7 @@ __NAKED void ARM_FaultSave (void) {
593
594
, [MagicNumber_ofs ] "i" (offsetof(ARM_FaultInfo_t , MagicNumber ))
594
595
, [MagicNumber_val ] "i" (ARM_FAULT_MAGIC_NUMBER )
595
596
, [CRC32_ofs ] "i" (offsetof(ARM_FaultInfo_t , CRC32 ))
596
- , [Content_ofs ] "i" (offsetof( ARM_FaultInfo_t , Content ) )
597
+ , [Content_addr ] "i" (& ARM_FaultInfo . Content )
597
598
, [AdditionalContext_bit ] "i" (1U << 6 )
598
599
, [R4_addr ] "i" (& ARM_FaultInfo .Registers .R4 )
599
600
, [crc_init_val ] "i" (ARM_FAULT_CRC32_INIT_VAL )
0 commit comments