diff options
Diffstat (limited to 'machine/mtrap.c')
-rw-r--r-- | machine/mtrap.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/machine/mtrap.c b/machine/mtrap.c index 778990f..b8dcc68 100644 --- a/machine/mtrap.c +++ b/machine/mtrap.c @@ -31,17 +31,6 @@ static uintptr_t mcall_console_putchar(uint8_t ch) return 0; } -void poweroff(uint16_t code) -{ - printm("Power off\n"); - finisher_exit(code); - if (htif) { - htif_poweroff(); - } else { - while (1) { asm volatile ("#noop\n"); } - } -} - void putstring(const char* s) { while (*s) @@ -229,3 +218,15 @@ void trap_from_machine_mode(uintptr_t* regs, uintptr_t dummy, uintptr_t mepc) bad_trap(regs, dummy, mepc); } } + +void poweroff(uint16_t code) +{ + printm("Power off\r\n"); + finisher_exit(code); + if (htif) { + htif_poweroff(); + } else { + send_ipi_many(0, IPI_HALT); + while (1) { asm volatile ("wfi\n"); } + } +} |