x86 64 - Why is the %rax register used in the assembly for this . . . @RossRidge given %rax is the go-to register for storing return values, seeing it used in another way is surprising to me It means that reading the disassembled code requires us to mentally map %rax not to the return value, but to just another scratch reg
What does the R stand for in RAX, RBX, RCX, RDX, RSI, RDI, RBP, RSP? • RDX:RAX register pair representing a 128-bit operand See the question and answer for x86_64 registers rax eax ax al overwriting full register contents as well as Why do most x64 instructions zero the upper part of a 32 bit register which provide some explanation about how the 64 bit register operation differ from the 32 bit register operation
assembly - How is rax different from eax? - Stack Overflow The registers starting with r as in rax, rbx, etc, are the 64-bit registers introduced with the AMD64 extension to the existing 32-bit x86 ISA That ISA extension was subsequently adopted by Intel and is often known by the more neutral name x86-64 Essentially all x86 chips released in the last decade from AMD and Intel support this ISA Registers like eax, ebx, etc are the 32-bit registers
What is the difference between mov (%rax),%eax and mov %rax,%eax? In AT T syntax, the instruction: mov (%rax), %eax # AT T syntax or, equivalently in Intel syntax: mov eax, DWORD PTR [rax] ; Intel syntax dereferences the memory address stored in rax, reads a 32-bit value from that memory address, and stores it in the eax register Because the memory address being dereferenced is stored in rax, it can be a 64-bit address, which is necessary when running on a
x86_64 registers rax eax ax al overwriting full register contents As it is widely advertised, modern x86_64 processors have 64-bit registers that can be used in backward-compatible fashion as 32-bit registers, 16-bit registers and even 8-bit registers, for exampl
Assembly registers in 64-bit architecture - Stack Overflow Following the answer about assembly registers' sizes: First, what sizes are eax, ax, ah and their counterparts, in the 64-bit architecture? How to access a single register's byte and how to access
assembly - What does callq * (%rax) mean? - Stack Overflow Thus (%rax) means to get the value of the pointer currently stored in %rax What does the star decoration do on that? Does that further dereference that value (thus (%rax) is itself a pointer)? I'm having trouble googling * ( assembly syntax This is x64 assembly generated from GCC 4 8 compiling C++ code
c - Why am i adding rax and rdx? - Stack Overflow I don't understand the confusion You know that rdx+1 is the address of argv [1] [1], and you know that rax contains i, so it should be clear that rdx+rax is the address of argv [1] [i] The next statement movszx eax, byte ptr [rax] loads the character at that address
How do I write the value in RAX to STDOUT in assembly? You have to convert it to text first You can go the easy route and use e g printf from libc or, if you're so inclined, write your own conversion utility Update: If you want the code to be position independent it's easier to use the stack Simply moving the buffer into the code segment as the code you linked to in the comments doesn't work anymore since modern processors have code segments