From 7cde8a9d7fe55c4c7b5c1bb1d95cbcb5b3eb4b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 7 Sep 2003 17:22:15 +0000 Subject: [PATCH] Implemented __swap_int16/32/64() (float/double are missing right now, but should be the same as __swap_int32/64()). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4527 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/os/arch/x86/Jamfile | 2 ++ src/kernel/libroot/os/arch/x86/byteorder.S | 33 ++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/kernel/libroot/os/arch/x86/byteorder.S diff --git a/src/kernel/libroot/os/arch/x86/Jamfile b/src/kernel/libroot/os/arch/x86/Jamfile index 50be02dfe2..b21be2b8c9 100644 --- a/src/kernel/libroot/os/arch/x86/Jamfile +++ b/src/kernel/libroot/os/arch/x86/Jamfile @@ -2,6 +2,7 @@ SubDir OBOS_TOP src kernel libroot os arch x86 ; KernelMergeObject os_arch_$(OBOS_ARCH).o : <$(SOURCE_GRIST)>atomic.S + <$(SOURCE_GRIST)>byteorder.S <$(SOURCE_GRIST)>cpuid.S <$(SOURCE_GRIST)>systeminfo.c <$(SOURCE_GRIST)>system_time.S @@ -13,6 +14,7 @@ KernelMergeObject os_arch_$(OBOS_ARCH).o : MergeObjectFromObjects kernel_os_arch_$(OBOS_ARCH).o : <$(SOURCE_GRIST)>atomic.o + <$(SOURCE_GRIST)>byteorder.S <$(SOURCE_GRIST)>cpuid.o <$(SOURCE_GRIST)>system_time.o ; diff --git a/src/kernel/libroot/os/arch/x86/byteorder.S b/src/kernel/libroot/os/arch/x86/byteorder.S new file mode 100644 index 0000000000..f56bf66853 --- /dev/null +++ b/src/kernel/libroot/os/arch/x86/byteorder.S @@ -0,0 +1,33 @@ +/* +** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ + + +#define FUNCTION(x) .global x; .type x,@function; x + + +/* uint16 __swap_int16(uint16 value) */ +FUNCTION(__swap_int16): + movl 4(%esp), %eax + bswap %eax + shr $16, %eax + ret + +/* uint32 __swap_int32(uint32 value) */ +FUNCTION(__swap_int32): + movl 4(%esp), %eax + bswap %eax + ret + +/* uint64 __swap_int64(uint64 value) */ +FUNCTION(__swap_int64): + movl 4(%esp), %edx /* the 32-bits registers are swapped here */ + movl 8(%esp), %eax + bswap %eax + bswap %edx + ret + +/* float __swap_float(float value) */ + +/* double __swap_double(double value) */