計算機組織與結構›Ch1 指令集架構(ISA)
第 15 題/共 39 題
◀ CC 15/39
15. MIPS Assembly、Function Call、Reverse Engineering
#CC-01-015易MIPS AssemblyFunction CallReverse Engineering
題組題幹(本題:第29題,共 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

Which of the following C code could be the body of my_call()?

📄 交大112
跳轉到第題
▤完整推導請見《WH 資工筆記 · 計算機組織與結構》Ch1 指令集架構(ISA)
本章題號 · 1–20 / 39