| 2.21.1 Assume that the stack and the static data segments are empty and that the stack and global pointers start at address 0x7fff fffc and 0x1000 8000, respectively. Assume the calling conventions as specified in Figure 2.11 and that function inputs are passed using registers $a0–$a3 and returned in register $r0. Assume that leaf functions may only use saved registers. a. int my_global = 100; main() { int x = 10; int y = 20; int z; z = my_function(x, y) } int my_function(int x, int y) { return x – y + my_global; } b. int my_global = 100; main() { int z; my_global += 1; z = leaf_function(my_global); } int leaf_function(int x) { return x + 1; } [5] <2.8> Write MIPS assembly code for the code in the table above. | |
| View Solution | |
| << Back | Next >> |