Jump to content
  • Advertisement
Sign in to follow this  
Catafriggm

Need to Learn x86-64 Assembly

This topic is 4853 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
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
just put
and esp, 0xfffffff0

in your code after you put your stack address in esp (something to do with efficiency). Is this not the same as in x86-32?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!