A question about Xgate: it is not clear wether it can execute ONLY Interrupt Service Routines or any other piece of code ( like a task which requires a fast turn around time but no ISR )
Yes, XGATE threads can only be invoked through interrupts, but the XGATE provides a set of software triggers (XGSWT register) that make it easy to launch a task via the S12X CPU. Software triggers work like regular interrupt flags, but they can be set and cleared directly through a register access.
Since the XGATE has a short interrupt latency (ideally approx. 5 bus clock cycles), the interrupt based trigger mechanism still suits tasks with fast turn around time.
At startup XGATE is idle. To make it running, one of interrupts, which is routed to XGATE, should fire. To execute some forever-task, just don't let XGATE exit thread. On S12XD/S12XA XGATE threads are not interruptible. On S12XE there are high priority (levels 4-7) threads and low priority (levels 1-3) threads. Low priority threads can be interrupted by high priority threads. High priority threads cann't be interrupted. So to use it like CPU with interrupts, you need to 1) start and never exit low priority thread, and 2) sevice interrupts using high priority threads.