- Remove _fltused from alldiv_asm.s / mscmain.c and use fltused.c instead.
- Remove amd64/alldiv.S
- Implement amd64 ceil, ceilf with sse
[NTOSKNRL]
- Fix amd64 exports
[ASM]
- Fix amd64 asm files to conform to the new syntax

svn path=/trunk/; revision=54131
This commit is contained in:
Timo Kreuzer 2011-10-14 08:33:22 +00:00
parent 38ed2303d8
commit e3a81ccca5
27 changed files with 129 additions and 126 deletions

View file

@ -683,4 +683,6 @@ msgLoading:
.word HEX(0aa55) // BootSector signature
.endcode16
END

View file

@ -17,7 +17,7 @@ FUNC BaseFiberStartup
/* FIXME: TODO */
ret
ENDFUNC BaseFiberStartup
ENDFUNC
PUBLIC SwitchToFiber
@ -27,6 +27,6 @@ FUNC SwitchToFiber
UNIMPLEMENTED BaseFiberStartup
/* FIXME: TODO */
ret
ENDFUNC SwitchToFiber
ENDFUNC
END

View file

@ -15,7 +15,7 @@
.code64
/*
/*
* VOID NTAPI
* RtlCaptureContext(
* PCONTEXT ContextRecord); <rcx>
@ -96,7 +96,7 @@ PUBLIC RtlCaptureContext
/* Cleanup stack and return */
add rsp, 8
ret
.ENDP RtlCaptureContext
.ENDP
END

View file

@ -2,7 +2,7 @@
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Run-Time Library
* PURPOSE: Memory functions for amd64
* FILE: lib/rtl/i386/rtlswap.S
* FILE: lib/rtl/amd64/rtlmem.S
* PROGRAMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
@ -14,7 +14,7 @@
.code64
/* SIZE_T
/* SIZE_T
* RtlCompareMemory(
* IN CONST VOID *Source1, <rcx>
* IN CONST VOID *Source2, <rdx>
@ -81,7 +81,7 @@ RtlCompareMemory6:
pop rdi
pop rsi
ret
.endp RtlCompareMemory
.endp
END

View file

@ -123,6 +123,7 @@ list(APPEND CRT_SOURCE
misc/amsg.c
misc/assert.c
misc/environ.c
misc/fltused.c
misc/getargs.c
misc/i10output.c
misc/initterm.c
@ -384,7 +385,6 @@ elseif(ARCH MATCHES amd64)
float/amd64/fpreset.S
float/amd64/logb.S
float/i386/statfp.c
math/amd64/alldiv.S
math/amd64/atan.S
math/amd64/atan2.S
math/amd64/ceil.S

View file

@ -20,13 +20,13 @@ FUNC __chkstk
.endprolog
UNIMPLEMENTED chkstk
ret
ENDFUNC __chkstk
ENDFUNC
FUNC __alloca_probe
.endprolog
UNIMPLEMENTED alloca_probe
ret
ENDFUNC __alloca_probe
ENDFUNC
END
/* EOF */

View file

@ -30,36 +30,36 @@ PUBLIC _except_handler3
FUNC _unwind_handler
.endprolog
ret
ENDFUNC _unwind_handler
ENDFUNC
FUNC _global_unwind2
.endprolog
ret
ENDFUNC _global_unwind2
ENDFUNC
FUNC _abnormal_termination
.endprolog
ret
ENDFUNC _abnormal_termination
ENDFUNC
FUNC _local_unwind
.endprolog
ret
ENDFUNC _local_unwind
ENDFUNC
FUNC _local_unwind2
.endprolog
ret
ENDFUNC _local_unwind2
ENDFUNC
FUNC _except_handler2
.endprolog
ret
ENDFUNC _except_handler2
ENDFUNC
FUNC _except_handler3
.endprolog
ret
ENDFUNC _except_handler3
ENDFUNC
END

View file

@ -10,6 +10,6 @@ FUNC _clearfp
.ENDPROLOG
fnclex
ENDFUNC _clearfp
ENDFUNC
END

View file

@ -6,6 +6,6 @@
FUNC _fpreset
.endprolog
fninit
ENDFUNC _fpreset
ENDFUNC
END

View file

