add some comments to explain workarounds

This commit is contained in:
Andrew Kelley 2023-01-02 14:08:50 -07:00
parent 4776128099
commit 72560b8db5
2 changed files with 6 additions and 0 deletions

View File

@ -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 {

View File

@ -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.