summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-08-10 07:51:17 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-08-10 09:24:26 +0200
commit7d097c5c693e8330b14ae2c0a10854c909b73060 (patch)
tree051680d26e3cdef1be4e652cce44e5de024aaa4d /cpukit
parentarm: Fix CPU context validation for Cortex-R4 (diff)
downloadrtems-7d097c5c693e8330b14ae2c0a10854c909b73060.tar.bz2
arm: Validate IT[7:0] bit field of PSR
Close #3093.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/score/cpu/arm/arm-context-validate.S30
1 files changed, 29 insertions, 1 deletions
diff --git a/cpukit/score/cpu/arm/arm-context-validate.S b/cpukit/score/cpu/arm/arm-context-validate.S
index 1cf53baea1..5c6ac217c5 100644
--- a/cpukit/score/cpu/arm/arm-context-validate.S
+++ b/cpukit/score/cpu/arm/arm-context-validate.S
@@ -44,9 +44,14 @@
#define FRAME_SIZE (FRAME_OFFSET_LR + 4)
#endif
+ .syntax unified
.section .text
+#ifdef __thumb2__
FUNCTION_THUMB_ENTRY(_CPU_Context_validate)
+#else
+FUNCTION_ENTRY(_CPU_Context_validate)
+#endif
/* Save */
@@ -170,11 +175,34 @@ check:
bne restore
.endm
- cmp r2, sp
+ /* A compare involving the stack pointer is deprecated */
+ mov r1, sp
+ cmp r2, r1
bne restore
mov r1, r0
+#ifdef __thumb2__
+ cmp r1, r1
+ itttt eq
+ addeq r1, #1
+ addeq r1, #2
+ addeq r1, #4
+ addeq r1, #8
+ subs r1, #15
+ cmp r1, r0
+ bne restore
+ cmp r1, r1
+ iteee eq
+ addeq r1, #1
+ addne r1, #2
+ addne r1, #4
+ addne r1, #8
+ subs r1, #1
+ cmp r1, r0
+ bne restore
+#endif
+
#ifndef ARM_MULTILIB_VFP
check_register r3
#endif