|
<< Click to Display Table of Contents >> Navigation: ASA-EMulatR Reference Guide > Introduction > Architecture Overview > Chapter 20 – Boot Sequence, PAL, and SRM Integration > 20.2 PalService Delegation |
PalBox delegates most implementation to PalService (owned via std::unique_ptr<PalService>). PalBox methods follow a uniform pattern:
// PalBox dispatch pattern
BoxResult PalBox::executeXXX(PipelineSlot& slot) {
m_palService->executeXXX(slot, slot.palResult);
commitPalResult(slot);
return applyBoxResult(slot);
}
PalService (palLib_EV6/Pal_Service.h) contains the actual PAL operation implementations. It holds references to the IPR storage, register files, GuestMemory, IRQPendingState, and InterruptRouter needed to implement privileged operations. The separation between PalBox (dispatch and pipeline integration) and PalService (implementation logic) allows PalService to be tested independently of the pipeline.
PalBox also holds references to IRQPendingState and InterruptRouter for interrupt delivery coordination. The commitPalResult() method writes the PAL return value to the destination register after PAL call completion. The contextSwitch(cpuId) method breaks the LL/SC reservation for the specified CPU — the minimal reservation-clearing action required for a context switch.
See Also: palLib_EV6/Pal_Service.h – PalService class; palLib_EV6/Pal_core_inl.h – PAL core inline helpers; palLib_EV6/PAL_core.h – PAL constants.