* Sync to trunk HEAD (r53473).

svn path=/branches/shell32_new-bringup/; revision=53475
This commit is contained in:
Amine Khaldi 2011-08-27 19:26:31 +00:00
commit fc902e6f58
465 changed files with 372898 additions and 11548 deletions

View file

@ -1,3 +1,4 @@
list(APPEND CRT_SOURCE
conio/cgets.c
conio/cputs.c
@ -313,24 +314,6 @@ if(ARCH MATCHES i386)
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 @@ if(ARCH MATCHES i386)
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,48 @@ if(ARCH MATCHES i386)
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
except/amd64/ehandler.c
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)
if(MSVC)
list(APPEND CRT_SOURCE
except/amd64/cpp.s)
endif()
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 +439,6 @@ else()
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)

View file

@ -98,6 +98,7 @@
<directory name="amd64">
<file>seh.s</file>
<file>chkstk_asm.s</file>
<file>ehandler.c</file>
</directory>
</if>
<file>xcptfil.c</file>
@ -157,7 +158,7 @@
<file>sinh.c</file>
<file>tanh.c</file>
<file>powl.c</file>
<directory name="ieee754">
<file>j0_y0.c</file>
<file>j1_y1.c</file>

View file

@ -0,0 +1,53 @@
#include <asm.inc>
.code64
.align 4
MACRO(START_VTABLE, shortname, cxxname)
EXTERN shortname&_rtti:PROC
EXTERN MSVCRT_&shortname&_vector_dtor:PROC
.double shortname&_rtti
PUBLIC MSVCRT_&shortname&_vtable
MSVCRT_&shortname&_vtable:
PUBLIC &cxxname
&cxxname:
.double MSVCRT_&shortname&_vector_dtor
ENDM
MACRO(DEFINE_EXCEPTION_VTABLE, shortname, cxxname)
START_VTABLE shortname, cxxname
EXTERN MSVCRT_what_exception:PROC
.double MSVCRT_what_exception
ENDM
START_VTABLE type_info, __dummyname_type_info
DEFINE_EXCEPTION_VTABLE exception, ??_7exception@@6B@
DEFINE_EXCEPTION_VTABLE bad_typeid, ??_7bad_typeid@@6B@
DEFINE_EXCEPTION_VTABLE bad_cast, ??_7bad_cast@@6B@
DEFINE_EXCEPTION_VTABLE __non_rtti_object, ??_7__non_rtti_object@@6B@
MACRO(DEFINE_ALIAS, alias, orig)
EXTERN &orig:ABS
ALIAS <&alias> = <&orig>
ENDM
DEFINE_ALIAS ??3@YAXPEAX@Z, MSVCRT_operator_delete
DEFINE_ALIAS ??_U@YAPEAX_K@Z, MSVCRT_operator_new
DEFINE_ALIAS ??_V@YAXPEAX@Z, MSVCRT_operator_delete
DEFINE_ALIAS ??2@YAPEAX_K@Z, MSVCRT_operator_new
DEFINE_ALIAS ?_query_new_handler@@YAP6AHI@ZXZ, MSVCRT__query_new_handler
DEFINE_ALIAS ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z, MSVCRT__set_new_handler
DEFINE_ALIAS ?set_new_handler@@YAP6AXXZP6AXXZ@Z, MSVCRT_set_new_handler
DEFINE_ALIAS ?_query_new_mode@@YAHXZ, MSVCRT__query_new_mode
DEFINE_ALIAS ?_set_new_mode@@YAHH@Z, MSVCRT__set_new_mode
DEFINE_ALIAS ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z, MSVCRT__set_se_translator
DEFINE_ALIAS ?set_terminate@@YAP6AXXZP6AXXZ@Z, MSVCRT_set_terminate
DEFINE_ALIAS ?set_unexpected@@YAP6AXXZP6AXXZ@Z, MSVCRT_set_unexpected
DEFINE_ALIAS ?terminate@@YAXXZ, MSVCRT_terminate
DEFINE_ALIAS ?unexpected@@YAXXZ, MSVCRT_unexpected
END

View file

@ -0,0 +1,17 @@
#include <precomp.h>
_CRTIMP
EXCEPTION_DISPOSITION
__cdecl
__C_specific_handler(
struct _EXCEPTION_RECORD *_ExceptionRecord,
void *_EstablisherFrame,
struct _CONTEXT *_ContextRecord,
struct _DISPATCHER_CONTEXT *_DispatcherContext)
{
UNIMPLEMENTED;
return 0;
}

View file

@ -18,6 +18,7 @@
/* GLOBALS *******************************************************************/
PUBLIC _global_unwind2
PUBLIC _local_unwind
PUBLIC _local_unwind2
PUBLIC _abnormal_termination
PUBLIC _except_handler2
@ -41,6 +42,11 @@ FUNC _abnormal_termination
ret
ENDFUNC _abnormal_termination
FUNC _local_unwind
.endprolog
ret
ENDFUNC _local_unwind
FUNC _local_unwind2
.endprolog
ret

View file

@ -0,0 +1,15 @@
#include <asm.inc>
.code64
PUBLIC _clearfp
FUNC _clearfp
.ENDPROLOG
fnclex
ENDFUNC _clearfp
END

View file

@ -0,0 +1,11 @@
#include <asm.inc>
.code64
FUNC _fpreset
.endprolog
fninit
ENDFUNC _fpreset
END

View file

@ -0,0 +1,16 @@
#include <asm.inc>
.code64
FUNC _logb
.endprolog
fld dword ptr [rsp + 8]
fxtract
fstp st
ret
ENDFUNC _logb
END

View file

