static void GoToRealMode( void *rm_func ) { unsigned i; PMData->rm_func = RM_OFF( rm_func ); if( IntrState == IS_DPMI ) { for( i = 0; i < NUM_PM_SAVE_VECTS; ++i ) { DPMISetPMInterruptVector( PMVectSaveList[i], SavePMVects[i] ); } for( i = 0; i < NUM_PM_SAVE_EXCEPTS; ++i ) { DPMISetPMExceptionVector( PMExceptSaveList[i], SavePMExcepts[i] ); } DoRawSwitchToRM( RMData.segm.rm, offsetof( rm_data, stack ) + STACK_SIZE, RM_OFF( RawSwitchHandler ) ); for( i = 0; i < NUM_PM_SAVE_EXCEPTS; ++i ) { SavePMExcepts[i] = DPMIGetPMExceptionVector(PMExceptSaveList[i]); DPMISetPMExceptionVector( PMExceptSaveList[i], OrigPMExcepts[i] ); } for( i = 0; i < NUM_PM_SAVE_VECTS; ++i ) { SavePMVects[i] = DPMIGetPMInterruptVector( PMVectSaveList[i] ); DPMISetPMInterruptVector( PMVectSaveList[i], OrigPMVects[i] ); } } else { DoIntSwitchToRM(); } }
void RestoreOrigVectors(void) { unsigned i; unsigned old; for( i = 0; i < NUM_PM_SAVE_EXCEPTS; ++i ) { DPMISetPMExceptionVector( PMExceptSaveList[i], OrigPMExcepts[i] ); } for( i = 0; i < NUM_PM_SAVE_VECTS; ++i ) { DPMISetPMInterruptVector( PMVectSaveList[i], OrigPMVects[i] ); } old = D32NullPtrCheck( 0 ); for( i = 0; i < NUM_VECTS; ++i ) { MySetRMVector( i, PMData->orig_vects[i].s.segment, PMData->orig_vects[i].s.offset ); } D32NullPtrCheck( old ); }