計算機組織與結構›Ch1 指令集架構(ISA)第 14 題/共 39 題
14. MIPS Assembly、Calling Convention、Function Parameters
#CC-01-014易MIPS AssemblyCalling ConventionFunction Parameters
題組題幹(本題:第28題,共 3 小題)點擊展開
We want to translate a C function my_call() into the MIPS assembly language. The function my_call() calls another function func() which is declared as "int func(int s, int t);". The translated assembly code for the function my_call() is as follows:
my_call:
addi $sp, $sp, -12
sw $ra, 8($sp)
sw $s1, 4($sp)
sw $s0, 0($sp)
move $s1, $a2
move $s0, $a3
jal func
move $a0, $v0
add $a1, $s0, $s1
jal func
lw $ra, 8($sp)
lw $s1, 4($sp)
lw $s0, 0($sp)
addi $sp, $sp, 12
jr $ra
How many parameters does the function my_call() have?
📄 交大112
▤完整推導請見《WH 資工筆記 · 計算機組織與結構》Ch1 指令集架構(ISA)