Search code examples
stackinterruptvxworks

The stack an interrupt handler use on VxWorks (PowerPC)


Does the interrupt handler use the stack of the task that's interrupted or a separate stack as its stack? (PowerPC, VxWorks)


Solution

  • In VxWorks, there is a specific stack for interrupts. All Interrupt handlers share that same stack, which is located just above where the vxWorks image is loaded.

    I believe the default stack size is 5K, but can easily be changed with the kernel configurator.

    The ISR mechanism works roughly this way:
    You can think of VxWorks as typically installs an assembly code wrapper around your ISR code.

    On Entry, it automatically saves the general purpose registers (on the ISR stack) so the executing context (another ISR or a task) state is preserved.

    On Exit, the registers are restored, but in addition, the OS scheduler is called to see if the just finished ISR changed the state of a higher priority task. If this happened, then the higher priority task resumes. If no higher priority tasks are available, then the original task is restored.