mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 05:22:57 +00:00
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 svn path=/trunk/; revision=23826
This commit is contained in:
parent
73120d4d50
commit
0d6e03c305
7 changed files with 228 additions and 63 deletions
75
reactos/lib/rtl/i386/memgeni386.c
Normal file
75
reactos/lib/rtl/i386/memgeni386.c
Normal file
|
@ -0,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@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 */
|
21
reactos/lib/rtl/i386/rtlulongbyteswap.s
Normal file
21
reactos/lib/rtl/i386/rtlulongbyteswap.s
Normal file
|
@ -0,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@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
|
23
reactos/lib/rtl/i386/rtlulonglongbyteswap.s
Normal file
23
reactos/lib/rtl/i386/rtlulonglongbyteswap.s
Normal file
|
@ -0,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@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
|
22
reactos/lib/rtl/i386/rtlushortbyteswap.s
Normal file
22
reactos/lib/rtl/i386/rtlushortbyteswap.s
Normal file
|
@ -0,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@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
|
|
@ -12,9 +12,6 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#undef RtlUlonglongByteSwap
|
|
||||||
#undef RtlUlongByteSwap
|
|
||||||
#undef RtlUshortByteSwap
|
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
@ -173,63 +170,4 @@ RtlZeroMemory (
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
* 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 */
|
/* EOF */
|
||||||
|
|
77
reactos/lib/rtl/memgen.c
Normal file
77
reactos/lib/rtl/memgen.c
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
/* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS system libraries
|
||||||
|
* FILE: lib/rtl/mem.c
|
||||||
|
* PURPOSE: Memory functions
|
||||||
|
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
||||||
|
#include <rtl.h>
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#undef RtlUlonglongByteSwap
|
||||||
|
#undef RtlUlongByteSwap
|
||||||
|
#undef RtlUshortByteSwap
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* 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 */
|
|
@ -35,6 +35,10 @@
|
||||||
<file>ftol_asm.s</file>
|
<file>ftol_asm.s</file>
|
||||||
<file>log_asm.s</file>
|
<file>log_asm.s</file>
|
||||||
<file>random_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>pow_asm.s</file>
|
||||||
<file>prefetchmemory_asm.s</file>
|
<file>prefetchmemory_asm.s</file>
|
||||||
<file>res_asm.s</file>
|
<file>res_asm.s</file>
|
||||||
|
@ -44,6 +48,11 @@
|
||||||
<file>zeromemory_asm.s</file>
|
<file>zeromemory_asm.s</file>
|
||||||
</directory>
|
</directory>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
<ifnot property="ARCH" value="i386">
|
||||||
|
<file>memgen.c</file>
|
||||||
|
</ifnot>
|
||||||
|
|
||||||
<file>access.c</file>
|
<file>access.c</file>
|
||||||
<file>acl.c</file>
|
<file>acl.c</file>
|
||||||
<file>atom.c</file>
|
<file>atom.c</file>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue