Assembly Chapters 5 and 8 Flashcards

1
Q

5.1 How does the PUSH instruction work?

A

first decrements ESP and then copies a source operand into the stack. A 16 bit operand causes ESP to be decremented by 2. A 32-bit operand causes ESP to be decremented by 4.

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

5.1 What are the instruction formats for PUSH

A

PUSH reg/mem16
PUSH reg/mem32
PUSH imm32

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

How does the POP instruction work?

A

first copies the contents of the stack element pointed to by ESP into a 16 or 32 bit destination operand and then increments ESP.

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

What are the instruction formats of POP?

A

POP reg/mem16

POP reg/mem32

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

What is PUSHFD?

A

instruction that pushes the 32-bit EFLAGS register on the stack

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

What POPFD?

A

pops the stack into EFLAGS

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

MOV instruction can be used to copy the flags to a variable. True or False?

A

False. use PUSHFD

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

What is PUSHAD?

A

pushes all of the 32 bit general purpose registers on the stack in the following order: EAX, ECX, EDX, EBX, ESP EBP, ESI & EDI

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

What is going on in the following lines of code?

MySub PROC
   pushad
   mov eax, ...
   mov edx,...
   mov ecx,...
   popad
   ret
MySub ENDP
A

saving the 32 bit general purpose registers by pushing them on stack and then modifying them and then restoring values before call ret

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

What is RET

A

forces program to return to location where it was before procedure was called

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

How does the CALL instruction work?

A

pushes its return address on the stack and copies the called procedure’s address into the instruction pointer

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

How much memory does a CALL statement use?

A

5 bytes

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

8.2 What is the stack frame?

A

AKA activation record, the area of the stack set aside for passed arguments, subroutine return address, local variables, and saved registers.

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

What is a prologue and epilogue?

A

statements that save EBP register and point EBP to the top of the stack. The Epilogue is statements that restore the EBP register and calls the RET

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