You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Move .section down to under the function comment
* Ensure all routines are assembled as Arm, not Thumb
* Save an instruction by doing the AND directly on the SP register
Copy file name to clipboardExpand all lines: aarch32-rt/src/arch_v4/interrupt.rs
+1-2Lines changed: 1 addition & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -25,8 +25,7 @@ core::arch::global_asm!(
25
25
push {{ lr }} // save it to IRQ stack using LR
26
26
msr cpsr_c, {sys_mode} // switch to system mode so we can handle another interrupt (because if we interrupt irq mode we trash our own shadow registers)
27
27
push {{ lr }} // Save LR of system mode before using it for stack alignment
28
-
mov lr, sp // align SP down to eight byte boundary using LR
29
-
and lr, lr, 7 //
28
+
and lr, sp, 7 // align SP down to eight byte boundary using LR
30
29
sub sp, lr // SP now aligned - only push 64-bit values from here
31
30
push {{ r0-r3, r12, lr }} // push alignment amount (in LR) and preserved registers
Copy file name to clipboardExpand all lines: aarch32-rt/src/arch_v7/interrupt.rs
+3-4Lines changed: 3 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -6,23 +6,22 @@ core::arch::global_asm!(
6
6
// Work around https://github.com/rust-lang/rust/issues/127269
7
7
.fpu vfp3
8
8
9
-
.section .text._asm_default_irq_handler
10
-
11
9
// Called from the vector table when we have an interrupt.
12
10
// Saves state and calls a C-compatible handler like
13
11
// `extern "C" fn _irq_handler();`
14
12
//
15
13
// See https://developer.arm.com/documentation/dui0203/j/handling-processor-exceptions/armv6-and-earlier--armv7-a-and-armv7-r-profiles/interrupt-handlers
16
14
// for details on how we need to save LR_irq, SPSR_irq and LR_sys.
15
+
.section .text._asm_default_irq_handler
16
+
.arm
17
17
.global _asm_default_irq_handler
18
18
.type _asm_default_irq_handler, %function
19
19
_asm_default_irq_handler:
20
20
sub lr, lr, 4 // make sure we jump back to the right place
21
21
srsfd sp!, #{sys_mode} // store return state to SYS stack
22
22
cps #{sys_mode} // switch to system mode so we can handle another interrupt (because if we interrupt irq mode we trash our own shadow registers)
23
23
push {{ lr }} // save adjusted LR to SYS stack
24
-
mov lr, sp // align SP down to eight byte boundary using LR
25
-
and lr, lr, 7 //
24
+
and lr, sp, 7 // align SP down to eight byte boundary using LR
26
25
sub sp, lr // SP now aligned - only push 64-bit values from here
27
26
push {{ r0-r3, r12, lr }} // push alignment amount (in LR) and preserved registers
0 commit comments