1) __declspec(naked) is a directiv for the VS compiler. it tells the compiler to generate a function entrypoint but NOT provide it with the normal entry/exit code (setting up a stack frame, saving registers, cleaning up the stack frame and doign a return.
if your target compiler doesn't understand this, then it is very much possible that things will not quite work right. And it might not be immediately obvious from running the code that it doesn't work right.
gcc seems to not know the directive. assuming... this code wasn't designed for Gcc (inline assembly tends to not mix well on compilers other than what it was designed for).
2) gcc seems to expect an explicit C/C++ "return" clause. the asm code doesn't make a need (or non-need) for this obvious to the compiler hence the warning.
It looks alright, return is in eax, and eax is set to "something" whether it's correct is another matter
This may or may not work when compiling on another compiler than VS. The fact you're accessing explicit addresses relative to FS mean all bets are off.
Bookmarks