AT91SAM7 and DBGU Receive Interrupt

Hi, I want to use the Debug Unit as a menu based debug shell and I have some problems with receiving characters and passing them to the corresponding task. I know that DBGU and PIT (for tick generating) are sharing the same interrupt and I can toggle a led on character receive but more interesting for me is forwarding the received character preferred with a queue. But as soon as I call a normal function (not inline as for now) the systems seems to hang up. Now my real questions: - Why is contect saving and restoring used for the tick increment instead of isr enter and exit - and how can I do function calls from this system interrupt?

AT91SAM7 and DBGU Receive Interrupt

Meanwhile I have it partially running. Receiving characters work and the queue mechanism, too. But now after porting the menu based debug code into freertos it hangs again and I found out that the last working command is a pop where I get back 0xaaaaaaaa (Top of Stack after some searching). How can I determine where a push is missed/pop is too much?