Question: Consider the assembly language function below. I have added some comments to help you understand the code. (gdb) disas p4 Dump of assembler code for
Consider the assembly language function below. I have added some comments to help you understand the code.
(gdb) disas p4
Dump of assembler code for function p4:
0x4005c0 <+0>: movzbl (%rdi),%edx
0x4005c3 <+3>: test %dl,%dl # %dl is the least significant bype of %rdx
0x4005c5 <+5>: je 0x4005e9
0x4005c7 <+7>: add $0x1,%rdi
0x4005cb <+11>: xor %eax,%eax
0x4005cd <+13>: nopl (%rax) # nopl ("no-op") does nothing and is for alignment
0x4005d0 <+16>: cmp %sil,%dl # %sil is the least significant byte of %rsi
0x4005d3 <+19>: sete %dl
0x4005d6 <+22>: add $0x1,%rdi
0x4005da <+26>: movzbl %dl,%edx
0x4005dd <+29>: add %edx,%eax
0x4005df <+31>: movzbl -0x1(%rdi),%edx
0x4005e3 <+35>: test %dl,%dl
0x4005e5 <+37>: jne 0x4005d0
0x4005e7 <+39>: retq
0x4005e9 <+41>: xor %eax,%eax
0x4005eb <+43>: retq
A. (1 point)The first parameter of p4 is an array. What type of data does the array contain? Explain your answer.
C. (1 point) What type of data is passed as the second parameter of p4? Explain.
D. (1 point) If a function is passed a third parameter, it is placed in register %rdx..
Note that %rdx (!%dl!) is used in line
E. (1 point) What type of data (if any) does the function return?
F. (1 point) In 25 words or less, describe in English what p4 does.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
