From 6a05b84ecaf6fa1f3343011351f9bdd2e4e5eaf2 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 27 May 2020 20:19:04 +0200 Subject: [PATCH] winnt.h: Provide inline NtCurrentTeb implementation for mingw arm builds. Based on mingw-w64. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- include/winnt.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/winnt.h b/include/winnt.h index ae9177842bf..34951766dd1 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -2675,6 +2675,13 @@ static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) { return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self)); } +#elif defined(__arm__) && defined(__MINGW32__) +static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) +{ + struct _TEB *teb; + __asm__("mrc p15, 0, %0, c13, c0, 2" : "=r" (teb)); + return teb; +} #else extern struct _TEB * WINAPI NtCurrentTeb(void); #endif