Lecture 04 Flashcards
In x86 AT&T syntax, the main memory addressing mode is:
disp (%reg1, %reg2, scale)
What is disp?
disp - Displacement. A constant integer. This is also known as the offset
In x86 AT&T syntax, the main memory addressing mode is:
disp (%reg1, %reg2, scale)
What is reg1?
The base register of the operand
In x86 AT&T syntax, the main memory addressing mode is:
disp (%reg1, %reg2, scale)
What is reg2?
The index register of the operand
In x86 AT&T syntax, the main memory addressing mode is:
disp (%reg1, %reg2, scale)
What is scale?
1,2,4 or 8.
This is what the index is multiplied by.
In x86 AT&T syntax, the main memory addressing mode is:
disp (%reg1, %reg2, scale)
How are these values combined to calculate the memory address?
address = (reg1) + (scale) * (reg2) + disp
in x86 AT&T syntax, you may omit the displacement, scale, and reg2 when accessing a memory address:
(%reg1)
Which accessing mode is this?
Indirect mode
in x86 AT&T syntax, you may omit the scale, reg1, and reg2 when accessing a memory address:
disp
Which accessing mode is this?
Direct mode
If you wished to use the number 7 as an operand in a line of AT&T x86 assembler, which character would need to precede it?
$
A line of assembler ending with a colon is what?
A label.
These are used as names for places in the program, for example for jumps.
In AT&T syntax, does the destination of an operation come first, or last?
Last.
For example, ‘movq reg1, reg2’ would be read ‘Copy reg1 to reg2’
In C calling conventions for x86-64, how many arguments are stored in registers (Assuming each argument fits within 64 bits)?
6.
The registers rdi, rsi, rdx, rcx, r8, and r9.
In C calling conventions for x86-64, where do additional arguments go that cannot fit in the registers?
On the stack.
In C calling conventions for x86-64, are registers rbp, rbx, and r12-15 callee safe or caller safe?
Callee safe.
They must be returned to their previous values by the caller before the function returns.
In C calling conventions for x86-64, which register is used to hold the first 64 bits of a return value?
rax
In C calling conventions for x86-64, which register is used to hold the second 64 bits of a 128 bit return value?
rdx