Author: greatlrd
Date: Tue Aug 29 23:14:18 2006
New Revision: 23790
URL:
http://svn.reactos.org/svn/reactos?rev=23790&view=rev
Log:
found more inline asm.
1. move all inline asm to folder i386
2. to do : seh.s should be rewrites to intel syntax
3. to do : almost all c files in folders i386 need be convert to true asm instead using
inline asm
4. add dection for x86 arch in rbuild for each found I have done
Added:
trunk/reactos/lib/crt/except/i386/
trunk/reactos/lib/crt/except/i386/seh.s
- copied unchanged from r23781, trunk/reactos/lib/crt/except/seh.s
trunk/reactos/lib/crt/except/i386/unwind.c
- copied unchanged from r23788, trunk/reactos/lib/crt/except/unwind.c
trunk/reactos/lib/crt/float/i386/
trunk/reactos/lib/crt/float/i386/clearfp.c
- copied unchanged from r23781, trunk/reactos/lib/crt/float/clearfp.c
trunk/reactos/lib/crt/float/i386/cntrlfp.c
- copied unchanged from r23781, trunk/reactos/lib/crt/float/cntrlfp.c
trunk/reactos/lib/crt/float/i386/logb.c
- copied unchanged from r23781, trunk/reactos/lib/crt/float/logb.c
trunk/reactos/lib/crt/float/i386/statfp.c
- copied unchanged from r23781, trunk/reactos/lib/crt/float/statfp.c
trunk/reactos/lib/crt/math/i386/atan2.c
- copied unchanged from r23784, trunk/reactos/lib/crt/math/atan2.c
trunk/reactos/lib/crt/math/i386/exp.c
- copied unchanged from r23784, trunk/reactos/lib/crt/math/exp.c
trunk/reactos/lib/crt/math/i386/fmod.c
- copied unchanged from r23784, trunk/reactos/lib/crt/math/fmod.c
trunk/reactos/lib/crt/math/i386/ldexp.c
- copied unchanged from r23784, trunk/reactos/lib/crt/math/ldexp.c
Removed:
trunk/reactos/lib/crt/except/seh.s
trunk/reactos/lib/crt/except/unwind.c
trunk/reactos/lib/crt/float/clearfp.c
trunk/reactos/lib/crt/float/cntrlfp.c
trunk/reactos/lib/crt/float/logb.c
trunk/reactos/lib/crt/float/statfp.c
trunk/reactos/lib/crt/math/atan2.c
trunk/reactos/lib/crt/math/exp.c
trunk/reactos/lib/crt/math/fmod.c
trunk/reactos/lib/crt/math/ldexp.c
Modified:
trunk/reactos/lib/crt/crt.rbuild
Modified: trunk/reactos/lib/crt/crt.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/crt/crt.rbuild?rev=237…
==============================================================================
--- trunk/reactos/lib/crt/crt.rbuild (original)
+++ trunk/reactos/lib/crt/crt.rbuild Tue Aug 29 23:14:18 2006
@@ -41,23 +41,32 @@
<file>abnorter.c</file>
<file>exhand2.c</file>
<file>matherr.c</file>
- <file>seh.s</file>
- <file>unwind.c</file>
+ <if property="ARCH" value="i386">
+ <directory name="i386">
+ <file>seh.s</file>
+ <file>unwind.c</file>
+ </directory>
+ </if>
<file>xcptfil.c</file>
</directory>
<directory name="float">
- <file>chgsign.c</file>
- <file>clearfp.c</file>
- <file>cntrlfp.c</file>
+ <file>chgsign.c</file>
<file>copysign.c</file>
<file>fpclass.c</file>
<file>fpecode.c</file>
<file>fpreset.c</file>
<file>isnan.c</file>
- <file>logb.c</file>
<file>nafter.c</file>
<file>scalb.c</file>
- <file>statfp.c</file>
+
+ <if property="ARCH" value="i386">
+ <directory name="i386">
+ <file>clearfp.c</file>
+ <file>cntrlfp.c</file>
+ <file>logb.c</file>
+ <file>statfp.c</file>
+ </directory>
+ </if>
</directory>
<directory name="io">
<file>access.c</file>
@@ -121,13 +130,12 @@
<file>tanh.c</file>
<file>pow_asm.c</file>
- <if property="ARCH" value="i386">
- <file>atan2.c</file>
- <file>exp.c</file>
- <file>fmod.c</file>
- <file>ldexp.c</file>
-
+ <if property="ARCH" value="i386">
<directory name="i386">
+ <file>atan2.c</file>
+ <file>exp.c</file>
+ <file>fmod.c</file>
+ <file>ldexp.c</file>
<file>atan_asm.s</file>
<file>pow_asm.s</file>
<file>log10_asm.s</file>
Removed: trunk/reactos/lib/crt/except/seh.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/crt/except/seh.s?rev=2…
==============================================================================
--- trunk/reactos/lib/crt/except/seh.s (original)
+++ trunk/reactos/lib/crt/except/seh.s (removed)
@@ -1,380 +1,0 @@
-/* $Id$
- *
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS MSVCRT Runtime Library
- * PURPOSE: Runtime library exception support for IA-32
- * FILE: lib/msvcrt/except/seh.s
- * PROGRAMER: Casper S. Hornstrup (chorns(a)users.sourceforge.net)
- * NOTES: This file is shared with ntoskrnl/rtl/i386/seh.s.
- * Please keep them in sync.
- */
-
-#define ExceptionContinueExecution 0
-#define ExceptionContinueSearch 1
-#define ExceptionNestedException 2
-#define ExceptionCollidedUnwind 3
-
-#define EXCEPTION_NONCONTINUABLE 0x01
-#define EXCEPTION_UNWINDING 0x02
-#define EXCEPTION_EXIT_UNWIND 0x04
-#define EXCEPTION_STACK_INVALID 0x08
-#define EXCEPTION_NESTED_CALL 0x10
-#define EXCEPTION_TARGET_UNWIND 0x20
-#define EXCEPTION_COLLIDED_UNWIND 0x40
-
-#define EXCEPTION_UNWIND_MODE \
-( EXCEPTION_UNWINDING \
- | EXCEPTION_EXIT_UNWIND \
- | EXCEPTION_TARGET_UNWIND \
- | EXCEPTION_COLLIDED_UNWIND)
-
-#define EREC_CODE 0x00
-#define EREC_FLAGS 0x04
-#define EREC_RECORD 0x08
-#define EREC_ADDRESS 0x0C
-#define EREC_NUMPARAMS 0x10
-#define EREC_INFO 0x14
-
-#define TRYLEVEL_NONE -1
-#define TRYLEVEL_INVALID -2
-
-#define ER_STANDARDESP -0x08
-#define ER_EPOINTERS -0x04
-#define ER_PREVFRAME 0x00
-#define ER_HANDLER 0x04
-#define ER_SCOPETABLE 0x08
-#define ER_TRYLEVEL 0x0C
-#define ER_EBP 0x10
-
-#define ST_TRYLEVEL 0x00
-#define ST_FILTER 0x04
-#define ST_HANDLER 0x08
-
-#define CONTEXT_EDI 0x9C
-#define CONTEXT_EBX 0xA4
-#define CONTEXT_EIP 0xB8
-
-.globl __local_unwind2
-.globl __except_handler3
-.globl __EH_prolog
-
-// EAX = value to print
-_do_debug:
- pushal
- pushl %eax
- call _MsvcrtDebug@4
- popal
- ret
-
-#define LU2_TRYLEVEL 0x08
-#define LU2_REGFRAME 0x04
-
-//
-// void
-// _local_unwind2(PEXCEPTION_REGISTRATION RegistrationFrame,
-// LONG TryLevel)
-//
-// Parameters:
-// [EDX+08h] - PEXCEPTION_REGISTRATION RegistrationFrame
-// [EDX+04h] - LONG TryLevel
-// Registers:
-// EBP - EBP of call frame we are unwinding
-// Returns:
-// Nothing
-// Notes:
-// Run all termination handlers for a call frame from the current
-// try-level up to (but not including) the given stop try-level.
-__local_unwind2:
- // Setup our call frame so we can access parameters using EDX
- //pushl %ebp
- movl %esp, %edx
-
- // FIXME: Setup an EXCEPTION_REGISTRATION entry to protect the
- // unwinding in case something goes wrong
-
-.lu2_next_scope:
-
- // Keep a pointer to the exception registration in EBX
- movl LU2_REGFRAME(%edx), %ebx
-
- // If we have reached the end of the chain or we're asked to stop here
- // by the caller then exit
- test %ebx, %ebx
- je .lu2_done
-
- movl ER_TRYLEVEL(%ebx), %eax
- cmpl $-1, %eax
- je .lu2_done
-
- cmpl LU2_TRYLEVEL(%edx), %eax
- je .lu2_done
-
- // Keep a pointer to the scopetable in ESI
- movl ER_SCOPETABLE(%ebx), %esi
-
- // Compute the offset of the entry in the scopetable that describes
- // the scope that is to be unwound. Put the offset in EDI.
- movl ST_TRYLEVEL(%esi), %edi
- lea (%edi, %edi, 2), %edi
- shll $2, %edi
- addl %esi, %edi
-
- // If this is not a termination handler then skip it
- cmpl $0, ST_FILTER(%edi)
- jne .lu2_next_scope
-
- // Save the previous try-level in the exception registration structure
- movl ST_TRYLEVEL(%edi), %eax
- movl %eax, ER_TRYLEVEL(%ebx)
-
- // Fetch the address of the termination handler
- movl ST_HANDLER(%edi), %eax
-
- // Termination handlers may trash all registers so save the
- // important ones and then call the handler
- pushl %edx
- call *%eax
-
- // Get our base pointer back
- popl %edx
-
- jmp .lu2_next_scope
-
-.lu2_done:
-
- // FIXME: Tear down the EXCEPTION_REGISTRATION entry setup to protect
- // the unwinding
-
- //movl %esi, %esp
- //popl %ebp
- ret
-
-#define EH3_DISPCONTEXT 0x14
-#define EH3_CONTEXT 0x10
-#define EH3_REGFRAME 0x0C
-#define EH3_ERECORD 0x08
-
-// Parameters:
-// [ESP+14h] - PVOID DispatcherContext
-// [ESP+10h] - PCONTEXT Context
-// [ESP+0Ch] - PEXCEPTION_REGISTRATION RegistrationFrame
-// [ESP+08h] - PEXCEPTION_RECORD ExceptionRecord
-// Registers:
-// Unknown
-// Returns:
-// EXCEPTION_DISPOSITION - How this handler handled the exception
-// Notes:
-// Try to find an exception handler that will handle the exception.
-// Traverse the entries in the scopetable that is associated with the
-// exception registration passed as a parameter to this function.
-// If an exception handler that will handle the exception is found, it
-// is called and this function never returns
-__except_handler3:
- // Setup our call frame so we can access parameters using EBP
- pushl %ebp // Standard ESP in frame (considered part of
EXCEPTION_REGISTRATION)
- movl %esp, %ebp
-
- // Don't trust the direction flag to be cleared
- cld
-
- // Either we're called to handle an exception or we're called to unwind
- movl EH3_ERECORD(%ebp), %eax
- testl $EXCEPTION_UNWIND_MODE, EREC_FLAGS(%eax)
- jnz .eh3_unwind
-
- // Keep a pointer to the exception registration in EBX
- movl EH3_REGFRAME(%ebp), %ebx
-
- // Build an EXCEPTION_POINTERS structure on the stack and store it's
- // address in the EXCEPTION_REGISTRATION structure
- movl EH3_CONTEXT(%esp), %eax
- pushl %ebx // Registration frame
- pushl %eax // Context
- movl %esp, ER_EPOINTERS(%ebx) // Pointer to EXCEPTION_REGISTRATION on the stack
-
- // Keep current try-level in EDI
- movl ER_TRYLEVEL(%ebx), %edi
-
- // Keep a pointer to the scopetable in ESI
- movl ER_SCOPETABLE(%ebx), %esi
-
-.eh3_next_scope:
-
- // If we have reached the end of the chain then exit
- cmpl $-1, %edi
- je .eh3_search
-
- // Compute the offset of the entry in the scopetable and store
- // the absolute address in EAX
- lea (%edi, %edi, 2), %eax
- shll $2, %eax
- addl %esi, %eax
-
- // Fetch the address of the filter routine
- movl ST_FILTER(%eax), %eax
-
- // If this is a termination handler then skip it
- cmpl $0, %eax
- je .eh3_continue
-
- // Filter routines may trash all registers so save the important
- // ones before restoring the call frame ebp and calling the handler
- pushl %ebp
- pushl %edi // Stop try-level
- lea ER_EBP(%ebx), %ebp
- call *%eax
- popl %edi // Stop try-level
- popl %ebp
-
- // Reload EBX with registration frame address
- movl EH3_REGFRAME(%ebp), %ebx
-
- // Be more flexible here by checking if the return value is less than
- // zero, equal to zero, or larger than zero instead of the defined
- // values:
- // -1 (EXCEPTION_CONTINUE_EXECUTION)
- // 0 (EXCEPTION_CONTINUE_SEARCH)
- // +1 (EXCEPTION_EXECUTE_HANDLER)
- orl %eax, %eax
- jz .eh3_continue
- js .eh3_dismiss
-
- // Filter returned: EXCEPTION_EXECUTE_HANDLER
-
- // Ask the OS to perform global unwinding.
- pushl %edi // Save stop try-level
- pushl %ebx // Save registration frame address
- pushl %ebx // Registration frame address
- call __global_unwind2
- popl %eax // Remove parameter to __global_unwind2
- popl %ebx // Restore registration frame address
- popl %edi // Restore stop try-level
-
- // Change the context structure so _except_finish is called in the
- // correct context since we return ExceptionContinueExecution.
- movl EH3_CONTEXT(%ebp), %eax
-
- movl %edi, CONTEXT_EDI(%eax) // Stop try-level
- movl %ebx, CONTEXT_EBX(%eax) // Registration frame address
- movl $_except_finish, CONTEXT_EIP(%eax)
-
- movl $ExceptionContinueExecution, %eax
- jmp .eh3_return
-
- // Filter returned: EXCEPTION_CONTINUE_SEARCH
-.eh3_continue:
-
- // Reload ESI because the filter routine may have trashed it
- movl ER_SCOPETABLE(%ebx), %esi
-
- // Go one try-level closer to the top
- lea (%edi, %edi, 2), %edi
- shll $2, %edi
- addl %esi, %edi
- movl ST_TRYLEVEL(%edi), %edi
-
- jmp .eh3_next_scope
-
- // Filter returned: EXCEPTION_CONTINUE_EXECUTION
- // Continue execution like nothing happened
-.eh3_dismiss:
- movl $ExceptionContinueExecution, %eax
- jmp .eh3_return
-
- // Tell the OS to search for another handler that will handle the exception
-.eh3_search:
-
- movl $ExceptionContinueSearch, %eax
- jmp .eh3_return
-
- // Perform local unwinding
-.eh3_unwind:
-
- testl $EXCEPTION_TARGET_UNWIND, EREC_FLAGS(%eax)
- jnz .eh3_return
-
- // Save some important registers
- pushl %ebp
-
- lea ER_EBP(%ebx), %ebp
- pushl $-1
- pushl %ebx
- call __local_unwind2
- addl $8, %esp
-
- // Restore some important registers
- popl %ebp
-
- movl $ExceptionContinueSearch, %eax
-
- // Get me out of here
-.eh3_return:
-
- movl %ebp, %esp
- popl %ebp
- ret
-
-// Parameters:
-// None
-// Registers:
-// EBX - Pointer to exception registration structure
-// EDI - Stop try-level
-// Returns:
-// -
-// Notes:
-// -
-_except_finish:
-
- // Setup EBP for the exception handler. By doing this the exception
- // handler can access local variables as normal
- lea ER_EBP(%ebx), %ebp
-
- // Save some important registers
- pushl %ebp
- pushl %ebx
- pushl %edi
-
- // Stop try-level
- pushl %edi
-
- // Pointer to exception registration structure
- pushl %ebx
- call __local_unwind2
- addl $8, %esp
-
- // Restore some important registers
- popl %edi
- popl %ebx
- popl %ebp
-
- // Keep a pointer to the scopetable in ESI
- movl ER_SCOPETABLE(%ebx), %esi
-
- // Compute the offset of the entry in the scopetable and store
- // the absolute address in EDI
- lea (%edi, %edi, 2), %edi
- shll $2, %edi
- addl %esi, %edi
-
- // Set the current try-level to the previous try-level and call
- // the exception handler
- movl ST_TRYLEVEL(%edi), %eax
- movl %eax, ER_TRYLEVEL(%ebx)
- movl ST_HANDLER(%edi), %eax
-
- call *%eax
-
- // We should never get here
- ret
-
-// Copied from Wine.
-__EH_prolog:
- pushl $-1
- pushl %eax
- pushl %fs:0
- movl %esp, %fs:0
- movl 12(%esp), %eax
- movl %ebp, 12(%esp)
- leal 12(%esp), %ebp
- pushl %eax
- ret
Removed: trunk/reactos/lib/crt/except/unwind.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/crt/except/unwind.c?re…
==============================================================================
--- trunk/reactos/lib/crt/except/unwind.c (original)
+++ trunk/reactos/lib/crt/except/unwind.c (removed)
@@ -1,72 +1,0 @@
-#define WIN32_NO_STATUS
-#include <precomp.h>
-#include <windows.h>
-#define NTOS_MODE_USER
-#include <ndk/umtypes.h>
-#include <ndk/extypes.h>
-#include <ndk/rtlfuncs.h>
-
-/*
- * @implemented
- */
-void __cdecl
-_global_unwind2(PEXCEPTION_REGISTRATION_RECORD RegistrationFrame)
-{
-#ifdef __GNUC__
- RtlUnwind(RegistrationFrame, &&__ret_label, NULL, 0);
-__ret_label:
- // return is important
- return;
-#else
-#endif
-}
-
-
-/* VC++ extensions to Win32 SEH */
-typedef struct _SCOPETABLE
-{
- int previousTryLevel;
- int (*lpfnFilter)(PEXCEPTION_POINTERS);
- int (*lpfnHandler)(void);
-} SCOPETABLE, *PSCOPETABLE;
-
-typedef struct _MSVCRT_EXCEPTION_FRAME
-{
- PEXCEPTION_REGISTRATION_RECORD *prev;
- void (*handler)(PEXCEPTION_RECORD, PEXCEPTION_REGISTRATION_RECORD,
- PCONTEXT, PEXCEPTION_RECORD);
- PSCOPETABLE scopetable;
- int trylevel;
- int _ebp;
- PEXCEPTION_POINTERS xpointers;
-} MSVCRT_EXCEPTION_FRAME;
-
-
-typedef struct __JUMP_BUFFER
-{
- unsigned long Ebp;
- unsigned long Ebx;
- unsigned long Edi;
- unsigned long Esi;
- unsigned long Esp;
- unsigned long Eip;
- unsigned long Registration;
- unsigned long TryLevel;
- /* Start of new struct members */
- unsigned long Cookie;
- unsigned long UnwindFunc;
- unsigned long UnwindData[6];
-} _JUMP_BUFFER;
-
-void
-_local_unwind2(MSVCRT_EXCEPTION_FRAME *RegistrationFrame,
- LONG TryLevel);
-
-/*
- * @implemented
-*/
-
-void __stdcall _seh_longjmp_unwind(_JUMP_BUFFER *jmp)
-{
- _local_unwind2((MSVCRT_EXCEPTION_FRAME*) jmp->Registration, jmp->TryLevel);
-}
Removed: trunk/reactos/lib/crt/float/clearfp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/crt/float/clearfp.c?re…
==============================================================================
--- trunk/reactos/lib/crt/float/clearfp.c (original)
+++ trunk/reactos/lib/crt/float/clearfp.c (removed)
@@ -1,29 +1,0 @@
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS system libraries
- * FILE: lib/crt/??????
- * PURPOSE: Unknown
- * PROGRAMER: Unknown
- * UPDATE HISTORY:
- * 25/11/05: Added license header
- */
-
-#include <precomp.h>
-
-unsigned int _statusfp( void );
-
-/*
- * @implemented
- */
-unsigned int _clearfp (void)
-{
- unsigned short __res = _statusfp();
-#ifdef __GNUC__
-__asm__ __volatile__ (
- "fclex \n\t"
- );
-#else
-#endif /*__GNUC__*/
- return __res;
-}
-
Removed: trunk/reactos/lib/crt/float/cntrlfp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/crt/float/cntrlfp.c?re…
==============================================================================
--- trunk/reactos/lib/crt/float/cntrlfp.c (original)
+++ trunk/reactos/lib/crt/float/cntrlfp.c (removed)
@@ -1,174 +1,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-
-#include <precomp.h>
-
-#define X87_CW_IM (1<<0) /* Invalid operation mask */
-#define X87_CW_DM (1<<1) /* Denormal operand mask */
-#define X87_CW_ZM (1<<2) /* Zero divide mask */
-#define X87_CW_OM (1<<3) /* Overflow mask */
-#define X87_CW_UM (1<<4) /* Underflow mask */
-#define X87_CW_PM (1<<5) /* Precision mask */
-
-#define X87_CW_PC_MASK (3<<8) /* precision control mask */
-#define X87_CW_PC24 (0<<8) /* 24 bit precision */
-#define X87_CW_PC53 (2<<8) /* 53 bit precision */
-#define X87_CW_PC64 (3<<8) /* 64 bit precision */
-
-#define X87_CW_RC_MASK (3<<10) /* rounding control mask */
-#define X87_CW_RC_NEAREST (0<<10) /* round to nearest */
-#define X87_CW_RC_DOWN (1<<10) /* round down */
-#define X87_CW_RC_UP (2<<10) /* round up */
-#define X87_CW_RC_ZERO (3<<10) /* round toward zero (chop) */
-
-#define X87_CW_IC (1<<12) /* infinity control flag */
-
-/*
- * @implemented
- */
-unsigned int _controlfp(unsigned int unNew, unsigned int unMask)
-{
- return _control87(unNew,unMask);
-}
-
-/*
- * @implemented
- */
-unsigned int _control87(unsigned int unNew, unsigned int unMask)
-{
- unsigned int FpuCw;
- unsigned int DummyCw = 0;
-
- /* get the controlword */
- asm volatile("fstcw %0\n\t" : "=m"(FpuCw));
- FpuCw &= 0x0000ffff;
-
- /* translate it into _control87 format */
- if (FpuCw & X87_CW_IM)
- DummyCw |= _EM_INVALID;
- if (FpuCw & X87_CW_DM)
- DummyCw |= _EM_DENORMAL;
- if (FpuCw & X87_CW_ZM)
- DummyCw |= _EM_ZERODIVIDE;
- if (FpuCw & X87_CW_OM)
- DummyCw |= _EM_OVERFLOW;
- if (FpuCw & X87_CW_UM)
- DummyCw |= _EM_UNDERFLOW;
- if (FpuCw & X87_CW_PM)
- DummyCw |= _EM_INEXACT;
-
- switch (FpuCw & X87_CW_PC_MASK)
- {
- case X87_CW_PC24:
- DummyCw |= _PC_24;
- break;
- case X87_CW_PC53:
- DummyCw |= _PC_53;
- break;
- case X87_CW_PC64:
- DummyCw |= _PC_64;
- break;
- }
-
- switch (FpuCw & X87_CW_RC_MASK)
- {
- case X87_CW_RC_NEAREST:
- DummyCw |= _RC_NEAR;
- break;
- case X87_CW_RC_DOWN:
- DummyCw |= _RC_DOWN;
- break;
- case X87_CW_RC_UP:
- DummyCw |= _RC_UP;
- break;
- case X87_CW_RC_ZERO:
- DummyCw |= _RC_CHOP;
- break;
- }
-
- /* unset (un)masked bits */
- DummyCw &= ~unMask;
- unNew &= unMask;
-
- /* set new bits */
- DummyCw |= unNew;
-
- /* translate back into x87 format
- * FIXME: translate infinity control!
- */
- FpuCw = 0;
- if (DummyCw & _EM_INVALID)
- FpuCw |= X87_CW_IM;
- if (DummyCw & _EM_DENORMAL)
- FpuCw |= X87_CW_DM;
- if (DummyCw & _EM_ZERODIVIDE)
- FpuCw |= X87_CW_ZM;
- if (DummyCw & _EM_OVERFLOW)
- FpuCw |= X87_CW_OM;
- if (DummyCw & _EM_UNDERFLOW)
- FpuCw |= X87_CW_UM;
- if (DummyCw & _EM_INEXACT)
- FpuCw |= X87_CW_PM;
-
- switch (DummyCw & _MCW_PC)
- {
- case _PC_24:
- FpuCw |= X87_CW_PC24;
- break;
- case _PC_53:
- FpuCw |= X87_CW_PC53;
- break;
- case _PC_64:
- default:
- FpuCw |= X87_CW_PC64;
- break;
- }
-
- switch (DummyCw & _MCW_RC)
- {
- case _RC_NEAR:
- FpuCw |= X87_CW_RC_NEAREST;
- break;
- case _RC_DOWN:
- FpuCw |= X87_CW_RC_DOWN;
- break;
- case _RC_UP:
- FpuCw |= X87_CW_RC_UP;
- break;
- case _RC_CHOP:
- FpuCw |= X87_CW_RC_ZERO;
- break;
- }
-
- /* set controlword */
- asm volatile("fldcw %0" : : "m"(FpuCw));
-
- return DummyCw;
-
-#if 0 /* The follwing is the original code, broken I think! -blight */
-register unsigned int __res;
-#ifdef __GNUC__
-__asm__ __volatile__ (
- "pushl %%eax \n\t" /* make room on stack */
- "fstcw (%%esp) \n\t"
- "fwait \n\t"
- "popl %%eax \n\t"
- "andl $0xffff, %%eax \n\t" /* OK; we have the old value ready */
-
- "movl %1, %%ecx \n\t"
- "notl %%ecx \n\t"
- "andl %%eax, %%ecx \n\t" /* the bits we want to keep */
-
- "movl %2, %%edx \n\t"
- "andl %1, %%edx \n\t" /* the bits we want to change */
-
- "orl %%ecx, %%edx\n\t" /* the new value */
- "pushl %%edx \n\t"
- "fldcw (%%esp) \n\t"
- "popl %%edx \n\t"
-
- :"=a" (__res):"r" (unNew),"r" (unMask): "dx",
"cx");
-#else
-#endif /*__GNUC__*/
- return __res;
-#endif
-}
Removed: trunk/reactos/lib/crt/float/logb.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/crt/float/logb.c?rev=2…
==============================================================================
--- trunk/reactos/lib/crt/float/logb.c (original)
+++ trunk/reactos/lib/crt/float/logb.c (removed)
@@ -1,34 +1,0 @@
-/* Math functions for i387.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by John C. Bowman <bowman(a)ipp-garching.mpg.de>de>, 1995.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <precomp.h>
-
-double _logb (double __x)
-{
- register double __val;
-#ifdef __GNUC__
- register double __junk;
- __asm __volatile__
- ("fxtract\n\t"
- : "=t" (__junk), "=u" (__val) : "0" (__x));
-#else
-#endif /*__GNUC__*/
- return __val;
-}
Removed: trunk/reactos/lib/crt/float/statfp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/crt/float/statfp.c?rev…
==============================================================================
--- trunk/reactos/lib/crt/float/statfp.c (original)
+++ trunk/reactos/lib/crt/float/statfp.c (removed)
@@ -1,29 +1,0 @@
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS system libraries
- * FILE: lib/crt/??????
- * PURPOSE: Unknown
- * PROGRAMER: Unknown
- * UPDATE HISTORY:
- * 25/11/05: Added license header
- */
-
-#include <precomp.h>
-
-/*
- * @implemented
- */
-unsigned int _statusfp (void)
-{
-
-register unsigned short __res;
-#ifdef __GNUC__
-__asm__ __volatile__ (
- "fstsw %0 \n\t"
-// "movzwl %ax, %eax"
- :"=a" (__res)
- );
-#else
-#endif /*__GNUC__*/
- return __res;
-}
Removed: trunk/reactos/lib/crt/math/atan2.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/crt/math/atan2.c?rev=2…
==============================================================================
--- trunk/reactos/lib/crt/math/atan2.c (original)
+++ trunk/reactos/lib/crt/math/atan2.c (removed)
@@ -1,21 +1,0 @@
-
-#include <math.h>
-
-double atan2 (double __y, double __x);
-
-/*
- * @implemented
- */
-double atan2 (double __y, double __x)
-{
- register double __val;
-#ifdef __GNUC__
- __asm __volatile__
- ("fpatan\n\t"
- "fld %%st(0)"
- : "=t" (__val) : "0" (__x), "u" (__y));
-#else
- __val = linkme_atan2(__x, __y);
-#endif /*__GNUC__*/
- return __val;
-}
Removed: trunk/reactos/lib/crt/math/exp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/crt/math/exp.c?rev=237…
==============================================================================
--- trunk/reactos/lib/crt/math/exp.c (original)
+++ trunk/reactos/lib/crt/math/exp.c (removed)
@@ -1,47 +1,0 @@
-/* Math functions for i387.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by John C. Bowman <bowman(a)ipp-garching.mpg.de>de>, 1995.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <math.h>
-
-double exp (double __x);
-
-double exp (double __x)
-{
-#ifdef __GNUC__
- register double __value, __exponent;
- __asm __volatile__
- ("fldl2e # e^x = 2^(x * log2(e))\n\t"
- "fmul %%st(1) # x * log2(e)\n\t"
- "fst %%st(1)\n\t"
- "frndint # int(x * log2(e))\n\t"
- "fxch\n\t"
- "fsub %%st(1) # fract(x * log2(e))\n\t"
- "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t"
- : "=t" (__value), "=u" (__exponent) : "0" (__x));
- __value += 1.0;
- __asm __volatile__
- ("fscale"
- : "=t" (__value) : "0" (__value), "u" (__exponent));
-
- return __value;
-#else
- return linkme_exp(__x);
-#endif /*__GNUC__*/
-}
Removed: trunk/reactos/lib/crt/math/fmod.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/crt/math/fmod.c?rev=23…
==============================================================================
--- trunk/reactos/lib/crt/math/fmod.c (original)
+++ trunk/reactos/lib/crt/math/fmod.c (removed)
@@ -1,39 +1,0 @@
-/* Math functions for i387.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by John C. Bowman <bowman(a)ipp-garching.mpg.de>de>, 1995.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <math.h>
-
-double fmod (double __x, double __y);
-
-double fmod (double __x, double __y)
-{
- register double __val;
-#ifdef __GNUC__
- __asm __volatile__
- ("1: fprem\n\t"
- "fstsw %%ax\n\t"
- "sahf\n\t"
- "jp 1b"
- : "=t" (__val) : "0" (__x), "u" (__y) :
"ax", "cc");
-#else
- __val = linkme_fmod(__x, __y);
-#endif /*__GNUC__*/
- return __val;
-}
Removed: trunk/reactos/lib/crt/math/ldexp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/crt/math/ldexp.c?rev=2…
==============================================================================
--- trunk/reactos/lib/crt/math/ldexp.c (original)
+++ trunk/reactos/lib/crt/math/ldexp.c (removed)
@@ -1,36 +1,0 @@
-/* Math functions for i387.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by John C. Bowman <bowman(a)ipp-garching.mpg.de>de>, 1995.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <math.h>
-
-double ldexp (double __x, int __y);
-
-double ldexp (double __x, int __y)
-{
- register double __val;
-#ifdef __GNUC__
- __asm __volatile__
- ("fscale"
- : "=t" (__val) : "0" (__x), "u" ((double) __y));
-#else
- __val = linkme_ldexp(__x, __y);
-#endif /*__GNUC__*/
- return __val;
-}