1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

ntdll: Implement RtlU(short|long)ByteSwap() using fastcall bits.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
This commit is contained in:
Eric Pouech 2022-12-12 16:58:15 +01:00 committed by Alexandre Julliard
parent 4708bb7453
commit 84cf6aa20d
4 changed files with 28 additions and 12 deletions

View file

@ -1038,7 +1038,7 @@
@ stdcall RtlTryAcquireSRWLockShared(ptr) @ stdcall RtlTryAcquireSRWLockShared(ptr)
@ stdcall RtlTryEnterCriticalSection(ptr) @ stdcall RtlTryEnterCriticalSection(ptr)
@ stdcall RtlUTF8ToUnicodeN(ptr long ptr ptr long) @ stdcall RtlUTF8ToUnicodeN(ptr long ptr ptr long)
@ cdecl -i386 -norelay RtlUlongByteSwap() NTDLL_RtlUlongByteSwap @ stdcall -fastcall -arch=i386 -norelay RtlUlongByteSwap(long)
@ stdcall -fastcall -arch=i386 -norelay RtlUlonglongByteSwap(int64) @ stdcall -fastcall -arch=i386 -norelay RtlUlonglongByteSwap(int64)
# @ stub RtlUnhandledExceptionFilter2 # @ stub RtlUnhandledExceptionFilter2
# @ stub RtlUnhandledExceptionFilter # @ stub RtlUnhandledExceptionFilter
@ -1072,7 +1072,7 @@
@ stdcall RtlUpperString(ptr ptr) @ stdcall RtlUpperString(ptr ptr)
@ stub RtlUsageHeap @ stub RtlUsageHeap
@ stdcall -norelay RtlUserThreadStart(ptr ptr) @ stdcall -norelay RtlUserThreadStart(ptr ptr)
@ cdecl -i386 -norelay RtlUshortByteSwap() NTDLL_RtlUshortByteSwap @ stdcall -fastcall -arch=i386 -norelay RtlUshortByteSwap(long)
@ stdcall RtlValidAcl(ptr) @ stdcall RtlValidAcl(ptr)
@ stdcall RtlValidRelativeSecurityDescriptor(ptr long long) @ stdcall RtlValidRelativeSecurityDescriptor(ptr long long)
@ stdcall RtlValidSecurityDescriptor(ptr) @ stdcall RtlValidSecurityDescriptor(ptr)

View file

@ -659,10 +659,10 @@ __ASM_FASTCALL_FUNC(RtlUlonglongByteSwap, 8,
* ix86 version takes argument in %ecx. Other systems use the inline version. * ix86 version takes argument in %ecx. Other systems use the inline version.
*/ */
#ifdef __i386__ #ifdef __i386__
__ASM_GLOBAL_FUNC(NTDLL_RtlUlongByteSwap, __ASM_FASTCALL_FUNC(RtlUlongByteSwap, 4,
"movl %ecx,%eax\n\t" "movl %ecx,%eax\n\t"
"bswap %eax\n\t" "bswap %eax\n\t"
"ret") "ret")
#endif #endif
/************************************************************************* /*************************************************************************
@ -674,10 +674,10 @@ __ASM_GLOBAL_FUNC(NTDLL_RtlUlongByteSwap,
* i386 version takes argument in %cx. Other systems use the inline version. * i386 version takes argument in %cx. Other systems use the inline version.
*/ */
#ifdef __i386__ #ifdef __i386__
__ASM_GLOBAL_FUNC(NTDLL_RtlUshortByteSwap, __ASM_FASTCALL_FUNC(RtlUshortByteSwap, 4,
"movb %ch,%al\n\t" "movb %ch,%al\n\t"
"movb %cl,%ah\n\t" "movb %cl,%ah\n\t"
"ret") "ret")
#endif #endif

View file

@ -2187,6 +2187,22 @@ LONG FASTCALL NTOSKRNL_InterlockedIncrement( LONG volatile *dest )
#ifdef __i386__ #ifdef __i386__
/*************************************************************************
* RtlUshortByteSwap (NTOSKRNL.EXE.@)
*/
__ASM_FASTCALL_FUNC(RtlUshortByteSwap, 4,
"movb %ch,%al\n\t"
"movb %cl,%ah\n\t"
"ret")
/*************************************************************************
* RtlUlongByteSwap (NTOSKRNL.EXE.@)
*/
__ASM_FASTCALL_FUNC(RtlUlongByteSwap, 4,
"movl %ecx,%eax\n\t"
"bswap %eax\n\t"
"ret")
/************************************************************************* /*************************************************************************
* RtlUlonglongByteSwap (NTOSKRNL.EXE.@) * RtlUlonglongByteSwap (NTOSKRNL.EXE.@)
*/ */

View file

@ -67,9 +67,9 @@
@ stdcall -fastcall ObfDereferenceObject(ptr) @ stdcall -fastcall ObfDereferenceObject(ptr)
@ stdcall -fastcall ObfReferenceObject(ptr) @ stdcall -fastcall ObfReferenceObject(ptr)
@ stub RtlPrefetchMemoryNonTemporal @ stub RtlPrefetchMemoryNonTemporal
@ cdecl -i386 -norelay RtlUlongByteSwap() @ stdcall -fastcall -arch=i386 -norelay RtlUlongByteSwap(long)
@ stdcall -fastcall -arch=i386 -norelay RtlUlonglongByteSwap(int64) @ stdcall -fastcall -arch=i386 -norelay RtlUlonglongByteSwap(int64)
@ cdecl -i386 -norelay RtlUshortByteSwap() @ stdcall -fastcall -arch=i386 -norelay RtlUshortByteSwap(long)
@ stub WmiGetClock @ stub WmiGetClock
@ stub Kei386EoiHelper @ stub Kei386EoiHelper
@ stub Kii386SpinOnSpinLock @ stub Kii386SpinOnSpinLock