aboutsummaryrefslogtreecommitdiff
path: root/pk/bbl.c
blob: 8d52b7d41055ceb57cf6f756a8fce632046c38f5 (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
#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)
    panic("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();
}