After a minor edit, I noticed that the number of passes required to compile my program suddenly dropped from 3 to 2, and I could not work out why, so I cropped the file down as much as I could. The actual line I noticed it on is marked with ;! but now even removing a "mov eax,1" or changing a "cmp eax, 0x80000004" to "cmp eax,1" now has this effect(!). I can't make it any smaller than I have (sorry).
It isn't causing me any problem, but behind even the smallest anomaly one suspects there may be a nasty bug lurking. Please don't try to run this program!
format PE
section '.data' data readable writeable
x db 0
virtual at ebx ; exception_pointers
exception_record dd ?
context_record dd ?
end virtual
virtual at eax ; context_record
context_flags dd ?
dr_0 dd ? ; debug register 0
dr_1 dd ?
dr_2 dd ?
dr_3 dd ?
dr_6 dd ?
dr_7 dd ?
fp_cw dd ? ; control word
fp_sw dd ? ; status word
fp_tw dd ? ; tag word
fp_eo dd ? ; error offset
fp_es dd ? ; error selector
fp_do dd ? ; data offset
fp_ds dd ? ; data selector
fp_st0 dt ? ; floating point register 0
fp_st1 dt ?
fp_st2 dt ?
fp_st3 dt ?
fp_st4 dt ?
fp_st5 dt ?
fp_st6 dt ?
fp_st7 dt ?
fp_cron dd ? ; ? Cr0NpxState ?
sr_gs dd ? ; gs register
sr_fs dd ? ; gs register
sr_es dd ? ; gs register
sr_ds dd ? ; gs register
or_edi dd ? ; edi
or_esi dd ? ; esi
or_ebx dd ?
or_edx dd ?
or_ecx dd ?
or_eax dd ?
end virtual
section '.text' code readable executable
_putstr:
ret
handler:
jmp _donewith
cmp eax, 0x80000004 ;1!
jnz @f
mov esi,x
call _putstr
mov eax,[context_record]
mov eax,[dr_6]
and eax,0x0000F00F
cmp eax,1
jnz _unknown
mov esi,x
;!
call _putstr
jmp _donewith
@@:
cmp eax,0xC0000094 ;;1!
jnz @f
mov esi, x
call _putstr
mov eax,[context_record]
mov [or_eax],0
mov [or_edx],0
mov [or_ebx],1
mov [or_ecx],1
jmp _donewith
@@:
_unknown:
mov esi,x
call _putstr
call _donewith
mov eax,1
ret
_donewith:
ret
start:
ret
entry start
|