From b9d954dafd2289691a7b7c131997d6ec37341bd6 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 19 May 2012 21:49:53 +0800 Subject: [PATCH] Kernel - Added SwapEndian64 for SCSI code (coming) --- KernelLand/Kernel/include/acess.h | 5 +++++ KernelLand/Kernel/lib.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/KernelLand/Kernel/include/acess.h b/KernelLand/Kernel/include/acess.h index c8cff886..767230fe 100644 --- a/KernelLand/Kernel/include/acess.h +++ b/KernelLand/Kernel/include/acess.h @@ -386,16 +386,21 @@ extern int CheckMem(const void *Mem, int Num); #ifdef __BIG_ENDIAN__ #define LittleEndian16(_val) SwapEndian16(_val) #define LittleEndian32(_val) SwapEndian32(_val) +#define LittleEndian64(_val) SwapEndian32(_val) #define BigEndian16(_val) (_val) #define BigEndian32(_val) (_val) +#define BigEndian64(_val) (_val) #else #define LittleEndian16(_val) (_val) #define LittleEndian32(_val) (_val) +#define LittleEndian64(_val) (_val) #define BigEndian16(_val) SwapEndian16(_val) #define BigEndian32(_val) SwapEndian32(_val) +#define BigEndian64(_val) SwapEndian64(_val) #endif extern Uint16 SwapEndian16(Uint16 Val); extern Uint32 SwapEndian32(Uint32 Val); +extern Uint64 SwapEndian64(Uint64 Val); /** * \} */ diff --git a/KernelLand/Kernel/lib.c b/KernelLand/Kernel/lib.c index 7356d6fe..f07e9f34 100644 --- a/KernelLand/Kernel/lib.c +++ b/KernelLand/Kernel/lib.c @@ -87,6 +87,7 @@ EXPORT(ModUtil_SetIdent); EXPORT(UnHex); EXPORT(SwapEndian16); EXPORT(SwapEndian32); +EXPORT(SwapEndian64); EXPORT(memmove); // === CODE === @@ -1060,6 +1061,10 @@ Uint32 SwapEndian32(Uint32 Val) { return ((Val&0xFF)<<24) | ((Val&0xFF00)<<8) | ((Val>>8)&0xFF00) | ((Val>>24)&0xFF); } +Uint64 SwapEndian64(Uint64 Val) +{ + return SwapEndian32(Val >> 32) | ((Uint64)SwapEndian32(Val) << 32); +} void *memmove(void *__dest, const void *__src, size_t len) { -- 2.20.1