Signed-off-by: Martin Storsjö <[email protected]>
---
mingw-w64-headers/crt/_mingw.h.in | 25 +++++++++++++++++++++++++
mingw-w64-headers/crt/intrin.h | 1 +
mingw-w64-headers/include/winnt.h | 3 ---
3 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/mingw-w64-headers/crt/_mingw.h.in
b/mingw-w64-headers/crt/_mingw.h.in
index 0ef7ae6ea..087fce88d 100644
--- a/mingw-w64-headers/crt/_mingw.h.in
+++ b/mingw-w64-headers/crt/_mingw.h.in
@@ -577,6 +577,7 @@ extern "C" {
#ifdef __MINGW_INTRIN_INLINE
+
#ifdef __has_builtin
#define __MINGW_DEBUGBREAK_IMPL !__has_builtin(__debugbreak)
#else
@@ -596,8 +597,32 @@ __MINGW_INTRIN_INLINE void __cdecl __debugbreak(void)
__asm__ __volatile__("unimplemented");
#endif
}
+#endif /* __MINGW_DEBUGBREAK_IMPL == 1 */
+
+#ifdef __has_builtin
+#define __MINGW_FASTFAIL_IMPL !__has_builtin(__fastfail)
+#else
+#define __MINGW_FASTFAIL_IMPL 1
#endif
+#if __MINGW_FASTFAIL_IMPL == 1
+void __cdecl __MINGW_ATTRIB_NORETURN __fastfail(unsigned int code);
+__MINGW_INTRIN_INLINE void __cdecl __MINGW_ATTRIB_NORETURN __fastfail(unsigned
int code)
+{
+#if defined(__i386__) || defined(__x86_64__)
+ __asm__ __volatile__("int {$}0x29"::"c"(code));
+#elif defined(__arm__)
+ register unsigned int r0 __asm__("r0") = code;
+ __asm__ __volatile__("udf #0xfb"::"r"(r0));
+#elif defined(__aarch64__)
+ register unsigned int w0 __asm__("w0") = code;
+ __asm__ __volatile__("brk #0xf003"::"r"(w0));
+#else
+ __asm__ __volatile__("unimplemented");
#endif
+}
+#endif /* __MINGW_FASTFAIL_IMPL == 1 */
+
+#endif /* defined(__MINGW_INTRIN_INLINE) */
/* mingw-w64 specific functions: */
const char *__mingw_get_crt_info (void);
diff --git a/mingw-w64-headers/crt/intrin.h b/mingw-w64-headers/crt/intrin.h
index fbfee5fdc..1f45148f9 100644
--- a/mingw-w64-headers/crt/intrin.h
+++ b/mingw-w64-headers/crt/intrin.h
@@ -310,6 +310,7 @@ extern "C" {
__MACHINEI(__MINGW_EXTENSION unsigned __int64 __emulu(unsigned
int,unsigned int))
__MACHINEI(void __cdecl _enable(void))
__MACHINEIA64(void __cdecl _enable(void))
+ __MACHINE(void __cdecl __MINGW_ATTRIB_NORETURN __fastfail(unsigned int
code))
__MACHINEIA64(__MINGW_EXTENSION void __fc(__int64))
__MACHINEIA64(void __fclrf(void))
__MACHINEIA64(void __fsetc(int,int))
diff --git a/mingw-w64-headers/include/winnt.h
b/mingw-w64-headers/include/winnt.h
index d65b21c43..3a5bbd3c6 100644
--- a/mingw-w64-headers/include/winnt.h
+++ b/mingw-w64-headers/include/winnt.h
@@ -8870,9 +8870,6 @@ typedef DWORD (WINAPI
*PRTL_RUN_ONCE_INIT_FN)(PRTL_RUN_ONCE, PVOID, PVOID *);
#define FAST_FAIL_UNSAFE_REGISTRY_ACCESS 9
#define FAST_FAIL_INVALID_FAST_FAIL_CODE 0xffffffff
-/* TODO: Check implementation of
- DECLSPEC_NORETURN VOID __fastfail (unsigned int); */
-
#define HEAP_NO_SERIALIZE 0x00000001
#define HEAP_GROWABLE 0x00000002
#define HEAP_GENERATE_EXCEPTIONS 0x00000004
--
2.25.1
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public