Skip to content

Fix detection of AVX2 #222

@k0ekk0ek

Description

@k0ekk0ek

@wekers trying out NSD 4.10.0 on FreeBSD reported nsd-checkzone crashing with "Illegal instruction (core dumped)" (see NLnetLabs/nsd#361). @wekers was kind enough to help out with debugging and it seems there's a bug in ISA detection. The ebx for CPUID with eax=0x7 has bit 5 set (AVX2). However, basing the decision on whether AVX2 is actually available on the system requires bit 28 (AVX instructions supported) being set in ecx with eax=0x1. Apart from that, we must also check if the operating system properly supports it.

Peter Cordes (as always) provides excellent explanations (1, 2) on Stack Overflow.

See Félix Cloutier's pages on CPUID and XGETBV for detailed information on the aforementioned instructions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions