Author: tkreuzer
Date: Sat Aug 20 17:11:16 2011
New Revision: 53342
URL:
http://svn.reactos.org/svn/reactos?rev=53342&view=rev
Log:
[CRT]
- Add __C_specific_handler stub
- Add aliases for C++ code on amd64 builds
- Fix fmod symbol
- Merge .CRT section into .data on amd64
- remove an old hack
Added:
trunk/reactos/lib/sdk/crt/except/amd64/cpp.s
- copied, changed from r53298, trunk/reactos/lib/sdk/crt/except/i386/cpp.s
trunk/reactos/lib/sdk/crt/except/amd64/ehandler.c (with props)
Modified:
trunk/reactos/lib/sdk/crt/crt.cmake
trunk/reactos/lib/sdk/crt/crt.rbuild
trunk/reactos/lib/sdk/crt/math/amd64/fmod.S
trunk/reactos/lib/sdk/crt/startup/cinitexe.c
trunk/reactos/lib/sdk/crt/startup/mscmain.c
trunk/reactos/lib/sdk/crt/startup/tlsmcrt.c
Modified: trunk/reactos/lib/sdk/crt/crt.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/crt.cmake?rev=…
==============================================================================
--- trunk/reactos/lib/sdk/crt/crt.cmake [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/crt.cmake [iso-8859-1] Sat Aug 20 17:11:16 2011
@@ -377,6 +377,7 @@
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
@@ -401,6 +402,10 @@
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)
Modified: trunk/reactos/lib/sdk/crt/crt.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/crt.rbuild?rev…
==============================================================================
--- trunk/reactos/lib/sdk/crt/crt.rbuild [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/crt.rbuild [iso-8859-1] Sat Aug 20 17:11:16 2011
@@ -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>
Copied: trunk/reactos/lib/sdk/crt/except/amd64/cpp.s (from r53298,
trunk/reactos/lib/sdk/crt/except/i386/cpp.s)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/except/amd64/c…
==============================================================================
--- trunk/reactos/lib/sdk/crt/except/i386/cpp.s [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/except/amd64/cpp.s [iso-8859-1] Sat Aug 20 17:11:16 2011
@@ -2,74 +2,24 @@
#include <asm.inc>
-.code
+.code64
.align 4
-MACRO(DEFINE_THISCALL_WRAPPER, cxxname, stdcallname)
-EXTERN &stdcallname:PROC
+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:
- pop eax
- push ecx
- push eax
- jmp &stdcallname
-ENDM
-
-DEFINE_THISCALL_WRAPPER ??0exception@@QAE@ABQBD@Z, _MSVCRT_exception_ctor@8
-DEFINE_THISCALL_WRAPPER ??0exception@@QAE@ABQBDH@Z, _MSVCRT_exception_ctor_noalloc@12
-DEFINE_THISCALL_WRAPPER ??0exception@@QAE@ABV0@@Z, _MSVCRT_exception_copy_ctor@8
-DEFINE_THISCALL_WRAPPER ??0exception@@QAE@XZ, _MSVCRT_exception_default_ctor@4
-DEFINE_THISCALL_WRAPPER ??1exception@@UAE@XZ, _MSVCRT_exception_dtor@4
-DEFINE_THISCALL_WRAPPER ??4exception@@QAEAAV0@ABV0@@Z, _MSVCRT_exception_opequals@8
-DEFINE_THISCALL_WRAPPER ??_Eexception@@UAEPAXI@Z, _MSVCRT_exception_vector_dtor@8
-DEFINE_THISCALL_WRAPPER ??_Gexception@@UAEPAXI@Z, _MSVCRT_exception_scalar_dtor@8
-DEFINE_THISCALL_WRAPPER ?what@exception@@UBEPBDXZ, _MSVCRT_what_exception@4
-DEFINE_THISCALL_WRAPPER ??0bad_typeid@@QAE@ABV0@@Z, _MSVCRT_bad_typeid_copy_ctor@8
-DEFINE_THISCALL_WRAPPER ??0bad_typeid@@QAE@PBD@Z, _MSVCRT_bad_typeid_ctor@8
-DEFINE_THISCALL_WRAPPER ??_Fbad_typeid@@QAEXXZ, _MSVCRT_bad_typeid_default_ctor@4
-DEFINE_THISCALL_WRAPPER ??1bad_typeid@@UAE@XZ, _MSVCRT_bad_typeid_dtor@4
-DEFINE_THISCALL_WRAPPER ??4bad_typeid@@QAEAAV0@ABV0@@Z, _MSVCRT_bad_typeid_opequals@8
-DEFINE_THISCALL_WRAPPER ??_Ebad_typeid@@UAEPAXI@Z, _MSVCRT_bad_typeid_vector_dtor@8
-DEFINE_THISCALL_WRAPPER ??_Gbad_typeid@@UAEPAXI@Z, _MSVCRT_bad_typeid_scalar_dtor@8
-DEFINE_THISCALL_WRAPPER ??0__non_rtti_object@@QAE@ABV0@@Z,
_MSVCRT___non_rtti_object_copy_ctor@8
-DEFINE_THISCALL_WRAPPER ??0__non_rtti_object@@QAE@PBD@Z,
_MSVCRT___non_rtti_object_ctor@8
-DEFINE_THISCALL_WRAPPER ??1__non_rtti_object@@UAE@XZ, _MSVCRT___non_rtti_object_dtor@4
-DEFINE_THISCALL_WRAPPER ??4__non_rtti_object@@QAEAAV0@ABV0@@Z,
_MSVCRT___non_rtti_object_opequals@8
-DEFINE_THISCALL_WRAPPER ??_E__non_rtti_object@@UAEPAXI@Z,
_MSVCRT___non_rtti_object_vector_dtor@8
-DEFINE_THISCALL_WRAPPER ??_G__non_rtti_object@@UAEPAXI@Z,
_MSVCRT___non_rtti_object_scalar_dtor@8
-DEFINE_THISCALL_WRAPPER ??0bad_cast@@AAE@PBQBD@Z, _MSVCRT_bad_cast_ctor@8
-DEFINE_THISCALL_WRAPPER ??0bad_cast@@QAE@ABQBD@Z, _MSVCRT_bad_cast_ctor@8
-DEFINE_THISCALL_WRAPPER ??0bad_cast@@QAE@ABV0@@Z, _MSVCRT_bad_cast_copy_ctor@8
-DEFINE_THISCALL_WRAPPER ??0bad_cast@@QAE@PBD@Z, _MSVCRT_bad_cast_ctor_charptr@8
-DEFINE_THISCALL_WRAPPER ??_Fbad_cast@@QAEXXZ, _MSVCRT_bad_cast_default_ctor@4
-DEFINE_THISCALL_WRAPPER ??1bad_cast@@UAE@XZ, _MSVCRT_bad_cast_dtor@4
-DEFINE_THISCALL_WRAPPER ??4bad_cast@@QAEAAV0@ABV0@@Z, _MSVCRT_bad_cast_opequals@8
-DEFINE_THISCALL_WRAPPER ??_Ebad_cast@@UAEPAXI@Z, _MSVCRT_bad_cast_vector_dtor@8
-DEFINE_THISCALL_WRAPPER ??_Gbad_cast@@UAEPAXI@Z, _MSVCRT_bad_cast_scalar_dtor@8
-DEFINE_THISCALL_WRAPPER ??8type_info@@QBEHABV0@@Z, _MSVCRT_type_info_opequals_equals@8
-DEFINE_THISCALL_WRAPPER ??9type_info@@QBEHABV0@@Z, _MSVCRT_type_info_opnot_equals@8
-DEFINE_THISCALL_WRAPPER ?before@type_info@@QBEHABV1@@Z, _MSVCRT_type_info_before@8
-DEFINE_THISCALL_WRAPPER ??1type_info@@UAE@XZ, _MSVCRT_type_info_dtor@4
-DEFINE_THISCALL_WRAPPER ?name@type_info@@QBEPBDXZ, _MSVCRT_type_info_name@4
-DEFINE_THISCALL_WRAPPER ?raw_name@type_info@@QBEPBDXZ, _MSVCRT_type_info_raw_name@4
-
-
-#undef _MSVCRT_
-MACRO(START_VTABLE, shortname, cxxname)
-EXTERN _&shortname&_rtti:PROC
-EXTERN ___thiscall_MSVCRT_&shortname&_vector_dtor:PROC
- .long _&shortname&_rtti
-PUBLIC _MSVCRT_&shortname&_vtable
-_MSVCRT_&shortname&_vtable:
-PUBLIC &cxxname
-&cxxname:
- .long ___thiscall_MSVCRT_&shortname&_vector_dtor
+ .double MSVCRT_&shortname&_vector_dtor
ENDM
MACRO(DEFINE_EXCEPTION_VTABLE, shortname, cxxname)
START_VTABLE shortname, cxxname
- EXTERN ___thiscall_MSVCRT_what_exception:PROC
- .long ___thiscall_MSVCRT_what_exception
+ EXTERN MSVCRT_what_exception:PROC
+ .double MSVCRT_what_exception
ENDM
START_VTABLE type_info, __dummyname_type_info
@@ -78,35 +28,26 @@
DEFINE_EXCEPTION_VTABLE bad_cast, ??_7bad_cast@@6B@
DEFINE_EXCEPTION_VTABLE __non_rtti_object, ??_7__non_rtti_object@@6B@
-EXTERN _MSVCRT_operator_delete:PROC
-PUBLIC ??3@YAXPAX@Z
-??3@YAXPAX@Z:
- jmp _MSVCRT_operator_delete
-EXTERN _MSVCRT_operator_new:PROC
-PUBLIC ??_U@YAPAXI@Z
-??_U@YAPAXI@Z:
- jmp _MSVCRT_operator_new
-
-
-MACRO(DEFINE_ALIAS, alias, orig, type)
-EXTERN &orig:&type
+MACRO(DEFINE_ALIAS, alias, orig)
+EXTERN &orig:ABS
ALIAS <&alias> = <&orig>
ENDM
-DEFINE_ALIAS ??_V@YAXPAX@Z, _MSVCRT_operator_delete, PROC
-DEFINE_ALIAS ??2@YAPAXI@Z, _MSVCRT_operator_new, PROC
-DEFINE_ALIAS ?_query_new_handler@@YAP6AHI@ZXZ, _MSVCRT__query_new_handler, PROC
-DEFINE_ALIAS ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z, _MSVCRT__set_new_handler, PROC
-DEFINE_ALIAS ?set_new_handler@@YAP6AXXZP6AXXZ@Z, _MSVCRT_set_new_handler, PROC
-DEFINE_ALIAS ?_query_new_mode@@YAHXZ, _MSVCRT__query_new_mode, PROC
-DEFINE_ALIAS ?_set_new_mode@@YAHH@Z, _MSVCRT__set_new_mode, PROC
-DEFINE_ALIAS ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z,
_MSVCRT__set_se_translator, PROC
-DEFINE_ALIAS ?set_terminate@@YAP6AXXZP6AXXZ@Z, _MSVCRT_set_terminate, PROC
-DEFINE_ALIAS ?set_unexpected@@YAP6AXXZP6AXXZ@Z, _MSVCRT_set_unexpected, PROC
-DEFINE_ALIAS ?terminate@@YAXXZ, _MSVCRT_terminate, PROC
-DEFINE_ALIAS ?unexpected@@YAXXZ, _MSVCRT_unexpected, PROC
-
+DEFINE_ALIAS ??3@YAXPAX@Z, MSVCRT_operator_delete
+DEFINE_ALIAS ??_U@YAPAXI@Z, MSVCRT_operator_new
+DEFINE_ALIAS ??_V@YAXPAX@Z, MSVCRT_operator_delete
+DEFINE_ALIAS ??2@YAPAXI@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
Added: trunk/reactos/lib/sdk/crt/except/amd64/ehandler.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/except/amd64/e…
==============================================================================
--- trunk/reactos/lib/sdk/crt/except/amd64/ehandler.c (added)
+++ trunk/reactos/lib/sdk/crt/except/amd64/ehandler.c [iso-8859-1] Sat Aug 20 17:11:16
2011
@@ -1,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;
+}
+
Propchange: trunk/reactos/lib/sdk/crt/except/amd64/ehandler.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/lib/sdk/crt/math/amd64/fmod.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/fmo…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/fmod.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/fmod.S [iso-8859-1] Sat Aug 20 17:11:16 2011
@@ -13,8 +13,8 @@
/* CODE **********************************************************************/
.code64
-PUBLIC _fmod
-_fmod:
+PUBLIC fmod
+fmod:
UNIMPLEMENTED fmod
ret
Modified: trunk/reactos/lib/sdk/crt/startup/cinitexe.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/startup/cinite…
==============================================================================
--- trunk/reactos/lib/sdk/crt/startup/cinitexe.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/startup/cinitexe.c [iso-8859-1] Sat Aug 20 17:11:16 2011
@@ -2,7 +2,11 @@
#include <sect_attribs.h>
#ifdef _MSC_VER
+#ifdef _M_AMD64
+#pragma comment(linker, "/merge:.CRT=.data")
+#else
#pragma comment(linker, "/merge:.CRT=.rdata")
+#endif
#endif
typedef void (__cdecl *_PVFV)(void);
Modified: trunk/reactos/lib/sdk/crt/startup/mscmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/startup/mscmai…
==============================================================================
--- trunk/reactos/lib/sdk/crt/startup/mscmain.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/startup/mscmain.c [iso-8859-1] Sat Aug 20 17:11:16 2011
@@ -8,6 +8,12 @@
#include <stdlib.h>
int _fltused;
+
+int __mingw_init_ehandler (void)
+{
+ /* Nothing to do */
+ return 1;
+}
void
__do_global_dtors (void)
Modified: trunk/reactos/lib/sdk/crt/startup/tlsmcrt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/startup/tlsmcr…
==============================================================================
--- trunk/reactos/lib/sdk/crt/startup/tlsmcrt.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/startup/tlsmcrt.c [iso-8859-1] Sat Aug 20 17:11:16 2011
@@ -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
-