Hello all, I encountered a very strange problem related to a preemptive scheduler that I wrote (for a xc167). the context switch handler is, of course, implemented in an interrupt handler, like this: #pragma NOFRAME // gain full control over stack push/pop instructions static void task_switch() interrupt 0x20 { // push registers ... // select next stack // pop registers } the problem is that if this handler is preempted by a timer (also an interrupt), the return address of the next scheduled task gets corrupted! (I notice that as I 'POP' the registers of the new task) I fixed this by disabling interrupts upon entry to 'task_switch' (and enabling them upon context switch completion) and this works fine, but I don't understand WHY this happens. I have tried to increase the level of the task switch handler, but it still gets preempted by a timer with a lower level. Greetings, Tamir Michael