| ... | @@ -528,6 +528,8 @@ const CpuidLeaf = packed struct { | ... | @@ -528,6 +528,8 @@ const CpuidLeaf = packed struct { |
| 528 | edx: u32, | 528 | edx: u32, |
| 529 | }; | 529 | }; |
| 530 | | 530 | |
| | 531 | /// This is a workaround for the C backend until zig has the ability to put |
| | 532 | /// C code in inline assembly. |
| 531 | extern fn zig_x86_cpuid(leaf_id: u32, subid: u32, eax: *u32, ebx: *u32, ecx: *u32, edx: *u32) callconv(.C) void; | 533 | extern fn zig_x86_cpuid(leaf_id: u32, subid: u32, eax: *u32, ebx: *u32, ecx: *u32, edx: *u32) callconv(.C) void; |
| 532 | | 534 | |
| 533 | fn cpuid(leaf_id: u32, subid: u32) CpuidLeaf { | 535 | fn 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 | } |
| 555 | | 557 | |
| | 558 | /// This is a workaround for the C backend until zig has the ability to put |
| | 559 | /// C code in inline assembly. |
| 556 | extern fn zig_x86_get_xcr0() callconv(.C) u32; | 560 | extern fn zig_x86_get_xcr0() callconv(.C) u32; |
| 557 | | 561 | |
| 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. |