aboutsummaryrefslogtreecommitdiff
path: root/pk/mentry.S
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2015-09-14 12:44:45 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2015-09-14 12:46:14 -0700
commit18efb61dc4fa2f20ce54cafcf12b12545751dd43 (patch)
tree73afa5d418575d17e41199459c83ed838a25928b /pk/mentry.S
parentcc3a93bf30d66a2e38fa744cbd9fb8c97dbf96f2 (diff)
downloadpk-18efb61dc4fa2f20ce54cafcf12b12545751dd43.zip
pk-18efb61dc4fa2f20ce54cafcf12b12545751dd43.tar.gz
pk-18efb61dc4fa2f20ce54cafcf12b12545751dd43.tar.bz2
Zero-initialize x-registers for debuggability
Diffstat (limited to 'pk/mentry.S')
-rw-r--r--pk/mentry.S33
1 files changed, 33 insertions, 0 deletions
diff --git a/pk/mentry.S b/pk/mentry.S
index 560923e..f26e2dd 100644
--- a/pk/mentry.S
+++ b/pk/mentry.S
@@ -133,6 +133,39 @@ mentry:
# Entry point for power-on reset (mtvec + 0x100)
+ # Zero registers for debuggability
+ 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
+
# sp <- end of first full page after the end of the binary
la sp, _end + 2*RISCV_PGSIZE - 1
li t0, -RISCV_PGSIZE