ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
January 2025
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
23 participants
278 discussions
Start a n
N
ew thread
[reactos] 14/20: [UCRTSUPPORT] Add ucrtsupport library
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d74ab36324f78d37548e4…
commit d74ab36324f78d37548e4bdc06ab7549527d73ea Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Tue Oct 22 00:07:12 2024 +0300 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sun Jan 26 18:08:55 2025 +0200 [UCRTSUPPORT] Add ucrtsupport library This library is compiled from our old CRT sources to supplement missing UCRT code. --- sdk/lib/crt/CMakeLists.txt | 1 + sdk/lib/crt/math/libm_sse2/exp2.c | 4 +--- sdk/lib/crt/math/math.cmake | 7 ++++++- sdk/lib/crt/ucrtsupport.cmake | 29 +++++++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/sdk/lib/crt/CMakeLists.txt b/sdk/lib/crt/CMakeLists.txt index 740b9aec154..634be636c18 100644 --- a/sdk/lib/crt/CMakeLists.txt +++ b/sdk/lib/crt/CMakeLists.txt @@ -28,6 +28,7 @@ include(crt.cmake) include(libcntpr.cmake) include(msvcrtex.cmake) include(oldnames.cmake) +include(ucrtsupport.cmake) add_library(user32_wsprintf printf/streamout.c diff --git a/sdk/lib/crt/math/libm_sse2/exp2.c b/sdk/lib/crt/math/libm_sse2/exp2.c index 470be6f4bf8..a5998791c9c 100644 --- a/sdk/lib/crt/math/libm_sse2/exp2.c +++ b/sdk/lib/crt/math/libm_sse2/exp2.c @@ -44,9 +44,7 @@ THE SOFTWARE. #include "libm_errno.h" -/* exp2 is only provided for use by powf under Windows, so give - it a leading underscore. */ -double FN_PROTOTYPE(_exp2)(double x) +double FN_PROTOTYPE(exp2)(double x) { static const double max_exp2_arg = 1024.0, /* 0x4090000000000000 */ diff --git a/sdk/lib/crt/math/math.cmake b/sdk/lib/crt/math/math.cmake index 3a6c69995b5..e46243f1841 100644 --- a/sdk/lib/crt/math/math.cmake +++ b/sdk/lib/crt/math/math.cmake @@ -2,9 +2,11 @@ include_directories(libm_sse2) list(APPEND LIBCNTPR_MATH_SOURCE + math/_chgsignf.c math/_invoke_matherr.c math/abs.c math/div.c + math/exp2f.c math/labs.c math/sincos.c ) @@ -55,6 +57,9 @@ if(ARCH STREQUAL "i386") math/i386/fmod_asm.s math/i386/fmodf_asm.s ) + list(APPEND CRT_MATH_SOURCE + math/_hypotf.c + ) elseif(ARCH STREQUAL "amd64") list(APPEND LIBCNTPR_MATH_SOURCE math/amd64/_set_statfp.c @@ -204,7 +209,6 @@ endif() if(NOT ARCH STREQUAL "i386") list(APPEND CRT_MATH_SOURCE - math/_chgsignf.c math/_copysignf.c math/log10f.c math/stubs.c @@ -217,6 +221,7 @@ if(NOT ARCH STREQUAL "amd64") math/asin.c math/cosh.c math/cosf.c + math/exp2.c math/hypot.c math/modf.c math/s_modf.c diff --git a/sdk/lib/crt/ucrtsupport.cmake b/sdk/lib/crt/ucrtsupport.cmake new file mode 100644 index 00000000000..18216a5483f --- /dev/null +++ b/sdk/lib/crt/ucrtsupport.cmake @@ -0,0 +1,29 @@ + +list(APPEND UCRTSUPP_SOURCE + ${CRT_FLOAT_SOURCE} + ${CRT_MATH_SOURCE} + wine/undname.c +) + +list(APPEND UCRTSUPP_ASM_SOURCE + ${CRT_EXCEPT_ASM_SOURCE} + ${CRT_FLOAT_ASM_SOURCE} + ${CRT_MATH_ASM_SOURCE} + ${CRT_SETJMP_ASM_SOURCE} +) + +add_asm_files(ucrtsupp_asm ${UCRTSUPP_ASM_SOURCE}) + +add_library(ucrtsupport ${UCRTSUPP_SOURCE} ${ucrtsupp_asm}) +target_link_libraries(ucrtsupport chkstk ${PSEH_LIB}) +target_compile_definitions(ucrtsupport PRIVATE + CRTDLL + _MSVCRT_LIB_ + _MSVCRT_ + _MT + USE_MSVCRT_PREFIX + __MINGW_IMPORT=extern + __fma3_lib_init=__acrt_initialize_fma3 +) +#add_pch(crt precomp.h) +add_dependencies(ucrtsupport psdk asm)
1 week, 3 days
1
0
0
0
[reactos] 13/20: [CMAKE] Do not implicitly link libgcc/stdc++compat to msvcrt
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=82ef7b5df147351981d8b…
commit 82ef7b5df147351981d8b8e9772d55f8aa234d88 Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Tue Oct 22 17:44:27 2024 +0300 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sun Jan 26 18:08:55 2025 +0200 [CMAKE] Do not implicitly link libgcc/stdc++compat to msvcrt This allows ucrtbase and modules linked to it to be linked to those helper libraries. --- sdk/cmake/gcc.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/cmake/gcc.cmake b/sdk/cmake/gcc.cmake index 1a233c22d47..a628c1b92c7 100644 --- a/sdk/cmake/gcc.cmake +++ b/sdk/cmake/gcc.cmake @@ -580,8 +580,8 @@ add_library(libgcc STATIC IMPORTED) execute_process(COMMAND ${GXX_EXECUTABLE} -print-file-name=libgcc.a OUTPUT_VARIABLE LIBGCC_LOCATION) string(STRIP ${LIBGCC_LOCATION} LIBGCC_LOCATION) set_target_properties(libgcc PROPERTIES IMPORTED_LOCATION ${LIBGCC_LOCATION}) -# libgcc needs kernel32 imports, winpthread, a CRT and msvcrtex -target_link_libraries(libgcc INTERFACE libwinpthread libkernel32 libmsvcrt msvcrtex) +# libgcc needs kernel32 and winpthread (an appropriate CRT must be linked manually) +target_link_libraries(libgcc INTERFACE libwinpthread libkernel32) add_library(libsupc++ STATIC IMPORTED GLOBAL) execute_process(COMMAND ${GXX_EXECUTABLE} -print-file-name=libsupc++.a OUTPUT_VARIABLE LIBSUPCXX_LOCATION) @@ -602,7 +602,7 @@ execute_process(COMMAND ${GXX_EXECUTABLE} -print-file-name=libstdc++.a OUTPUT_VA string(STRIP ${LIBSTDCCXX_LOCATION} LIBSTDCCXX_LOCATION) set_target_properties(libstdc++ PROPERTIES IMPORTED_LOCATION ${LIBSTDCCXX_LOCATION}) # libstdc++ requires libsupc++ and mingwex provided by GCC -target_link_libraries(libstdc++ INTERFACE libsupc++ libmingwex) +target_link_libraries(libstdc++ INTERFACE libsupc++ libmingwex oldnames) # this is for our SAL annotations target_compile_definitions(libstdc++ INTERFACE "$<$<COMPILE_LANGUAGE:CXX>:PAL_STDCPP_COMPAT>")
1 week, 3 days
1
0
0
0
[reactos] 12/20: [UCRT:MATH] Implement math error support functions
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b09b5584e0778519bb2ee…
commit b09b5584e0778519bb2ee286a1afb04967295d18 Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Mon Oct 28 18:14:55 2024 +0200 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sun Jan 26 18:08:55 2025 +0200 [UCRT:MATH] Implement math error support functions --- sdk/lib/ucrt/CMakeLists.txt | 2 + sdk/lib/ucrt/math/math.cmake | 4 ++ sdk/lib/ucrt/math/matherr.cpp | 90 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+) diff --git a/sdk/lib/ucrt/CMakeLists.txt b/sdk/lib/ucrt/CMakeLists.txt index a5106b5037c..a10b7b60029 100644 --- a/sdk/lib/ucrt/CMakeLists.txt +++ b/sdk/lib/ucrt/CMakeLists.txt @@ -94,6 +94,7 @@ include(initializers/initializers.cmake) include(internal/internal.cmake) include(locale/locale.cmake) include(lowio/lowio.cmake) +include(math/math.cmake) include(mbstring/mbstring.cmake) include(misc/misc.cmake) include(startup/startup.cmake) @@ -116,6 +117,7 @@ add_library(ucrt OBJECT ${UCRT_INTERNAL_SOURCES} ${UCRT_LOCALE_SOURCES} ${UCRT_LOWIO_SOURCES} + ${UCRT_MATH_SOURCES} ${UCRT_MBSTRING_SOURCES} ${UCRT_MISC_SOURCES} ${UCRT_STARTUP_SOURCES} diff --git a/sdk/lib/ucrt/math/math.cmake b/sdk/lib/ucrt/math/math.cmake new file mode 100644 index 00000000000..4eadd9f107d --- /dev/null +++ b/sdk/lib/ucrt/math/math.cmake @@ -0,0 +1,4 @@ + +list(APPEND UCRT_MATH_SOURCES + math/matherr.cpp +) diff --git a/sdk/lib/ucrt/math/matherr.cpp b/sdk/lib/ucrt/math/matherr.cpp new file mode 100644 index 00000000000..500d8fd1a9b --- /dev/null +++ b/sdk/lib/ucrt/math/matherr.cpp @@ -0,0 +1,90 @@ +// +// matherr.cpp +// +// Copyright (c) 2024 Timo Kreuzer +// +// User math error support. +// +// SPDX-License-Identifier: MIT +// + +#include <math.h> +#include <corecrt_startup.h> +#include <corecrt_internal.h> + +static __crt_state_management::dual_state_global<_UserMathErrorFunctionPointer> __acrt_global_user_matherr; + +// +// Declared in corecrt_internal.h +// Called from initialize_pointers() +// +extern "C" +void __cdecl __acrt_initialize_user_matherr(void* encoded_null) +{ + __acrt_global_user_matherr.initialize( + reinterpret_cast<_UserMathErrorFunctionPointer>(encoded_null)); +} + +// +// Declared in corecrt_internal.h +// +extern "C" +bool __cdecl __acrt_has_user_matherr(void) +{ + _UserMathErrorFunctionPointer user_matherr = + __crt_fast_decode_pointer(__acrt_global_user_matherr.value()); + return user_matherr != nullptr; +} + +// +// Declared in corecrt_internal.h +// +extern "C" +int __cdecl __acrt_invoke_user_matherr(struct _exception* _Exp) +{ + _UserMathErrorFunctionPointer user_matherr = + __crt_fast_decode_pointer(__acrt_global_user_matherr.value()); + if (user_matherr != nullptr) + { + return user_matherr(_Exp); + } + + return 0; +} + +// +// Declared in corecrt_startup.h +// +extern "C" +void +__cdecl +__setusermatherr( + _UserMathErrorFunctionPointer _UserMathErrorFunction) +{ + _UserMathErrorFunctionPointer encodedPtr = + __crt_fast_encode_pointer(_UserMathErrorFunction); + + __acrt_global_user_matherr.value() = encodedPtr; +} + +// +// Used by libm +// +extern "C" +int +__cdecl +_invoke_matherr( + int type, + char* name, + double arg1, + double arg2, + double retval) +{ + struct _exception excpt; + excpt.type = type; + excpt.name = name; + excpt.arg1 = arg1; + excpt.arg2 = arg2; + excpt.retval = retval; + return __acrt_invoke_user_matherr(&excpt); +}
1 week, 3 days
1
0
0
0
[reactos] 11/20: [UCRT:VCRUNTIME] Implement __isa_available_init()
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8aab548ecdd7bb5230ad7…
commit 8aab548ecdd7bb5230ad774fb8df09cb15c9ac76 Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Mon Dec 2 13:56:48 2024 +0200 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sun Jan 26 18:08:55 2025 +0200 [UCRT:VCRUNTIME] Implement __isa_available_init() --- sdk/lib/ucrt/vcruntime/isa_available.cpp | 65 ++++++++++++++++++++++++++++++++ sdk/lib/ucrt/vcruntime/vcruntime.cmake | 1 + 2 files changed, 66 insertions(+) diff --git a/sdk/lib/ucrt/vcruntime/isa_available.cpp b/sdk/lib/ucrt/vcruntime/isa_available.cpp new file mode 100644 index 00000000000..f2806f29084 --- /dev/null +++ b/sdk/lib/ucrt/vcruntime/isa_available.cpp @@ -0,0 +1,65 @@ +// +// isa_available.c +// +// Copyright (c) 2024 Timo Kreuzer +// +// Implementation of __isa_available_init. +// +// SPDX-License-Identifier: MIT +// + +#include <isa_availability.h> +#include <intrin.h> +#include <windef.h> +#include <winbase.h> + +extern "C" { int __isa_available = 0; } + +extern "C" +int +__cdecl +__isa_available_init(void) +{ +#if defined(_M_IX86) || defined(_M_X64) + if (IsProcessorFeaturePresent(PF_AVX512F_INSTRUCTIONS_AVAILABLE)) + { + __isa_available = __ISA_AVAILABLE_AVX512; + } + else if (IsProcessorFeaturePresent(PF_AVX2_INSTRUCTIONS_AVAILABLE)) + { + __isa_available = __ISA_AVAILABLE_AVX2; + } + else if (IsProcessorFeaturePresent(PF_AVX_INSTRUCTIONS_AVAILABLE)) + { + __isa_available = __ISA_AVAILABLE_AVX; + } + else if (IsProcessorFeaturePresent(PF_SSE4_2_INSTRUCTIONS_AVAILABLE)) + { + __isa_available = __ISA_AVAILABLE_SSE42; + } + else if (IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE)) + { + __isa_available = __ISA_AVAILABLE_SSE2; + } + else + { + __isa_available = __ISA_AVAILABLE_X86; + } +#elif defined(_M_ARM) || defined(_M_ARM64) + // CHECKME: Is this correct? + if (IsProcessorFeaturePresent(PF_ARM_V8_INSTRUCTIONS_AVAILABLE)) + { +#ifdef _M_ARM64 + __isa_available = __ISA_AVAILABLE_NEON_ARM64; +#else + __isa_available = __ISA_AVAILABLE_NEON; +#endif + } + else + { + __isa_available = __ISA_AVAILABLE_ARMNT; + } +#endif + + return 0; +} diff --git a/sdk/lib/ucrt/vcruntime/vcruntime.cmake b/sdk/lib/ucrt/vcruntime/vcruntime.cmake index 2c3ab680910..dc610565944 100644 --- a/sdk/lib/ucrt/vcruntime/vcruntime.cmake +++ b/sdk/lib/ucrt/vcruntime/vcruntime.cmake @@ -5,6 +5,7 @@ list(APPEND UCRT_VCRUNTIME_SOURCES vcruntime/__security_init_cookie.c vcruntime/__vcrt_init.c vcruntime/initializers.cpp + vcruntime/isa_available.cpp ) if(${ARCH} STREQUAL "i386")
1 week, 3 days
1
0
0
0
[reactos] 10/20: [UCRT:VCRUNTIME] Add initializer sections
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9c887efa0e90bcc5a516e…
commit 9c887efa0e90bcc5a516ebea902366398708e65f Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Mon Dec 2 14:00:35 2024 +0200 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sun Jan 26 18:08:55 2025 +0200 [UCRT:VCRUNTIME] Add initializer sections Use #pragma section only for MSVC (and Clang-cl), because Clang doesn't like allocating non-const variables in a read-only section, while GCC doesn't understand these pragmas and ignores them. --- sdk/lib/ucrt/inc/internal_shared.h | 2 ++ sdk/lib/ucrt/vcruntime/initializers.cpp | 22 ++++++++++++++++++++++ sdk/lib/ucrt/vcruntime/vcruntime.cmake | 1 + 3 files changed, 25 insertions(+) diff --git a/sdk/lib/ucrt/inc/internal_shared.h b/sdk/lib/ucrt/inc/internal_shared.h index a0f1a5a841e..340407bed96 100644 --- a/sdk/lib/ucrt/inc/internal_shared.h +++ b/sdk/lib/ucrt/inc/internal_shared.h @@ -27,6 +27,7 @@ extern "C" { #define _CRTALLOC(x) __attribute__((section(x))) #endif +#ifdef _MSC_VER #pragma section(".CRT$XIC", long, read) #pragma section(".CRT$XPX", long, read) #pragma section(".CRT$XPXA", long, read) @@ -39,6 +40,7 @@ extern "C" { #pragma section(".CRT$XPZ", long, read) #pragma section(".CRT$XTA", long, read) #pragma section(".CRT$XTZ", long, read) +#endif extern _PIFV __xi_a[]; extern _PIFV __xi_z[]; diff --git a/sdk/lib/ucrt/vcruntime/initializers.cpp b/sdk/lib/ucrt/vcruntime/initializers.cpp new file mode 100644 index 00000000000..f93e918bdc7 --- /dev/null +++ b/sdk/lib/ucrt/vcruntime/initializers.cpp @@ -0,0 +1,22 @@ +// +// section_markers.c +// +// Copyright (c) 2024 Timo Kreuzer +// +// Markers for CRT initializer sections. +// +// SPDX-License-Identifier: MIT +// + +#include <internal_shared.h> + +_CRTALLOC(".CRT$XIA") _PIFV __xi_a[] = { 0 }; +_CRTALLOC(".CRT$XIZ") _PIFV __xi_z[] = { 0 }; +_CRTALLOC(".CRT$XCA") _PVFV __xc_a[] = { 0 }; +_CRTALLOC(".CRT$XCZ") _PVFV __xc_z[] = { 0 }; +_CRTALLOC(".CRT$XPA") _PVFV __xp_a[] = { 0 }; +_CRTALLOC(".CRT$XPZ") _PVFV __xp_z[] = { 0 }; +_CRTALLOC(".CRT$XTA") _PVFV __xt_a[] = { 0 }; +_CRTALLOC(".CRT$XTZ") _PVFV __xt_z[] = { 0 }; + +#pragma comment(linker, "/merge:.CRT=.rdata") diff --git a/sdk/lib/ucrt/vcruntime/vcruntime.cmake b/sdk/lib/ucrt/vcruntime/vcruntime.cmake index feb4a44d66d..2c3ab680910 100644 --- a/sdk/lib/ucrt/vcruntime/vcruntime.cmake +++ b/sdk/lib/ucrt/vcruntime/vcruntime.cmake @@ -4,6 +4,7 @@ list(APPEND UCRT_VCRUNTIME_SOURCES vcruntime/__report_rangecheckfailure.c vcruntime/__security_init_cookie.c vcruntime/__vcrt_init.c + vcruntime/initializers.cpp ) if(${ARCH} STREQUAL "i386")
1 week, 3 days
1
0
0
0
[reactos] 09/20: [UCRT:VCRUNTIME] Implement vcruntime init stubs
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4198ceb83aa95e799f32c…
commit 4198ceb83aa95e799f32ca7b71e3768b468422e4 Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Fri Jan 17 11:44:15 2025 +0200 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sun Jan 26 18:08:55 2025 +0200 [UCRT:VCRUNTIME] Implement vcruntime init stubs --- sdk/lib/ucrt/vcruntime/__vcrt_init.c | 36 ++++++++++++++++++++++++++++++++++ sdk/lib/ucrt/vcruntime/vcruntime.cmake | 1 + 2 files changed, 37 insertions(+) diff --git a/sdk/lib/ucrt/vcruntime/__vcrt_init.c b/sdk/lib/ucrt/vcruntime/__vcrt_init.c new file mode 100644 index 00000000000..45cce866e92 --- /dev/null +++ b/sdk/lib/ucrt/vcruntime/__vcrt_init.c @@ -0,0 +1,36 @@ +// +// __vcrt_init.c +// +// Copyright (c) 2024 Timo Kreuzer +// +// Implementation of vcruntime initialization and termination functions. +// +// SPDX-License-Identifier: MIT +// + +#include <vcruntime_startup.h> + +__vcrt_bool __cdecl __vcrt_initialize(void) +{ + return 1; +} + +__vcrt_bool __cdecl __vcrt_uninitialize(_In_ __vcrt_bool _Terminating) +{ + return 1; +} + +__vcrt_bool __cdecl __vcrt_uninitialize_critical(void) +{ + return 1; +} + +__vcrt_bool __cdecl __vcrt_thread_attach(void) +{ + return 1; +} + +__vcrt_bool __cdecl __vcrt_thread_detach(void) +{ + return 1; +} diff --git a/sdk/lib/ucrt/vcruntime/vcruntime.cmake b/sdk/lib/ucrt/vcruntime/vcruntime.cmake index d0f06931599..feb4a44d66d 100644 --- a/sdk/lib/ucrt/vcruntime/vcruntime.cmake +++ b/sdk/lib/ucrt/vcruntime/vcruntime.cmake @@ -3,6 +3,7 @@ list(APPEND UCRT_VCRUNTIME_SOURCES vcruntime/__report_gsfailure.c vcruntime/__report_rangecheckfailure.c vcruntime/__security_init_cookie.c + vcruntime/__vcrt_init.c ) if(${ARCH} STREQUAL "i386")
1 week, 3 days
1
0
0
0
[reactos] 08/20: [UCRT:VCRUNTIME] Implement __report_rangecheckfailure()
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4d809565663c95a145d32…
commit 4d809565663c95a145d32b68da03be07ff1c0109 Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Fri Jan 17 11:43:24 2025 +0200 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sun Jan 26 18:08:55 2025 +0200 [UCRT:VCRUNTIME] Implement __report_rangecheckfailure() --- sdk/lib/ucrt/vcruntime/__report_rangecheckfailure.c | 17 +++++++++++++++++ sdk/lib/ucrt/vcruntime/vcruntime.cmake | 1 + 2 files changed, 18 insertions(+) diff --git a/sdk/lib/ucrt/vcruntime/__report_rangecheckfailure.c b/sdk/lib/ucrt/vcruntime/__report_rangecheckfailure.c new file mode 100644 index 00000000000..0e8784b8815 --- /dev/null +++ b/sdk/lib/ucrt/vcruntime/__report_rangecheckfailure.c @@ -0,0 +1,17 @@ +// +// __report_rangecheckfailure.c +// +// Copyright (c) 2024 Timo Kreuzer +// +// Implementation of __report_rangecheckfailure. +// +// SPDX-License-Identifier: MIT +// + +#include <intrin.h> +#include <ntrtl.h> + +__declspec(noreturn) void __cdecl __report_rangecheckfailure(void) +{ + __fastfail(FAST_FAIL_RANGE_CHECK_FAILURE); +} diff --git a/sdk/lib/ucrt/vcruntime/vcruntime.cmake b/sdk/lib/ucrt/vcruntime/vcruntime.cmake index 3e571e76517..d0f06931599 100644 --- a/sdk/lib/ucrt/vcruntime/vcruntime.cmake +++ b/sdk/lib/ucrt/vcruntime/vcruntime.cmake @@ -1,6 +1,7 @@ list(APPEND UCRT_VCRUNTIME_SOURCES vcruntime/__report_gsfailure.c + vcruntime/__report_rangecheckfailure.c vcruntime/__security_init_cookie.c )
1 week, 3 days
1
0
0
0
[reactos] 07/20: [UCRT:VCRUNTIME] Implement __report_gsfailure()
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b0f3e623b7efdd04fca95…
commit b0f3e623b7efdd04fca9523d0168ab14f5bae8ab Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Fri Jan 17 11:42:45 2025 +0200 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sun Jan 26 18:08:55 2025 +0200 [UCRT:VCRUNTIME] Implement __report_gsfailure() --- sdk/lib/ucrt/vcruntime/__report_gsfailure.c | 21 +++++++++++++++++++++ sdk/lib/ucrt/vcruntime/vcruntime.cmake | 1 + 2 files changed, 22 insertions(+) diff --git a/sdk/lib/ucrt/vcruntime/__report_gsfailure.c b/sdk/lib/ucrt/vcruntime/__report_gsfailure.c new file mode 100644 index 00000000000..d45f96df22f --- /dev/null +++ b/sdk/lib/ucrt/vcruntime/__report_gsfailure.c @@ -0,0 +1,21 @@ +// +// __report_gsfailure.c +// +// Copyright (c) 2024 Timo Kreuzer +// +// Implementation of __report_gsfailure. +// +// SPDX-License-Identifier: MIT +// + +#include <intrin.h> +#include <ntrtl.h> + +#if defined(_M_IX86) +__declspec(noreturn) void __cdecl __report_gsfailure(void) +#else +__declspec(noreturn) void __cdecl __report_gsfailure(_In_ uintptr_t _StackCookie) +#endif +{ + __fastfail(FAST_FAIL_STACK_COOKIE_CHECK_FAILURE); +} diff --git a/sdk/lib/ucrt/vcruntime/vcruntime.cmake b/sdk/lib/ucrt/vcruntime/vcruntime.cmake index e4857cfe95c..3e571e76517 100644 --- a/sdk/lib/ucrt/vcruntime/vcruntime.cmake +++ b/sdk/lib/ucrt/vcruntime/vcruntime.cmake @@ -1,5 +1,6 @@ list(APPEND UCRT_VCRUNTIME_SOURCES + vcruntime/__report_gsfailure.c vcruntime/__security_init_cookie.c )
1 week, 3 days
1
0
0
0
[reactos] 06/20: [UCRT:VCRUNTIME] Implement __security_init_cookie and __security_check_cookie
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5dcd1d1714663fcc7db6f…
commit 5dcd1d1714663fcc7db6fb4dab48ac16e6c0c5d5 Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Tue Oct 22 09:05:04 2024 +0300 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sun Jan 26 18:08:55 2025 +0200 [UCRT:VCRUNTIME] Implement __security_init_cookie and __security_check_cookie --- sdk/lib/ucrt/CMakeLists.txt | 2 + sdk/lib/ucrt/vcruntime/__security_init_cookie.c | 87 ++++++++++++++++++++++ .../ucrt/vcruntime/amd64/__security_check_cookie.s | 27 +++++++ .../ucrt/vcruntime/i386/__security_check_cookie.s | 27 +++++++ sdk/lib/ucrt/vcruntime/vcruntime.cmake | 14 ++++ 5 files changed, 157 insertions(+) diff --git a/sdk/lib/ucrt/CMakeLists.txt b/sdk/lib/ucrt/CMakeLists.txt index deeb3c7b27e..a5106b5037c 100644 --- a/sdk/lib/ucrt/CMakeLists.txt +++ b/sdk/lib/ucrt/CMakeLists.txt @@ -101,6 +101,7 @@ include(stdio/stdio.cmake) include(stdlib/stdlib.cmake) include(string/string.cmake) include(time/time.cmake) +include(vcruntime/vcruntime.cmake) add_library(ucrt OBJECT ${UCRT_CONIO_SOURCES} @@ -122,6 +123,7 @@ add_library(ucrt OBJECT ${UCRT_STDLIB_SOURCES} ${UCRT_STRING_SOURCES} ${UCRT_TIME_SOURCES} + ${UCRT_VCRUNTIME_SOURCES} ) #target_link_libraries(ucrt pseh) diff --git a/sdk/lib/ucrt/vcruntime/__security_init_cookie.c b/sdk/lib/ucrt/vcruntime/__security_init_cookie.c new file mode 100644 index 00000000000..7488aec954d --- /dev/null +++ b/sdk/lib/ucrt/vcruntime/__security_init_cookie.c @@ -0,0 +1,87 @@ +// +// __security_init_cookie.c +// +// Copyright (c) 2024 Timo Kreuzer +// +// Implementation of __security_init_cookie. +// +// SPDX-License-Identifier: MIT +// + +#include <stdlib.h> +#include <intrin.h> +#include <corecrt_internal.h> + +#ifdef _WIN64 +#define DEFAULT_SECURITY_COOKIE 0x00002B992DDFA232ull +#define _rotlptr _rotl64 +#else +#define DEFAULT_SECURITY_COOKIE 0xBB40E64E +#define _rotlptr _rotl +#endif + +uintptr_t __security_cookie = DEFAULT_SECURITY_COOKIE; +uintptr_t __security_cookie_complement = ~DEFAULT_SECURITY_COOKIE; + +void __security_init_cookie(void) +{ + LARGE_INTEGER performanceCounter; + FILETIME fileTime; + uintptr_t randomValue = (uintptr_t)0x27E30B2C16B07297ull; + +#if defined(_M_IX86) || defined(_M_X64) + if (IsProcessorFeaturePresent(PF_RDRAND_INSTRUCTION_AVAILABLE)) + { +#ifdef _M_X64 + while (!_rdrand64_step(&randomValue)) + _mm_pause(); +#else + while (!_rdrand32_step(&randomValue)) + _mm_pause(); +#endif + } + + if (IsProcessorFeaturePresent(PF_RDTSC_INSTRUCTION_AVAILABLE)) + { + randomValue += __rdtsc(); + } +#endif + + randomValue += (uintptr_t)&randomValue; + randomValue ^= GetTickCount(); + + QueryPerformanceCounter(&performanceCounter); +#ifdef _WIN64 + randomValue ^= performanceCounter.QuadPart; +#else + randomValue ^= performanceCounter.LowPart; + randomValue ^= performanceCounter.HighPart; +#endif + + randomValue += GetCurrentThreadId(); + randomValue = _rotlptr(randomValue, GetCurrentThreadId() >> 2); + +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + GetSystemTimePreciseAsFileTime(&fileTime); +#else + GetSystemTimeAsFileTime(&fileTime); +#endif + randomValue += fileTime.dwLowDateTime; + randomValue += fileTime.dwHighDateTime; + + randomValue += GetCurrentProcessId(); + randomValue = _rotlptr(randomValue, GetCurrentProcessId() >> 2); + + if (randomValue == DEFAULT_SECURITY_COOKIE) + { + randomValue++; + } + +#ifdef _WIN64 + /* Zero out highest 16 bits */ + randomValue &= 0x0000FFFFFFFFFFFFull; +#endif + + __security_cookie = randomValue; + __security_cookie_complement = ~randomValue; +} diff --git a/sdk/lib/ucrt/vcruntime/amd64/__security_check_cookie.s b/sdk/lib/ucrt/vcruntime/amd64/__security_check_cookie.s new file mode 100644 index 00000000000..621426521f4 --- /dev/null +++ b/sdk/lib/ucrt/vcruntime/amd64/__security_check_cookie.s @@ -0,0 +1,27 @@ +// +// __security_check_cookie.asm +// +// Copyright (c) 2024 Timo Kreuzer +// +// Implementation of __security_check_cookie for x64. +// +// SPDX-License-Identifier: MIT +// + +#include <asm.inc> + +EXTERN __security_cookie:QWORD +EXTERN __report_gsfailure:PROC + +.code64 + +// This function must not clobber any registers! +PUBLIC __security_check_cookie +__security_check_cookie: + cmp rcx, qword ptr __security_cookie[rip] + jne __security_check_cookie_fail + ret +__security_check_cookie_fail: + jmp __report_gsfailure + +END diff --git a/sdk/lib/ucrt/vcruntime/i386/__security_check_cookie.s b/sdk/lib/ucrt/vcruntime/i386/__security_check_cookie.s new file mode 100644 index 00000000000..276025efae3 --- /dev/null +++ b/sdk/lib/ucrt/vcruntime/i386/__security_check_cookie.s @@ -0,0 +1,27 @@ +// +// __security_check_cookie.asm +// +// Copyright (c) 2024 Timo Kreuzer +// +// Implementation of __security_check_cookie for x86. +// +// SPDX-License-Identifier: MIT +// + +#include <asm.inc> + +EXTERN ___security_cookie:QWORD +EXTERN ___report_gsfailure:PROC + +.code + +// This function must not clobber any registers! +PUBLIC ___security_check_cookie +___security_check_cookie: + cmp ecx, dword ptr [___security_cookie] + jne ___security_check_cookie_fail + ret +___security_check_cookie_fail: + jmp ___report_gsfailure + +END diff --git a/sdk/lib/ucrt/vcruntime/vcruntime.cmake b/sdk/lib/ucrt/vcruntime/vcruntime.cmake new file mode 100644 index 00000000000..e4857cfe95c --- /dev/null +++ b/sdk/lib/ucrt/vcruntime/vcruntime.cmake @@ -0,0 +1,14 @@ + +list(APPEND UCRT_VCRUNTIME_SOURCES + vcruntime/__security_init_cookie.c +) + +if(${ARCH} STREQUAL "i386") + list(APPEND UCRT_VCRUNTIME_SOURCES + vcruntime/i386/__security_check_cookie.s + ) +elseif(${ARCH} STREQUAL "amd64") + list(APPEND UCRT_VCRUNTIME_SOURCES + vcruntime/amd64/__security_check_cookie.s + ) +endif()
1 week, 3 days
1
0
0
0
[reactos] 05/20: [UCRT:FLOAT] Add _fltused
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=055875fbd894e73de031a…
commit 055875fbd894e73de031aaf4c876171068e270ab Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Mon Oct 28 19:17:56 2024 +0200 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sun Jan 26 18:08:55 2025 +0200 [UCRT:FLOAT] Add _fltused --- sdk/lib/ucrt/CMakeLists.txt | 2 ++ sdk/lib/ucrt/float/_fltused.c | 11 +++++++++++ sdk/lib/ucrt/float/float.cmake | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/sdk/lib/ucrt/CMakeLists.txt b/sdk/lib/ucrt/CMakeLists.txt index 4c2b2e18559..deeb3c7b27e 100644 --- a/sdk/lib/ucrt/CMakeLists.txt +++ b/sdk/lib/ucrt/CMakeLists.txt @@ -88,6 +88,7 @@ include(dll/dll.cmake) include(env/env.cmake) include(exec/exec.cmake) include(filesystem/filesystem.cmake) +include(float/float.cmake) include(heap/heap.cmake) include(initializers/initializers.cmake) include(internal/internal.cmake) @@ -108,6 +109,7 @@ add_library(ucrt OBJECT ${UCRT_ENV_SOURCES} ${UCRT_EXEC_SOURCES} ${UCRT_FILESYSTEM_SOURCES} + ${UCRT_FLOAT_SOURCES} ${UCRT_HEAP_SOURCES} ${UCRT_INITIALIZERS_SOURCES} ${UCRT_INTERNAL_SOURCES} diff --git a/sdk/lib/ucrt/float/_fltused.c b/sdk/lib/ucrt/float/_fltused.c new file mode 100644 index 00000000000..234d3cf0cd4 --- /dev/null +++ b/sdk/lib/ucrt/float/_fltused.c @@ -0,0 +1,11 @@ +// +// _fltused.c +// +// Copyright (c) 2024 Timo Kreuzer +// +// Implementation of _fltused. +// +// SPDX-License-Identifier: MIT +// + +int _fltused = 0x9875; diff --git a/sdk/lib/ucrt/float/float.cmake b/sdk/lib/ucrt/float/float.cmake new file mode 100644 index 00000000000..a0306235771 --- /dev/null +++ b/sdk/lib/ucrt/float/float.cmake @@ -0,0 +1,4 @@ + +list(APPEND UCRT_FLOAT_SOURCES + float/_fltused.c +)
1 week, 3 days
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
28
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Results per page:
10
25
50
100
200