From d81df6ce849ca9d892773a1d52fcf3047325a502 Mon Sep 17 00:00:00 2001 From: Fredrik Holmqvist Date: Sun, 7 Feb 2021 12:32:02 +0100 Subject: [PATCH] Add byteorder.S for ARM64 Change-Id: I346e83683ad2318948914c5027123f84d4038451 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3737 Reviewed-by: Fredrik Holmqvist Reviewed-by: Adrien Destugues --- src/system/kernel/lib/arch/arm64/Jamfile | 3 ++- src/system/libroot/os/arch/arm64/Jamfile | 9 ++++--- src/system/libroot/os/arch/arm64/byteorder.S | 26 ++++++++++++++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 src/system/libroot/os/arch/arm64/byteorder.S diff --git a/src/system/kernel/lib/arch/arm64/Jamfile b/src/system/kernel/lib/arch/arm64/Jamfile index e1a5e14323..8d106db8d6 100644 --- a/src/system/kernel/lib/arch/arm64/Jamfile +++ b/src/system/kernel/lib/arch/arm64/Jamfile @@ -9,6 +9,7 @@ SEARCH_SOURCE += [ FDirName $(librootSources) os arch $(TARGET_ARCH) ] ; SEARCH_SOURCE += [ FDirName $(librootSources) os arch generic ] ; KernelMergeObject kernel_os_arch_$(TARGET_ARCH).o : + byteorder.S generic_atomic.cpp generic_system_time_nsecs.cpp @@ -24,7 +25,7 @@ KernelMergeObject kernel_lib_posix_arch_$(TARGET_ARCH).o : sigsetjmp.S kernel_longjmp_return.c kernel_setjmp_save_sigs.c - + arch_string.S memset.c memcpy.c diff --git a/src/system/libroot/os/arch/arm64/Jamfile b/src/system/libroot/os/arch/arm64/Jamfile index fe33fee20f..e38ab9dc01 100644 --- a/src/system/libroot/os/arch/arm64/Jamfile +++ b/src/system/libroot/os/arch/arm64/Jamfile @@ -13,11 +13,12 @@ for architectureObject in [ MultiArchSubDirSetup arm64 ] { SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ; MergeObject <$(architecture)>os_arch_$(TARGET_ARCH).o : - tls.c - thread.c - system_time.c - time.c + byteorder.S get_stack_frame.S + system_time.c + thread.c + time.c + tls.c generic_atomic.cpp generic_stack_trace.cpp diff --git a/src/system/libroot/os/arch/arm64/byteorder.S b/src/system/libroot/os/arch/arm64/byteorder.S new file mode 100644 index 0000000000..dc5ad70a94 --- /dev/null +++ b/src/system/libroot/os/arch/arm64/byteorder.S @@ -0,0 +1,26 @@ +/* + * Copyright 2021, Haiku, Inc. All rights reserved. + * Released under the terms of the MIT License + */ + + +#include + +.text + +/* float __swap_float(float value) */ +FUNCTION(__swap_float): + fmov s0, w0 // Bitcopy float to general register + rev w0, w0 // GCC8.3 does this for __builtin_bswap32 + fmov w0, s0 // and back + ret +FUNCTION_END(__swap_float) + + +/* double __swap_double(double value) */ +FUNCTION(__swap_double): + fmov d0, x0 // Bitcopy double to general register + rev x0, x0 // GCC8.3 does this for __builtin_bswap64 + fmov x0, d0 // and back + ret +FUNCTION_END(__swap_double)