[rtems commit] bsps/powerpc: Fix warning

Sebastian Huber sebh at rtems.org
Fri Jun 16 04:23:09 UTC 2017


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jun 16 06:22:21 2017 +0200

bsps/powerpc: Fix warning

Close #3051.

---

 c/src/lib/libbsp/powerpc/shared/src/memcpy.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/c/src/lib/libbsp/powerpc/shared/src/memcpy.c b/c/src/lib/libbsp/powerpc/shared/src/memcpy.c
index 6265f64..bd72d37 100644
--- a/c/src/lib/libbsp/powerpc/shared/src/memcpy.c
+++ b/c/src/lib/libbsp/powerpc/shared/src/memcpy.c
@@ -25,7 +25,7 @@
 
 #include <libcpu/powerpc-utility.h>
 
-#define CACHE_LINE_SIZE 32
+#define PPC_CACHE_ALIGNMENT 32
 
 #define WORD_SIZE 4
 
@@ -47,8 +47,8 @@ void *memcpy(void *dst_ptr, const void *src_ptr, size_t n)
     uint32_t *word_dst = (uint32_t *) dst - 1;
     const uint32_t *word_src = (const uint32_t *) src - 1;
 
-    if (n >= 2 * CACHE_LINE_SIZE - WORD_SIZE) {
-      while ((uintptr_t) (word_dst + 1) % CACHE_LINE_SIZE != 0) {
+    if (n >= 2 * PPC_CACHE_ALIGNMENT - WORD_SIZE) {
+      while ((uintptr_t) (word_dst + 1) % PPC_CACHE_ALIGNMENT != 0) {
         uint32_t tmp;
         __asm__ volatile (
           "lwzu %[tmp], 0x4(%[src])\n"
@@ -60,7 +60,7 @@ void *memcpy(void *dst_ptr, const void *src_ptr, size_t n)
         n -= WORD_SIZE;
       }
 
-      while (n >= CACHE_LINE_SIZE) {
+      while (n >= PPC_CACHE_ALIGNMENT) {
         uint32_t dst_offset = 4;
         uint32_t src_offset = 32 + 4;
         uint32_t tmp0;
@@ -95,7 +95,7 @@ void *memcpy(void *dst_ptr, const void *src_ptr, size_t n)
           : [src_offset] "r" (src_offset),
             [dst_offset] "r" (dst_offset)
         );
-        n -= CACHE_LINE_SIZE;
+        n -= PPC_CACHE_ALIGNMENT;
       }
     }
 




More information about the vc mailing list