Week 5 Flashcards
How would you find the hexadecimal address of the last item in the following array?
.data
0x44 history WORD 100 DUP(?)
The array effectively spans from 0-198 bytes. So add 0x44 + 198d = 0x10A
What hexadecimal value does EIP hold immediately after “inc EAX” has executed?
0x26 inc EAX
0x2B mov EBX, z
0x30 xor EAX, EBX
0x2B
The following instruction will increment the stack pointer (ESP) by how many bytes?
ret 8
12
The following instruction will increment the stack pointer (ESP) by how many bytes?
ret 2
6
If you reference a point beyond the end of an array i.e. the 101st element of a 100-element array, what happens?
You access whatever data bytes are stored there.
Given the following register states, and using Register Indirect Addressing, how would you move the 11th element of the list array (of DWORDs) to the EAX register?
EDX = the address of list[0]
ESI = address of list[10]
EBX = 40
mov eax, [esi]
Given the following register states, and using Base Indexed Addressing, how would you move the 11th element of the list array (of DWORDs) to the EAX register?
EDX = the address of list[0]
ESI = address of list[10]
EBX = 40
mov eax, [edx + ebx]
Given the following register states, and using Indexed Addressing, how would you move the 11th element of the list array (of DWORDs) to the EAX register?
EDX = the address of list[0]
ESI = address of list[10]
EBX = 40
mov eax, list [ebx]
Given list, an array of WORDs, what element is addressed by list[7]?
4th element
The RET instruction (without operands) will pop how many bytes off the stack?
4
The following two instructions are equivalent:
ret
ret 4
False, the second instruction pops an additional 4 bytes off the stack.
When passing procedure parameters on the stack, why are the following lines of code often necessary?
push ebp
mov ebb, esp
To keep additional usage of the stack within the procedure from invalidating the stack offsets.
Register indirect addressing is defined as?
Indexed Addressing is defined as?
Base Indexed Addressing is defined as?
Register indirect addressing is accessing memory through an address stored in a register. mov esi, OFFSET list mov eax, [esi] add esi, 4 mov eax, [esi]
Indexed addressing is adding a constant to a register to generate an effective address.
mov esi, 0
mov eax, list[esi] ; or [list + esi]
Base Indexed Addressing is accessing lists through the base pointer in procedures.
mov esi, [ebp + 12] ; @list
mov edx, 0
mov eax, [esi + edx] ; gets curr element
What is SIZEOF myChecker (in decimal)?
.data
myChecker BYTE 12h
BYTE 34h
BYTE 56h
SIZEOF = 1
How do you obtain the value of the SIZEOF operator?
Multiply the number of elements in a data declaration by the size in bytes.