|
<< Click to Display Table of Contents >> Navigation: ASA-EMulatR Reference Guide > Introduction > Architecture Overview > Chapter 6 - Serialization and Stall Model > 6.11 CALL_PAL as a Serialization Point |
CALL_PAL transitions execution into privileged PAL mode. This transition must be serialized to prevent speculative execution across privilege boundaries, inconsistent IPR state, and unsafe MMIO access.
CALL_PAL behaves as the strongest serialization point (MemoryBarrierKind::PAL = 0xFFFF). It requires:
•All prior instructions complete
•Pipeline is flushed or drained
•LL/SC reservations are cleared
•Write buffers are drained
•Interrupts are masked during the transition
In SMP configurations, CBox::issueMemoryBarrier() checks the active CPU count. If more than one CPU is active and the barrier kind is PAL, the MemoryBarrierCoordinator initiates a global barrier and waits for all CPUs to acknowledge before the PAL transition completes:
// CBox::issueMemoryBarrier()
drainWriteBuffers(); // Step 1: local drain
if (activeCpuCount > 1 && kind == MemoryBarrierKind::PAL) {
m_barrierCoordinator->initiateGlobalMemoryBarrier(m_cpuId, activeCpuCount);
m_barrierCoordinator->waitForBarrierAcknowledge(m_cpuId);
}
m_state = CBoxState::RUNNING;
See Also: 4.9 PalBox - Privileged Architecture Library Box; CBoxLib/CBoxBase.h (issueMemoryBarrier).