diff --git a/arch/x86/include/asm/string.h b/arch/x86/include/asm/string.h index 51d288a5..fd6480e0 100644 --- a/arch/x86/include/asm/string.h +++ b/arch/x86/include/asm/string.h @@ -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 diff --git a/arch/x86/scc/scc_memcpy.h b/arch/x86/scc/scc_memcpy.h index 31eb47c1..8748a496 100644 --- a/arch/x86/scc/scc_memcpy.h +++ b/arch/x86/scc/scc_memcpy.h @@ -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 diff --git a/include/metalsvm/tasks_types.h b/include/metalsvm/tasks_types.h index 784167a7..926b66cd 100644 --- a/include/metalsvm/tasks_types.h +++ b/include/metalsvm/tasks_types.h @@ -93,7 +93,11 @@ typedef struct task { /// Start address of the heap size_t start_heap; /// End address of the heap +<<<<<<< HEAD size_t end_heap; +======= + uint32_t end_heap; +>>>>>>> master /// LwIP error code int lwip_err; /// Mail inbox diff --git a/kernel/tests.c b/kernel/tests.c index d04cf938..281329d5 100644 --- a/kernel/tests.c +++ b/kernel/tests.c @@ -279,7 +279,7 @@ int test_init(void) //create_kernel_task(NULL, consumer, NULL, NORMAL_PRIO); //create_kernel_task(NULL, mail_ping, NULL, NORMAL_PRIO); //create_user_task(NULL, "/bin/hello", argv); - create_user_task(NULL, "/bin/tests", argv); + //create_user_task(NULL, "/bin/tests", argv); //create_user_task(NULL, "/bin/jacobi", argv); //create_user_task(NULL, "/bin/jacobi", argv); //create_user_task(NULL, "/bin/server", server_argv);