I'm new to assembly. I want to call two or more functions but not lose or push anything into stack. I used jmp but this one is ignoring next lines in code and leaves current function. So is it possible to do this? (Additional information: I have many functions and want to hook them (Create (pre/original/post) function). I don't want to make hook separately (this will take huge space, i want one universal), so i have created naked functions for all of them which will store some information in variables for incoming function and them will jump into universal function (naked too + assembly code), this will loop Pre hooks and calls them, then will call original... But issue is that 'call' is not the case and jmp function is just ignoring next code)
答案 0 :(得分:0)
You've found both options. The behavior is completely determined by this question:
Do you save a return address?
If the answer is yes, you have behavior like call, and stuff gets pushed onto the stack (at least a return address).
If the answer is no, you don't return to the calling function, so the rest of it gets skipped (like jmp
).
The Law of the Excluded Middle says there are no other options.
A possible way to get around this, is to save the return address (coming back to your trampoline) right on top of the original return address (saving that somewhere else, thread-local storage perhaps). That way you maintain the stack layout needed by the function you are forwarding to. Part of your post-hook then needs to put the original return address back.