mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 22:43:40 +00:00
runtime: check for heap allocations inside interrupts
This is unsafe and should never be done.
This commit is contained in:
committed by
Ron Evans
parent
e066e67baf
commit
f41b6a3b96
@@ -31,6 +31,12 @@ func main() {
|
||||
kendryte.PLIC.PRIORITY[i].Set(0)
|
||||
}
|
||||
|
||||
// Zero MCAUSE, which is set to the reset reason on reset. It must be zeroed
|
||||
// to make interrupt.In() work.
|
||||
// This would also be a good time to save the reset reason, but that hasn't
|
||||
// been implemented yet.
|
||||
riscv.MCAUSE.Set(0)
|
||||
|
||||
// Set the interrupt address.
|
||||
// Note that this address must be aligned specially, otherwise the MODE bits
|
||||
// of MTVEC won't be zero.
|
||||
@@ -93,6 +99,10 @@ func handleInterrupt() {
|
||||
// misaligned loads). However, for now we'll just print a fatal error.
|
||||
handleException(code)
|
||||
}
|
||||
|
||||
// Zero MCAUSE so that it can later be used to see whether we're in an
|
||||
// interrupt or not.
|
||||
riscv.MCAUSE.Set(0)
|
||||
}
|
||||
|
||||
// initPeripherals configures periperhals the way the runtime expects them.
|
||||
|
||||
Reference in New Issue
Block a user