0
votes

I am developing a bare metal program. The platform is x86, 32 bit, protected mode, I am at ring 0. I would like to enable AVX by using xsetgv instruction. 18th bit of CR4 is 1, if I use xgetgv then nothing wrong happens, but the xsetgv crashes (the virtualbox reports fatal error). The problematic code is the following:

mov ecx, 0
mov eax, 0x7
mov edx, 0
xsetbv

What is the problem?

1
Make sure your virtualbox actually supports AVX. IIRC, it doesn't expose AVX support to the guest by default, or there was an old bug with it. (Test by booting Linux in the vbox instance, and run grep avx /proc/cpuinfo or something.Peter Cordes
Along those lines, try with bochs which is known to have working AVX support (make sure it's enabled). It also has a debugger and source code ;)Jester

1 Answers

2
votes

The problem was the bugy virtual box, my code works greatly on a real hardware, and the newest virtualbox.