Convert the following C code into ARM assembly. You must follow ARM Procedure Call standard. Write...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Related Book For
Auditing and Assurance services an integrated approach
ISBN: 978-0132575959
14th Edition
Authors: Alvin a. arens, Randal j. elder, Mark s. Beasley
Posted Date:
Students also viewed these computer network questions
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
The bank portion of the bank reconciliation for Langer Company at November 30, 2017, was as follows. The bank statement contained two memoranda: 1. A credit of $5,285 for the collection of a $5,140...
-
Starting from the position indicated in the drawing, the semicircular piece of wire rotates through half a revolution in the direction shown. Which end of the resistor is positive-the left or the...
-
Figure P18.27 shows streamlines of water flowing in two regions \(A\) and \(B\) of the same pipe (neither of the two regions shown spans the entire diameter of the pipe). Between these two regions no...
-
Explain the difference between an emissions trading scheme and a carbon tax. What are some of the benefits and limitations of each?
-
M. Jordan & E. Stone, CPAs, audited the financial statements of Tech Company, a non-issuer, for the year ended December 31, 2013, and expressed an unmodified opinion. For the next year, ended...
-
For this exercise, instead of using the values in the challenge, ask the user for the number of shares, the share price, and the percent commission.For this exercise, instead of using the values in...
-
Read the case study "Southwest Airlines," found in Part 2 of your textbook. Review the "Guide to Case Analysis" found on pp. CA1 - CA11 of your textbook. (This guide follows the last case in the...
-
1.1 The diagram in Figure 1 shows the supervisory control system. As an industrial engineering graduate how would you describe the importance of having such a system in an organization? Hint: In you...
-
what ways do calligraphers engage with digital technologies and software to augment their creative process or facilitate collaboration in the modern age ?
-
4- Find the missing numbers "letters A, B, C, D, E, F, G and I". a-16N (a, 1p) Bo b-H(1H, CH){H c-EC (C, a) 10Ne d-H(H, n) He
-
b) Find the general and definite solutions of the first order differential equations (i) dy/dt +2y=2 y(0)=7 dy/dt - 9y=10 y(0)=11 dy/dt+y=5 y(0)=1/5 dy/dt+4y= 1/3 y(0) = 9 dy/dt +3y=-3 y(0)=12 (vi)...
-
JDS is company financed by long-term debt (PLN 5,000,000) and equity (PLN 4,000,000). The company pays 20% income tax. The company's revenues planned for the next year amount to 1,800,000 PLN,...
-
Apply the Ampere's Circuital Law to determine H. dl for the currents and closed paths l1, l2, and l3 in Figure Q1(b). 10 A O 10 A O 10 A O 30 A 10 A O 30 A l3 Figure Q1(b) 10 A 10 A O 10 A 30 A 10 A...
-
(A) Accounting is considered a social science and as a result of the development and technological advancement and economic growth that led to the emergence of fields (branches) specialized in...
-
Assume you are the accountant for Catalina Industries. John Catalina, the owner of the company, is in a hurry to receive the financial statements for the year ended December 31, 20X1, and asks you...
-
Pamela Albright is the manager of the audit of Stanton Enterprises, a public company that manufactures formed steel subassemblies for other manufacturers. Albright is planning the 2011 audit and is...
-
Identify the four phases of the audit. What is the relationship of the four phases to the objective of the audit of financial statements?
-
Why is an auditor's independence so essential?
-
A ball rolls off a table and lands on the floor. The horizontal distance between the position at which the ball lands and the edge of the table is \(0.50 \mathrm{~m}\), and the tabletop is \(0.80...
-
A rifle is aimed horizontally at a target \(100 \mathrm{~m}\) away, and the bullet leaves the rifle barrel at \(650 \mathrm{~m} / \mathrm{s}\). If the gun is aimed right at the bull's-eye, by how...
-
On a rifle that has a telescopic sight, the telescope is usually not parallel to the barrel of the rifle. The angle the telescope makes with the barrel has to be adjusted for the distance to the...
Study smarter with the SolutionInn App