⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ut4_panic.c

📁 小型操作系统,以VC为开发环境,需要boachs调试
💻 C
字号:
/***************************************************************************
**     File name   : ut4_panic.c
**     Author      : x.cheng
**     Create date :
**
**	   Comment:
**        panic() defined in this file...
**
**     Revisions:
**     $Log: ut4_panic.c,v $
**     Revision 1.2  2005/08/05 15:11:39  x.cheng
**     reboot function added
**
**     Revision 1.1.1.1  2005/07/27 06:53:15  x.cheng
**     add into repositories
**
**
***************************************************************************/
#include "const.h"
#include "type.h"
#include "stdarg.h"

#include "..\..\Inc\i386\io.h"
#include "..\..\Inc\i386\system.h"
#include "..\..\Inc\i386\page.h"
#include "..\..\Inc\vga.h"
#include "..\..\Inc\keyb.h"
#include "..\..\Inc\tui.h"

#include "..\inc\def_util.h"

/************************************************************
*************************************************************
**      Function Name:			panic
**      Author:                 x.cheng
**
**      Comment:
**			panic function
**
**      List of parameters:
**			va_list
**
**      Return value:   
**          no
**
**      Revisions:
**
*************************************************************
*************************************************************/
int panic(const char * fmt, ...)
{
	ts_Console *pstConsole = pstTuiGetConsoleAddress(iTuiGetCurrentConsole());
	int iRtc; 
	va_list args;
	BYTE aucBuffer[1024];
	
	vCLI();

	va_start(args, fmt);
	iRtc = iVSPrintf(aucBuffer, fmt, args);
	va_end(args);

	pstConsole->ucCurrentColor = RED;
	vVgaConsolePutString(pstConsole, "Panic:");
	pstConsole->ucCurrentColor = YELLOW;
	vVgaConsolePutString(pstConsole,(const char *)aucBuffer);

	for(;;) vCLI();

	return iRtc;
}

/************************************************************
*************************************************************
**      Function Name:			Ut4RebootSystem
**      Author:                 x.cheng
**
**      Comment:
**			reboot function
**
**      List of parameters:
**			
**
**      Return value:   
**          no
**
**      Revisions:
**
*************************************************************
*************************************************************/
void Ut4RebootSystem( void )
{
	vCLI();

	// Inform the BIOS that this is a warm reboot.
	*(unsigned short *)PHYSICAL( 0x472 ) = 0x1234;

	// Pulse the CPU reset line.
	vKeybWaitForBusy();
	vOutPort( 0x64, 0xFE );
	vKeybWaitForBusy();

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -