Im confused about when I should be saving and restoring registers with inline asm.
I have a Function_1 which changes the esi, edi, ecx and ebx registers with inline asm operations. In the middle of that function, I make a call to another Function_2 which also changes several of those same registers.
I compiled two versions of the code, when where I push all the registers prior to making the Function_2 call and the caller pops the variables back on the return. This works. But so does the 2nd compiled version where I just comment out all the pushes and pops. That implies that im just saving extra copies on the stack and that somewhere along the line PB is pushing and popping those registers as well?
So is the only time I want to push and pop is within the same procedure/function when i want to temporarily store a register for use later within that same procedure/function?
Thanks
-Mike
I have a Function_1 which changes the esi, edi, ecx and ebx registers with inline asm operations. In the middle of that function, I make a call to another Function_2 which also changes several of those same registers.
I compiled two versions of the code, when where I push all the registers prior to making the Function_2 call and the caller pops the variables back on the return. This works. But so does the 2nd compiled version where I just comment out all the pushes and pops. That implies that im just saving extra copies on the stack and that somewhere along the line PB is pushing and popping those registers as well?
So is the only time I want to push and pop is within the same procedure/function when i want to temporarily store a register for use later within that same procedure/function?
Thanks
-Mike
Comment