static void callit_far( fpfn _WCI86NEAR *f ) { // don't call a null pointer if( *f ) { save_ds(); // call function (void)(**f)(); restore_ds(); } }
static void callit_near( npfn *f ) { // don't call a null pointer if( *f ) { save_dx(); save_ds(); // call function (void)(**f)(); restore_ds(); } }
void __InitRtns( unsigned limit ) { __type_rtp local_limit; struct rt_init _WCI86NEAR *pnext; save_ds(); save_es(); __GETDS(); local_limit = (__type_rtp)limit; for(;;) { { __type_rtp working_limit; struct rt_init _WCI86NEAR *pcur; pcur = (struct rt_init _WCI86NEAR*)&_Start_XI; #if defined(COMP_CFG_COFF) pcur++; #endif pnext = (struct rt_init _WCI86NEAR*)&_End_XI; working_limit = local_limit; // walk list of routines while( pcur < (struct rt_init _WCI86NEAR*)&_End_XI ) { // if this one hasn't been called if( pcur->rtn_type != PDONE ) { // if the priority is better than best so far if( pcur->priority <= working_limit ) { // remember this one pnext = pcur; working_limit = pcur->priority; } } // advance to next entry pcur++; } // check to see if all done, if we didn't find any // candidates then we can return if( pnext == (struct rt_init _WCI86NEAR*)&_End_XI ) { break; } } #if defined(M_I86) if( pnext->rtn_type == PNEAR ) { callit_near( (npfn *)&pnext->rtn ); } else { callit_far( (fpfn _WCI86NEAR *)&pnext->rtn ); } #else callit( &pnext->rtn ); #endif // mark entry as invoked pnext->rtn_type = PDONE; } restore_es(); restore_ds(); }
SHADOWFX_RETURN_CODE AMD_SHADOWFX_DLL_API AMD::ShadowFX_Render(const ShadowFX_Desc & desc) { if (NULL == desc.m_pContext) { return SHADOWFX_RETURN_CODE_INVALID_DEVICE_CONTEXT; } AMD::C_SaveRestore_IA save_ia(desc.m_pContext); AMD::C_SaveRestore_VS save_vs(desc.m_pContext); AMD::C_SaveRestore_HS save_hs(desc.m_pContext); AMD::C_SaveRestore_DS save_ds(desc.m_pContext); AMD::C_SaveRestore_GS save_gs(desc.m_pContext); AMD::C_SaveRestore_PS save_ps(desc.m_pContext); AMD::C_SaveRestore_RS save_rs(desc.m_pContext); AMD::C_SaveRestore_OM save_om(desc.m_pContext); AMD::C_SaveRestore_CS save_cs(desc.m_pContext); SHADOWFX_RETURN_CODE result = desc.m_pOpaque->render(desc); return result; }
//------------------------------------------------------------------------------------------------- // //------------------------------------------------------------------------------------------------- AOFX_RETURN_CODE AMD_AOFX_DLL_API AOFX_Render(const AOFX_Desc & desc) { AMD_OUTPUT_DEBUG_STRING("CALL: " AMD_FUNCTION_NAME "\n"); if (NULL == desc.m_pDeviceContext) { return AOFX_RETURN_CODE_INVALID_DEVICE_CONTEXT; } AMD::C_SaveRestore_IA save_ia(desc.m_pDeviceContext); AMD::C_SaveRestore_VS save_vs(desc.m_pDeviceContext); AMD::C_SaveRestore_HS save_hs(desc.m_pDeviceContext); AMD::C_SaveRestore_DS save_ds(desc.m_pDeviceContext); AMD::C_SaveRestore_GS save_gs(desc.m_pDeviceContext); AMD::C_SaveRestore_PS save_ps(desc.m_pDeviceContext); AMD::C_SaveRestore_RS save_rs(desc.m_pDeviceContext); AMD::C_SaveRestore_OM save_om(desc.m_pDeviceContext); AMD::C_SaveRestore_CS save_cs(desc.m_pDeviceContext); AOFX_RETURN_CODE result = desc.m_pOpaque->render(desc); return result; }
void __FiniRtns( unsigned min_limit, unsigned max_limit ) { __type_rtp local_min_limit; __type_rtp local_max_limit; struct rt_init _WCI86NEAR *pnext; save_ds(); save_es(); __GETDS(); local_min_limit = (__type_rtp)min_limit; local_max_limit = (__type_rtp)max_limit; for(;;) { { __type_rtp working_limit; struct rt_init _WCI86NEAR *pcur; pcur = (struct rt_init _WCI86NEAR*)&_Start_YI; #if defined(COMP_CFG_COFF) pcur++; #endif pnext = (struct rt_init _WCI86NEAR*)&_End_YI; working_limit = local_min_limit; // walk list of routines while( pcur < (struct rt_init _WCI86NEAR*)&_End_YI ) { // if this one hasn't been called if( pcur->rtn_type != PDONE ) { // if the priority is better than best so far if( pcur->priority >= working_limit ) { // remember this one pnext = pcur; working_limit = pcur->priority; } } // advance to next entry pcur++; } // check to see if all done, if we didn't find any // candidates then we can return if( pnext == (struct rt_init _WCI86NEAR*)&_End_YI ) { break; } } if( pnext->priority <= local_max_limit ) { #if defined(M_I86) if( pnext->rtn_type == PNEAR ) { callit_near( (npfn *)&pnext->rtn ); } else { callit_far( (fpfn _WCI86NEAR *)&pnext->rtn ); } #else callit( &pnext->rtn ); #endif } // mark entry as invoked even if we don't call it // if we didn't call it, it is because we don't want to // call finirtns with priority > max_limit, in that case // marking the function as called, won't hurt anything pnext->rtn_type = PDONE; } restore_es(); restore_ds(); }