You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/02/08 07:04:03 UTC

[GitHub] [incubator-nuttx] zhuyanlinzyl commented on a change in pull request #5367: armv7-r/a: bugfix: fix a4 register use but not store in xxx_invalidate/flush/clean_all.S

zhuyanlinzyl commented on a change in pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#discussion_r801318847



##########
File path: arch/arm/src/armv7-a/cp15_clean_dcache_all.S
##########
@@ -86,36 +86,34 @@
  *
  ****************************************************************************/
 
-	.globl	cp15_flush_dcache_all
-	.type	cp15_flush_dcache_all, function
+	.globl	cp15_clean_dcache_all
+	.type	cp15_clean_dcache_all, function
 
-cp15_flush_dcache_all:
+cp15_clean_dcache_all:
+
+	mrc		CP15_CCSIDR(r1)			/* Read the Cache Size Identification Register */
 
-	mrc		CP15_CCSIDR(r0)			/* Read the Cache Size Identification Register */
 	ldr		r3, =0x7fff			/* Isolate the NumSets field (bits 13-27) */
-	and		r0, r3, r0, lsr #13		/* r0=NumSets (number of sets - 1) */
+	and		r0, r3, r1, lsr #13		/* r0=NumSets (number of sets - 1) */
 
 	ldr		r3, =0x3ff			/* Isolate the way field (bits 3-12) */
-	add		r4, r3, r0, lsr #3		/* r4=(number of ways - 1) */
+	and		r1, r3, r1, lsr #3		/* r1=(number of ways - 1) */
 
-	mov		r1, #0				/* r1 = way loop counter */
 way_loop:
-
-	mov		r3, #0				/* r3 = set loop counter */
+	mov		r3, r0				/* Init Sets */
 set_loop:
 	mov		r2, r1, lsl #30			/* r2 = way loop counter << 30 */
 	orr		r2, r3, lsl #5			/* r2 = set/way cache operation format */
-	mcr		CP15_DCCISW(r2)			/* Data Cache Invalidate by Set/Way */
-	add		r3, r3, #1			/* Increment set counter */
-	cmp		r0, r3				/* Last set? */
+	mcr		CP15_DCCSW(r2)			/* Data Cache Clean by Set/Way */
+	sub		r3, r3, #1			/* Subtraction set counter */
+	cmp		r3, #0				/* Last set? */
 	bne		set_loop			/* Keep looping if not */
 
-	add		r1, r1, #1			/* Increment the way counter */
-	cmp		r4, r1				/* Last way */
+	sub		r1, r1, #1			/* Subtraction the way counter */
+	cmp		r1, #0				/* Last way? */

Review comment:
       @masayuki2009  
   
   Yes, `sub` and `bne` only loop 3times.
   I use `subs` and `bcs` , It should loop 4times.
   
   I update the patch. please review agian.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org