From: kettenis Date: Thu, 13 May 2021 06:44:11 +0000 (+0000) Subject: When doing AST processing: X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0f6296b86303a33577b09ef08e0a0e23296d6b0c;p=openbsd When doing AST processing: 1) block interrupts, then check for ASTs 2) if no ASTs, return with interrupts blocked, so they can be re-enabled ATOMICALLY in the return to userspace 3) if an AST happened, then re-enable interrupts, call ast(), then goto 1 ok jsg@ --- diff --git a/sys/arch/riscv64/riscv64/exception.S b/sys/arch/riscv64/riscv64/exception.S index 316447f99aa..719f9ab9c8b 100644 --- a/sys/arch/riscv64/riscv64/exception.S +++ b/sys/arch/riscv64/riscv64/exception.S @@ -1,4 +1,4 @@ -/* $OpenBSD: exception.S,v 1.3 2021/05/10 05:58:20 jsg Exp $ */ +/* $OpenBSD: exception.S,v 1.4 2021/05/13 06:44:11 kettenis Exp $ */ /*- * Copyright (c) 2015-2018 Ruslan Bukin @@ -183,9 +183,8 @@ .endm .macro do_ast - /* Disable interrupts */ - csrr a4, sstatus 1: + /* Disable interrupts */ csrci sstatus, (SSTATUS_SIE) /* Check for astpending */ @@ -196,8 +195,8 @@ sw x0, P_ASTPENDING(a1) - /* Restore interrupts */ - csrw sstatus, a4 + /* Enable interrupts */ + csrsi sstatus, (SSTATUS_SIE) /* handle the ast */ mv a0, sp