aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2016-05-04 00:43:08 +0200
committerClifford Wolf <clifford@clifford.at>2016-05-04 00:43:08 +0200
commit133befd278f64c2019d842e6ac658db389ce40d4 (patch)
treea89a7988cc0b2715131509779278b0a5fb85a036 /scripts
parent3192555374a0a8839bc52d5e9a101bf5950a53cd (diff)
downloadpicorv32-133befd278f64c2019d842e6ac658db389ce40d4.tar.gz
picorv32-133befd278f64c2019d842e6ac658db389ce40d4.zip
Fixed SP init in scripts/{csmith,cxxdemo}/
Diffstat (limited to 'scripts')
-rw-r--r--scripts/csmith/start.S8
-rw-r--r--scripts/cxxdemo/start.S8
2 files changed, 12 insertions, 4 deletions
diff --git a/scripts/csmith/start.S b/scripts/csmith/start.S
index 33114cc..f872a14 100644
--- a/scripts/csmith/start.S
+++ b/scripts/csmith/start.S
@@ -40,9 +40,13 @@ addi x31, zero, 0
lui sp, %hi(4*1024*1024)
addi sp, sp, %lo(4*1024*1024)
-/* push a zero on the stack */
-addi sp,sp,-4
+/* push zeros on the stack for argc and argv */
+/* (stack is aligned to 16 bytes in riscv calling convention) */
+addi sp,sp,-16
sw zero,0(sp)
+sw zero,4(sp)
+sw zero,8(sp)
+sw zero,12(sp)
/* jump to libc init */
j _ftext
diff --git a/scripts/cxxdemo/start.S b/scripts/cxxdemo/start.S
index 33114cc..f872a14 100644
--- a/scripts/cxxdemo/start.S
+++ b/scripts/cxxdemo/start.S
@@ -40,9 +40,13 @@ addi x31, zero, 0
lui sp, %hi(4*1024*1024)
addi sp, sp, %lo(4*1024*1024)
-/* push a zero on the stack */
-addi sp,sp,-4
+/* push zeros on the stack for argc and argv */
+/* (stack is aligned to 16 bytes in riscv calling convention) */
+addi sp,sp,-16
sw zero,0(sp)
+sw zero,4(sp)
+sw zero,8(sp)
+sw zero,12(sp)
/* jump to libc init */
j _ftext