diff --git a/libc/nt/version.h b/libc/nt/version.h index 106cc54eb..1c92f0a7c 100644 --- a/libc/nt/version.h +++ b/libc/nt/version.h @@ -9,6 +9,8 @@ bool32 GetVersionEx(struct NtOsVersionInfo *lpVersionInformation); #if defined(__GCC_ASM_FLAG_OUTPUTS__) && !defined(__STRICT_ANSI__) #define IsAtLeastWindows10() (GetNtMajorVersion() >= 10) +#define IsAtleastWindows8p1() \ + (GetNtMajorVersion() > 6 || (GetNtMajorVersion() == 6 && GetNtMinorVersion() == 3)) #define GetNtMajorVersion() \ ({ \ uintptr_t __x; \ @@ -17,6 +19,14 @@ bool32 GetVersionEx(struct NtOsVersionInfo *lpVersionInformation); : "=q"(__x)); \ (unsigned char)__x; \ }) +#define GetNtMinorVersion() \ + ({ \ + uintptr_t __x; \ + asm("mov\t%%gs:96,%q0\r\n" \ + "mov\t284(%q0),%b0" \ + : "=q"(__x)); \ + (unsigned char)__x; \ + }) #endif COSMOPOLITAN_C_END_ diff --git a/libc/runtime/memtrack.internal.h b/libc/runtime/memtrack.internal.h index c85878fdd..fe9ba0dd0 100644 --- a/libc/runtime/memtrack.internal.h +++ b/libc/runtime/memtrack.internal.h @@ -7,7 +7,6 @@ #include "libc/macros.internal.h" #include "libc/thread/tls.h" #include "libc/nt/version.h" -#include "libc/nt/enum/version.h" #include "libc/runtime/stack.h" #include "libc/sysv/consts/ss.h" #if !(__ASSEMBLER__ + __LINKER__ + 0) @@ -39,7 +38,7 @@ COSMOPOLITAN_C_START_ #define _kMem(NORMAL, WIN7) \ (!IsWindows() || IsAtLeastWindows10() ? NORMAL : WIN7) #define _kMemVista(NORMAL, WINVISTA) \ - (!IsWindows() || NtGetVersion() >= kNtVersionWindows81 ? NORMAL : WINVISTA) + (!IsWindows() || IsAtleastWindows8p1() ? NORMAL : WINVISTA) struct MemoryInterval { int x;