Skip to content

Commit a8b6c64

Browse files
committed
Fix SVC from Thumb mode.
We were checking the *current* processor status register, not the *saved* processor status register that tells us what mode we were in when the SVC call occurred.
1 parent 3600c25 commit a8b6c64

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cortex-a-rt/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ core::arch::global_asm!(
704704
"#,
705705
save_context!(),
706706
r#"
707-
mrs r0, cpsr // Load processor status
707+
mrs r0, spsr // Load processor status
708708
tst r0, {t_bit} // Occurred in Thumb state?
709709
ldrhne r0, [lr,#-2] // Yes: Load halfword and...
710710
bicne r0, r0, #0xFF00 // ...extract comment field

cortex-r-rt/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ core::arch::global_asm!(
639639
"#,
640640
save_context!(),
641641
r#"
642-
mrs r0, cpsr // Load processor status
642+
mrs r0, spsr // Load processor status
643643
tst r0, {t_bit} // Occurred in Thumb state?
644644
ldrhne r0, [lr,#-2] // Yes: Load halfword and...
645645
bicne r0, r0, #0xFF00 // ...extract comment field

0 commit comments

Comments
 (0)