Sign in to follow this  
Catafriggm

Need to Learn x86-64 Assembly

Recommended Posts

Catafriggm    296
Well, more accurately, I need a couple pieces of information in particular. I've got the AMD manuals right next to me, and I already know x86-32 assembly. What I need to know are these: 1. How are C-declared function names decorated using the x86-64 calling convention (I found a reference that lists the parameter passing conventions, return conventions, and register preservation requirements, but it doesn't mention the name decoration)? 2. What is this about keeping the stack aligned to 16 bytes? I've seen it mentioned in a couple of places, but I couldn't manage to figure out exactly what was required (it really confuses me when they talk about leaf and nonleaf functions, because shouldn't stack alignment by definition apply to all functions?)?

Share this post


Link to post
Share on other sites
Nemesis2k2    1045
Quote:
1. How are C-declared function names decorated using the x86-64 calling convention (I found a reference that lists the parameter passing conventions, return conventions, and register preservation requirements, but it doesn't mention the name decoration)?

Regular C doesn't decorate function names. The name of the function is the name of the function, and that's it; no return type or parameter information. C++ has name decoration, but I believe that's compiler-specific (which is one reason why people generally use undecorated C function names when exporting functions).

Share this post


Link to post
Share on other sites
hplus0603    11356
Actually, the decoration of function names is dependent on the tool chain (compiler/linker). You have to go look at the tools you're using (GCC? Proton?) to get this information.

As an example, K&R style C compilers used to always decorate functions with a leading underscore.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this