mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-13 22:49:11 +00:00
Fix some issues and do some code cleanup
This commit is contained in:
parent
1f229e4efc
commit
312ed5c67c
72 changed files with 880 additions and 982 deletions
|
@ -4,17 +4,18 @@
|
|||
|
||||
/**
|
||||
* Known versions of the New Technology executive.
|
||||
* @see IsAtLeastWindows10()
|
||||
* @see NtGetVersion()
|
||||
*/
|
||||
#define kNtVersionWindows10 0x0a00
|
||||
#define kNtVersionWindows81 0x0603
|
||||
#define kNtVersionWindows8 0x0602
|
||||
#define kNtVersionWindows7 0x0601
|
||||
#define kNtVersionWindows10 0x0a00
|
||||
#define kNtVersionWindows81 0x0603
|
||||
#define kNtVersionWindows8 0x0602
|
||||
#define kNtVersionWindows7 0x0601
|
||||
#define kNtVersionWindowsVista 0x0600 /* intended baseline */
|
||||
#define kNtVersionWindowsXp64 0x0502 /* end of the road */
|
||||
#define kNtVersionWindowsXp 0x0501 /* snowball's chance */
|
||||
#define kNtVersionWindows2000 0x0500 /* the golden age */
|
||||
#define kNtVersionFuture 0x0b00
|
||||
#define kNtVersionWindowsXp64 0x0502 /* end of the road */
|
||||
#define kNtVersionWindowsXp 0x0501 /* snowball's chance */
|
||||
#define kNtVersionWindows2000 0x0500 /* the golden age */
|
||||
#define kNtVersionFuture 0x0b00
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_VERSION_H_ */
|
||||
|
|
|
@ -8,16 +8,14 @@ bool IsAtLeastWindows10(void) pureconst;
|
|||
bool32 GetVersionEx(struct NtOsVersionInfo *lpVersionInformation);
|
||||
|
||||
#if defined(__GCC_ASM_FLAG_OUTPUTS__) && !defined(__STRICT_ANSI__)
|
||||
#define IsAtLeastWindows10() \
|
||||
({ \
|
||||
long ReG; \
|
||||
bool NoTbelow; \
|
||||
asm("mov\t%%gs:96,%1\r\n" \
|
||||
"cmpb\t%2,280(%1)" \
|
||||
: "=@ccnb"(NoTbelow), "=l"(ReG) \
|
||||
: "i"(10)); \
|
||||
NoTbelow; \
|
||||
})
|
||||
#define IsAtLeastWindows10() (GetNtMajorVersion() >= 10)
|
||||
static pureconst inline unsigned char GetNtMajorVersion(void) {
|
||||
uintptr_t _x;
|
||||
asm("mov\t%%gs:96,%q0\r\n"
|
||||
"mov\t280(%q0),%b0"
|
||||
: "=q"(_x));
|
||||
return _x;
|
||||
}
|
||||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue