diff options
author | Howard Mao <zhehao.mao@gmail.com> | 2020-08-07 18:08:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-07 18:08:23 -0700 |
commit | f7df78365f9aca4102a6d7136ea58b91f51c13cb (patch) | |
tree | a0e2d1d247ea8fcf5fb3daf63c04db0103a7725c | |
parent | 7d8b7c0dab72108e3ea7bb7744d3f6cc907c7ef4 (diff) | |
download | pk-f7df78365f9aca4102a6d7136ea58b91f51c13cb.zip pk-f7df78365f9aca4102a6d7136ea58b91f51c13cb.tar.gz pk-f7df78365f9aca4102a6d7136ea58b91f51c13cb.tar.bz2 |
make htif_poweroff thread-safe (#211)
-rw-r--r-- | machine/htif.c | 5 |
1 files changed, 3 insertions, 2 deletions
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); } } |