openhwgroup / corev-gcc

GNU General Public License v2.0
22 stars 23 forks source link

Hardware Loops registers not saved/restored before being used in synchronous/asynchronous exception handler #104

Open pascalgouedo opened 7 months ago

pascalgouedo commented 7 months ago

When Hardware Loop feature is automatically generated and used in exception handlers, HWloop CSRs are not saved/restored. So when returning to main program from exception handler using HWloop, it is corrupted if exception happened during main program HWloop execution. This could happen with illegal exception, interrupt, debug code and maybe other situations.

jeremybennett commented 5 months ago

Technically not a bug, but a design decision. There are a number of options, which trade performance against flexibility when using hardware loops within interrupt handlers. For now we shall just document the issue in the GCC user manual.

jeremybennett commented 5 months ago

Documentation added in commit b34f9d1cf13