We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 213cdf6 commit 95c2fbaCopy full SHA for 95c2fba
src/device/riscv/riscv.go
@@ -25,13 +25,14 @@ func AsmFull(asm string, regs map[string]interface{}) uintptr
25
func DisableInterrupts() uintptr {
26
// Note: this can be optimized with a CSRRW instruction, which atomically
27
// swaps the value and returns the old value.
28
- mask := MIE.Get()
29
- MIE.Set(0)
+ mask := MSTATUS.Get()
+ MSTATUS.ClearBits(1 << 3) // clear the MIE bit
30
return mask
31
}
32
33
// EnableInterrupts enables all interrupts again. The value passed in must be
34
// the mask returned by DisableInterrupts.
35
func EnableInterrupts(mask uintptr) {
36
- MIE.Set(mask)
+ mask &= 1 << 3 // clear all bits except for the MIE bit
37
+ MSTATUS.SetBits(mask) // set the MIE bit, if it was previously cleared
38
0 commit comments