summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorRonald G. Minnich <rminnich@gmail.com>2015-09-22 15:53:32 -0700
committerRonald G. Minnich <rminnich@gmail.com>2015-09-23 17:02:18 +0000
commitf47f5fb4f138d234ac0ea62a2420873afa8b86dc (patch)
tree65c91307cd5f82459015de99398d008114ec26b9 /src/arch
parentd972f78e759ffccf9187ab3f3b00b567c7f30f53 (diff)
RISCV: modify arch_prog_run to handle payloads correctly.
Unlike the other stages, the payload requires virtual memory to be set up and also a privelege level change. Change-Id: Ibbe2a55f7719d917f121a53a17c6d90e6b2ab3d1 Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Reviewed-on: http://review.coreboot.org/11699 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/riscv/boot.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/arch/riscv/boot.c b/src/arch/riscv/boot.c
index d07d825d96..ab4ae95a19 100644
--- a/src/arch/riscv/boot.c
+++ b/src/arch/riscv/boot.c
@@ -18,11 +18,19 @@
*/
#include <program_loading.h>
+#include <vm.h>
+#include <arch/encoding.h>
+#include <rules.h>
void arch_prog_run(struct prog *prog)
{
- void (*doit)(void *);
+ void (*doit)(void *) = prog_entry(prog);
- doit = prog_entry(prog);
- doit(prog_entry_arg(prog));
+ if (ENV_RAMSTAGE && prog_type(prog) == ASSET_PAYLOAD) {
+ initVirtualMemory();
+ write_csr(mepc, doit);
+ asm volatile("eret");
+ } else {
+ doit(prog_entry_arg(prog));
+ }
}