# Nested Interrupts, enable state after context switch

**URL:** <https://forums.freertos.org/t/nested-interrupts-enable-state-after-context-switch/10749>\
**Category:** Kernel\
**Created:** [September 23, 2020, 8:28am UTC](https://forums.freertos.org/t/nested-interrupts-enable-state-after-context-switch/10749 "2020-09-23T08:28:30Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![ripperle](https://avatars.discourse-cdn.com/v4/letter/r/47e85d/32.png) [@ripperle](https://forums.freertos.org/u/ripperle)\
**Post date:** [September 24, 2020, 5:48am UTC](https://forums.freertos.org/t/nested-interrupts-enable-state-after-context-switch/10749/3 "2020-09-24T05:48:20Z")

</div>

Yes i wrote a port for the NIOS processor with vectored interrupt controller last year ([LINK](https://forums.freertos.org/t/nios-ii-vic-for-interrupts/7743/6))…

There were some issues with it, and now i try to fix it… The first thing was the bad nested interrupt implementation 🙄

Now i think it works like expected… The IRQ state will be restored in every task. I think i also fixed the “portDisable” and “portEnable” Interrupts implementiation, by saving the last enable state (for every task) on the stack (while context is swtiched) und write this state to the ISR\_ENABLE register, as soon “portEnable” will be called…  
Nesting should also work because of the use of the “vTaskEnterCritical” and “vTaskExitCritical” implementation…

Thank you for your help!  
Andy

---

_[View the full topic](https://forums.freertos.org/t/nested-interrupts-enable-state-after-context-switch/10749)._
