mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-08-30 23:58:11 +08:00
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user