After a long trip fixing my LEGACY BIOS bootloader to run on QEMU with HAXM enabled, the bootloader successfully do its job and jumps to the kernel, the first thing the kernel does is to enable CPU features. However, when HAXM is enabled, the kernel detects AVX support but xsetbv triggers a vCPU Shutdown. I figured out that XSAVE and OSXSAVE are disabled in CPUID,EAX=1. I tried to check for them by creating a windows program and they seem to be both enabled on the host CPU.
The goal of enabling HAXM was mainly to test and use AVX, PCID, AES, TSC_DEADLINE support and lot of other features present on my CPU, rather than just rebooting my PC each time which takes minutes!
How to enable OSXSAVE, XSAVE on an HAXM host? How to use AVX and other CPU features?
Enabling these extensions on real hardware (the host CPU) seems to work normally.