Skip to content

Instantly share code, notes, and snippets.

@tea
Created April 7, 2026 16:05
Show Gist options
  • Select an option

  • Save tea/81354563f595a30d25d607d1c8c2fc29 to your computer and use it in GitHub Desktop.

Select an option

Save tea/81354563f595a30d25d607d1c8c2fc29 to your computer and use it in GitHub Desktop.
avx512-in-16-bit-pm test
bits 16
org 0x7c00
start:
xor ax, ax
mov ds, ax
cli
lgdt [gdtp]
mov eax, cr0
and ax, 0xfffb ;CR0.EM
or ax, 3 ; CR0.PE, CR0.MP
mov cr0, eax
mov eax, cr4
or eax, 0x40600 ; CR4.OSFXSR | CR4.OSXMMEXCPT | CR4.OSXSAVE
mov cr4, eax
xor ecx, ecx
xgetbv
or eax, 0xe7 ; avx, sse, x87, opmask, zmm_hi256, hi16_zmm
xsetbv
jmp 0x18:pm16
pm16:
mov ax, 0x10
mov ds, ax
movdqu xmm0,[data]
mov eax, 0xAABBCCDD
db 0x62, 0xF1, 0x7F, 0x08, 0x79, 0xC0
mov ebp, 0xb8010
mov bh, 0xF
mov ecx, 8
print:
mov bl, al
shr eax, 4
and bl, 0xf
cmp bl, 0xa
jb @digit
add bl, 7
@digit: add bl, '0'
mov ds:[ebp], bx
sub ebp, 2
loop print
hlt: hlt
jmp hlt
gdtp:
dw 0x1f
dd gdt
gdt:
dq 0
; 32 bit code
dw 0xffff
dw 0
db 0
db 0x9b
db 0xcf
db 0
; data
dw 0xffff
dw 0
db 0
db 0x93
db 0xcf
db 0
; 16 bit code
dw 0xffff
dw 0
db 0
db 0x9b
db 0x8f
db 0
align 16
data: dq 123456789.012345, 0
times 510-($-$$) db 0
dw 0xaa55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment