Cpu halts when enabling osxsave

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
devc1
Member
Member
Posts: 439
Joined: Fri Feb 11, 2022 4:55 am
Location: behind the keyboard

Cpu halts when enabling osxsave

Post by devc1 »

I'm trying to enable extended processor features, when emulating on qemu with "Cascadelake-Server" i got the AVX, SSE Features but when emulating with normal cpu, it exactly halts when enabling OSXSAVE bit[18] on CR4

Here is the code :

Code: Select all

mov eax, 1
cpuid
test ecx, 1 << 26
je .enable_osxsave

.enable_osxsave:
push rax
mov rax, cr4
or rax, 1 << 18 ; Anything another than this bit works fine
mov cr4, rax ; Cpu Shutdown without any message by qemu and in debug the "halt" instruction is not executed
cli
hlt
jmp ,ret0
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: Cpu halts when enabling osxsave

Post by Octocontrabass »

The TEST instruction sets ZF when none of the tested bits are set.

The JE instruction jumps when ZF is set.

You're trying to set CR4.OSXSAVE on a CPU that does not support XSAVE.
Post Reply