aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-01-02 14:08:50 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-01-02 14:08:50 -0700
commit72560b8db525ac81877799035ef093d9badd6bfd (patch)
treea574ee1fd11375a0778c7eda2905ffb410bbff92
parent4776128099e3c5096ee7365a59dd73adce04f0e9 (diff)
downloadzig-72560b8db525ac81877799035ef093d9badd6bfd.tar.gz
zig-72560b8db525ac81877799035ef093d9badd6bfd.zip
add some comments to explain workarounds
-rw-r--r--lib/std/os/windows.zig2
-rw-r--r--lib/std/zig/system/x86.zig4
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig
index 268e13a379..2a4d0d9a9b 100644
--- a/lib/std/os/windows.zig
+++ b/lib/std/os/windows.zig
@@ -1776,6 +1776,8 @@ pub fn UnlockFile(
}
}
+/// This is a workaround for the C backend until zig has the ability to put
+/// C code in inline assembly.
extern fn zig_x86_64_windows_teb() callconv(.C) *anyopaque;
pub fn teb() *TEB {
diff --git a/lib/std/zig/system/x86.zig b/lib/std/zig/system/x86.zig
index 634a04fb43..873659e58c 100644
--- a/lib/std/zig/system/x86.zig
+++ b/lib/std/zig/system/x86.zig
@@ -528,6 +528,8 @@ const CpuidLeaf = packed struct {
edx: u32,
};
+/// This is a workaround for the C backend until zig has the ability to put
+/// C code in inline assembly.
extern fn zig_x86_cpuid(leaf_id: u32, subid: u32, eax: *u32, ebx: *u32, ecx: *u32, edx: *u32) callconv(.C) void;
fn cpuid(leaf_id: u32, subid: u32) CpuidLeaf {
@@ -553,6 +555,8 @@ fn cpuid(leaf_id: u32, subid: u32) CpuidLeaf {
return .{ .eax = eax, .ebx = ebx, .ecx = ecx, .edx = edx };
}
+/// This is a workaround for the C backend until zig has the ability to put
+/// C code in inline assembly.
extern fn zig_x86_get_xcr0() callconv(.C) u32;
// Read control register 0 (XCR0). Used to detect features such as AVX.