summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibC')
-rw-r--r--Userland/Libraries/LibC/pthread.cpp4
-rw-r--r--Userland/Libraries/LibC/string.cpp10
2 files changed, 11 insertions, 3 deletions
diff --git a/Userland/Libraries/LibC/pthread.cpp b/Userland/Libraries/LibC/pthread.cpp
index 5f9d981096..81caebf276 100644
--- a/Userland/Libraries/LibC/pthread.cpp
+++ b/Userland/Libraries/LibC/pthread.cpp
@@ -97,11 +97,13 @@ static int create_thread(pthread_t* thread, void* (*entry)(void*), void* argumen
push_on_stack(thread_params->stack_location);
push_on_stack(argument);
push_on_stack((void*)entry);
-#else
+#elif ARCH(X86_64)
thread_params->rdi = (FlatPtr)entry;
thread_params->rsi = (FlatPtr)argument;
thread_params->rdx = (FlatPtr)thread_params->stack_location;
thread_params->rcx = thread_params->stack_size;
+#else
+# error Unknown architecture
#endif
VERIFY((uintptr_t)stack % 16 == 0);
diff --git a/Userland/Libraries/LibC/string.cpp b/Userland/Libraries/LibC/string.cpp
index 054553d8cf..d031a3cff8 100644
--- a/Userland/Libraries/LibC/string.cpp
+++ b/Userland/Libraries/LibC/string.cpp
@@ -130,17 +130,19 @@ int timingsafe_memcmp(void const* b1, void const* b2, size_t len)
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/memcpy.html
void* memcpy(void* dest_ptr, void const* src_ptr, size_t n)
{
+#if ARCH(I386) || ARCH(X86_64)
void* original_dest = dest_ptr;
asm volatile(
"rep movsb"
: "+D"(dest_ptr), "+S"(src_ptr), "+c"(n)::"memory");
return original_dest;
+#else
+# error Unknown architecture
+#endif
}
#if ARCH(I386)
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/memset.html
-//
-// For x86-64, an optimized ASM implementation is found in ./arch/x86_64/memset.S
void* memset(void* dest_ptr, int c, size_t n)
{
size_t dest = (size_t)dest_ptr;
@@ -164,6 +166,10 @@ void* memset(void* dest_ptr, int c, size_t n)
: "memory");
return dest_ptr;
}
+#elif ARCH(X86_64)
+// For x86-64, an optimized ASM implementation is found in ./arch/x86_64/memset.S
+#else
+# error Unknown architecture
#endif
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/memmove.html