AVX Support
Page 1 of 1

Author:  tsdnz [ Thu May 18, 2017 3:25 pm ]
Post subject:  AVX Support

Hi, I am adding AVX support to my OS.

Does AVX only work in protected mode?
I get an Invalid Opcode exception
I have setup AVX support and the server has AVX
Under exceptions in the docs it looks like AVX is only supported in Protected Mode.

Anyone else come across this?


Author:  tsdnz [ Thu May 18, 2017 3:29 pm ]
Post subject:  Re: AVX Support

The instruction causing the exception is vldmxcsr

Author:  JAAman [ Fri May 19, 2017 9:03 am ]
Post subject:  Re: AVX Support

Intel volume 2, section LDMXCSR wrote:
Note: In VEX-encoded versions, VEX.vvvv is reserved and must be 1111b, otherwise instructions will #UD.

Intel LDMXCSR: Exceptions wrote:
#UD If VEX.vvvv ≠ 1111B.

also, Intel manual volume 2, 2.4.5 Exceptions Type 5 includes a table (labeled table 2-22 in my latest edition) gives a list of causes of various causes for exceptions in various modes

in #UD in RMode for type 5 exception-class can be caused by:
-VEX prefix
-legacy SSE instructions if CR0.EM=1 or CR4.OSFXSR=0
-if preceded by lock instruction
-if any corresponding CPUID feature flag is 0

there is nothing in the "ldmxcsr" section that says it only works in PMode

Author:  tsdnz [ Fri May 19, 2017 5:29 pm ]
Post subject:  Re: AVX Support

Cheers for the reply, it reminded me to have another look.

I had two issues.
  • Forgot to xsetbv to enable the features. AVX, SSE, FPU.
  • Then I forgot to do this for each core, I was only setting this in BSP, which made the other cores crash, and I was only showing BSP on the screen at the time to try to figue this out, which made me think it was BSP exception.

Thanks for your reply.


Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group