Merge branch 'master' into svm
This commit is contained in:
commit
c471e8177e
2 changed files with 63 additions and 1 deletions
|
@ -35,6 +35,59 @@ void copy_page_physical(void* dest, const void * src);
|
|||
|
||||
#ifdef HAVE_ARCH_MEMCPY
|
||||
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
/** @brief Fast procedure to get a byte range from RAM into on-die memory.
|
||||
*
|
||||
* A write access, which cache line is not present, doesn't perform (on the
|
||||
* current SCC architecture) a cache line fill. Therefore, the core writes
|
||||
* in this case directly to the memory.
|
||||
*
|
||||
* The following function copies by prefetching its destintation. Therefore,
|
||||
* the function avoids the bad behavior of a "write miss".
|
||||
*
|
||||
* @param dest Destination address
|
||||
* @param src Source address
|
||||
* @param count Range size in bytes
|
||||
*/
|
||||
inline static void *memcpy(void *dest, const void *src, size_t count)
|
||||
{
|
||||
int32_t h, i, j, k, l, m;
|
||||
|
||||
asm volatile ("cld;\n\t"
|
||||
"1: cmpl $0, %%eax ; je 3f\n\t"
|
||||
"movl (%%esi), %%ecx\n\t"
|
||||
"movl (%%edi), %%edx\n\t"
|
||||
"cmpl $1, %%eax ; je 2f\n\t"
|
||||
"movl 32(%%esi), %%ecx\n\t"
|
||||
"movl 32(%%edi), %%edx\n\t"
|
||||
"2: movl 0(%%esi), %%ecx\n\t"
|
||||
"movl 4(%%esi), %%edx\n\t"
|
||||
"movl %%ecx, 0(%%edi)\n\t"
|
||||
"movl %%edx, 4(%%edi)\n\t"
|
||||
"movl 8(%%esi), %%ecx\n\t"
|
||||
"movl 12(%%esi), %%edx\n\t"
|
||||
"movl %%ecx, 8(%%edi)\n\t"
|
||||
"movl %%edx, 12(%%edi)\n\t"
|
||||
"movl 16(%%esi), %%ecx\n\t"
|
||||
"movl 20(%%esi), %%edx\n\t"
|
||||
"movl %%ecx, 16(%%edi)\n\t"
|
||||
"movl %%edx, 20(%%edi)\n\t"
|
||||
"movl 24(%%esi), %%ecx\n\t"
|
||||
"movl 28(%%esi), %%edx\n\t"
|
||||
"movl %%ecx, 24(%%edi)\n\t"
|
||||
"movl %%edx, 28(%%edi)\n\t"
|
||||
"addl $32, %%esi\n\t"
|
||||
"addl $32, %%edi\n\t"
|
||||
"dec %%eax ; jmp 1b\n\t"
|
||||
"3: movl %%ebx, %%ecx\n\t"
|
||||
"movl (%%edi), %%edx\n\t"
|
||||
"andl $31, %%ecx\n\t"
|
||||
"rep ; movsb\n\t":"=&a" (h), "=&D"(i), "=&S"(j), "=&b"(k), "=&c"(l), "=&d"(m)
|
||||
: "0"(count / 32), "1"(dest), "2"(src), "3"(count) : "memory");
|
||||
|
||||
return dest;
|
||||
}
|
||||
#else
|
||||
/** @brief Copy a byte range from source to dest
|
||||
*
|
||||
* @param dest Destination address
|
||||
|
@ -60,6 +113,8 @@ inline static void *memcpy(void* dest, const void *src, size_t count)
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ARCH_MEMSET
|
||||
|
||||
/** @brief Repeated write of a value to a whole range of bytes
|
||||
|
|
|
@ -85,7 +85,13 @@ inline static void *memcpy_get(void *dest, const void *src, size_t count)
|
|||
return dest;
|
||||
}
|
||||
|
||||
|
||||
#if 1
|
||||
/*
|
||||
* In our kernel, we didn't want to use FPU registers.
|
||||
* Therefore, we use standard memcpy routine
|
||||
*/
|
||||
#define memcpy_put memcpy
|
||||
#else
|
||||
/** @brief Fast procedure to get a byte range from on-die memory into RAM.
|
||||
*
|
||||
* If the destination is located on on-die memory (MPB), classical prefetching
|
||||
|
@ -166,6 +172,7 @@ inline static void *memcpy_put(void *dest, const void *src, size_t count)
|
|||
|
||||
return dest;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue