Lecture 04 Flashcards

1
Q

In x86 AT&T syntax, the main memory addressing mode is:
disp (%reg1, %reg2, scale)

What is disp?

A

disp - Displacement. A constant integer. This is also known as the offset

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In x86 AT&T syntax, the main memory addressing mode is:
disp (%reg1, %reg2, scale)

What is reg1?

A

The base register of the operand

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In x86 AT&T syntax, the main memory addressing mode is:
disp (%reg1, %reg2, scale)

What is reg2?

A

The index register of the operand

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In x86 AT&T syntax, the main memory addressing mode is:
disp (%reg1, %reg2, scale)

What is scale?

A

1,2,4 or 8.

This is what the index is multiplied by.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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?

A

address = (reg1) + (scale) * (reg2) + disp

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

in x86 AT&T syntax, you may omit the displacement, scale, and reg2 when accessing a memory address:
(%reg1)
Which accessing mode is this?

A

Indirect mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

in x86 AT&T syntax, you may omit the scale, reg1, and reg2 when accessing a memory address:
disp
Which accessing mode is this?

A

Direct mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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

$

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

A line of assembler ending with a colon is what?

A

A label.

These are used as names for places in the program, for example for jumps.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

In AT&T syntax, does the destination of an operation come first, or last?

A

Last.

For example, ‘movq reg1, reg2’ would be read ‘Copy reg1 to reg2’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In C calling conventions for x86-64, how many arguments are stored in registers (Assuming each argument fits within 64 bits)?

A

6.

The registers rdi, rsi, rdx, rcx, r8, and r9.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

In C calling conventions for x86-64, where do additional arguments go that cannot fit in the registers?

A

On the stack.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

In C calling conventions for x86-64, are registers rbp, rbx, and r12-15 callee safe or caller safe?

A

Callee safe.

They must be returned to their previous values by the caller before the function returns.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In C calling conventions for x86-64, which register is used to hold the first 64 bits of a return value?

A

rax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

In C calling conventions for x86-64, which register is used to hold the second 64 bits of a 128 bit return value?

A

rdx

How well did you know this?
1
Not at all
2
3
4
5
Perfectly