Lab7: Computer Architecture Exploitation and Security The ARM Instruction Set and Cross-Compilation Objectives This lab focuses on the following objectives: · Describe registers. · Explain ALU...

1 answer below »
Assignment questions in the word document. Need a raspberry pi as well. Please ensure for part 1, if you can screenshot the calculations and for part 2... screenshot every step for each question including the installation. Thank you.



Lab7: Computer Architecture Exploitation and Security The ARM Instruction Set and Cross-Compilation Objectives This lab focuses on the following objectives: · Describe registers. · Explain ALU functionality. · Describe processor control registers. · Cross-compilation Background Reading · ARM Instruction Reference · https://developer.arm.com/documentation/dui0068/b/arm-instruction-reference · https://developer.arm.com/documentation/100067/0612/armclang-Integrated-Assembler/Data-definition-directives · https://developer.arm.com/documentation/100067/0612/armclang-Integrated-Assembler/Alignment-directives · https://developer.arm.com/documentation/100067/0612/armclang-Integrated-Assembler/String-definition-directives · Emulator -qemu https://azeria-labs.com/emulate-raspberry-pi-with-qemu/ Problem 1 __23 Use the following arm instructions to perform the respective calculations and based on the results complete the tables. Reference for arithmetic and logical instructions and conditional Execution- CPSR https://developer.arm.com/documentation/dui0068/b/ARM-Instruction-Reference/ARM-general-data-processing-instructions?lang=en https://developer.arm.com/documentation/dui0068/b/Writing-ARM-and-Thumb-Assembly-Language/Conditional-execution?lang=en https://developer.arm.com/documentation/dui0068/b/ARM-Instruction-Reference/Conditional-execution?lang=en adds r0,r0,r1 Register or Memory Address Before After r0 0x12345678 r1 0x12345678 cpsr bits N,Z,C,V 0,0,0,0 subs r0,r0,r1 Register or Memory Address Before After r0 0x12345678 r1 0x12345679 cpsr bits N,Z,C,V 0,0,0,0 ands r0,r0,r1 Register or Memory Address Before After r0 0x1a2b3c4d r1 0x12345678 cpsr bits N,Z,C,V 0,0,0,0 orrs r0,r0,r1 Register or Memory Address Before After r0 0x1a2b3c4d r1 0x12345678 cpsr bits N,Z,C,V 0,0,0,0 eors r0,r0,r1 Register or Memory Address Before After r0 0x1a2b3c4d r1 0x12345678 cpsr bits N,Z,C,V 0,0,0,0 bic r0,r1,r2 Register or Memory Address Before After r0 0x1a2b3c4d r1 0x12345678 r2 0x02000240 cpsr bits N,Z,C,V 0,0,1,0 adc r0,r1,r2,lsl #3 Register or Memory Address Before After r0 0x1a2b3c4d r1 0x12345678 r2 0x02000240 cpsr bits N,Z,C,V 0,0,1,0 Problem 2 Cross-Compilation __10 Because of the limited size of memory provided on embedded systems, developers will normally create a cross-compilation environment. The idea behind cross-compilation is that you can: 1. Have the toolchain (development tools to create analyze and modify binary files) on a system with sufficient resources (CPU, RAM, Storage) to allow for rapid prototyping. 2. Transfer only the binary files to the embedded system to test. For this problem you will follow a simple workflow to create a binary on Kali or Ubuntu distro and then transfer that file to the raspberry pi when connected. 1. If the build and target platform are x86_64 and the host is the ARM platform (aarch64) on Ubuntu or Kali VM perform the following steps: a. Install the cross-compilation toolchain for ARM-64 sudo apt install gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu b. If your system does not have gcc and make then install sudo apt install gcc make gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu If the ARM platform is aarch32 and Raspberry pi OS 32-bit, on Ubuntu or Kali VM perform the following steps: a. Install the cross-compilation toolchain for ARM-32 sudo apt install gcc-arm-linux-gnueabi binutils-arm-linux-gnueabi b. If your system does not have gcc and make then install sudo apt install gcc make gcc-arm-linux-gnueabi binutils-arm-linux-gnueabi 2. Use one of the C programs created before with the following cross-compiler programs to build an ARM executable a. For 64-bit system use : aarch64-linux-gnu-gcc program.c –o program-arm b. For 32-bit system use arm-linux-gnueabi-gcc program.c –o program-arm 3. Use file command to verify file format: file program-arm and answer the following questions: i. What is the file type? ii. What the architecture? iii. What is LSB? 4. Can you execute program-arm in your Ubuntu or Kali (Intel Architecture) ? Why ? 5. Attach the screen that demo results after using file command with program-arm 6. ARM executables should be ready to run on ARM architecture (raspberry pi) 7. Boot raspberry pi 8. On Ubuntu or Kali ssh the raspberry pi using: ssh [email protected] (replace IP address with the respective IP of yur network). 9. If you ssh raspberry pi you can use scp to copy the executables you created in Ubuntu or Kali and copy them into raspberry pi as follows: scp program-arm [email protected]:/home/pi/ (replace the IP address with the respective IP in your network) 10. Verify on raspberry pi session (terminal ) if the file(s) were copied 11. On raspberry pi run the executable ./program-arm and attach screen capture of the results 12. If raspberry pi is configured and working, use nano to create the following ARM code and verify the previous results. Modify the code with the respective data and instructions Save it as oper.s and compile it as follows: as oper.s -o oper.o ld oper.o -o oper gdb ./oper
Answered 1 days AfterApr 13, 2022

Answer To: Lab7: Computer Architecture Exploitation and Security The ARM Instruction Set and Cross-Compilation...

Neetha answered on Apr 15 2022
84 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here