MASM code:
.model flat, stdcall
option prologue:none
option epilogue:none
.code
lockc proc value : dword
mov ecx, [esp+04h]
_loop:
lock bts [ecx], 0
pause
jc _loop
ret
lockc endp
end
C code:
typedef struct { DWORD l; }lck_t;
extern DWORD __stdcall lockc(lck_t* l);
ignore any typos that may have happened, i copied by hand. the code compiles fine but i keep getting the ESP error thing.
i call the function from 2 threads and it always shows me the error after the first execution, but i cannot see why that would be.