From f4e0ad68b3249ed70896783e12d259b2ab877c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Thu, 13 Aug 2009 04:32:05 +0000 Subject: [PATCH] [ARM] - fixed copyright, - added a naive armv5 implementation for __swap_int{16,32}. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32294 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/os/arch/arm/byteorder.S | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/system/libroot/os/arch/arm/byteorder.S b/src/system/libroot/os/arch/arm/byteorder.S index 752c01a97a..5189c683f9 100644 --- a/src/system/libroot/os/arch/arm/byteorder.S +++ b/src/system/libroot/os/arch/arm/byteorder.S @@ -1,7 +1,7 @@ /* -** Copyright 2003, Axel D�fler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ + * Copyright 2009, Johannes Wischert. All rights reserved. + * Distributed under the terms of the MIT License. + */ #include @@ -14,7 +14,13 @@ FUNCTION(__swap_int16): rev16 r0,r0; #else #warning IMPLEMENT_ME + and r1,r0,#0x000000ff + and r2,r0,#0x0000ff00 + mov r1,r1,LSL #8 + mov r2,r2,ROR #8 + orr r0,r1,r2 #endif + mov pc,lr FUNCTION_END(__swap_int16) /* uint32 __swap_int32(uint32 value) @@ -24,7 +30,16 @@ FUNCTION(__swap_int32): rev r0,r0; #else #warning IMPLEMENT_ME + mov r3,#0xff000000 + orr r3,#0x0000ff00 + and r1,r0,r3 + mov r1,r1,ROR #24 + mov r3,r3,ROR #8 + and r2,r0,r3 + mov r2,r2,ROR #8 + orr r0,r1,r2 #endif + mov pc,lr FUNCTION_END(__swap_int32) /* uint64 __swap_int64(uint64 value) @@ -39,6 +54,7 @@ FUNCTION(__swap_int64): #else #warning IMPLEMENT_ME #endif + mov pc,lr FUNCTION_END(__swap_int64) /* TODO: The following functions can surely be optimized. A simple optimization