EmulatorLoopHandler: if -> switch

This commit is contained in:
Gwenhael Le Moine 2024-10-10 16:37:09 +02:00
parent 2076cfd1c9
commit 3b9ea042d8
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -433,41 +433,42 @@ static ChfAction do_SHUTDN( void )
}
/* Condition handler for the EmulatorLoop */
static ChfAction EmulatorLoopHandler( const ChfDescriptor* d, const ChfState s, void* _ctx )
static ChfAction EmulatorLoopHandler( const ChfDescriptor* descriptor, const ChfState state, void* _ctx )
{
ChfAction act;
/* Check Chf state */
switch ( s ) {
switch ( state ) {
/* 2.1: Chf release 2 fixed the spelling of 'SIGNALING' */
case CHF_SIGNALING:
/* ChfSignal() in progress */
if ( d->module_id == CPU_CHF_MODULE_ID ) {
/* Condition from CPU modules; check Condition Code */
switch ( d->condition_code ) {
case CPU_I_SHUTDN:
act = do_SHUTDN();
break;
switch ( descriptor->module_id ) {
case CPU_CHF_MODULE_ID:
/* Condition from CPU modules; check Condition Code */
switch ( descriptor->condition_code ) {
case CPU_I_SHUTDN:
act = do_SHUTDN();
break;
case CPU_I_EMULATOR_INT:
/* Emulator interrupt; unwind */
act = CHF_UNWIND;
break;
default:
/* Condition Code not handled; resignal */
act = CHF_RESIGNAL;
}
} else
/* Condition from other modules; resignal */
act = CHF_RESIGNAL;
case CPU_I_EMULATOR_INT:
/* Emulator interrupt; unwind */
act = CHF_UNWIND;
break;
default:
/* Condition Code not handled; resignal */
act = CHF_RESIGNAL;
}
break;
default:
/* Condition from other modules; resignal */
act = CHF_RESIGNAL;
}
break;
default:
/* Other states; resignal the condition */
act = CHF_RESIGNAL;
break;
}
return act;