<commit_before>%include '../header.inc'

MEM_RESERVE        equ 2000h
MEM_TOP_DOWN       equ 100000h
MB_ICONINFORMATION equ 040h

EntryPoint:
    mov eax, res
    fldpi
    movq qword [eax], mm7
    cmp dword [eax], 2168c235h
    jnz bad
    cmp dword [eax+4], 0c90fdaa2h
    jnz bad
    ; not testing FST nor cr0 yet ;)
    jmp good
_c

good:
    push MB_ICONINFORMATION
    push correct
    push noerrors
    push 0
    call MessageBoxA
bad:
    push 0
    call ExitProcess
_c
res dq 0

;%IMPORT user32.dll!MessageBoxA
;%IMPORT kernel32.dll!ExitProcess
_c
<commit_msg>added cr0/st0/fst test. cr0 test should be stronger<commit_after>; registers checks on a single FPU operation
;
; a single (fldpi) FPU Load Pi modifies ST0, FST, MM7, CR0
;
; <NAME>, BSD Licence 2011

%include '../header.inc'

MEM_RESERVE        equ 2000h
MEM_TOP_DOWN       equ 100000h
MB_ICONINFORMATION equ 040h

EntryPoint:
    smsw ebx
    mov [cr0before], ebx
_
    mov ebx, fstbefore
    fstsw [ebx]
    mov edx, fstafter
_
    fldpi
    smsw ecx
    mov [cr0after], ecx
    fstsw [edx]
    fstp tword [st0after]
    movq qword [_mm7], mm7
_
    cmp word [fstbefore], 0
    jnz bad
    cmp word [fstafter], 03800h
    jnz bad
_
    and dword [cr0before], 0fff0ffffh
    cmp dword [cr0before],  8000003bh
    jnz bad
    and dword [cr0after], 0fff0ffffh
    cmp dword [cr0after],  80000031h
    jnz bad
_
    cmp dword [_mm7], 2168c235h
    jnz bad
    cmp dword [_mm7 + 4], 0c90fdaa2h
    jnz bad
_
    cmp dword [st0after], 02168c235h
    jnz bad
    cmp dword [st0after + 4], 0c90fdaa2h
    jnz bad
    cmp word [st0after + 8], 04000h
    jnz bad
_
    jmp good
_c

good:
    push MB_ICONINFORMATION
    push correct
    push noerrors
    push 0
    call MessageBoxA
bad:
    push 0
    call ExitProcess
_c

_mm7 dq 0
fstbefore dw 0
fstafter dw 0
cr0before dd 0
cr0after dd 0
st0after dt 0
_d

;%IMPORT user32.dll!MessageBoxA
;%IMPORT kernel32.dll!ExitProcess
_c

{'fraction_non_alphanumeric': 0.06436663233779609, 'fraction_numerical': 0.07363542739443872, 'mean_word_length': 2.6317757009345795, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4360498', 'n_tokens_mistral': 907, 'n_tokens_neox': 784, 'n_words': 245}