You need the xgetbv instruction to check for OS support.
avxSupported proc uses ebx
mov eax, 1
cpuid
bt ecx, 27
jnc @exitfalse
xor ecx, ecx
xgetbv
and eax, 6
cmp eax, 6
jne @exitfalse
mov eax, 1
cpuid
bt ecx, 28
jnc @exitfalse
mov eax, 1
ret
@exitfalse:
mov eax, 0
ret
avxSupported endp