Printf Assembly Language Stack pointer nasm intel -


Setup: Nasm Intel 64bit Ubuntu I'm getting a split error when I include the printf line without compiling it and running OK.

Is printing on the stack pointer printed? When printf is called here, will the DD2 be on the stack pointer?

I suppressed the last two items for stack returns in their initial position.

All help appreciated, a great evening!

  section. Data DD: DB1DD2: DB "% d" Extinty print section .text global main menu: push DD push DD2 call printf pop racks; Pop rbx; The calling conference for 64-bit is very different, with whatever you use 32 bit.  

Scroll down to x86-64 It will tell you that the first 6 parameters have been passed in the registers: the first in RDI, the second in RSI, the 3 in the RDX , Fourth rcx, 5th r8, 6th r 9, and more and they have passed on stack; Floating point parameters are provided in XMM0. 7

Then, you must have a printf:

  mov rsi, ddv mov rdi, dd2 mov rack, 0 call printf   

Because we do not give anything in XMM Reg, we set Rock to 0 (without it it can crash)

I should also note that the stack should be aligned by 16 bytes, Then when your program starts and you link to the c library. But, since the call stack (return address) puts an 8 byte value, stack is not a coalition. At the beginning of your work (main in your case), just make a sub-RSP, 8 and he will take care of it.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -