Author: greatlrd
Date: Thu Aug 31 01:17:53 2006
New Revision: 23826
URL:
http://svn.reactos.org/svn/reactos?rev=23826&view=rev
Log:
Wrote RtlUshotByteSwap RtlUlongByteSwap and RtlUlonglongByteSwap to asm code.
but we need a C api for header to linking it right. Put the asm version to i386
Added:
trunk/reactos/lib/rtl/i386/memgeni386.c
trunk/reactos/lib/rtl/i386/rtlulongbyteswap.s
trunk/reactos/lib/rtl/i386/rtlulonglongbyteswap.s (with props)
trunk/reactos/lib/rtl/i386/rtlushortbyteswap.s
trunk/reactos/lib/rtl/memgen.c
- copied, changed from r23804, trunk/reactos/lib/rtl/mem.c
Modified:
trunk/reactos/lib/rtl/mem.c
trunk/reactos/lib/rtl/rtl.rbuild
Added: trunk/reactos/lib/rtl/i386/memgeni386.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/i386/memgeni386.c?…
==============================================================================
--- trunk/reactos/lib/rtl/i386/memgeni386.c (added)
+++ trunk/reactos/lib/rtl/i386/memgeni386.c Thu Aug 31 01:17:53 2006
@@ -1,0 +1,75 @@
+/* COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS system libraries
+ * FILE: lib/rtl/mem.c
+ * PURPOSE: Memory functions
+ * PROGRAMMER: David Welch (welch(a)mcmail.com)
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include <rtl.h>
+
+#define NDEBUG
+#include <debug.h>
+
+#undef RtlUlonglongByteSwap
+#undef RtlUlongByteSwap
+#undef RtlUshortByteSwap
+
+USHORT UshortByteSwap (IN USHORT Source);
+ULONG UlongByteSwap (IN ULONG Source);
+ULONGLONG UlonglongByteSwap (IN ULONGLONG Source);
+
+/*************************************************************************
+ * RtlUshortByteSwap
+ *
+ * Swap the bytes of an unsigned short value.
+ *
+ *
+ * @implemented
+ */
+USHORT FASTCALL
+RtlUshortByteSwap (IN USHORT Source)
+{
+ return UshortByteSwap (Source);
+}
+
+
+
+/*************************************************************************
+ * RtlUlongByteSwap [NTDLL.@]
+ *
+ * Swap the bytes of an unsigned int value.
+ *
+ *
+ * @implemented
+ */
+ULONG
+FASTCALL
+RtlUlongByteSwap(
+ IN ULONG Source
+)
+{
+ return UlongByteSwap(Source);
+}
+
+
+/*************************************************************************
+ * RtlUlonglongByteSwap
+ *
+ * Swap the bytes of an unsigned long long value.
+ *
+ * PARAMS
+ * i [I] Value to swap bytes of
+ *
+ *
+ * @implemented
+ */
+ULONGLONG FASTCALL
+RtlUlonglongByteSwap (IN ULONGLONG Source)
+{
+ return UlonglongByteSwap(Source);
+}
+
+
+/* EOF */
Added: trunk/reactos/lib/rtl/i386/rtlulongbyteswap.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/i386/rtlulongbytes…
==============================================================================
--- trunk/reactos/lib/rtl/i386/rtlulongbyteswap.s (added)
+++ trunk/reactos/lib/rtl/i386/rtlulongbyteswap.s Thu Aug 31 01:17:53 2006
@@ -1,0 +1,21 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS kernel
+ * PURPOSE: Run-Time Library
+ * FILE: lib/rtl/i386/RtlUlongByteSwap.S
+ * PROGRAMER: Magnus Olsen (magnus(a)greatlord.com)
+ */
+
+.globl _UlongByteSwap
+
+.intel_syntax noprefix
+
+/* FUNCTIONS ***************************************************************/
+
+_UlongByteSwap:
+ push ebp // save base
+ mov ebp,esp // move stack to base
+ mov eax,[ebp+8] // load the ULONG
+ bswap eax // swap the ULONG
+ pop ebp // restore the base
+ ret
Added: trunk/reactos/lib/rtl/i386/rtlulonglongbyteswap.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/i386/rtlulonglongb…
==============================================================================
--- trunk/reactos/lib/rtl/i386/rtlulonglongbyteswap.s (added)
+++ trunk/reactos/lib/rtl/i386/rtlulonglongbyteswap.s Thu Aug 31 01:17:53 2006
@@ -1,0 +1,23 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS kernel
+ * PURPOSE: Run-Time Library
+ * FILE: lib/rtl/i386/RtlUlonglongByteSwap.S
+ * PROGRAMER: Magnus Olsen (magnus(a)greatlord.com)
+ */
+
+.globl _UlonglongByteSwap
+
+.intel_syntax noprefix
+
+/* FUNCTIONS ***************************************************************/
+
+_UlonglongByteSwap:
+ push ebp // save base
+ mov ebp,esp // move stack to base
+ mov edx,[ebp+8] // load the higher part of ULONGLONG
+ mov eax,[ebp+12] // load the lower part of ULONGLONG
+ bswap edx // swap the higher part
+ bswap eax // swap the lower part
+ pop ebp // restore the base
+ ret
Propchange: trunk/reactos/lib/rtl/i386/rtlulonglongbyteswap.s
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/lib/rtl/i386/rtlushortbyteswap.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/i386/rtlushortbyte…
==============================================================================
--- trunk/reactos/lib/rtl/i386/rtlushortbyteswap.s (added)
+++ trunk/reactos/lib/rtl/i386/rtlushortbyteswap.s Thu Aug 31 01:17:53 2006
@@ -1,0 +1,22 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS kernel
+ * PURPOSE: Run-Time Library
+ * FILE: lib/rtl/i386/RtlUlongByteSwap.S
+ * PROGRAMER: Magnus Olsen (magnus(a)greatlord.com)
+ */
+
+.globl _UshortByteSwap
+
+.intel_syntax noprefix
+
+/* FUNCTIONS ***************************************************************/
+
+_UshortByteSwap:
+ push ebp // save base
+ mov ebp,esp // move stack to base
+ mov eax,[ebp+8] // load the USHORT
+ bswap eax // swap the USHORT, xchg is slow so we use
bswap with rol
+ rol eax,16 // make it USHORT
+ pop ebp // restore the base
+ ret
Modified: trunk/reactos/lib/rtl/mem.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/mem.c?rev=23826&am…
==============================================================================
--- trunk/reactos/lib/rtl/mem.c (original)
+++ trunk/reactos/lib/rtl/mem.c Thu Aug 31 01:17:53 2006
@@ -12,9 +12,6 @@
#define NDEBUG
#include <debug.h>
-#undef RtlUlonglongByteSwap
-#undef RtlUlongByteSwap
-#undef RtlUshortByteSwap
/* FUNCTIONS *****************************************************************/
@@ -173,63 +170,4 @@
);
}
-
-/*************************************************************************
- * RtlUshortByteSwap
- *
- * Swap the bytes of an unsigned short value.
- *
- * NOTES
- * Based on the inline versions in Wine winternl.h
- *
- * @implemented
- */
-USHORT FASTCALL
-RtlUshortByteSwap (IN USHORT Source)
-{
- return (Source >> 8) | (Source << 8);
-}
-
-
-
-/*************************************************************************
- * RtlUlongByteSwap [NTDLL.@]
- *
- * Swap the bytes of an unsigned int value.
- *
- * NOTES
- * Based on the inline versions in Wine winternl.h
- *
- * @implemented
- */
-ULONG
-FASTCALL
-RtlUlongByteSwap(
- IN ULONG Source
-)
-{
- return ((ULONG)RtlUshortByteSwap((USHORT)Source) << 16) |
RtlUshortByteSwap((USHORT)(Source >> 16));
-}
-
-
-/*************************************************************************
- * RtlUlonglongByteSwap
- *
- * Swap the bytes of an unsigned long long value.
- *
- * PARAMS
- * i [I] Value to swap bytes of
- *
- * RETURNS
- * The value with its bytes swapped.
- *
- * @implemented
- */
-ULONGLONG FASTCALL
-RtlUlonglongByteSwap (IN ULONGLONG Source)
-{
- return ((ULONGLONG) RtlUlongByteSwap (Source) << 32) | RtlUlongByteSwap
(Source>>32);
-}
-
-
/* EOF */
Copied: trunk/reactos/lib/rtl/memgen.c (from r23804, trunk/reactos/lib/rtl/mem.c)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/memgen.c?p2=trunk/…
==============================================================================
--- trunk/reactos/lib/rtl/mem.c (original)
+++ trunk/reactos/lib/rtl/memgen.c Thu Aug 31 01:17:53 2006
@@ -15,164 +15,6 @@
#undef RtlUlonglongByteSwap
#undef RtlUlongByteSwap
#undef RtlUshortByteSwap
-
-/* FUNCTIONS *****************************************************************/
-
-/******************************************************************************
- * RtlCompareMemory [NTDLL.@]
- *
- * Compare one block of memory with another
- *
- * PARAMS
- * Source1 [I] Source block
- * Source2 [I] Block to compare to Source1
- * Length [I] Number of bytes to fill
- *
- * RETURNS
- * The length of the first byte at which Source1 and Source2 differ, or Length
- * if they are the same.
- *
- * @implemented
- */
-SIZE_T NTAPI
-RtlCompareMemory(IN const VOID *Source1,
- IN const VOID *Source2,
- IN SIZE_T Length)
-{
- SIZE_T i;
- for(i=0; (i<Length) && (((PUCHAR)Source1)[i]==((PUCHAR)Source2)[i]); i++)
- ;
- return i;
-}
-
-
-/*
- * @implemented
- */
-ULONG
-NTAPI
-RtlCompareMemoryUlong (
- PVOID Source,
- ULONG Length,
- ULONG Value
-)
-/*
- * FUNCTION: Compares a block of ULONGs with an ULONG and returns the number of equal
bytes
- * ARGUMENTS:
- * Source = Block to compare
- * Length = Number of bytes to compare
- * Value = Value to compare
- * RETURNS: Number of equal bytes
- */
-{
- PULONG ptr = (PULONG)Source;
- ULONG len = Length / sizeof(ULONG);
- ULONG i;
-
- for (i = 0; i < len; i++)
- {
- if (*ptr != Value)
- break;
- ptr++;
- }
-
- return (ULONG)((PCHAR)ptr - (PCHAR)Source);
-}
-
-
-#undef RtlFillMemory
-/*
- * @implemented
- */
-VOID
-NTAPI
-RtlFillMemory (
- PVOID Destination,
- ULONG Length,
- UCHAR Fill
-)
-{
- memset(Destination, Fill, Length);
-}
-
-
-
-/*
- * @implemented
- */
-VOID
-NTAPI
-RtlFillMemoryUlong (
- PVOID Destination,
- ULONG Length,
- ULONG Fill
-)
-{
- PULONG Dest = Destination;
- ULONG Count = Length / sizeof(ULONG);
-
- while (Count > 0)
- {
- *Dest = Fill;
- Dest++;
- Count--;
- }
-}
-
-
-#undef RtlMoveMemory
-/*
- * @implemented
- */
-VOID
-NTAPI
-RtlMoveMemory (
- PVOID Destination,
- CONST VOID * Source,
- ULONG Length
-)
-{
- memmove (
- Destination,
- Source,
- Length
- );
-}
-
-/*
-* @implemented
-*/
-VOID
-FASTCALL
-RtlPrefetchMemoryNonTemporal(
- IN PVOID Source,
- IN SIZE_T Length
- )
-{
- /* By nature of prefetch, this is non-portable. */
- (void)Source;
- (void)Length;
-}
-
-
-#undef RtlZeroMemory
-/*
- * @implemented
- */
-VOID
-NTAPI
-RtlZeroMemory (
- PVOID Destination,
- ULONG Length
-)
-{
- RtlFillMemory (
- Destination,
- Length,
- 0
- );
-}
-
/*************************************************************************
* RtlUshortByteSwap
Modified: trunk/reactos/lib/rtl/rtl.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/rtl.rbuild?rev=238…
==============================================================================
--- trunk/reactos/lib/rtl/rtl.rbuild (original)
+++ trunk/reactos/lib/rtl/rtl.rbuild Thu Aug 31 01:17:53 2006
@@ -35,6 +35,10 @@
<file>ftol_asm.s</file>
<file>log_asm.s</file>
<file>random_asm.S</file>
+ <file>memgeni386.c</file>
+ <file>rtlushortbyteswap.s</file>
+ <file>rtlulongbyteswap.s</file>
+ <file>rtlulonglongbyteswap.s</file>
<file>pow_asm.s</file>
<file>prefetchmemory_asm.s</file>
<file>res_asm.s</file>
@@ -42,8 +46,13 @@
<file>sqrt_asm.s</file>
<file>tan_asm.s</file>
<file>zeromemory_asm.s</file>
- </directory>
+ </directory>
</if>
+
+ <ifnot property="ARCH" value="i386">
+ <file>memgen.c</file>
+ </ifnot>
+
<file>access.c</file>
<file>acl.c</file>
<file>atom.c</file>