authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-01-02 14:08:50-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-01-02 14:08:50-07:00
log72560b8db525ac81877799035ef093d9badd6bfd
treea574ee1fd11375a0778c7eda2905ffb410bbff92
parent4776128099e3c5096ee7365a59dd73adce04f0e9

add some comments to explain workarounds


2 files changed, 6 insertions(+), 0 deletions(-)

lib/std/os/windows.zig+2
...@@ -1776,6 +1776,8 @@ pub fn UnlockFile(...@@ -1776,6 +1776,8 @@ pub fn UnlockFile(
1776 }1776 }
1777}1777}
17781778
1779/// This is a workaround for the C backend until zig has the ability to put
1780/// C code in inline assembly.
1779extern fn zig_x86_64_windows_teb() callconv(.C) *anyopaque;1781extern fn zig_x86_64_windows_teb() callconv(.C) *anyopaque;
17801782
1781pub fn teb() *TEB {1783pub fn teb() *TEB {
lib/std/zig/system/x86.zig+4
...@@ -528,6 +528,8 @@ const CpuidLeaf = packed struct {...@@ -528,6 +528,8 @@ const CpuidLeaf = packed struct {
528 edx: u32,528 edx: u32,
529};529};
530530
531/// This is a workaround for the C backend until zig has the ability to put
532/// C code in inline assembly.
531extern fn zig_x86_cpuid(leaf_id: u32, subid: u32, eax: *u32, ebx: *u32, ecx: *u32, edx: *u32) callconv(.C) void;533extern fn zig_x86_cpuid(leaf_id: u32, subid: u32, eax: *u32, ebx: *u32, ecx: *u32, edx: *u32) callconv(.C) void;
532534
533fn cpuid(leaf_id: u32, subid: u32) CpuidLeaf {535fn cpuid(leaf_id: u32, subid: u32) CpuidLeaf {
...@@ -553,6 +555,8 @@ fn cpuid(leaf_id: u32, subid: u32) CpuidLeaf {...@@ -553,6 +555,8 @@ fn cpuid(leaf_id: u32, subid: u32) CpuidLeaf {
553 return .{ .eax = eax, .ebx = ebx, .ecx = ecx, .edx = edx };555 return .{ .eax = eax, .ebx = ebx, .ecx = ecx, .edx = edx };
554}556}
555557
558/// This is a workaround for the C backend until zig has the ability to put
559/// C code in inline assembly.
556extern fn zig_x86_get_xcr0() callconv(.C) u32;560extern fn zig_x86_get_xcr0() callconv(.C) u32;
557561
558// Read control register 0 (XCR0). Used to detect features such as AVX.562// Read control register 0 (XCR0). Used to detect features such as AVX.