The default CodeWarrior S12X project shows you how to send XGATE a software request. If you are using CodeWarrior then build a new project using the wizard and you will see how to do it. I think Cosmic also have some sample projects showing this.
In principle the XGATE configuration is always the same:
1. Direct the interrupt event to the XGATE.
2. Create a thread to handle the interrupt.
3. Initialize the XGATE interrupt vector table to point to the thread.
If you need detailed instructions on how to do this have a look at AN3144.