hengck23
asked on
how to implement __fastcall for __declspec(naked) function?
Dear all,
I have just finished coding my __declspec(naked) function.
I want to pass variables through the registers. What are the important things i must take note?
__declspec(naked) void function( ...){
}
void someCallingFunction(...){
...
//what must i do here?
function(...);
//what must i do here?
...
}
I have just finished coding my __declspec(naked) function.
I want to pass variables through the registers. What are the important things i must take note?
__declspec(naked) void function( ...){
}
void someCallingFunction(...){
...
//what must i do here?
function(...);
//what must i do here?
...
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You may find not a lot of speed increase.. If the top-level language is C or C++, then on some level it is likely the compiler has to generate code to save and restore the registers. If you've pushed that overhead out of a loop, that's good. But it's also possible to confuse the C compiler's optimizer this way-- this can lead to overall SLOWER code. Try it both ways and see.
Just don't use the registers which have been reserved for other purposes.
1. ebp, esp, ---> reserved for stack manipulation, don't pass your variables through these register
2. eax --->usually used as return value, but here I think you still can use it to pass your variables