1,885
edits
Changes
→Group Lab Tasks
{{Admon/tip|Shortcut|To save lab time '''your group can decide''' to do steps 1-4 as individual homework after the lab.}}
1. Build Review, build, and run the three C versions of the program for x86_64assembly language programs. Take a look at the differences in code using <code>objdump -d '''objectfile'''</code> and compare it to the source code. Notice the absence of other code (compared to the C binary, which had a lot of extra code).
2. Use Build and run the <code>objdump -d</code> command to dump (print) three C versions of the program for aarch64. Verify that you can disassemble the object code (machine code) and disassemble it into assembler for each of the binaries. Find in the ELF binary using <code><nowiki><main></nowiki>objdump -d '''objectfile'''</code> section and take a look at the code. Notice the total amount of code.
3. Review, build, and run the x86_64 aarch64 assembly language programs. Take a look at the code using <code>objdump -d '''objectfile'''</code> and compare it to the source code. Notice the absence of other code (compared to the C binary, which had a lot of extra code).
4. Build and run the three C versions of the program for aarch64. Verify that you can disassemble the object code in the ELF binary using <code>objdump -d '''objectfile'''</code> and take a look at the code. 5. Review, build, and run the aarch64 assembly language programs. Take a look at the code using <code>objdump -d '''objectfile'''</code> and compare it to the source code. 6. Here is a basic loop in AArch64 assembler - this loops from 0 to 9, using r19 as the index (loop control) counter:
.text
{{Admon/tip|Character conversion|In order to print the loop index value, you will need to convert from an integer to digit character. In ASCII/ISO-8859-1/Unicode UTF-8, the digit characters are in the range 48-57 (0x30-0x39). You will also need to assemble the message to be printed for each line - you can do this by writing the digit into the message buffer before outputting it to stdout, which is probably the best approach, or you can perform a sequence of writes for the thee parts of the message ('Loop: ', number, '\n'). You may want to refer to the manpage for <code>ascii</code>.}}
For reference, here is the loop code in x86_64 assembler:
syscall
{{Admon/tip|2-Digit Conversion|You will need to take the loop index and convert it to a 2-digit decimal number by dividing by 10. To do this, use the <code>div</code> instruction, which takes the dividend from rax and the divisor from register supplied as an argument. The quotient will be placed in rax and the remainder will be placed in rdx.}}
=== Deliverables ===