OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Dec 13, 2017 12:40 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: AVX Support
PostPosted: Thu May 18, 2017 3:25 pm 
Offline
Member
Member

Joined: Sun Jun 16, 2013 4:09 am
Posts: 330
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?

Ali


Top
 Profile  
 
 Post subject: Re: AVX Support
PostPosted: Thu May 18, 2017 3:29 pm 
Offline
Member
Member

Joined: Sun Jun 16, 2013 4:09 am
Posts: 330
The instruction causing the exception is vldmxcsr


Top
 Profile  
 
 Post subject: Re: AVX Support
PostPosted: Fri May 19, 2017 9:03 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2004 11:00 pm
Posts: 829
Location: WA
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

_________________
## ---- ----- ------ Intel Manuals
OSdev wiki


Top
 Profile  
 
 Post subject: Re: AVX Support
PostPosted: Fri May 19, 2017 5:29 pm 
Offline
Member
Member

Joined: Sun Jun 16, 2013 4:09 am
Posts: 330
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.

Ali


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group