Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Convert the following C code into ARM assembly. You must follow ARM Procedure Call standard. Write your program in three different styles: passing by
Convert the following C code into ARM assembly. You must follow ARM Procedure Call standard. Write your program in three different styles: passing by value, passing by reference, and passing by stack. int pow(int base, int exp) ( int prod; int n; prod = 1; for (n=exp; n>0; n--) { prod=prod* base; } return prod; } 1. [10 pts] Convert the following ARM assembly code into machine language. Write the instructions in hexadecimal. ADD R8, RO, RI LDR R11, [R3, #4] SUB R5, R7, #0x58 LSL R3, R2, #14 2. [15 pts] Convert the following program from machine language into ARM assembly language. The numbers on the left are the instruction addresses in memory, and the numbers on the right give the instruction at that address. Then reverse engineer a high-level program that would compile into this assembly language routine and write it. Explain in words what the program does. RO and R1 are the input, and they initially contain positive numbers, a and b. At the end of the program, RO is the output. 0x00008008 0xE3A02000 0x0000800c 0xE1A03001 0x00008010 0xE1510000 0x00008014 0x8A000002 0x00008018 0xE2822001 0x0000801c 0xE0811003 0x00008020 0xEAFFFFFA 0x00008024 0xE1A00002 3. [20 pts] Convert the following branch instructions into ARM machine code. Instruction addresses are given to the left of each instruction. BEQ LOOP (a) 0x0000A000 0x0000A004 0x0000A008 0x0000A00C LOOP... (b) 0x00801000 0x00802040 DONE ... (c) 0x00103000 BGE DONE (d) 0x00008004 L1 ... BL FUNC 0x0011147C FUNC... 0x0000F00C BLI 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started