@ -11,7 +11,7 @@ FUNC __getfpcw87
mov rax, [rsp]
add rsp, 8
ret
ENDFUNC __getfpcw87
ENDFUNC
PUBLIC __setfpcw87
FUNC __setfpcw87
@ -19,6 +19,6 @@ FUNC __setfpcw87
.ENDPROLOG
ldmxcsr [rsp + 8]
ret
ENDFUNC __setfpcw87
ENDFUNC
END

View file

@ -11,6 +11,6 @@ FUNC _logb
fxtract
fstp st
ret
ENDFUNC _logb
ENDFUNC
END

View file

@ -9,6 +9,7 @@ list(APPEND LIBCNTPR_SOURCE
mem/memccpy.c
mem/memcmp.c
mem/memicmp.c
misc/fltused.c
printf/_snprintf.c
printf/_snwprintf.c
printf/_vcprintf.c
@ -104,7 +105,6 @@ elseif(ARCH MATCHES amd64)
setjmp/amd64/setjmp.s
math/cos.c
math/sin.c
math/amd64/alldiv.S
math/amd64/atan.S
math/amd64/atan2.S
math/amd64/ceil.S

View file

@ -1,30 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of alldiv
* FILE: lib/sdk/crt/math/amd64/alldiv.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <asm.inc>
/* DATA **********************************************************************/
.code64
PUBLIC _fltused
_fltused:
.long HEX(9875)
/* CODE **********************************************************************/
.code64
FUNC alldiv
.endprolog
UNIMPLEMENTED alldiv
ret
ENDFUNC alldiv
END

View file

@ -14,9 +14,42 @@
/* CODE **********************************************************************/
.code64
/* ceil(x) = - floor(-x)
*/
PUBLIC ceil
ceil:
UNIMPLEMENTED ceil
.PROC ceil
sub rsp, 16
.ENDPROLOG
/* Duplicate the bits into rax */
movd rax, xmm0
/* Invert the sign bit */
rol rax, 1
xor al, 1
ror rax, 1
/* Copy back to xmm0 */
movd xmm0, rax
/* Truncate xmm0 to integer (double precision) */
cvttsd2si rcx, xmm0
/* Shift all bits to the right, keeping the sign bit */
shr rax, 63
/* Substract the sign bit from the truncated value, so that
we get the correct result for negative values. */
sub rcx, rax
/* Now compensate for the previous negation */
neg rcx
/* Convert the result back to xmm0 (double precision) */
cvtsi2sd xmm0, rcx
add rsp, 16
ret
.ENDP
END

View file

@ -19,29 +19,33 @@ FUNC ceilf
sub rsp, 16
.ENDPROLOG
/* Put parameter on the stack */
movss dword ptr [rsp], xmm0
fld dword ptr [rsp]
/* Duplicate the bits into eax (zero exteneded to rax) */
movd eax, xmm0
/* Change fpu control word to round up */
fstcw [rsp + 8]
mov eax, [rsp + 8]
or eax, HEX(00800)
and eax, HEX(0fbff)
mov [rsp + 12], eax
fldcw [rsp + 12]
/* Invert the sign bit */
xor eax, HEX(80000000)
/* Round to integer */
frndint
/* Copy back to xmm0 */
movd xmm0, eax
/* Restore fpu control word */
fldcw [rsp + 8]
/* Truncate xmm0 to integer (single precision) */
cvttss2si rcx, xmm0
fstp dword ptr [rsp]
movss xmm0, dword ptr [rsp]
/* Shift all bits to the right, keeping the sign bit */
shr rax, 31
/* Add the sign bit from the truncated value, so that
we get the correct result for negative values. */
add rcx, rax
/* Now compensate for the previous negation */
neg ecx
/* Convert the result back to xmm0 (single precision) */
cvtsi2ss xmm0, rcx
add rsp, 16
ret
ENDFUNC ceilf
ENDFUNC
END

View file

@ -36,6 +36,6 @@ FUNC floor
add rsp, 16
ret
ENDFUNC floor
ENDFUNC
END

View file

@ -36,6 +36,6 @@ FUNC floorf
add rsp, 16
ret
ENDFUNC floorf
ENDFUNC
END

View file

@ -6,20 +6,20 @@
* PROGRAMER: Alex Ionescu (alex@relsoft.net)
*
* Copyright (C) 2002 Michael Ringgaard.
* All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@ -30,23 +30,18 @@
* OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <asm.inc>
PUBLIC __alldiv
PUBLIC __fltused
/* DATA ********************************************************************/
.data
ASSUME CS:NOTHING, DS:NOTHING, ES:NOTHING, FS:NOTHING, GS:NOTHING
__fltused:
.long HEX(9875)
/* FUNCTIONS ***************************************************************/
.code

View file

@ -1,2 +1,2 @@
int _fltused;
int _fltused = 0x9875;

View file

@ -51,8 +51,7 @@ if(ARCH MATCHES i386)
elseif(ARCH MATCHES amd64)
list(APPEND MSVCRTEX_SOURCE
except/amd64/chkstk_asm.s
except/amd64/chkstk_ms.s
math/amd64/alldiv.S)
except/amd64/chkstk_ms.s)
endif()
if(MSVC)

