Chapter 9 XGATE (S12XGATEV2)
MC9S12XDP512 Data Sheet, Rev. 2.11
396 Freescale Semiconductor
Figure 9-22 gives an example of the typical usage of the XGATE hardware semaphores.
Two concurrent threads are running on the system. One is running on the S12X_CPU and the other is
running on the RISC core. They both have a critical section of code that accesses the same system resource.
To guarantee that the system resource is only accessed by one thread at a time, the critical code sequence
must be embedded in a semaphore lock/release sequence as shown.
Figure 9-22. Algorithm for Locking and Releasing Semaphores

9.4.5 Software Error Detection

The XGATE module will immediately terminate program execution after detecting an error condition
caused by erratic application code. There are three error conditions:
Execution of an illegal opcode
Illegal vector or opcode fetches
Illegal load or store accesses
All opcodes which are not listed in section Section 9.8, “Instruction Set” are illegal opcodes. Illegal vector
and opcode fetches as well as illegal load and store accesses are defined on chip level. Refer to the
S12X_MMC Section for a detailed information.
SSEM
XGSEM %1?
XGSEM %0
BCC?
%1 XGSEMx
CSEM
......... .........
.........
.........
critical
code
sequence
critical
code
sequence
S12X_CPU XGATE