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 »

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
arm-instruction-reference
· https:
developer.arm.com/documentation/100067/0612/armclang-Integrated-Assemble
Data-definition-directives
· https:
developer.arm.com/documentation/100067/0612/armclang-Integrated-Assemble
Alignment-directives
· https:
developer.arm.com/documentation/100067/0612/armclang-Integrated-Assemble
String-definition-directives
· Emulator -qemu XXXXXXXXXXhttps:
azeria-labs.com/emulate-raspbe
y-pi-with-qemu
Problem 1 XXXXXXXXXX__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
ARM-Instruction-Reference/ARM-general-data-processing-instructions?lang=en
https:
developer.arm.com/documentation/dui0068
Writing-ARM-and-Thumb-Assembly-Language/Conditional-execution?lang=en
https:
developer.arm.com/documentation/dui0068
ARM-Instruction-Reference/Conditional-execution?lang=en
adds r0,r0,r1
    Register or Memory Address
    Before
    Afte
    r0
    0x XXXXXXXXXX
    
    r1
    0x XXXXXXXXXX
    
    cpsr bits N,Z,C,V
    0,0,0,0
    
subs r0,r0,r1
    Register or Memory Address
    Before
    Afte
    r0
    0x XXXXXXXXXX
    
    r1
    0x XXXXXXXXXX
    
    cpsr bits N,Z,C,V
    0,0,0,0
    
ands r0,r0,r1
    Register or Memory Address
    Before
    Afte
    r0
    0x1a2b3c4d
    
    r1
    0x XXXXXXXXXX
    
    cpsr bits N,Z,C,V
    0,0,0,0
    
o
s r0,r0,r1
    Register or Memory Address
    Before
    Afte
    r0
    0x1a2b3c4d
    
    r1
    0x XXXXXXXXXX
    
    cpsr bits N,Z,C,V
    0,0,0,0
    
eors r0,r0,r1
    Register or Memory Address
    Before
    Afte
    r0
    0x1a2b3c4d
    
    r1
    0x XXXXXXXXXX
    
    cpsr bits N,Z,C,V
    0,0,0,0
    
ic r0,r1,r2
    Register or Memory Address
    Before
    Afte
    r0
    0x1a2b3c4d
    
    r1
    0x XXXXXXXXXX
    
    r2
    0x XXXXXXXXXX
    
    cpsr bits N,Z,C,V
    0,0,1,0
    
adc r0,r1,r2,lsl #3
    Register or Memory Address
    Before
    Afte
    r0
    0x1a2b3c4d
    
    r1
    0x XXXXXXXXXX
    
    r2
    0x XXXXXXXXXX
    
    cpsr bits N,Z,C,V
    0,0,1,0
    
Problem 2 Cross-Compilation XXXXXXXXXX__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 raspbe
y 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
. If your system does not have gcc and make then install
XXXXXXXXXXsudo apt install gcc make gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
If the ARM platform is aarch32 and Raspbe
y 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
. If your system does not have gcc and make then install
XXXXXXXXXXsudo 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
. 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 (raspbe
y pi)
7. Boot raspbe
y pi
8. On Ubuntu or Kali ssh the raspbe
y pi using: ssh XXXXXXXXXX (replace IP address with the respective IP of yur network).
9. If you ssh raspbe
y pi you can use scp to copy the executables you created in Ubuntu or Kali and copy them into raspbe
y pi as follows:
scp program-arm XXXXXXXXXX:/home/pi/ (replace the IP address with the respective IP in your network)
10. Verify on raspbe
y pi session (terminal ) if the file(s) were copied
11. On raspbe
y pi run the executable ./program-arm and attach screen capture of the results
12. If raspbe
y 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 ope
gdb ./ope
Answered 1 days AfterApr 13, 2022

Solution

Neetha answered on Apr 15 2022
12 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