Lab Exercise #10 -- SPARC Subprograms This exercise develops familiarity with SPARC assembly language subprograms. A. Consider the SPARC assembly language functions given as source code in the file "~cse320/Labs/lab10.program.s", and the output from that program. The program was assembled and linked using: gcc lab10.program.s ~cse320/lib/reglib.o The program output is displayed below. IU WINDOW y: 00000000 psr: fe401000 icc: 4 (-Z--) g0: 00000000 o0: 000212f4 l0: 00010754 i0: 00010c14 g1: ffffffff o1: ff342068 l1: 00010818 i1: 00010848 g2: 00000000 o2: 00035638 l2: 000212b8 i2: ffbff9b4 g3: 00000000 o3: ff3b3994 l3: 000212bc i3: 00021318 g4: 00000000 o4: ffbffff1 l4: 000212dc i4: 00000000 g5: 00000000 o5: ff3cc03c l5: 00010714 i5: 00000000 g6: 00000000 o6: ffbff8e8 l6: 00010730 i6: ffbff948 g7: 00000000 o7: 000107a8 l7: 00010748 i7: 000105ac MEMORY CONTENTS [00010714 to 00010863] 00010714: 9d e3 bf a0 40 00 01 3f 01 00 00 00 ae 10 00 00 00010724: a0 10 00 18 a2 10 00 19 a4 10 00 00 80 a4 80 11 00010734: 16 80 00 05 01 00 00 00 a4 04 a0 01 10 bf ff fc 00010744: 01 00 00 00 b0 10 00 17 81 c7 e0 08 81 e8 00 00 00010754: 9d e3 bf a0 21 00 00 41 a0 14 23 54 23 00 00 42 00010764: a2 14 60 18 25 00 00 84 a4 14 a2 b8 27 00 00 84 00010774: a6 14 e2 bc 29 00 00 84 a8 15 22 dc 2b 00 00 41 00010784: aa 15 63 14 2d 00 00 41 ac 15 a3 30 2f 00 00 41 00010794: ae 15 e3 48 31 00 00 43 b0 16 20 14 33 00 00 42 000107a4: b2 16 60 48 40 00 01 1b 01 00 00 00 11 00 00 41 000107b4: 90 12 23 14 92 02 21 50 40 00 00 23 01 00 00 00 000107c4: 21 00 00 84 a0 14 22 bc 23 00 00 84 a2 14 62 dc 000107d4: a4 24 40 10 a7 3c a0 02 90 10 00 10 92 10 00 13 000107e4: 7f ff ff cc 01 00 00 00 29 00 00 84 a8 15 22 b8 000107f4: d0 25 00 00 11 00 00 42 90 12 20 18 92 10 00 13 00010804: d4 05 00 00 40 00 42 78 01 00 00 00 81 c7 e0 08 00010814: 81 e8 00 00 0a 54 68 65 20 73 75 6d 20 6f 66 20 00010824: 74 68 65 20 25 64 20 65 6c 65 6d 65 6e 74 73 20 00010834: 69 6e 20 74 68 65 20 61 72 72 61 79 20 69 73 20 00010844: 25 64 0a 00 9d e3 be 90 c1 3f bf 00 c5 3f bf 08 00010854: c9 3f bf 10 cd 3f bf 18 d1 3f bf 20 d5 3f bf 28 IU WINDOW y: 00000000 psr: fe401000 icc: 4 (-Z--) g0: 00000000 o0: 00000000 l0: 00000000 i0: 000212bc g1: ffffffff o1: 00000007 l1: 00010864 i1: 00000008 g2: 00000000 o2: 00010748 l2: 00000150 i2: 00035638 g3: 00000000 o3: 00000007 l3: 00000000 i3: ff3b3994 g4: 00000000 o4: 000105ac l4: 00000000 i4: ffbffff1 g5: 00000000 o5: 00000020 l5: 00000000 i5: ff3cc03c g6: 00000000 o6: ffbff888 l6: 00000000 i6: ffbff8e8 g7: 00000000 o7: 00010718 l7: 00000000 i7: 000107e4 The sum of the 8 elements in the array is 0 1. Complete the following table to show the actual address for some of the symbolic addresses defined (or used) in functions "main" and "sum_list". symbol actual address symbol actual address -------- ---------------- -------- ---------------- main ________________ sum_list ________________ format ________________ loop ________________ total ________________ endloop ________________ list ________________ iu_window ________________ endlist ________________ memory ________________ 2. Give the relative order in which the four functions ("main", "sum_list", "iu_window", and "memory") appear in memory by listing the function names in order, from first to last. 3. In the output produced by the first call to "iu_window" (printed on the first page), locate and label each of the following items: a. The address (in a register) from which "iu_window" was called. b. The address (in a register) from which "main" was called. 4. In the output produced by "memory" (printed on the first page), locate and label each of the following items: a. The ".text" section of function "main". b. The ".text" section of function "sum_list". c. The first instruction in function "memory". d. Each branch or call instruction in function "main". e. Each branch or call instruction in function "sum_list". 5. In the output produced by the second call to "iu_window" (printed on the first page), locate and label each of the following items: a. Each argument (in a register) to function "sum_list". b. The address (in a register) from which "iu_window" was called. c. The address (in a register) from which "sum_list" was called. B. Revise the source code to complete the program. Copy the source code file into your directory and revise the program so that function "sum_list" correctly computes the sum of the array elements. Assemble, link and execute your program to prove that it executes correctly.