section .text global enter_section extern printf enter_section: enter 0, 0 ; 0 bytes of local stack space mov ebx,[ebp+8] ; first parameter to function spin: mov ecx, 0 lock bts dword [ebx], 0 jc save print: push busy call printf cmp ecx, 1 je spin save: mov ecx, 1 jmp print leave ; mov esp,ebp / pop ebp ret section .rodata busy: db "Busy waiting!",10,0