View file

@ -77,7 +77,7 @@ FUNC _setjmp
movdqa [rcx + JUMP_BUFFER_Xmm15], xmm15
xor rax, rax
ret
ENDFUNC _setjmp
ENDFUNC
/*!
* int _setjmpex(jmp_buf _Buf,void *_Ctx);
@ -119,7 +119,7 @@ FUNC _setjmpex
movdqa [rcx + JUMP_BUFFER_Xmm15], xmm15
xor rax, rax
ret
ENDFUNC _setjmpex
ENDFUNC
/*!
@ -164,6 +164,6 @@ FUNC longjmp
jnz l2
inc rax
l2: jmp r8
ENDFUNC longjmp
ENDFUNC
END

View file

@ -7,8 +7,6 @@
#include <windows.h>
#include <stdlib.h>
int _fltused;
int __mingw_init_ehandler (void)
{
/* Nothing to do */

View file

@ -78,7 +78,6 @@
/* MMPTE related defines */
#define MM_EMPTY_PTE_LIST ((ULONG64)0xFFFFFFFF)
#define MM_EMPTY_LIST ((ULONG_PTR)-1)
#define PTE_PER_PAGE 0x200
#define ADDR_TO_PAGE_TABLE(v) ((ULONG)(((ULONG_PTR)(v)) / (512 * PAGE_SIZE)))
#define ADDR_TO_PDE_OFFSET(v) ((ULONG)((((ULONG_PTR)(v)) / (512 * PAGE_SIZE))))

View file

@ -36,7 +36,7 @@ PUBLIC KiSwitchToBootStack
jmp KiSystemStartupBootStack
.ENDP KiSwitchToBootStack
.ENDP
END

View file

