Question

Question1 At the beginning of a procedure in Assembly, right after it is called, which of...

Question1

  1. 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

  1. 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?

Homework Answers

Answer #1

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.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
;Assembly x86-64 ;Q9: What is the value of eax (in decimal) after the function call in...
;Assembly x86-64 ;Q9: What is the value of eax (in decimal) after the function call in _start returns? global _start _start: mov edi, 4 call function1 global function1 function1: push rdi inc edi mov esi, 2 call function2 pop rdi mul edi ret global function2 function2: mov eax, edi mov edx, 0 div esi add eax, edi add eax, edx ret ;Q10: A function uses 10 integer arguments. What is the appropriate value for the blank operand to clear the...
in assembly 1. Real mode allows access to memory below which memory address? 2. Under real...
in assembly 1. Real mode allows access to memory below which memory address? 2. Under real and protected mode, the far jump modifies the current instruction address by changing which register or registers? 3. Under real and protected mode, the near jump modifies the current instruction address by changing which register or registers? 4. Under real mode, briefly explain what happens when the PUSH BX instruction executes. Make sure to show where BH and BL are stored. Assume that initially...
QUESTION 1 Convert the following code fragment to assembly code fragment, using instructions discussed in class....
QUESTION 1 Convert the following code fragment to assembly code fragment, using instructions discussed in class. if X > Y then Y=X else X=Y 2 QUESTION Suppose a user wants to do a system call. Assume that the service routine of this system call is at physical address 500. Suppose the user knows this address of the service routine. So instead of executing a system call, the user simply jumps to this location 500 (by executing “JMP 500”). Assume that...
Write a sequence of two instructions that copies bits 0-5 from AL to bits 0-5 in...
Write a sequence of two instructions that copies bits 0-5 from AL to bits 0-5 in BL. Bits 6-7 in BL should be cleared, and AL should be unchanged             Mov al, bl       And 00111111, bl       Write a sequence of two instructions that copies the integer in bits 4-7 from AL register into bits 0-3 of the BL register. Upper 4 bits of AL and BL will be cleared             Shr al, 4       Mov bl,...
7. (True/False): Nested procedure calls are not permitted by the Microsoft assembler unless the NESTED operator...
7. (True/False): Nested procedure calls are not permitted by the Microsoft assembler unless the NESTED operator is used in the procedure definition. 15. What will be the final value in EAX after these instructions execute? push 5 push 6 pop eax pop eax 3. Which instruction pops the stack into the EFLAGS register? 17. Which statement is true about what will happen when the example code runs? 1: main PROC 2: mov eax,30 3: push eax 4: push 40 5:...
Can i get the answer to these questions in detail explaining how you go to the...
Can i get the answer to these questions in detail explaining how you go to the solution 1.Convert to/from Hex (0) 2.Octal Binary Unsigned/ 2’s complement 3.Understand how to shift and rotate. 4.Understand the relationship between shifting and multiplication/division 5.Be able to recognize and use the following gates: AND OR NOT NAND NOR XOR 6.Understand how a half adder works Given a logical statement ((A OR B) AND NOT(C OR A)) show the gates. 7.What is the difference between an...
In which order the following ‘arguments’ of the foo() function will be put on the stack...
In which order the following ‘arguments’ of the foo() function will be put on the stack (the left-most variable has the highest memory address and the right-most variable has the lowest memory address)? void foo(int d, int s, string x, int e) d, s, x, e. e, x, s, d. x, d, s, e. d, s, e, x. To execute an external command from inside a program, either of the ‘system()’ or ‘execve()’ functions can be used. Select ALL of...
III. After execution of the following instructions what value will be in register r0? LDR                ...
III. After execution of the following instructions what value will be in register r0? LDR                 r12, =0xA4000000 LDR                 r0, =0x75 LDR                 r1, =0xD2 LDR                 r2, =0x9C LDR                 r5, =0xC STMDB           r12!, {r0-r2, r5} LDR                 r0, [r12, #8] SUB                 r0, #0x77 IV. Assume that the variables f, g, h, i, and j are assigned to registers r0, r1, r2, r3, and r4, respectively. Assume that the base address of the arrays A and...
[5 pts] An element with no closing tag is called which of the following? an attribute...
[5 pts] An element with no closing tag is called which of the following? an attribute an empty element a Socratic element a hermit element [5 pts] <a href="#info">Click Here</a> The above HTML is an example of which of the following? An external link An internal link An anonymous function A source attribute [5 pts] Which of the following should be primarily responsible for the design and formatting of a Web page? CSS HTML JavaScript XML [5 pts]   The following:...
read Seasons of Love chapter:measuring a child's life after suicide. please answer the questions : reflect...
read Seasons of Love chapter:measuring a child's life after suicide. please answer the questions : reflect on what happens to the families when there is a suicide in the family, based on the Seasons of Love chapter...how should people be told? What details are best left unshared? below is the story These theories may have a certain face-validity, but they often neglect environmental or contextual factors that are innate to answering the question of “why” a person might engage in...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT