]> git.kernelconcepts.de Git - karo-tx-redboot.git/blobdiff - packages/hal/arm/arch/v2_0/src/context.S
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / packages / hal / arm / arch / v2_0 / src / context.S
index c71b5c4a02c13a66868a966cd10b096b03738909..88ce0d7cbd4cd6597467bcab85efe56d6a0df80e 100644 (file)
@@ -89,12 +89,13 @@ _name_:
 // Need to save/restore R4..R12, R13 (sp), R14 (lr)
 
 // Note: this is a little wasteful since r0..r3 don't need to be saved.
-// They are saved here though so that the information can match the HAL_SavedRegisters
+// They are saved here though so that the information can match the
+// HAL_SavedRegisters
         
 FUNC_START_ARM(hal_thread_switch_context, r2)
-        sub     ip,sp,#20               // skip svc_sp, svc_lr, vector, cpsr, and pc
-        stmfd   ip!,{sp,lr}
-        mov     sp,ip
+        mov     ip,sp
+        sub     sp,sp,#(ARMREG_SIZE - armreg_lr - 4) // skip svc_sp, svc_lr, vector, cpsr, and pc
+        stmfd   sp!,{ip,lr}
         stmfd   sp!,{r0-r10,fp,ip}
         mrs     r2,cpsr
         str     r2,[sp,#armreg_cpsr]