@ -90,7 +90,7 @@ KiInitializeContextThread(IN PKTHREAD Thread,
/* Set the Thread's NPX State */
Thread->NpxState = 0xA;
Thread->DispatcherHeader.NpxIrql = PASSIVE_LEVEL;
Thread->Header.NpxIrql = PASSIVE_LEVEL;
/* Disable any debug regiseters */
Context->ContextFlags &= ~CONTEXT_DEBUG_REGISTERS;

View file

@ -135,7 +135,7 @@ ENDR
add rsp, EXCEPTION_RECORD_LENGTH + KEXCEPTION_FRAME_LENGTH
ret
.ENDP InternalDispatchException
.ENDP
/* SOFTWARE INTERRUPT SERVICES ***********************************************/
@ -153,7 +153,7 @@ FUNC KiDivideErrorFault
/* Return */
ExitTrap TF_SAVE_ALL
ENDFUNC KiDivideErrorFault
ENDFUNC
PUBLIC KiDebugTrapOrFault
@ -174,7 +174,7 @@ KiDebugTrapOrFaultKMode:
/* Return */
ExitTrap TF_SAVE_ALL
ENDFUNC KiDebugTrapOrFault
ENDFUNC
PUBLIC KiNmiInterrupt
@ -187,7 +187,7 @@ FUNC KiNmiInterrupt
/* Return */
ExitTrap TF_SAVE_ALL
ENDFUNC KiNmiInterrupt
ENDFUNC
PUBLIC KiBreakpointTrap
@ -200,7 +200,7 @@ FUNC KiBreakpointTrap
/* Return */
ExitTrap TF_SAVE_ALL
ENDFUNC KiBreakpointTrap
ENDFUNC
PUBLIC KiOverflowTrap
@ -216,7 +216,7 @@ FUNC KiOverflowTrap
/* Return */
ExitTrap TF_SAVE_ALL
ENDFUNC KiOverflowTrap
ENDFUNC
PUBLIC KiBoundFault
@ -240,7 +240,7 @@ KiBoundFaultUserMode:
/* Return */
ExitTrap TF_SAVE_ALL
ENDFUNC KiBoundFault
ENDFUNC
PUBLIC KiInvalidOpcodeFault
@ -265,7 +265,7 @@ KiInvalidOpcodeKernel:
/* Return */
ExitTrap TF_SAVE_ALL
ENDFUNC KiInvalidOpcodeFault
ENDFUNC
PUBLIC KiNpxNotAvailableFault
@ -287,7 +287,7 @@ FUNC KiNpxNotAvailableFault
KiNpxNotAvailableFaultExit:
/* Return */
ExitTrap TF_SAVE_ALL
ENDFUNC KiNpxNotAvailableFault
ENDFUNC
PUBLIC KiDoubleFaultAbort
@ -298,7 +298,7 @@ FUNC KiDoubleFaultAbort
/* Bugcheck */
Fatal 8 // EXCEPTION_DOUBLE_FAULT
jmp $
ENDFUNC KiDoubleFaultAbort
ENDFUNC
PUBLIC KiNpxSegmentOverrunAbort
@ -309,7 +309,7 @@ FUNC KiNpxSegmentOverrunAbort
/* Bugcheck */
Fatal EXCEPTION_NPX_OVERRUN
jmp $
ENDFUNC KiNpxSegmentOverrunAbort
ENDFUNC
PUBLIC KiInvalidTssFault
@ -320,7 +320,7 @@ FUNC KiInvalidTssFault
/* Bugcheck */
Fatal EXCEPTION_INVALID_TSS
jmp $
ENDFUNC KiInvalidTssFault
ENDFUNC
PUBLIC KiSegmentNotPresentFault
@ -331,7 +331,7 @@ FUNC KiSegmentNotPresentFault
/* Bugcheck */
Fatal EXCEPTION_SEGMENT_NOT_PRESENT
jmp $
ENDFUNC KiSegmentNotPresentFault
ENDFUNC
PUBLIC KiStackFault
@ -342,7 +342,7 @@ FUNC KiStackFault
/* Bugcheck */
Fatal EXCEPTION_STACK_FAULT
jmp $
ENDFUNC KiStackFault
ENDFUNC
PUBLIC KiGeneralProtectionFault
@ -376,7 +376,7 @@ KiGpfExit:
/* Return */
/* Return */
ExitTrap TF_SAVE_ALL
ENDFUNC KiGeneralProtectionFault
ENDFUNC
PUBLIC KiPageFault
@ -435,7 +435,7 @@ SpecialCode:
PageFaultReturn:
/* Return */
ExitTrap TF_SAVE_ALL
ENDFUNC KiPageFault
ENDFUNC
PUBLIC KiFloatingErrorFault
@ -448,7 +448,7 @@ FUNC KiFloatingErrorFault
/* Return */
ExitTrap TF_SAVE_ALL
ENDFUNC KiFloatingErrorFault
ENDFUNC
PUBLIC KiAlignmentFault
@ -459,7 +459,7 @@ FUNC KiAlignmentFault
/* Bugcheck */
Fatal EXCEPTION_ALIGNMENT_CHECK
jmp $
ENDFUNC KiAlignmentFault
ENDFUNC
PUBLIC KiMcheckAbort
@ -470,7 +470,7 @@ FUNC KiMcheckAbort
/* Bugcheck */
Fatal HEX(12)
jmp $
ENDFUNC KiMcheckAbort
ENDFUNC
PUBLIC KiXmmException
@ -492,7 +492,7 @@ FUNC KiXmmException
KiXmmExit:
/* Return */
ExitTrap TF_SAVE_ALL
ENDFUNC KiXmmException
ENDFUNC
PUBLIC KiRaiseAssertion
@ -508,7 +508,7 @@ FUNC KiRaiseAssertion
/* Return */
ExitTrap TF_SAVE_ALL
ENDFUNC KiRaiseAssertion
ENDFUNC
PUBLIC KiDebugServiceTrap
@ -524,7 +524,7 @@ PUBLIC KiDebugServiceTrap
/* Return */
ExitTrap TF_SAVE_ALL
.ENDP KiDebugServiceTrap
.ENDP
PUBLIC KiApcInterrupt
@ -554,7 +554,7 @@ PUBLIC KiApcInterrupt
/* Return */
ExitTrap (TF_VOLATILES or TF_IRQL)
.ENDP KiApcInterrupt
.ENDP
PUBLIC KiDpcInterrupt
@ -576,7 +576,7 @@ PUBLIC KiDpcInterrupt
/* Return */
ExitTrap (TF_VOLATILES or TF_IRQL)
.ENDP KiDpcInterrupt
.ENDP
PUBLIC KiIpiInterrupt
@ -595,7 +595,7 @@ PUBLIC KiIpiInterrupt
/* Return */
ExitTrap (TF_VOLATILES or TF_IRQL)
.ENDP KiIpiInterrupt
.ENDP
PUBLIC KiUnexpectedInterrupt
@ -616,7 +616,7 @@ FUNC KiUnexpectedInterrupt
#endif
/* Return */
ExitTrap TF_SAVE_ALL
ENDFUNC KiUnexpectedInterrupt
ENDFUNC
#ifdef _MSC_VER
#undef lgdt

View file

@ -627,7 +627,7 @@
@ stdcall KeLeaveCriticalRegion() _KeLeaveCriticalRegion
@ stdcall KeLeaveGuardedRegion() _KeLeaveGuardedRegion
@ extern KeLoaderBlock
@ cdecl -arch=x86_64 KeLowerIrql(long)
@ cdecl -arch=x86_64 -private KeLowerIrql(long)
@ extern KeNumberProcessors _KeNumberProcessors
@ stdcall -arch=i386,arm KeProfileInterrupt(ptr)
@ stdcall KeProfileInterruptWithSource(ptr long)
@ -641,7 +641,7 @@
@ stdcall -arch=i386,arm KeQuerySystemTime(ptr)
@ stdcall -arch=i386,arm KeQueryTickCount(ptr)
@ stdcall KeQueryTimeIncrement()
@ cdecl -arch=x86_64 KeRaiseIrqlToDpcLevel()
@ cdecl -arch=x86_64 -private KeRaiseIrqlToDpcLevel()
@ stdcall KeRaiseUserException(long)
@ stdcall KeReadStateEvent(ptr)
@ stdcall KeReadStateMutant(ptr)
@ -654,6 +654,7 @@
@ stdcall KeRegisterNmiCallback(ptr ptr)
@ fastcall KeReleaseGuardedMutex(ptr)
@ fastcall KeReleaseGuardedMutexUnsafe(ptr)
@ cdecl -arch=x86_64 KeReleaseInStackQueuedSpinLock(ptr)
@ fastcall KeReleaseInStackQueuedSpinLockForDpc(ptr)
@ fastcall KeReleaseInStackQueuedSpinLockFromDpcLevel(ptr)
@ stdcall KeReleaseInterruptSpinLock(ptr long)
@ -716,7 +717,7 @@
@ fastcall -arch=i386,arm KefAcquireSpinLockAtDpcLevel(ptr)
@ fastcall -arch=i386,arm KefReleaseSpinLockFromDpcLevel(ptr)
@ stdcall -arch=i386 Kei386EoiHelper()
@ cdecl -arch=x86_64 KfRaiseIrql(long)
@ cdecl -arch=x86_64 -private KfRaiseIrql(long)
@ fastcall -arch=i386 KiEoiHelper(ptr)
@ fastcall -arch=i386,arm KiAcquireSpinLock(ptr)
@ extern KiBugCheckData
@ -1080,6 +1081,8 @@
@ stdcall RtlConvertSidToUnicodeString(ptr ptr long)
@ stdcall RtlConvertUlongToLargeInteger(long)
@ stdcall RtlCopyLuid(ptr ptr)
@ stdcall -arch=x86_64 RtlCopyMemory(ptr ptr int64) memmove
@ stdcall -arch=x86_64 RtlCopyMemoryNonTemporal(ptr ptr int64) memmove
@ stdcall RtlCopyRangeList(ptr ptr)
@ stdcall RtlCopySid(long ptr ptr)
@ stdcall RtlCopyString(ptr ptr)