vmovdqa 在 virtualbox 中不起作用? [英] vmovdqa not working in virtualbox?
问题描述
我使用的是支持 avx 和 avx2 的最新型号 i7 cpu,据说 virtualbox 支持 avx 和 avx2,那么为什么下面的代码会挂起?
I'm using a late model i7 cpu that supports avx and avx2, and supposedly virtualbox supports avx and avx2 so that being the case why does the following code hang?
vmovdqa ymm0, qqword[testmem]
testmem 在别处定义为
testmem is defined elsewhere as
align 32
testmem: rb 128
如果我使用
movdqa xmm0, dqword[testmem]
效果很好.
FASM 1.72、Windows 10、i7-7700hq、virtualbox 5.2.6
FASM 1.72, windows 10, i7-7700hq, virtualbox 5.2.6
这是一个 UEFI 应用程序(显然在 64 位模式下运行),除非出现上述指令,否则它可以正常工作.
It's a UEFI application (so obviously running in 64 bit mode) that works fine except if the above instruction appears.
编辑
尝试添加
mov rcx, 0
xgetbv
or rax, 0007h
xsetbv
在代码的开头,但没有帮助.
At the start of the code, but didn't help.
推荐答案
好的找到了答案.我知道这是一个相当深奥的问题,但以防万一它对其他人有帮助,这里是如何启用 AVX
Ok found the answer. I know this is a rather esoteric question but just in case it helps someone else here is how to enable AVX
mov rax, cr4
or eax, 0x40000 ; bit 18 for oxsave bit
mov cr4, rax
xor rcx, rcx
xgetbv
or rax, 6
xsetbv
我缺少的是设置启用 OSXSAVE 的 CR4 寄存器的第 18 位,这是启用 AVX 之前的要求.
What I was missing was setting bit 18 of the CR4 register which enables OSXSAVE, a requirement prior to enabling AVX.
这篇关于vmovdqa 在 virtualbox 中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!