@ -45,8 +45,10 @@ unsigned int CDECL _control87(unsigned int newval, unsigned int mask)
/* Get fp control word */
#if defined(__GNUC__)
__asm__ __volatile__( "fstcw %0" : "=m" (fpword) : );
#else
#elif defined(_M_IX86)
__asm fstcw [fpword];
#else
#pragma message("FIXME: _control87 is halfplemented")
#endif
TRACE("Control word before : %08x\n", fpword);
@ -98,8 +100,10 @@ unsigned int CDECL _control87(unsigned int newval, unsigned int mask)
/* Put fp control word */
#if defined(__GNUC__)
__asm__ __volatile__( "fldcw %0" : : "m" (fpword) );
#else
#elif defined(_M_IX86)
__asm fldcw [fpword];
#else
#pragma message("FIXME: _control87 is halfplemented")
#endif
return flags;

View file

@ -28,8 +28,10 @@ unsigned int CDECL _statusfp(void)
unsigned int fpword;
#if defined(__GNUC__)
__asm__ __volatile__( "fstsw %0" : "=m" (fpword) : );
#else
#elif defined(_M_IX86)
__asm fstsw [fpword];
#else
#pragma message("FIXME: _statusfp is halfplemented")
#endif
if (fpword & 0x1) retVal |= _SW_INVALID;
if (fpword & 0x2) retVal |= _SW_DENORMAL;

View file

@ -7,7 +7,7 @@
#if defined(_MSC_VER)
#if defined(_M_IA64) || defined(_M_AMD64)
#define _ATTRIBUTES
#define _ATTRIBUTES read
#else
#define _ATTRIBUTES read
#endif

View file

@ -98,6 +98,7 @@ if(ARCH MATCHES i386)
endif()
elseif(ARCH MATCHES amd64)
list(APPEND LIBCNTPR_SOURCE
except/amd64/ehandler.c
except/amd64/chkstk_asm.s
except/amd64/seh.s
setjmp/amd64/setjmp.s

View file

@ -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 @@ ceilf:
fldcw [rsp + 8]
fstp dword ptr [rsp]
movss xmm0, [rsp]
movss xmm0, dword ptr [rsp]
add rsp, 16
ret
ENDFUNC ceilf
END

View file

@ -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 @@ floorf:
fldcw [rsp]
fstp dword ptr [rsp]
movss xmm0, [rsp]
movss xmm0, dword ptr [rsp]
add rsp, 16
ret
ENDFUNC floorf
END

View file

@ -13,8 +13,8 @@
/* CODE **********************************************************************/
.code64
PUBLIC _fmod
_fmod:
PUBLIC fmod
fmod:
UNIMPLEMENTED fmod
ret

View file

@ -132,89 +132,3 @@ double CDECL _CIfmod(double x, double y)
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");
}

View file

@ -199,8 +199,8 @@ __DllMainCRTStartup (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
goto i__leave;
}
}
if (dwReason == DLL_PROCESS_ATTACH)
#if defined(__GNUC__)
if (dwReason == DLL_PROCESS_ATTACH)
__main ();
#endif
retcode = DllMain(hDllHandle,dwReason,lpreserved);

View file

@ -9,6 +9,12 @@
int _fltused;
int __mingw_init_ehandler (void)
{
/* Nothing to do */
return 1;
}
void
__do_global_dtors (void)
{

View file

@ -10,35 +10,3 @@
otherwise
we do tls cleanup in runtime and _CRT_MT has value 2. */
int _CRT_MT = 2;
// HACK around broken imports from libmingwex, until RosBE64 is updated
#ifdef _M_AMD64
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <stdlib.h>
int __mingwthr_key_dtor (DWORD key, void (*dtor)(void *));
int __mingwthr_remove_key_dtor (DWORD key);
extern int ___w64_mingwthr_remove_key_dtor (DWORD key);
extern int ___w64_mingwthr_add_key_dtor (DWORD key, void (*dtor)(void *));
int
__mingwthr_remove_key_dtor (DWORD key)
{
return ___w64_mingwthr_remove_key_dtor (key);
}
int
__mingwthr_key_dtor (DWORD key, void (*dtor)(void *))
{
if (dtor)
return ___w64_mingwthr_add_key_dtor (key, dtor);
return 0;
}
#endif

View file

@ -1136,41 +1136,6 @@ int CDECL _fileno(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;
}
/*********************************************************************
* _get_osfhandle (MSVCRT.@)
*/
@ -1750,38 +1715,6 @@ int CDECL _umask(int umask)
return old_umask;
}
/*********************************************************************
* _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.@)
*/

View file

@ -10,6 +10,7 @@
#define _tcschr _wcschr
#define _tcscmp _wcscmp
#define _tcscpy _wcscpy
#define tcscpy wcscpy
#define _tcslen _wcslen
#define _tcsncat _wcsncat
#define _tcsncmp _wcsncmp
@ -34,6 +35,7 @@
#define _tcschr _strchr
#define _tcscmp _strcmp
#define _tcscpy _strcpy
#define tcscpy strcpy
#define _tcslen _strlen
#define _tcsncat _strncat
#define _tcsncmp _strncmp

View file

@ -7,9 +7,11 @@
PUBLIC _tcscpy
.code
_tcscpy:
FUNC tcscpy
FPO 0, 2, 2, 2, 0, FRAME_FPO
push esi
push edi
mov edi, [esp + 12]
mov esi, [esp + 16]
cld
@ -25,6 +27,7 @@ _tcscpy:
pop edi
pop esi
ret
ENDFUNC tcscpy
END
/* EOF */

View file

@ -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 @@ HANDLE fdtoh(int fd);
/******************************************************************************
* \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
*/

View file

@ -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);