Exemple #1
0
void gsKit_remove_vsync_handler(int callback_id)
{
	DIntr();
	DisableIntc(kINTC_VBLANK_START);
	RemoveIntcHandler(2, callback_id);
	EIntr();
}
Exemple #2
0
int poweroffInit()
{
	int res;
	static int _init_count = -1;

	if(_init_count == _iop_reboot_count)
		return 0;
	_init_count = _iop_reboot_count;

	while(((res = SifBindRpc(&cd0, PWROFF_IRX, 0)) >= 0) && (cd0.server == NULL))
		nopdelay();

	ee_thread_t thread;
	ee_thread_status_t thisThread;

	ee_sema_t sema;

	// Terminate and delete any previously created threads
	if (powerOffThreadId >= 0) {
		TerminateThread(powerOffThreadId);
		DeleteThread(powerOffThreadId);
		powerOffThreadId = -1;
	}

	// Delete any previously created semaphores
	if (PowerOffSema >= 0)
	{
		DeleteSema(PowerOffSema);
		PowerOffSema = -1;
	}

	sema.init_count = 0;
	sema.max_count = 1;
	sema.option = 0;
	PowerOffSema = CreateSema(&sema);

	ReferThreadStatus(GetThreadId(), &thisThread);

	if (thisThread.current_priority == 0) {
		ChangeThreadPriority(GetThreadId(), 51);
		thread.initial_priority = 50;
	} else
		thread.initial_priority = thisThread.current_priority - 1;

	thread.stack_size = 512 * 16;
	thread.gp_reg = &_gp;
	thread.func = PowerOffThread;
	thread.stack = (void *)poffThreadStack;
	powerOffThreadId = CreateThread(&thread);
	StartThread(powerOffThreadId, NULL);
	
	DIntr();
	SifAddCmdHandler(POFF_SIF_CMD, _poff_intr_callback, NULL);
	EIntr();

	int autoShutdown = 0;
	SifCallRpc(&cd0, PWROFF_ENABLE_AUTO_SHUTOFF, 0, NULL, 0, &autoShutdown, sizeof(autoShutdown), 0, 0);
	
	return res;
}
Exemple #3
0
int SjPCM_InitEx(int sync, int num_blocks) {
	int i;

	while(1){
		if (SifBindRpc( &cd0, SJPCM_IRX, 0) < 0) return -1; // bind error
 		if (cd0.server != 0) break;
    		i = 0x10000;
    		while(i--);
	}
	
	sbuff[0] = num_blocks;
	
	SifCallRpc(&cd0,SJPCM_SETNUMBLOCKS,0,(void*)(&sbuff[0]),64,(void*)(&sbuff[0]),64,0,0);

	sbuff[0] = sync;

	SifCallRpc(&cd0,SJPCM_INIT,0,(void*)(&sbuff[0]),64,(void*)(&sbuff[0]),64,0,0);

	FlushCache(0);

	pcmbufl = sbuff[1];
	pcmbufr = sbuff[2];
	bufpos = sbuff[3];
	
        DIntr();
        SifAddCmdHandler(SJPCM_CALLBACK, _sjpcm_callback, NULL);
        EIntr();

	sjpcm_inited = 1;

	return 0;
}
Exemple #4
0
void gsKit_remove_hsync_handler(int callback_id)
{
	DIntr();
	// Mask HSync interrupt
	GsPutIMR(GsGetIMR() | 0x0400);
	DisableIntc(INTC_GS);
	RemoveIntcHandler(INTC_GS, callback_id);
	EIntr();
}
Exemple #5
0
void gsKit_remove_vsync_handler(int callback_id)
{
	DIntr();
	// Mask VSync interrupt
	GsPutIMR(GsGetIMR() | 0x0800);
	DisableIntc(INTC_VBLANK_S);
	RemoveIntcHandler(INTC_VBLANK_S, callback_id);
	EIntr();
}
Exemple #6
0
void gsKit_remove_vsync_handler(int callback_id)
{
    DIntr();

    DisableIntc(2);

    RemoveIntcHandler(2, callback_id);

    EIntr();
}
Exemple #7
0
/*
enum
{
   kINTC_GS,
   kINTC_SBUS,
   kINTC_VBLANK_START,
   kINTC_VBLANK_END,
   kINTC_VIF0,
   kINTC_VIF1,
   kINTC_VU0,
   kINTC_VU1,
   kINTC_IPU,
   kINTC_TIMER0,
   kINTC_TIMER1
};
*/
int gsKit_add_vsync_handler(int (*vsync_callback)())
{
	int callback_id;

	DIntr();
	callback_id = AddIntcHandler(2, vsync_callback, 0);
	EnableIntc(kINTC_VBLANK_START);
	EIntr();

	return callback_id;
}
Exemple #8
0
int gsKit_add_hsync_handler(int (*hsync_callback)())
{
	int callback_id;

	DIntr();
	callback_id = AddIntcHandler(INTC_GS, hsync_callback, 0);
	EnableIntc(INTC_GS);
	// Unmask HSync interrupt
	GsPutIMR(GsGetIMR() & ~0x0400);
	EIntr();

	return callback_id;
}
Exemple #9
0
int gsKit_add_vsync_handler(int (*vsync_callback)())
{
	int callback_id;

	DIntr();
	callback_id = AddIntcHandler(INTC_VBLANK_S, vsync_callback, 0);
	EnableIntc(INTC_VBLANK_S);
	// Unmask VSync interrupt
	GsPutIMR(GsGetIMR() & ~0x0800);
	EIntr();

	return callback_id;
}
Exemple #10
0
int graph_add_vsync_handler(int (*vsync_callback)())
{

	int callback_id;

	DIntr();

	callback_id = AddIntcHandler(2, vsync_callback, -1);

	EnableIntc(2);

	EIntr();

	return callback_id;

}
Exemple #11
0
EE_ExceptionHandler *ee_dbg_set_level2_handler(int cause, EE_ExceptionHandler *handler)
{
    EE_ExceptionHandler *old_handler;
    u32 oldintr;

    if((cause < 0) || (cause > 3)) { return(NULL); }

    oldintr = DIntr();

    old_handler = ee_level2_exception_handlers[cause];
    ee_level2_exception_handlers[cause] = handler;

    if(oldintr) { EIntr(); }

    return(old_handler);
}
Exemple #12
0
int SjPCM_Init(int sync)
{
	int i;
/*
	do {
        if (sif_bind_rpc(&cd0, SJPCM_IRX, 0) < 0) {
            return -1;
        }
        nopdelay();
    } while(!cd0.server);
*/
	while(1){
		if (SifBindRpc( &cd0, SJPCM_IRX, 0) < 0) return -1; // bind error
 		if (cd0.server != 0) break;
    	i = 0x10000;
    	while(i--);
	}

	sbuff[0] = sync;

	SifCallRpc(&cd0,SJPCM_INIT,0,(void*)(&sbuff[0]),64,(void*)(&sbuff[0]),64,0,0);

	FlushCache(0);

	pcmbufl = sbuff[1];
	pcmbufr = sbuff[2];
	bufpos = sbuff[3];

        DIntr();
        SifAddCmdHandler(SJPCM_CALLBACK, _sjpcm_callback, NULL);
        EIntr();

	sjpcm_inited = 1;

	return 0;
}
Exemple #13
0
int rmSetMode(int force) {
	if (gVMode < RM_VMODE_AUTO || gVMode >= NUM_RM_VMODES)
		gVMode = RM_VMODE_AUTO;

	// we don't want to set the vmode without a reason...
	int changed = (vmode != gVMode || force);
	if (changed) {
		vmode = gVMode;

		gsGlobal->Mode = rm_mode_table[vmode].mode;
		gsGlobal->Height = rm_mode_table[vmode].height;

		if (vmode == RM_VMODE_DTV480P || vmode == RM_VMODE_DTV576P || vmode == RM_VMODE_VGA_640_60) {
			gsGlobal->Interlace = GS_NONINTERLACED;
			gsGlobal->Field = GS_FRAME;
		} else {
			gsGlobal->Interlace = GS_INTERLACED;
			gsGlobal->Field = GS_FIELD;
		}
		gsGlobal->Width = 640;

		gsGlobal->PSM = GS_PSM_CT24;
		gsGlobal->PSMZ = GS_PSMZ_16S;
		gsGlobal->ZBuffering = GS_SETTING_OFF;
		gsGlobal->PrimAlphaEnable = GS_SETTING_ON;
		gsGlobal->DoubleBuffering = GS_SETTING_ON;

		if ((gsGlobal->Mode) == GS_MODE_DTV_576P) {	// Write X, Y, DW and DH positions for DTV576P (not covered by GSKit lib)
			gsGlobal->StartX = 324;
			gsGlobal->StartY = 72;
			gsGlobal->DW = 1280;
			gsGlobal->DH = 512;
		}

		gsKit_init_screen(gsGlobal);

		if (vmode == RM_VMODE_DTV480P) { // Overwrite X, Y and DW GSKit params for DTV480P
			gsGlobal->StartX = 312;
			gsGlobal->StartY = 37 + (480-448)/2;
			gsGlobal->DW = 1280;
			gsGlobal->DH = 448;
		}
		else if (vmode == RM_VMODE_VGA_640_60) { // Overwrite X, Y GSKit params for VGA_640_60
			gsGlobal->StartX = 276;
			gsGlobal->StartY = 42;
		}

		if ((vmode == RM_VMODE_DTV480P) || (vmode == RM_VMODE_VGA_640_60)) { 	// Commit settings for DTV480P and VGA_650_60
			DIntr(); // disable interrupts
			GS_SET_DISPLAY1(gsGlobal->StartX,	// X position in the display area (in VCK unit
					gsGlobal->StartY,			// Y position in the display area (in Raster u
					gsGlobal->MagH,				// Horizontal Magnification
					gsGlobal->MagV,				// Vertical Magnification
					gsGlobal->DW - 1,			// Display area width
					gsGlobal->DH - 1);			// Display area height
			GS_SET_DISPLAY2(gsGlobal->StartX,	// X position in the display area (in VCK units)
					gsGlobal->StartY,			// Y position in the display area (in Raster units)
					gsGlobal->MagH,				// Horizontal Magnification
					gsGlobal->MagV,				// Vertical Magnification
					gsGlobal->DW - 1,			// Display area width
					gsGlobal->DH - 1);			// Display area height
			__asm__("sync.l; sync.p;");
			EIntr(); // enable interrupts
		}

		gsKit_mode_switch(gsGlobal, GS_ONESHOT);

		gsKit_set_test(gsGlobal, GS_ZTEST_OFF);

		// reset the contents of the screen to avoid garbage being displayed
		gsKit_clear(gsGlobal, gColBlack);
		gsKit_sync_flip(gsGlobal);

		LOG("RENDERMAN New vmode: %d, %d x %d\n", vmode, gsGlobal->Width, gsGlobal->Height);
	}
	return changed;
}
Exemple #14
0
void gsKit_init_screen(GSGLOBAL *gsGlobal)
{
    u64	*p_data;
    u64	*p_store;
    int	size = 18;

    if((gsGlobal->Dithering == GS_SETTING_ON) &&
            ((gsGlobal->PSM == GS_PSM_CT16) || (gsGlobal->PSM == GS_PSM_CT16S)))
        size = 19;

    gsKit_set_buffer_attributes(gsGlobal);

#ifdef DEBUG
    printf("Screen Mode:\n");
    printf("------------\n");
    printf("Width : %d\n", gsGlobal->Width);
    printf("Height: %d\n", gsGlobal->Height);
    printf("StartX: %d\n", gsGlobal->StartX);
    printf("StartY: %d\n", gsGlobal->StartY);
    printf("MagH  : %d\n", gsGlobal->MagH);
    printf("MagV  : %d\n", gsGlobal->MagV);
    printf("DW    : %d\n", gsGlobal->DW);
    printf("DH    : %d\n", gsGlobal->DH);
#endif

    GS_RESET();

    __asm__("sync.p; nop;");

    *GS_CSR = 0x00000000; // Clean CSR registers

    GsPutIMR(0x0000F700); // Unmasks all of the GS interrupts

    SetGsCrt(gsGlobal->Interlace, gsGlobal->Mode, gsGlobal->Field);

    gsGlobal->FirstFrame = GS_SETTING_ON;

    if(gsGlobal->ZBuffering == GS_SETTING_OFF)
    {
        gsGlobal->Test->ZTE = GS_SETTING_ON;
        gsGlobal->Test->ZTST = 1;
    }

    DIntr(); // disable interrupts

    GS_SET_PMODE(	0,		// Read Circuit 1
                    1,		// Read Circuit 2
                    0,		// Use ALP Register for Alpha Blending
                    1,		// Alpha Value of Read Circuit 2 for Output Selection
                    0,		// Blend Alpha with output of Read Circuit 2
                    0x80);		// Alpha Value = 1.0

    GS_SET_DISPFB1(	0,			// Frame Buffer Base Pointer (Address/2048)
                    gsGlobal->Width / 64,	// Buffer Width (Address/64)
                    gsGlobal->PSM,		// Pixel Storage Format
                    0,			// Upper Left X in Buffer
                    0);

    GS_SET_DISPFB2(	0,			// Frame Buffer Base Pointer (Address/2048)
                    gsGlobal->Width / 64,	// Buffer Width (Address/64)
                    gsGlobal->PSM,		// Pixel Storage Format
                    0,			// Upper Left X in Buffer
                    0);			// Upper Left Y in Buffer

    GS_SET_DISPLAY1(gsGlobal->StartX,		// X position in the display area (in VCK unit
                    gsGlobal->StartY,		// Y position in the display area (in Raster u
                    gsGlobal->MagH,			// Horizontal Magnification
                    gsGlobal->MagV,			// Vertical Magnification
                    gsGlobal->DW - 1,	// Display area width
                    gsGlobal->DH - 1);		// Display area height

    GS_SET_DISPLAY2(gsGlobal->StartX,		// X position in the display area (in VCK units)
                    gsGlobal->StartY,		// Y position in the display area (in Raster units)
                    gsGlobal->MagH,			// Horizontal Magnification
                    gsGlobal->MagV,			// Vertical Magnification
                    gsGlobal->DW - 1,	// Display area width
                    gsGlobal->DH - 1);		// Display area height

    GS_SET_BGCOLOR(	gsGlobal->BGColor->Red,		// Red
                    gsGlobal->BGColor->Green,	// Green
                    gsGlobal->BGColor->Blue);	// Blue

    EIntr(); //enable interrupts

    gsGlobal->CurrentPointer = 0; // reset vram pointer too

    // Context 1
    gsGlobal->ScreenBuffer[0] = gsKit_vram_alloc( gsGlobal, gsKit_texture_size(gsGlobal->Width, gsGlobal->Height, gsGlobal->PSM), GSKIT_ALLOC_SYSBUFFER );

    if(gsGlobal->DoubleBuffering == GS_SETTING_OFF)
    {
        gsGlobal->ScreenBuffer[1] = gsGlobal->ScreenBuffer[0];
    }
    else
        // Context 2
        gsGlobal->ScreenBuffer[1] = gsKit_vram_alloc( gsGlobal, gsKit_texture_size(gsGlobal->Width, gsGlobal->Height, gsGlobal->PSM), GSKIT_ALLOC_SYSBUFFER );


    if(gsGlobal->ZBuffering == GS_SETTING_ON)
        gsGlobal->ZBuffer = gsKit_vram_alloc( gsGlobal, gsKit_texture_size(gsGlobal->Width, gsGlobal->Height, gsGlobal->PSMZ), GSKIT_ALLOC_SYSBUFFER ); // Z Buffer

    gsGlobal->TexturePointer = gsGlobal->CurrentPointer; // first useable address for textures

    p_data = p_store = (u64 *)gsGlobal->dma_misc;

    *p_data++ = GIF_TAG( size - 1, 1, 0, 0, 0, 1 );
    *p_data++ = GIF_AD;

    *p_data++ = 1;
    *p_data++ = GS_PRMODECONT;

    *p_data++ = GS_SETREG_FRAME_1( gsGlobal->ScreenBuffer[0], gsGlobal->Width / 64, gsGlobal->PSM, 0 );
    *p_data++ = GS_FRAME_1;

    *p_data++ = GS_SETREG_XYOFFSET_1( gsGlobal->OffsetX,
                                      gsGlobal->OffsetY);
    *p_data++ = GS_XYOFFSET_1;

    *p_data++ = GS_SETREG_SCISSOR_1( 0, gsGlobal->Width - 1, 0, gsGlobal->Height - 1 );
    *p_data++ = GS_SCISSOR_1;

    *p_data++ = GS_SETREG_TEST( gsGlobal->Test->ATE, gsGlobal->Test->ATST,
                                gsGlobal->Test->AREF, gsGlobal->Test->AFAIL,
                                gsGlobal->Test->DATE, gsGlobal->Test->DATM,
                                gsGlobal->Test->ZTE, gsGlobal->Test->ZTST );

    *p_data++ = GS_TEST_1;

    *p_data++ = GS_SETREG_CLAMP(gsGlobal->Clamp->WMS, gsGlobal->Clamp->WMT,
                                gsGlobal->Clamp->MINU, gsGlobal->Clamp->MAXU,
                                gsGlobal->Clamp->MINV, gsGlobal->Clamp->MAXV);

    *p_data++ = GS_CLAMP_1;

    if(gsGlobal->ZBuffering == GS_SETTING_ON)
    {
        if((gsGlobal->PSM == GS_PSM_CT16) && (gsGlobal->PSMZ != GS_PSMZ_16))
            gsGlobal->PSMZ = GS_PSMZ_16; // seems only non-S 16-bit z depth works with this mode
        if((gsGlobal->PSM != GS_PSM_CT16) && (gsGlobal->PSMZ == GS_PSMZ_16))
            gsGlobal->PSMZ = GS_PSMZ_16S; // other depths don't seem to work with 16-bit non-S z depth

        *p_data++ = GS_SETREG_ZBUF_1( gsGlobal->ZBuffer / 8192, gsGlobal->PSMZ, 0 );
        *p_data++ = GS_ZBUF_1;
    }
    if(gsGlobal->ZBuffering == GS_SETTING_OFF)
    {
        *p_data++ = GS_SETREG_ZBUF_1( NULL, gsGlobal->PSM, 1 );
        *p_data++ = GS_ZBUF_1;
    }

    *p_data++ = GS_SETREG_COLCLAMP( 255 );
    *p_data++ = GS_COLCLAMP;

    *p_data++ = GS_SETREG_FRAME_1( gsGlobal->ScreenBuffer[1], gsGlobal->Width / 64, gsGlobal->PSM, 0 );
    *p_data++ = GS_FRAME_2;

    *p_data++ = GS_SETREG_XYOFFSET_1( gsGlobal->OffsetX,
                                      gsGlobal->OffsetY);
    *p_data++ = GS_XYOFFSET_2;

    *p_data++ = GS_SETREG_SCISSOR_1( 0, gsGlobal->Width - 1, 0, gsGlobal->Height - 1);
    *p_data++ = GS_SCISSOR_2;

    *p_data++ = GS_SETREG_TEST( gsGlobal->Test->ATE, gsGlobal->Test->ATST,
                                gsGlobal->Test->AREF, gsGlobal->Test->AFAIL,
                                gsGlobal->Test->DATE, gsGlobal->Test->DATM,
                                gsGlobal->Test->ZTE, gsGlobal->Test->ZTST );

    *p_data++ = GS_TEST_2;

    *p_data++ = GS_SETREG_CLAMP(gsGlobal->Clamp->WMS, gsGlobal->Clamp->WMT,
                                gsGlobal->Clamp->MINU, gsGlobal->Clamp->MAXU,
                                gsGlobal->Clamp->MINV, gsGlobal->Clamp->MAXV);

    *p_data++ = GS_CLAMP_2;

    if(gsGlobal->ZBuffering == GS_SETTING_ON)
    {
        *p_data++ = GS_SETREG_ZBUF_1( gsGlobal->ZBuffer / 8192, gsGlobal->PSMZ, 0 );
        *p_data++ = GS_ZBUF_2;
    }
    if(gsGlobal->ZBuffering == GS_SETTING_OFF)
    {
        *p_data++ = GS_SETREG_ZBUF_1( NULL, gsGlobal->PSM, 1 );
        *p_data++ = GS_ZBUF_2;
    }

    *p_data++ = GS_BLEND_BACK2FRONT;
    *p_data++ = GS_ALPHA_1;

    *p_data++ = GS_BLEND_BACK2FRONT;
    *p_data++ = GS_ALPHA_2;

    *p_data++ = GS_SETREG_DIMX(gsGlobal->DitherMatrix[0],gsGlobal->DitherMatrix[1],
                               gsGlobal->DitherMatrix[2],gsGlobal->DitherMatrix[3],gsGlobal->DitherMatrix[4],
                               gsGlobal->DitherMatrix[5],gsGlobal->DitherMatrix[6],gsGlobal->DitherMatrix[7],
                               gsGlobal->DitherMatrix[8],gsGlobal->DitherMatrix[9],gsGlobal->DitherMatrix[10],
                               gsGlobal->DitherMatrix[11],gsGlobal->DitherMatrix[12],gsGlobal->DitherMatrix[13],
                               gsGlobal->DitherMatrix[14],gsGlobal->DitherMatrix[15]); // 4x4 dither matrix

    *p_data++ = GS_DIMX;

    if((gsGlobal->Dithering == GS_SETTING_ON) && ((gsGlobal->PSM == GS_PSM_CT16) || (gsGlobal->PSM == GS_PSM_CT16S))) {
        *p_data++ = 1;
        *p_data++ = GS_DTHE;
    }

    dmaKit_send_ucab(DMA_CHANNEL_GIF, p_store, size);
    dmaKit_wait_fast();

    // do a single frame here to get rid whatever needs to be done during the first frame

    gsKit_clear(gsGlobal, GS_SETREG_RGBAQ(0x00,0x00,0x00,0x00,0x00)); // clear the screen

    gsKit_queue_exec(gsGlobal);

    gsKit_sync_flip(gsGlobal);

    gsKit_queue_reset(gsGlobal->Os_Queue);
}
Exemple #15
0
int ee_dbg_remove(int levels)
{
    u32 oldintr, oldop;
    int i;

    if((levels < 1) || (levels > 3)) { return(-1); }

    if(!(_installed_levels & levels)) { return(-1); }

    if((levels & _installed_levels) & 2)
    {
        oldintr = DIntr();
        oldop = ee_set_opmode(0);

        ee_dbg_clr_bps();

        // restore the original debug exception vector.
        memcpy((void *) (0x80000100), &__saved_dbg_ex_vector, sizeof(__saved_dbg_ex_vector));

        ee_set_opmode(oldop);
        if(oldintr) { EIntr(); }
        
        FlushCache(0);
        FlushCache(2);

        _installed_levels &= 1;
    }

    if((levels & _installed_levels) & 1)
    {
        // restore the exception handlers that we previously hooked.
        for(i = 1; i <= 3; i++)
        {
            if(_old_l1_handlers[i] != NULL)
            {
                SetVTLBRefillHandler(i, _old_l1_handlers[i]);
                _old_l1_handlers[i] = NULL;
            }
        }
        for(i = 4; i <= 7; i++)
        {
            if(_old_l1_handlers[i] != NULL)
            {
                SetVCommonHandler(i, _old_l1_handlers[i]);
                _old_l1_handlers[i] = NULL;
            }
        }
        for(i = 10; i <= 13; i++)
        {
            if(_old_l1_handlers[i] != NULL)
            {
                SetVCommonHandler(i, _old_l1_handlers[i]);
                _old_l1_handlers[i] = NULL;
            }
        }
        
        FlushCache(0);
        FlushCache(2);

        _installed_levels &= 2;
    }

    return(0);
}
Exemple #16
0
int ee_dbg_install(int levels)
{
    u32 oldintr, oldop;
    int i;

    if(_installed_levels & levels)
    {
        return(-1);
    }

    if(levels & 1)
    {
        for(i = 0; i < 16; i++) { ee_level1_exception_handlers[i] = NULL; }
    }

    if(levels & 2)
    {
        for(i = 0; i < 4; i++) { ee_level2_exception_handlers[i] = NULL; }

        oldintr = DIntr();
        oldop = ee_set_opmode(0);

        ee_dbg_clr_bps();
        
        // save the original level 2 debug exception vector.
        memcpy(&__saved_dbg_ex_vector, (void *) (0x80000100), 0x80);

        // replace the level 2 debug exception vector with our own
        memcpy((void *) (0x80000100), &__ee_level2_ex_vector, 32);

        ee_set_opmode(oldop);
        if(oldintr) { EIntr(); }
    }

    if(levels & 1)
    {
        // redirect desirable "Level 1" exceptions to our level 1 handler.
        for(i = 1; i <= 3; i++)
        {
            _old_l1_handlers[i] = GetExceptionHandler(i);
            SetVTLBRefillHandler(i, __ee_level1_ex_vector);
        }

        for(i = 4; i <= 7; i++)
        {
            _old_l1_handlers[i] = GetExceptionHandler(i);
            SetVCommonHandler(i, __ee_level1_ex_vector);
        }

        for(i = 10; i <= 13; i++)
        {
            _old_l1_handlers[i] = GetExceptionHandler(i);
            SetVCommonHandler(i, __ee_level1_ex_vector);
        }
    }

    FlushCache(0);
    FlushCache(2);

    _installed_levels |= levels;

    return(0);
}