Skip to content

Commit

Permalink
Don't call metal API in synchronize_harts()
Browse files Browse the repository at this point in the history
metal_cpu_get_current_hartid() might be in the ITIM and is not available
at the time that synchronize_harts() is called. Use inline assembly
instead

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
  • Loading branch information
nategraff-sifive committed Aug 21, 2019
1 parent 438d54e commit 74a12ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/synchronize_harts.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
__attribute__((section(".init"))) void __metal_synchronize_harts() {
#if __METAL_DT_MAX_HARTS > 1

int hart = metal_cpu_get_current_hartid();
int hart;
__asm__ volatile("csrr %0, mhartid" : "=r"(hart)::);

uintptr_t msip_base = 0;

/* Get the base address of the MSIP registers */
Expand Down

0 comments on commit 74a12ba

Please sign in to comment.