I have been trying to develop code to implement context switch but I am not entirely sure how to start at the moment. Would you please kindly tell me where to start and how to use it
1. Disable all interrupts.
2. Push the old program counter on the stack.
3. Push all register on the stack
!!! The stack for each context must be an own array. !!!
4. Set the stackpointer on the stack(array) for the new(next) context.
5. Pop the register from this stack.
6. Enable interrupts.
7. Make an 'ret' instruction.