Kaynağa Gözat

Replace mul instruction with a loop for rv32i

Vadim Kaushan 5 yıl önce
ebeveyn
işleme
579f68ddf7
1 değiştirilmiş dosya ile 11 ekleme ve 0 silme
  1. 11 0
      riscv-rt/asm.S

+ 11 - 0
riscv-rt/asm.S

@@ -84,7 +84,18 @@ _abs_start:
     la sp, _stack_start
     lui t0, %hi(_hart_stack_size)
     add t0, t0, %lo(_hart_stack_size)
+#ifdef __riscv_mul
     mul t0, a2, t0
+#else
+    beqz a2, 2f  // Jump if single-hart
+    mv t1, a2
+    mv t2, t0
+1:
+    add t0, t0, t2
+    addi t1, t1, -1
+    bnez t1, 1b
+2:
+#endif
     sub sp, sp, t0
 
     // Set frame pointer