summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/sleep.h
diff options
context:
space:
mode:
authorScott Williams <scwilliams@nvidia.com>2011-08-03 22:18:31 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 00:56:02 -0700
commit6aba0be8e5e6867c672c45e62460ac27f14fdc25 (patch)
treec4418208550ee51ba8e423ec716d9c6fc4fd1671 /arch/arm/mach-tegra/sleep.h
parent2d399f70e2d0a3df932270ee6bb3c07e3fa12d9c (diff)
ARM: tegra: power: Add stack frame debug checks
Tag the stack frame created by the CPU register context push macro with a magic number and validate that magic number in the register context pop macro to ensure that the stack remains balanced and uncorrupted. Change-Id: I6aa876496e30e6e70c0c60800c1b35d217595153 Signed-off-by: Scott Williams <scwilliams@nvidia.com> Rebase-Id: R78eba17c256f03bdd6457ca3ebb1ecdba5632e60
Diffstat (limited to 'arch/arm/mach-tegra/sleep.h')
-rw-r--r--arch/arm/mach-tegra/sleep.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/arch/arm/mach-tegra/sleep.h b/arch/arm/mach-tegra/sleep.h
index f919e9668978..cba062e9c723 100644
--- a/arch/arm/mach-tegra/sleep.h
+++ b/arch/arm/mach-tegra/sleep.h
@@ -107,7 +107,28 @@
dsb
.endm
-.macro push_ctx_regs
+#define DEBUG_CONTEXT_STACK 0
+
+/* pops a debug check token from the stack */
+.macro pop_stack_token tmp1, tmp2
+#if DEBUG_CONTEXT_STACK
+ mov32 \tmp1, 0xBAB1F00D
+ ldmfd sp!, {\tmp2}
+ cmp \tmp1, \tmp2
+ movne pc, #0
+#endif
+.endm
+
+/* pushes a debug check token onto the stack */
+.macro push_stack_token tmp1
+#if DEBUG_CONTEXT_STACK
+ mov32 \tmp1, 0xBAB1F00D
+ stmfd sp!, {\tmp1}
+#endif
+.endm
+
+.macro push_ctx_regs, tmp1
+ push_stack_token \tmp1 @ debug check word
stmfd sp!, {r4 - r11, lr}
/* FIXME: The next two instructions should be removed if our change to
save the diagnostic regsiter in the CPU context is accepted. */
@@ -115,12 +136,13 @@
stmfd sp!, {r4}
.endm
-.macro pop_ctx_regs
+.macro pop_ctx_regs, tmp1, tmp2
/* FIXME: The next two instructions should be removed if our change to
save the diagnostic regsiter in the CPU context is accepted. */
ldmfd sp!, {r4}
mcr p15, 0, r4, c15, c0, 1 @ write diagnostic register
ldmfd sp!, {r4 - r11, lr}
+ pop_stack_token \tmp1, \tmp2 @ debug stack debug token
.endm
#else