mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 09:47:35 +00:00
Kernel: Build MiniStdLib.cpp in aarch64 builds
This commit is contained in:
parent
208aa05cf3
commit
a8d96df8e0
2 changed files with 20 additions and 7 deletions
|
@ -10,6 +10,7 @@ extern "C" {
|
||||||
|
|
||||||
void* memcpy(void* dest_ptr, const void* src_ptr, size_t n)
|
void* memcpy(void* dest_ptr, const void* src_ptr, size_t n)
|
||||||
{
|
{
|
||||||
|
#if ARCH(I386) || ARCH(X86_64)
|
||||||
size_t dest = (size_t)dest_ptr;
|
size_t dest = (size_t)dest_ptr;
|
||||||
size_t src = (size_t)src_ptr;
|
size_t src = (size_t)src_ptr;
|
||||||
// FIXME: Support starting at an unaligned address.
|
// FIXME: Support starting at an unaligned address.
|
||||||
|
@ -35,6 +36,12 @@ void* memcpy(void* dest_ptr, const void* src_ptr, size_t n)
|
||||||
asm volatile(
|
asm volatile(
|
||||||
"rep movsb\n" ::"S"(src), "D"(dest), "c"(n)
|
"rep movsb\n" ::"S"(src), "D"(dest), "c"(n)
|
||||||
: "memory");
|
: "memory");
|
||||||
|
#else
|
||||||
|
u8* pd = (u8*)dest_ptr;
|
||||||
|
u8 const* ps = (u8 const*)src_ptr;
|
||||||
|
for (; n--;)
|
||||||
|
*pd++ = *ps++;
|
||||||
|
#endif
|
||||||
return dest_ptr;
|
return dest_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +59,7 @@ void* memmove(void* dest, const void* src, size_t n)
|
||||||
|
|
||||||
void* memset(void* dest_ptr, int c, size_t n)
|
void* memset(void* dest_ptr, int c, size_t n)
|
||||||
{
|
{
|
||||||
|
#if ARCH(I386) || ARCH(X86_64)
|
||||||
size_t dest = (size_t)dest_ptr;
|
size_t dest = (size_t)dest_ptr;
|
||||||
// FIXME: Support starting at an unaligned address.
|
// FIXME: Support starting at an unaligned address.
|
||||||
if (!(dest & 0x3) && n >= 12) {
|
if (!(dest & 0x3) && n >= 12) {
|
||||||
|
@ -79,6 +87,11 @@ void* memset(void* dest_ptr, int c, size_t n)
|
||||||
: "=D"(dest), "=c"(n)
|
: "=D"(dest), "=c"(n)
|
||||||
: "0"(dest), "1"(n), "a"(c)
|
: "0"(dest), "1"(n), "a"(c)
|
||||||
: "memory");
|
: "memory");
|
||||||
|
#else
|
||||||
|
u8* pd = (u8*)dest_ptr;
|
||||||
|
for (; n--;)
|
||||||
|
*pd++ = c;
|
||||||
|
#endif
|
||||||
return dest_ptr;
|
return dest_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
UBSanitizer.cpp
|
UBSanitizer.cpp
|
||||||
|
../MiniStdLib.cpp
|
||||||
)
|
)
|
||||||
if ("${SERENITY_ARCH}" STREQUAL "aarch64")
|
if ("${SERENITY_ARCH}" STREQUAL "aarch64")
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
|
@ -14,7 +15,6 @@ else()
|
||||||
Arch/x86/multiboot.S
|
Arch/x86/multiboot.S
|
||||||
# FIXME: Eventually, some of these should build on aarch64 too.
|
# FIXME: Eventually, some of these should build on aarch64 too.
|
||||||
init.cpp
|
init.cpp
|
||||||
../MiniStdLib.cpp
|
|
||||||
../../Userland/Libraries/LibELF/Relocation.cpp
|
../../Userland/Libraries/LibELF/Relocation.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue