. Assume that the stack and the static data segments are empty and that the stac
ID: 3649795 • Letter: #
Question
. 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 regsiters $a0 and returned in register $v0. Assume that leaf functions may only use saved registers.int X[8] = {100, 200, 300, 500, 0, -1, 20, -2};
int count1;
int count2;
int count_less_than(int*, int, int);
int main()
{
count1 = count_less_than(X, 8, 0);
count2 = count_less_than(X, 4, 320);
}
int count_less_than (int X[], int N, int threshold)
{
int count = 0, i;
for (i = 0; i < N; i++)
count += (X[i] < threshold);
return count;
}
6. [5] Show the contents of the stack and the static data segments after each function call.
Explanation / Answer
compiler will initialize the stack pointer to the last location of RAM. .Line 9 is another #define that specifies the transmit data ready empty ,this is where the software will start after a reset or after being powered up. The -0x8000 to 0x7fff there are other possibilities like a static global
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.