Skip to content

Commit

Permalink
Add flags to enable x86-64-v2 support
Browse files Browse the repository at this point in the history
Summary:
Intel hosts without this diff are running into an issue where standard linux binaries are saying the following:

```
$ hermit run date
Fatal glibc error: CPU does not support x86-64-v2
```

This is unlike the AMD hosts because the AMD hosts do not actually properly intercept cpuid instructions (another issue we should deal with...). So they have this feature enabled since it's the equivalent of `no-virtualize-cpuid`.

Looking online, it seems like we need to just enable the flags required to support that architectural level. More details in #49 (comment)

Reviewed By: jasonwhite

Differential Revision: D55874608

fbshipit-source-id: 619116fe2f3a9d0bcfd667f1c6db26c031cee640
  • Loading branch information
CookieComputing authored and facebook-github-bot committed Apr 10, 2024
1 parent 727691f commit bd3153b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion detcore/src/cpuid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ const fn cpuid_result(eax: u32, ebx: u32, ecx: u32, edx: u32) -> CpuIdResult {
// masked off to prevent non-determinism.
const CPUIDS: &[CpuIdResult] = &[
cpuid_result(0x0000000D, 0x756E6547, 0x6C65746E, 0x49656E69),
cpuid_result(0x00000663, 0x00000800, 0x90202001, 0x078BFBFD),
cpuid_result(
0x00000663,
0x00000800,
// These flags are required for x86-64-v2 support. Found via https://www.felixcloutier.com/x86/cpuid
0x90202001 | (1 << 0) | (1 << 9) | (1 << 13) | (1 << 19) | (1 << 20) | (1 << 23),
0x078BFBFD,
),
cpuid_result(0x00000001, 0x00000000, 0x0000004D, 0x002C307D),
cpuid_result(0x00000000, 0x00000000, 0x00000000, 0x00000000),
cpuid_result(0x00000120, 0x01C0003F, 0x0000003F, 0x00000001),
Expand Down

0 comments on commit bd3153b

Please sign in to comment.