diff --git a/src/common/windows/nt.h b/src/common/windows/nt.h index a8bf50839..2f476b8d6 100644 --- a/src/common/windows/nt.h +++ b/src/common/windows/nt.h @@ -602,7 +602,15 @@ typedef struct _KUSER_SHARED_DATA { // ... more fields follow, but we don't need them } KUSER_SHARED_DATA, *PKUSER_SHARED_DATA; -#define SharedUserData ((const KUSER_SHARED_DATA*) 0x7FFE0000UL) +#ifdef __aarch64__ + #define SharedUserData ({ \ + __auto_type shared_user_data = (const volatile KUSER_SHARED_DATA*) (uintptr_t) 0x7FFE0000UL; \ + __asm__("" : "+r"(shared_user_data)); /* https://github.com/lhmouse/mcfgthread/issues/330 */ \ + shared_user_data; \ + }) +#else + #define SharedUserData ((const volatile KUSER_SHARED_DATA*) (uintptr_t) 0x7FFE0000UL) +#endif static inline uint64_t ffKSystemTimeToUInt64(const volatile KSYSTEM_TIME* pTime) { #if _WIN64