Home / Expert Answers / Computer Science / you-must-fill-the-c-programming-code-in-the-following-format-below-this-problem-will-gi-pa613

(Solved): You must fill the C programming code in the following format below: This problem will gi ...



This problem will give you a chance to reverse engineer a switch statement from disassembled machine code. In the following p

16 movq (\%rsi), \%rax
17 ret
18. L7: MODE_D
19 movq (\%rsi), \%rax
20 movq \%rax, (\%rdi)
21 movl \( \$ 27 \), \%eax
23. ret

You must fill the C programming code in the following format below:

This problem will give you a chance to reverse engineer a switch statement from disassembled machine code. In the following procedure, the body of the switch statement has been omitted: p1 in \%rdi, p2 in \%rsi, action in \%edx 1 .L8: MODE_E 2 movl 3 ret 4 .L3: MODE_A 5 movq (\%rsi), \%rax 6 movq (\%rdi), \%rdx 7 movq \%rdx, (\%rsi) 8 ret 9 .L5: MODE_B 10 movq (\%rdi), \%rax 11 addq (\%rsi), \%rax 12 movq \%rax, (\%rdi) 13 ret 14. L6: MODE_C 15 movq 16 movq (\%rsi), \%rax 17 ret 18. L7: MODE_D 19 movq (\%rsi), \%rax 20 movq \%rax, (\%rdi) 21 movl , \%eax 23. ret default 24 movl , \%eax 25 ret Figure 3.52 Assembly code for Problem 3.62. This code implements the different branches of a switch statement. Figure 3.53 shows the disassembled machine code for the procedure. The jump table resides in a different area of memory. We can see from the indirect jump on line 5 that the jump table begins at address . Using the GDB debugger, we can examine the six 8-byte words of memory comprising the jump table with the command . GDB prints the following: Fill in the body of the switch statement with code that will have the same behavior as the machine code.


We have an Answer from Expert

View Expert Answer

Expert Answer


This problem will give you a chance to reverse engineer a switch statement from disassembled machine code. In the following procedure, the body of the
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe