コード例 #1
0
ファイル: screen.c プロジェクト: dab2000/rEFInd-custom
VOID BeginTextScreen(IN CHAR16 *Title)
{
    DrawScreenHeader(Title);
    SwitchToText(FALSE);

    // reset error flag
    haveError = FALSE;
}
コード例 #2
0
ファイル: screen.c プロジェクト: dab2000/rEFInd-custom
VOID DebugPause(VOID)
{
    // show console and wait for key
    SwitchToText(FALSE);
    PauseForKey();

    // reset error flag
    haveError = FALSE;
}
コード例 #3
0
ファイル: screen.c プロジェクト: dab2000/rEFInd-custom
// Set the screen resolution and mode (text vs. graphics).
VOID SetupScreen(VOID)
{
    UINTN NewWidth, NewHeight;

    // Convert mode number to horizontal & vertical resolution values
    if ((GlobalConfig.RequestedScreenWidth > 0) && (GlobalConfig.RequestedScreenHeight == 0))
       egGetResFromMode(&(GlobalConfig.RequestedScreenWidth), &(GlobalConfig.RequestedScreenHeight));

    // Set the believed-to-be current resolution to the LOWER of the current
    // believed-to-be resolution and the requested resolution. This is done to
    // enable setting a lower-than-default resolution.
    if ((GlobalConfig.RequestedScreenWidth > 0) && (GlobalConfig.RequestedScreenHeight > 0)) {
       UGAWidth = (UGAWidth < GlobalConfig.RequestedScreenWidth) ? UGAWidth : GlobalConfig.RequestedScreenWidth;
       UGAHeight = (UGAHeight < GlobalConfig.RequestedScreenHeight) ? UGAHeight : GlobalConfig.RequestedScreenHeight;
    }

    // Set text mode. If this requires increasing the size of the graphics mode, do so.
    if (egSetTextMode(GlobalConfig.RequestedTextMode)) {
       egGetScreenSize(&NewWidth, &NewHeight);
       if ((NewWidth > UGAWidth) || (NewHeight > UGAHeight)) {
          UGAWidth = NewWidth;
          UGAHeight = NewHeight;
       }
       if ((UGAWidth > GlobalConfig.RequestedScreenWidth) || (UGAHeight > GlobalConfig.RequestedScreenHeight)) {
           // Requested text mode forces us to use a bigger graphics mode
           GlobalConfig.RequestedScreenWidth = UGAWidth;
           GlobalConfig.RequestedScreenHeight = UGAHeight;
       } // if
    }

    if (GlobalConfig.RequestedScreenWidth > 0) {
       egSetScreenSize(&(GlobalConfig.RequestedScreenWidth), &(GlobalConfig.RequestedScreenHeight));
       egGetScreenSize(&UGAWidth, &UGAHeight);
    } // if user requested a particular screen resolution

    if (GlobalConfig.TextOnly) {
        // switch to text mode if requested
        AllowGraphicsMode = FALSE;
        SwitchToText(FALSE);

    } else if (AllowGraphicsMode) {
        // clear screen and show banner
        // (now we know we'll stay in graphics mode)
        SwitchToGraphics();

        if (GlobalConfig.SavedScreen == NULL) {
           GlobalConfig.SavedScreen = egCropImage(egCopyScreen(), 0, 0, UGAWidth, GlobalConfig.MenuRowPosY);
        }

        if (GlobalConfig.ScreensaverTime != -1) {
           BltClearScreen(TRUE);
        } else { // start with screen blanked
           GraphicsScreenDirty = TRUE;
        }
    }
} // VOID SetupScreen()
コード例 #4
0
ファイル: screen.c プロジェクト: dab2000/rEFInd-custom
VOID FinishTextScreen(IN BOOLEAN WaitAlways)
{
    if (haveError || WaitAlways) {
       PauseForKey();
       SwitchToText(FALSE);
    }

    // reset error flag
    haveError = FALSE;
}
コード例 #5
0
ファイル: SYSTEM.C プロジェクト: AlexShiLucky/HelloX_STM32
//Default handler of Exception.
static VOID DefaultExcepHandler(LPVOID pESP,UCHAR ucVector)
{
	CHAR Buff[64];
	static DWORD totalExcepNum = 0;
#ifdef __I386__
	DWORD excepAddr = 0;
#endif
	__KERNEL_THREAD_OBJECT* pKernelThread = KernelThreadManager.lpCurrentKernelThread;

	//Switch to text mode,because the exception maybe caused in GUI mode.
#ifdef __I386__
	SwitchToText();
#endif
	_hx_sprintf(Buff,"  Unknown exception occured: excep number = %d",ucVector);
	PrintLine(Buff);
	totalExcepNum ++;
	if(totalExcepNum >= 1)  //Too many exception,maybe in deadlock,so halt the system.
	{
		PrintLine("  Fatal error : total unhandled exception number reached maximal value!");
		PrintLine("  Please power off the system and reboot it.");
		if(pKernelThread)
		{
			_hx_sprintf(Buff,"  Exception thread ID = %d.",pKernelThread->dwThreadID);
			PrintLine(Buff);
			_hx_sprintf(Buff,"  Exception thread name : %s.",pKernelThread->KernelThreadName);
			PrintLine(Buff);
			//Get the exception address try to access.
#ifdef __I386__
			__asm{
				push eax
				mov eax,cr2
				mov excepAddr,eax
				pop eax
			}
			_hx_sprintf(Buff,"  Exception memaddr = 0x%X.",excepAddr);
			PrintLine(Buff);
			_hx_sprintf(Buff,"  EIP    = 0x%X.",*((DWORD*)pESP + 8));
			PrintLine(Buff);
			_hx_sprintf(Buff,"  CS     = 0x%X.",*((DWORD*)pESP + 9));
			PrintLine(Buff);
			_hx_sprintf(Buff,"  EFlags = 0x%X.",*((DWORD*)pESP + 10));
			PrintLine(Buff);
#else
#endif
		}
		while(1); //Make a dead loop.
	}
	return;
}
コード例 #6
0
ファイル: screen.c プロジェクト: dab2000/rEFInd-custom
VOID FinishExternalScreen(VOID)
{
    // make sure we clean up later
    GraphicsScreenDirty = TRUE;

    if (haveError) {
        SwitchToText(FALSE);
        PauseForKey();
    }

    // Reset the screen resolution, in case external program changed it....
    SetupScreen();

    // reset error flag
    haveError = FALSE;
}
コード例 #7
0
ファイル: screen.c プロジェクト: dab2000/rEFInd-custom
VOID BeginExternalScreen(IN BOOLEAN UseGraphicsMode, IN CHAR16 *Title)
{
    if (!AllowGraphicsMode)
        UseGraphicsMode = FALSE;

    if (UseGraphicsMode) {
        SwitchToGraphics();
        BltClearScreen(FALSE);
    } else {
        egClearScreen(&DarkBackgroundPixel);
        DrawScreenHeader(Title);
        SwitchToText(TRUE);
    }

    // reset error flag
    haveError = FALSE;
}
コード例 #8
0
ファイル: SYSTEM.C プロジェクト: ohshout/HelloX_OS
//Default handler of Exception.
static VOID DefaultExcepHandler(LPVOID pESP, UCHAR ucVector)

{
	__KERNEL_THREAD_OBJECT* pKernelThread = KernelThreadManager.lpCurrentKernelThread;
	DWORD dwFlags;
	static DWORD totalExcepNum = 0;

	//Switch to text mode,because the exception maybe caused in GUI mode.
#ifdef __I386__
	SwitchToText();
#endif
	_hx_printf("Exception occured: #%d.\r\n", ucVector);
	totalExcepNum++;  //Increase total exception number.

	//Show kernel thread information which lead the exception.
	if (pKernelThread)
	{
		_hx_printf("\tCurrent kthread ID: %d.\r\n", pKernelThread->dwThreadID);
		_hx_printf("\tCurrent kthread name: %s.\r\n", pKernelThread->KernelThreadName);
	}
	else //In process of system initialization.
	{
		_hx_printf("\tException occured in process of initialization.\r\n");
	}

	//Call processor specific exception handler.
	PSExcepHandler(pESP, ucVector);

	if (totalExcepNum >= 1)  //Too many exception,maybe in deadlock,so halt the system.
	{
		_hx_printf("Fatal error: Total exception number reached maximal value(%d).\r\n", totalExcepNum);
		_hx_printf("Please power off the system and reboot it.\r\n");
		__ENTER_CRITICAL_SECTION(NULL, dwFlags);
		while (1); //Make a dead loop.
		__LEAVE_CRITICAL_SECTION(NULL, dwFlags);
	}
	return;
}