[esp]
can not be encoded using a modr/m
byte only, it needs a SIB
byte. See Table 2-2. 32-Bit Addressing Forms with the ModR/M Byte in the intel instruction set reference.
The 44
value of modr/m encodes that the other operand is eax
and that a SIB
byte and a displacement byte follows. SIB
value of 24
encodes [esp]
, see Table 2-3. 32-Bit Addressing Forms with the SIB Byte.
The SIB
can encode all the other variants too, but since that is 1 byte longer, the assembler doesn't use that form. Here is the list for reference:
89 44 20 FC mov [eax-0x4],eax
89 44 21 FC mov [ecx-0x4],eax
89 44 22 FC mov [edx-0x4],eax
89 44 23 FC mov [ebx-0x4],eax
89 44 24 FC mov [esp-0x4],eax
89 44 25 FC mov [ebp-0x4],eax
89 44 26 FC mov [esi-0x4],eax
89 44 27 FC mov [edi-0x4],eax
This, by itself, shouldn't cause your crash, but randomly trying to overwrite stuff in memory may.