pushf //couldnt store this in other registers
movd xmm0,eax//storing in xmm registers instead of pushing
movd xmm1,ebx//
movd xmm2,ecx//
movd xmm3,edx//
movd xmm4,edi//end of push backups
.
.//doing work
.
movd edi,xmm4//pop edi
movd edx,xmm3//pop edx
movd ecx,xmm2//pop ecx
movd ebx,xmm1//pop ebx
movd eax,xmm0//pop eax
popf
is %50 faster than push eax version in my computer. Is this safe?
Yes, as long as you (or some code you're calling) doesn't use XMM regs for anything else in the meantime. In fact, this trick is commonly used in BIOS code before RAM init.