Skip to contentSkip to conversation

ARM: OMAP4: sleep: Save the complete used register stack frame

PATCH New Santosh Shilimkar 2 participants 3 messages Jul 13, 2012 – Aug 9, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: OMAP4: sleep: Save the complete used register stack frame

OMAP4 sleep entry code even though itself don't use many CPU registers makes call to the v7_flush_dcache_all() which uses them. Since v7_flush_dcache_all() doesn't make use of stack, the caller must take care of the stack frame. Otherwise it will lead to corrupted stack frame.

Fix it by saving used registers.

---
 arch/arm/mach-omap2/sleep44xx.S |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/sleep44xx.S +2 -2
index 9f6b83d..b5823e9 100644
@@ -58,7 +58,7 @@ ppa_por_params:
  * CPU failed to transition to targeted OFF/DORMANT state.
  */
 ENTRY(omap4_finish_suspend)
-	stmfd	sp!, {lr}
+	stmfd	sp!, {r4-r12, lr}
 	cmp	r0, #0x0
 	beq	do_WFI				@ No lowpower state, jump to WFI
 
@@ -226,7 +226,7 @@ scu_gp_clear:
 skip_scu_gp_clear:
 	isb
 	dsb
-	ldmfd	sp!, {pc}
+	ldmfd	sp!, {r4-r12, pc}
 ENDPROC(omap4_finish_suspend)
 
 /*
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 ARM: OMAP4: sleep: Save the complete used register stack frame

Quoted 10 lines · Santosh Shilimkar

OMAP4 sleep entry code even though itself don't use many CPU registers makes call to the v7_flush_dcache_all() which uses them. Since v7_flush_dcache_all() doesn't make use of stack, the caller must take care of the stack frame. Otherwise it will lead to corrupted stack frame.

Fix it by saving used registers.

Please add a brief comment in the code as well explaining why the additional registers are saved/restored.

After that, I'll add to my PM fixes queue for v3.6-rc.

Thanks for the fix.

Kevin

Quoted 26 lines
---
 arch/arm/mach-omap2/sleep44xx.S |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/sleep44xx.S +2 -2
index 9f6b83d..b5823e9 100644
@@ -58,7 +58,7 @@ ppa_por_params:
  * CPU failed to transition to targeted OFF/DORMANT state.
  */
 ENTRY(omap4_finish_suspend)
-	stmfd	sp!, {lr}
+	stmfd	sp!, {r4-r12, lr}
 	cmp	r0, #0x0
 	beq	do_WFI				@ No lowpower state, jump to WFI
 
@@ -226,7 +226,7 @@ scu_gp_clear:
 skip_scu_gp_clear:
 	isb
 	dsb
-	ldmfd	sp!, {pc}
+	ldmfd	sp!, {r4-r12, pc}
 ENDPROC(omap4_finish_suspend)
 
 /*
#2 lore raw

PATCH 1/1 ARM: OMAP4: sleep: Save the complete used register stack frame

Quoted 7 lines · Kevin Hilman
Quoted 5 lines · Santosh Shilimkar

OMAP4 sleep entry code even though itself don't use many CPU registers makes call to the v7_flush_dcache_all() which uses them. Since v7_flush_dcache_all() doesn't make use of stack, the caller must take care of the stack frame. Otherwise it will lead to corrupted stack frame.

Quoted 9 lines
Quoted 5 lines

Fix it by saving used registers.

Please add a brief comment in the code as well explaining why the additional registers are saved/restored.

Ok.

Quoted 2 lines

After that, I'll add to my PM fixes queue for v3.6-rc.

Thanks.

Regards
Santosh