summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2019-12-16 17:41:56 -0800
committerAndrew Waterman <andrew@sifive.com>2019-12-16 17:42:57 -0800
commite0339fc0775e0e8d478462ce3ed055ccde33f76a (patch)
tree359da78d448d3b3ec258c2a9cab49390e672849a
parent99eb76ac3c19eb3ebc6c2f91c4bfb85baf187cd0 (diff)
downloadenv-e0339fc0775e0e8d478462ce3ed055ccde33f76a.zip
env-e0339fc0775e0e8d478462ce3ed055ccde33f76a.tar.gz
env-e0339fc0775e0e8d478462ce3ed055ccde33f76a.tar.bz2
Initialize all the x-registers for determinism
This isn't required for correctness, but it helps debugging (and, in a few restricted scenarios, it avoids x-prop issues). Closes #16
-rw-r--r--v/entry.S32
1 files changed, 32 insertions, 0 deletions
diff --git a/v/entry.S b/v/entry.S
index f60a289..fa492e6 100644
--- a/v/entry.S
+++ b/v/entry.S
@@ -28,6 +28,38 @@ trap_vector:
j wtf
handle_reset:
+ li x1, 0
+ li x2, 0
+ li x3, 0
+ li x4, 0
+ li x5, 0
+ li x6, 0
+ li x7, 0
+ li x8, 0
+ li x9, 0
+ li x10, 0
+ li x11, 0
+ li x12, 0
+ li x13, 0
+ li x14, 0
+ li x15, 0
+ li x16, 0
+ li x17, 0
+ li x18, 0
+ li x19, 0
+ li x20, 0
+ li x21, 0
+ li x22, 0
+ li x23, 0
+ li x24, 0
+ li x25, 0
+ li x26, 0
+ li x27, 0
+ li x28, 0
+ li x29, 0
+ li x30, 0
+ li x31, 0
+
la t0, trap_vector
csrw mtvec, t0
la sp, STACK_TOP - SIZEOF_TRAPFRAME_T