windowsexceptionvisual-studio-2015windbgillegal-instruction

Debugging 0xc000001d exception with WinDbg


I'm trying to find a root cause of the "Illegal instruction" exception (0xc000001d) with WinDbg. The project was built with VC++2015. I've got two memory dumps from two test runs.

For now I found the following that is true for both dumps:

I have no idea where to go further, so I'd appreciate any directions.

UPD:

...
movq    xmm0,mmword ptr [esi]
lea     ecx,[edi+94h]
movq    mmword ptr [ecx],xmm0 ; << this causes the exception

Solution

  • Illegal instruction is raised when the operating system handles a fault from the CPU where it has failed to decode an instruction. This can occur if an instruction extension is not supported by the CPU or the operating system. msdn : illegal instruction AVX. In this case the bug in msvc 2013 occurred when the CPU supported AVX, but the operating system did not.

    The CPUs which are failing don't appear to support SSE2, which is a likely cause for this issue.

    In the case I came across the AVX issue, when using a tool to identify if AVX was used, there was a CPU test which decided that the AVX was not supported by the tool (supplied by Intel).

    I am not aware of a tool by AMD, and would be wary of such a tool working, as it may be that it is the operating system support which is missing.

    Update

    Why does an instruction fail if the operating system does not support it? An example of this is the AVX instructions, which from wikipedia : AVX states.

    AVX adds new register-state through the 256-bit wide YMM register file, so explicit operating system support is required to properly save and restore AVX's expanded registers between context switches.

    Any change to the work or memory needed by the operating system, probably requires explicit opt-in. In the case of AVX, the extra registers changed the amount of data stored for a context switch.