Author: tkreuzer Date: Fri Aug 19 18:10:17 2011 New Revision: 53320
URL: http://svn.reactos.org/svn/reactos?rev=53320&view=rev Log: [CRT] - Remove duplicated functions - Fix MSVC amd64 build - cleanup the cmake file a little - creadit wine for their code
Added: trunk/reactos/lib/sdk/crt/float/amd64/ (with props) trunk/reactos/lib/sdk/crt/float/amd64/clearfp.S (with props) trunk/reactos/lib/sdk/crt/float/amd64/fpreset.S (with props) trunk/reactos/lib/sdk/crt/float/amd64/logb.S (with props) Modified: trunk/reactos/lib/sdk/crt/crt.cmake trunk/reactos/lib/sdk/crt/float/i386/cntrlfp.c trunk/reactos/lib/sdk/crt/float/i386/statfp.c trunk/reactos/lib/sdk/crt/math/amd64/ceilf.S trunk/reactos/lib/sdk/crt/math/amd64/floorf.S trunk/reactos/lib/sdk/crt/math/stubs.c trunk/reactos/lib/sdk/crt/stdio/file.c trunk/reactos/lib/sdk/crt/time/futime.c trunk/reactos/lib/sdk/crt/time/utime.c
Modified: trunk/reactos/lib/sdk/crt/crt.cmake URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/crt.cmake?rev=5... ============================================================================== --- trunk/reactos/lib/sdk/crt/crt.cmake [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/crt.cmake [iso-8859-1] Fri Aug 19 18:10:17 2011 @@ -1,3 +1,4 @@ + list(APPEND CRT_SOURCE conio/cgets.c conio/cputs.c @@ -313,24 +314,6 @@ float/i386/fpreset.c float/i386/logb.c float/i386/statfp.c - setjmp/i386/setjmp.s) - if(MSVC) - list(APPEND CRT_SOURCE - except/i386/cpp.s) - endif() -elseif(ARCH MATCHES amd64) - list(APPEND CRT_SOURCE - except/amd64/seh.s - float/i386/clearfp.c - float/i386/cntrlfp.c - float/i386/fpreset.c - float/i386/logb.c - float/i386/statfp.c - setjmp/amd64/setjmp.s) -endif() - -if(ARCH MATCHES i386) - list(APPEND CRT_SOURCE math/i386/alldiv_asm.s math/i386/alldvrm_asm.s math/i386/allmul_asm.s @@ -366,6 +349,7 @@ mem/i386/memmove_asm.s mem/i386/memset_asm.s misc/i386/readcr4.S + setjmp/i386/setjmp.s string/i386/strcat_asm.s string/i386/strchr_asm.s string/i386/strcmp_asm.s @@ -386,8 +370,43 @@ string/i386/wcsncpy_asm.s string/i386/wcsnlen_asm.s string/i386/wcsrchr_asm.s) -else() + if(MSVC) + list(APPEND CRT_SOURCE + except/i386/cpp.s) + endif() +elseif(ARCH MATCHES amd64) list(APPEND CRT_SOURCE + except/amd64/seh.s + float/amd64/clearfp.S + float/i386/cntrlfp.c + 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 + math/amd64/ceilf.S + math/amd64/exp.S + math/amd64/fabs.S + math/amd64/floor.S + math/amd64/floorf.S + math/amd64/fmod.S + math/amd64/fmodf.S + math/amd64/ldexp.S + math/amd64/log.S + math/amd64/log10.S + math/amd64/pow.S + math/amd64/sqrt.S + math/amd64/sqrtf.S + math/amd64/tan.S + setjmp/amd64/setjmp.s) +endif() + +if(NOT ARCH MATCHES i386) + list(APPEND CRT_SOURCE + math/cos.c + math/sin.c math/stubs.c mem/memchr.c mem/memcpy.c @@ -415,30 +434,6 @@ string/wcsrchr.c) endif()
-if(ARCH MATCHES amd64) - list(APPEND CRT_SOURCE - math/cos.c - math/sin.c - math/amd64/alldiv.S - math/amd64/atan.S - math/amd64/atan2.S - math/amd64/ceil.S - math/amd64/ceilf.S - math/amd64/exp.S - math/amd64/fabs.S - math/amd64/floor.S - math/amd64/floorf.S - math/amd64/fmod.S - math/amd64/fmodf.S - math/amd64/ldexp.S - math/amd64/log.S - math/amd64/log10.S - math/amd64/pow.S - math/amd64/sqrt.S - math/amd64/sqrtf.S - math/amd64/tan.S) -endif() - add_library(crt ${CRT_SOURCE}) target_link_libraries(crt chkstk) set_property(TARGET crt PROPERTY COMPILE_DEFINITIONS __MINGW_IMPORT=extern USE_MSVCRT_PREFIX _MSVCRT_LIB_ _MSVCRT_ _MT)
Propchange: trunk/reactos/lib/sdk/crt/float/amd64/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Fri Aug 19 18:10:17 2011 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+)
Propchange: trunk/reactos/lib/sdk/crt/float/amd64/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details.
Propchange: trunk/reactos/lib/sdk/crt/float/amd64/ ------------------------------------------------------------------------------ bugtraq:url = http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: trunk/reactos/lib/sdk/crt/float/amd64/ ------------------------------------------------------------------------------ tsvn:logminsize = 10
Added: trunk/reactos/lib/sdk/crt/float/amd64/clearfp.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/float/amd64/cle... ============================================================================== --- trunk/reactos/lib/sdk/crt/float/amd64/clearfp.S (added) +++ trunk/reactos/lib/sdk/crt/float/amd64/clearfp.S [iso-8859-1] Fri Aug 19 18:10:17 2011 @@ -1,0 +1,15 @@ + + + +#include <asm.inc> + +.code64 + +PUBLIC _clearfp +FUNC _clearfp + .ENDPROLOG + fnclex + +ENDFUNC _clearfp + +END
Propchange: trunk/reactos/lib/sdk/crt/float/amd64/clearfp.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/float/amd64/fpreset.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/float/amd64/fpr... ============================================================================== --- trunk/reactos/lib/sdk/crt/float/amd64/fpreset.S (added) +++ trunk/reactos/lib/sdk/crt/float/amd64/fpreset.S [iso-8859-1] Fri Aug 19 18:10:17 2011 @@ -1,0 +1,11 @@ + +#include <asm.inc> + +.code64 + +FUNC _fpreset + .endprolog + fninit +ENDFUNC _fpreset + +END
Propchange: trunk/reactos/lib/sdk/crt/float/amd64/fpreset.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/float/amd64/logb.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/float/amd64/log... ============================================================================== --- trunk/reactos/lib/sdk/crt/float/amd64/logb.S (added) +++ trunk/reactos/lib/sdk/crt/float/amd64/logb.S [iso-8859-1] Fri Aug 19 18:10:17 2011 @@ -1,0 +1,16 @@ + + +#include <asm.inc> + +.code64 + +FUNC _logb + .endprolog + + fld dword ptr [rsp + 8] + fxtract + fstp st + ret +ENDFUNC _logb + +END
Propchange: trunk/reactos/lib/sdk/crt/float/amd64/logb.S ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/reactos/lib/sdk/crt/float/i386/cntrlfp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/float/i386/cntr... ============================================================================== --- trunk/reactos/lib/sdk/crt/float/i386/cntrlfp.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/float/i386/cntrlfp.c [iso-8859-1] Fri Aug 19 18:10:17 2011 @@ -45,8 +45,10 @@ /* Get fp control word */ #if defined(__GNUC__) __asm__ __volatile__( "fstcw %0" : "=m" (fpword) : ); +#elif defined(_M_IX86) + __asm fstcw [fpword]; #else - __asm fstcw [fpword]; + #pragma message("FIXME: _control87 is halfplemented") #endif
TRACE("Control word before : %08x\n", fpword); @@ -98,8 +100,10 @@ /* Put fp control word */ #if defined(__GNUC__) __asm__ __volatile__( "fldcw %0" : : "m" (fpword) ); +#elif defined(_M_IX86) + __asm fldcw [fpword]; #else - __asm fldcw [fpword]; + #pragma message("FIXME: _control87 is halfplemented") #endif
return flags;
Modified: trunk/reactos/lib/sdk/crt/float/i386/statfp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/float/i386/stat... ============================================================================== --- trunk/reactos/lib/sdk/crt/float/i386/statfp.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/float/i386/statfp.c [iso-8859-1] Fri Aug 19 18:10:17 2011 @@ -28,8 +28,10 @@ unsigned int fpword; #if defined(__GNUC__) __asm__ __volatile__( "fstsw %0" : "=m" (fpword) : ); +#elif defined(_M_IX86) + __asm fstsw [fpword]; #else - __asm fstsw [fpword]; + #pragma message("FIXME: _statusfp is halfplemented") #endif if (fpword & 0x1) retVal |= _SW_INVALID; if (fpword & 0x2) retVal |= _SW_DENORMAL;
Modified: trunk/reactos/lib/sdk/crt/math/amd64/ceilf.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/ceil... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/ceilf.S [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/math/amd64/ceilf.S [iso-8859-1] Fri Aug 19 18:10:17 2011 @@ -15,11 +15,12 @@ .code64
PUBLIC ceilf -ceilf: +FUNC ceilf sub rsp, 16 + .ENDPROLOG
/* Put parameter on the stack */ - movss [rsp], xmm0 + movss dword ptr [rsp], xmm0 fld dword ptr [rsp]
/* Change fpu control word to round up */ @@ -37,9 +38,10 @@ fldcw [rsp + 8]
fstp dword ptr [rsp] - movss xmm0, [rsp] + movss xmm0, dword ptr [rsp]
add rsp, 16 ret +ENDFUNC ceilf
END
Modified: trunk/reactos/lib/sdk/crt/math/amd64/floorf.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/floo... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/floorf.S [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/math/amd64/floorf.S [iso-8859-1] Fri Aug 19 18:10:17 2011 @@ -15,18 +15,19 @@ .code64
PUBLIC floorf -floorf: +FUNC floorf sub rsp, 16 + .ENDPROLOG
/* Put parameter on the stack */ - movss [rsp], xmm0 + movss dword ptr [rsp], xmm0 fld dword ptr [rsp]
/* Change fpu control word to round down */ fstcw [rsp] mov eax, [rsp] - or eax, 0x00400 - and eax, 0x0f7ff + or eax, HEX(000400) + and eax, HEX(00f7ff) mov [rsp + 8], eax fldcw [rsp + 8]
@@ -37,8 +38,9 @@ fldcw [rsp]
fstp dword ptr [rsp] - movss xmm0, [rsp] + movss xmm0, dword ptr [rsp] add rsp, 16 ret +ENDFUNC floorf
END
Modified: trunk/reactos/lib/sdk/crt/math/stubs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/stubs.c?re... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/stubs.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/math/stubs.c [iso-8859-1] Fri Aug 19 18:10:17 2011 @@ -132,89 +132,3 @@ return fmod(x, y); }
-/* The following functions are likely workarounds for the pentium fdiv bug */ -void __stdcall _adj_fdiv_m32( unsigned int arg ) -{ - FIXME("_adj_fdiv_m32 stub\n"); -} -void __stdcall _adj_fdiv_m32i( int arg ) -{ - FIXME("_adj_fdiv_m32i stub\n"); -} - -void __stdcall _adj_fdiv_m64( unsigned __int64 arg ) -{ - FIXME("_adj_fdiv_m64 stub\n"); -} - -void _adj_fdiv_r(void) -{ - FIXME("_adj_fdiv_r stub\n"); -} - -void __stdcall _adj_fdivr_m32( unsigned int arg ) -{ - FIXME("_adj_fdivr_m32i stub\n"); -} - -void __stdcall _adj_fdivr_m32i( int arg ) -{ - FIXME("_adj_fdivr_m32i stub\n"); -} - -void __stdcall _adj_fdivr_m64( unsigned __int64 arg ) -{ - FIXME("_adj_fdivr_m64 stub\n"); -} - -void _adj_fpatan(void) -{ - FIXME("_adj_fpatan stub\n"); -} - -void __stdcall _adj_fdiv_m16i( short arg ) -{ - FIXME("_adj_fdiv_m16i stub\n"); -} - -void __stdcall _adj_fdivr_m16i( short arg ) -{ - FIXME("_adj_fdivr_m16i stub\n"); -} - -void _adj_fprem(void) -{ - FIXME("_adj_fprem stub\n"); -} - -void _adj_fprem1(void) -{ - FIXME("_adj_fprem1 stub\n"); -} - -void _adj_fptan(void) -{ - FIXME("_adj_fptan stub\n"); -} - -void _safe_fdiv(void) -{ - FIXME("_safe_fdiv stub\n"); -} - -void _safe_fdivr(void) -{ - FIXME("_safe_fdivr stub\n"); -} - -void _safe_fprem(void) -{ - FIXME("_safe_fprem stub\n"); -} - -void _safe_fprem1(void) -{ - FIXME("_safe_fprem1 stub\n"); -} - -
Modified: trunk/reactos/lib/sdk/crt/stdio/file.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdio/file.c?re... ============================================================================== --- trunk/reactos/lib/sdk/crt/stdio/file.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdio/file.c [iso-8859-1] Fri Aug 19 18:10:17 2011 @@ -1134,41 +1134,6 @@ { TRACE(":FILE* (%p) fd (%d)\n",file,file->_file); return file->_file; -} - -/********************************************************************* - * _futime (MSVCRT.@) - */ -int CDECL _futime(int fd, struct _utimbuf *t) -{ - HANDLE hand = fdtoh(fd); - FILETIME at, wt; - - if (hand == INVALID_HANDLE_VALUE) - return -1; - - if (!t) - { - time_t currTime; - time(&currTime); - RtlSecondsSince1970ToTime(currTime, (LARGE_INTEGER *)&at); - wt = at; - } - else - { - RtlSecondsSince1970ToTime(t->actime, (LARGE_INTEGER *)&at); - if (t->actime == t->modtime) - wt = at; - else - RtlSecondsSince1970ToTime(t->modtime, (LARGE_INTEGER *)&wt); - } - - if (!SetFileTime(hand, NULL, &at, &wt)) - { - _dosmaperr(GetLastError()); - return -1 ; - } - return 0; }
/********************************************************************* @@ -1751,38 +1716,6 @@ }
/********************************************************************* - * _utime (MSVCRT.@) - */ -int CDECL _utime(const char* path, struct _utimbuf *t) -{ - int fd = _open(path, _O_WRONLY | _O_BINARY); - - if (fd > 0) - { - int retVal = _futime(fd, t); - _close(fd); - return retVal; - } - return -1; -} - -/********************************************************************* - * _wutime (MSVCRT.@) - */ -int CDECL _wutime(const wchar_t* path, struct _utimbuf *t) -{ - int fd = _wopen(path, _O_WRONLY | _O_BINARY); - - if (fd > 0) - { - int retVal = _futime(fd, t); - _close(fd); - return retVal; - } - return -1; -} - -/********************************************************************* * _write (MSVCRT.@) */ int CDECL _write(int fd, const void* buf, unsigned int count)
Modified: trunk/reactos/lib/sdk/crt/time/futime.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/time/futime.c?r... ============================================================================== --- trunk/reactos/lib/sdk/crt/time/futime.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/time/futime.c [iso-8859-1] Fri Aug 19 18:10:17 2011 @@ -3,8 +3,37 @@ * PROJECT: ReactOS CRT library * FILE: lib/sdk/crt/time/futime.c * PURPOSE: Implementation of _futime - * PROGRAMERS: Timo Kreuzer + * PROGRAMERS: Wine team */ + +/* + * msvcrt.dll file functions + * + * Copyright 1996,1998 Marcus Meissner + * Copyright 1996 Jukka Iivonen + * Copyright 1997,2000 Uwe Bonnes + * Copyright 2000 Jon Griffiths + * Copyright 2004 Eric Pouech + * Copyright 2004 Juan Lang + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + * TODO + * Use the file flag hints O_SEQUENTIAL, O_RANDOM, O_SHORT_LIVED + */ + #include <precomp.h> #define RC_INVOKED 1 // to prevent inline functions #include <time.h> @@ -16,7 +45,7 @@ /****************************************************************************** * \name _futime * \brief Set a files modification time. - * \param [out] ptimeb Pointer to a structure of type struct _timeb that + * \param [out] ptimeb Pointer to a structure of type struct _timeb that * recieves the current time. * \sa http://msdn.microsoft.com/en-us/library/95e68951.aspx */
Modified: trunk/reactos/lib/sdk/crt/time/utime.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/time/utime.c?re... ============================================================================== --- trunk/reactos/lib/sdk/crt/time/utime.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/time/utime.c [iso-8859-1] Fri Aug 19 18:10:17 2011 @@ -3,15 +3,44 @@ * PROJECT: ReactOS CRT library * FILE: lib/sdk/crt/time/utime.c * PURPOSE: Implementation of utime, _wutime - * PROGRAMERS: Timo Kreuzer + * PROGRAMERS: Wine team */ + +/* + * msvcrt.dll file functions + * + * Copyright 1996,1998 Marcus Meissner + * Copyright 1996 Jukka Iivonen + * Copyright 1997,2000 Uwe Bonnes + * Copyright 2000 Jon Griffiths + * Copyright 2004 Eric Pouech + * Copyright 2004 Juan Lang + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + * TODO + * Use the file flag hints O_SEQUENTIAL, O_RANDOM, O_SHORT_LIVED + */ + #include <precomp.h> #include <tchar.h> #define RC_INVOKED 1 // to prevent inline functions #include <sys/utime.h> #include "bitsfixup.h"
-int +int _tutime(const _TCHAR* path, struct _utimbuf *t) { int fd = _topen(path, _O_WRONLY | _O_BINARY);