diff options
| author | kcbanner <kcbanner@gmail.com> | 2022-12-29 16:41:48 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-01-02 13:56:11 -0700 |
| commit | ccf0ab0ef6da95eae71c0dbc2c0ded0d5d674a40 (patch) | |
| tree | 9462718b2a43264a5634e97db8983e11151141f0 /lib/zig.h | |
| parent | 9c70315854735ab9ecd572e327f41ea547033f09 (diff) | |
| download | zig-ccf0ab0ef6da95eae71c0dbc2c0ded0d5d674a40.tar.gz zig-ccf0ab0ef6da95eae71c0dbc2c0ded0d5d674a40.zip | |
cbe: use callconv(.C) for zig.g stub functions, use zig.h function for windows teb instead of syscall
Diffstat (limited to 'lib/zig.h')
| -rw-r--r-- | lib/zig.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -2349,6 +2349,20 @@ zig_msvc_atomics_128op(u128, max) /* ========================= Special Case Intrinsics ========================= */ +#if (_MSC_VER && _M_X64) || defined(__x86_64__) + +static inline void* zig_x86_64_windows_teb() { +#if _MSC_VER + return __readgsqword(0x30); +#else + void* teb; + __asm volatile(" movq %%gs:0x30, %[ptr]": [ptr]"=r"(teb)::); + return teb; +#endif +} + +#endif + #if (_MSC_VER && (_M_IX86 || _M_X64)) || defined(__i386__) || defined(__x86_64__) static inline void zig_x86_cpuid(zig_u32 leaf_id, zig_u32 subid, zig_u32* eax, zig_u32* ebx, zig_u32* ecx, zig_u32* edx) { |
