[rtems commit] arm: Validate IT[7:0] bit field of PSR

Sebastian Huber sebh at rtems.org
Thu Aug 10 06:19:01 UTC 2017


Module:    rtems
Branch:    master
Commit:    a95d909878576c6467ba8ade52fedadeccb87b9c
Changeset: http://git.rtems.org/rtems/commit/?id=a95d909878576c6467ba8ade52fedadeccb87b9c

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Aug 10 07:51:17 2017 +0200

arm: Validate IT[7:0] bit field of PSR

Update #3093.

---

 cpukit/score/cpu/arm/arm-context-validate.S | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/cpukit/score/cpu/arm/arm-context-validate.S b/cpukit/score/cpu/arm/arm-context-validate.S
index d735bc6..2526691 100644
--- a/cpukit/score/cpu/arm/arm-context-validate.S
+++ b/cpukit/score/cpu/arm/arm-context-validate.S
@@ -44,6 +44,7 @@
   #define FRAME_SIZE (FRAME_OFFSET_LR + 4)
 #endif
 
+	.syntax	unified
 	.section	.text
 
 #ifdef __thumb__
@@ -174,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




More information about the vc mailing list