diff options
Diffstat (limited to 'pk/bbl.c')
-rw-r--r-- | pk/bbl.c | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -1,6 +1,15 @@ #include "pk.h" #include "vm.h" +volatile int elf_loaded; + +static void enter_entry_point() +{ + write_csr(mepc, current.entry); + asm volatile("eret"); + __builtin_unreachable(); +} + void run_loaded_program(struct mainvars* args) { if (!current.is_supervisor) @@ -10,7 +19,15 @@ void run_loaded_program(struct mainvars* args) #ifdef PK_ENABLE_LOGO print_logo(); #endif - write_csr(mepc, current.entry); - asm volatile("eret"); - __builtin_unreachable(); + mb(); + elf_loaded = 1; + enter_entry_point(); +} + +void boot_other_hart() +{ + while (!elf_loaded) + ; + mb(); + enter_entry_point(); } |