From 4c527e07fff9ed0a1eb0f34f1abd943706a0dba1 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Mon, 22 Feb 2021 19:55:49 +0100 Subject: Some improvements --- libc/cpu.c | 2 +- libc/mem.c | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'libc') diff --git a/libc/cpu.c b/libc/cpu.c index 2eb6c46..983a4a8 100644 --- a/libc/cpu.c +++ b/libc/cpu.c @@ -113,7 +113,7 @@ void fpu_restore(void) void cpu_enable_features(void) { - u32 a = 0, b = 0, c = 0, d = 0; + u32 a, b, c, d; cpuid(CPUID_FEATURES, &a, &b, &c, &d); cpu_features = d; if (cpu_has_feature(CPUID_FEAT_EDX_SSE)) { diff --git a/libc/mem.c b/libc/mem.c index 953ef33..b70f8ef 100644 --- a/libc/mem.c +++ b/libc/mem.c @@ -10,10 +10,10 @@ void *memcpy(void *dest, const void *src, u32 n) #ifdef userspace // Inspired by Jeko at osdev for (u32 i = 0; i < n / 16; i++) { - __asm__ __volatile__("movups (%0), %%xmm0\n" - "movntdq %%xmm0, (%1)\n" ::"r"(src), - "r"(dest) - : "memory"); + __asm__ volatile("movups (%0), %%xmm0\n" + "movntdq %%xmm0, (%1)\n" ::"r"(src), + "r"(dest) + : "memory"); src = ((u8 *)src) + 16; dest = ((u8 *)dest) + 16; @@ -23,17 +23,17 @@ void *memcpy(void *dest, const void *src, u32 n) n = n & 7; int d0, d1, d2; - __asm__ __volatile__("rep ; movsl\n\t" - "testb $2,%b4\n\t" - "je 1f\n\t" - "movsw\n" - "1:\ttestb $1,%b4\n\t" - "je 2f\n\t" - "movsb\n" - "2:" - : "=&c"(d0), "=&D"(d1), "=&S"(d2) - : "0"(n / 4), "q"(n), "1"((long)dest), "2"((long)src) - : "memory"); + __asm__ volatile("rep ; movsl\n\t" + "testb $2,%b4\n\t" + "je 1f\n\t" + "movsw\n" + "1:\ttestb $1,%b4\n\t" + "je 2f\n\t" + "movsb\n" + "2:" + : "=&c"(d0), "=&D"(d1), "=&S"(d2) + : "0"(n / 4), "q"(n), "1"((long)dest), "2"((long)src) + : "memory"); } return dest; #else -- cgit v1.2.3