Question1
At the beginning of a procedure in Assembly, right after it is called, which of the following will work to put the value of the 7th argument into %rax?
movq (%rsp), %rax |
||
movq 8(%rsp), %rax |
||
leaq (%rsp), %rax |
||
leaq 8(%rsp), %rax |
Question2
Given the following code:
question2
Address: Instruction 400510: mov %rsp,%rdi
400513: callq 4004cd <sum>
400518: add $0x28,%rsp
When the callq instruction executes, what value will be pushed on to the Stack by call?
Question3
Given this following code:
Address: Instruction
4004ed: sub $0x20,%rsp
4004f1: movq $0x1,(%rsp)
4004f9: movq $0x2,0x8(%rsp)
400502: movq $0x3,0x10(%rsp)
40050a: movq $0x4,0x18(%rsp)
Assume that %rsp is 0x1040 (the stack top is at address 0x1040).
1) After executing the code on address 4004ed, what will the new value of %rsp be?
2) After executing the code on address 4004f1, what address will the value 1 go in to?
3) After executing the code on address 40050a, what address will the value 4 go in to?
Question 1:
We can push the value of 7th argument into %rax by making use of the option C.) movq 8(%rsp), %rax because of the fact the indicating 8 after the movq instruction and before the %rsp to indicating we are referring to the 7th argument and we need to move that argument into %rax , 8 before the %rsp means that we want to reder to the data at the rsp+8 , similarly we can access other values by indicating the value in multiple of 8 like 16 inidcates the rsp+16 and 32 indicates rsp+32.
Get Answers For Free
Most questions answered within 1 hours.