blob: 5ace350ad0f7a8901d7e51d0a12bc6ee27d2dc45 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include "boot.h"
#include "mtrap.h"
#include "vm.h"
#include "config.h"
static volatile int elf_loaded;
static void enter_entry_point()
{
prepare_supervisor_mode();
write_csr(mepc, current.entry);
asm volatile("eret");
__builtin_unreachable();
}
void run_loaded_program(size_t argc, char** argv)
{
if (!current.is_supervisor)
die("bbl can't run user binaries; try using pk instead");
supervisor_vm_init();
#ifdef PK_ENABLE_LOGO
print_logo();
#endif
mb();
elf_loaded = 1;
enter_entry_point();
}
void boot_other_hart()
{
while (!elf_loaded)
;
mb();
enter_entry_point();
}
|