From f7df78365f9aca4102a6d7136ea58b91f51c13cb Mon Sep 17 00:00:00 2001 From: Howard Mao Date: Fri, 7 Aug 2020 18:08:23 -0700 Subject: make htif_poweroff thread-safe (#211) --- machine/htif.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'machine') diff --git a/machine/htif.c b/machine/htif.c index 5f8722f..7d2265c 100644 --- a/machine/htif.c +++ b/machine/htif.c @@ -109,8 +109,9 @@ void htif_console_putchar(uint8_t ch) void htif_poweroff() { while (1) { - fromhost = 0; - tohost = 1; + spinlock_lock(&htif_lock); + __set_tohost(0, 0, 1); + spinlock_unlock(&htif_lock); } } -- cgit v1.1