aboutsummaryrefslogtreecommitdiff
path: root/src/arch/riscv/payload.S
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/riscv/payload.S')
-rw-r--r--src/arch/riscv/payload.S28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/arch/riscv/payload.S b/src/arch/riscv/payload.S
new file mode 100644
index 0000000000..3261a80c2b
--- /dev/null
+++ b/src/arch/riscv/payload.S
@@ -0,0 +1,28 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+ .global riscvpayload
+riscvpayload:
+ /* Jump to a0 in S-mode */
+ mv t0,a0
+ csrw mepc, t0
+ csrr t0, mstatus
+ li t1, ~(3<<11)
+ and t0, t0, t1
+ li t2, (1<<11)
+ or t0, t0, t2
+ csrw mstatus, t0
+
+ // We're still in toolchain no mans land.
+ .word 0x30200073
+ //mret