From 464b2027034d8e4acf445540a4cb041ac8c616dc Mon Sep 17 00:00:00 2001 From: PulkoMandy Date: Sat, 9 Mar 2019 17:42:22 +0100 Subject: [PATCH] sparc: add float/double swapping functions. Change-Id: I07590af796d689b5e97c03a97727edfd58f5a811 Reviewed-on: https://review.haiku-os.org/c/1183 Reviewed-by: waddlesplash --- src/system/libroot/os/arch/sparc/Jamfile | 2 ++ src/system/libroot/os/arch/sparc/byteorder.S | 32 ++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/system/libroot/os/arch/sparc/byteorder.S diff --git a/src/system/libroot/os/arch/sparc/Jamfile b/src/system/libroot/os/arch/sparc/Jamfile index 725be98c7d..43d9ed6aff 100644 --- a/src/system/libroot/os/arch/sparc/Jamfile +++ b/src/system/libroot/os/arch/sparc/Jamfile @@ -13,6 +13,8 @@ for architectureObject in [ MultiArchSubDirSetup sparc ] { SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ; MergeObject <$(architecture)>os_arch_$(TARGET_ARCH).o : + byteorder.S + stack_frame.c system_time.c thread.c diff --git a/src/system/libroot/os/arch/sparc/byteorder.S b/src/system/libroot/os/arch/sparc/byteorder.S new file mode 100644 index 0000000000..c7aa4616df --- /dev/null +++ b/src/system/libroot/os/arch/sparc/byteorder.S @@ -0,0 +1,32 @@ +/* + * Copyright 2019, Adrien Destugues, pulkomandy@pulkomandy.tk + * Distributed under the terms of the MIT License. + */ + +#include + +.text + +// These function use the unused parameters slots on the stack (reserved for +// arguments that are in fact passed in registers) for temporary storage. +// %o0 is corrupt, but it is a scratch register so this should be fine. + +/* float __swap_float(float value) + */ +FUNCTION(__swap_float): + add %sp, 2175, %o0 + st %d0, [%o0] + lda [%o0] 0x88, %d0 + return +FUNCTION_END(__swap_float) + + +/* double __swap_double(double value) + */ +FUNCTION(__swap_double): + add %sp, 2175, %o0 + std %d0, [%o0] + ldda [%o0] 0x88, %d0 + return +FUNCTION_END(__swap_double) +