Assembly Part 1 Flashcards

1
Q

The format and behavior of a machine level program is defined by the ________, defining the processor state, the format of the instructions, and the effect these instructions have on the state.

A

Instruction set architecture

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

The ______ (commonly referred to as the PC and called %rip) indicate the address of the next instruction to be executed

A

Program counter

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

The integer _____ contains 16 name location storing 64-bit values. These registers can hold _____ (corresponding to C pointers) or _____ data

A

Register file, addresses, integer

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

The ____ hold status information about the most recently executed arithmetic or logical instruction. These are used to implement conditional changes in control or data flow such as is required to implement if and while statements

A

Condition code registers

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

Assembly code suffix for char (1 byte)

A

B

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

Assembly code suffix for short (2 bytes)

A

W

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

Assembly code suffix for int

A

L

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

Assembly code suffix for long

A

Q

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

Assembly code suffix for char *

A

Q

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

Assmebly code suffix for float

A

S

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

Assembly code suffix for double (8 bytes)

A

L

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

An x86-64 central processing unit (CPU) contains a set of ____ general purpose registers storing ____ bit values

A

16, 64

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

All of the x86 register we can use expect ____ and ____

A

Rsp and rbp

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

Rsp and rbp are _____ registers and should not be used for any other purpose

A

Stack management

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

Rsp is the address of the _____ of the stack (it points to the last value pushed on the stack)

A

Top

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

Rbp is a frame pointer: it points to the _____ of the stack frame of the function which is currently executing

A

Bottom

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

The ____ instruction copies a value from one location (operant 1) to another location (operand 2)

A

Mov

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

The instruction _____, the size of operand 1 and the size of operand 2 must all match

A

Suffix

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

______: constant integer data. Prefixed with _____

A

Immediate, $

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

_______: one of the 16 integer ____

A

Register, registers

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

____: 8 consecutive bytes of memory at address given by register. ____ means read from the address specified in register. (I.e, use value in register as pointer)

A

Memory, parentheses

(%rax)

22
Q

Memory addressing mode 1

Mem[Reg[R]]

Movq(%rcx), %rax =

A

Register R specifies a memory address

Rax = *rcx

23
Q

Memory Addressing mode 2

Imm(R) =
Movq 8(%rbp), %rdx =

A

Mem[Imm+Reg[R]]
Rdx = *(rbp+8)

24
Q

What is size of memory address of coelinux

25
Q

What is the only suffix we should be using when we are calculating/ moving addresses

26
Q

What size register should be use when we are calculating addresses

A

Rax, rax, red, rdx, r12, etc

27
Q

Is this valid instruction

Movq (%ecx), %eax

A

No, must use rcx not ecx because we are accessing the value at the memory address stored in rcx

28
Q

Is this instruction valid
Movb (%rax), %al

29
Q

Imm(Rb, Ri, S)

A

Mem[Imm + Reg[Rb] + Reg[Ri]*S]

30
Q

Immediate

A

Can be an constant value (constant displacement)

31
Q

Rb

A

Base register, can be any of the 16 registers

32
Q

Ri

A

Index register

33
Q

Ri can be any of the register except ____

34
Q

S

A

Scale, can only be 1,2,4,8

35
Q

%rdx contains start address of array (0x600400)
%rcx contains index into ar1 (e.g 15)

What if we want to access arr1[15]

A

Movl (%rdx,%rcx,4), %eax

36
Q

(Rb,Ri)

A

Mem[Reg[Rb] + Reg[Ri]]

37
Q

Imm(Rb,Ri)

A

Mem[Reg[Rb] + Reg[Ri] + Imm]

38
Q

(Rb, Ri, S)

A

Mem[Reg[Rb] + s*Reg[Ri]]

39
Q

Imm(,Ri,S)

A

Mem[Imm + Reg[Ri]*S]

40
Q

Imm

41
Q

Suffix and ______ register size must match (on a read from memory). Address calculations are always 8 bytes

A

Destination

42
Q

Suffix and ______ register size (on a write to memory) must match. Address calculations are always 8 bytes

43
Q

Address computation instruction

A

Leaq src, dst

44
Q

Leaq computes address without ______

A

Memory reference

45
Q

Leaq does not affect ______

A

Condition codes

46
Q

Interpret Leaq 24(%rax, %rcx, 4), %rdx

A

Compute a 8-byte value: (%rax + 4*%rcx + 24) and store in %rdx

48
Q

Is this valid

Leal 24(%eax, %ecx, 4), %edx

49
Q

Only ___ and ___ suffix work with lea instruction in x86-64