示例#1
0
static void PrintCSymbolHeader (void)
/* Output a header for a list of C symbols */
{
    /* Header */
    PrintLine ("  id  name                        type  kind   sc   offs  symbol scope");
    PrintSeparator ();
}
示例#2
0
//Handler for 'ioctrl' command.
VOID IoCtrlApp(LPSTR pstr)
{
	__KERNEL_THREAD_OBJECT*    lpIoCtrlThread    = NULL;

	lpIoCtrlThread = KernelThreadManager.CreateKernelThread(
		(__COMMON_OBJECT*)&KernelThreadManager,
		0,
		KERNEL_THREAD_STATUS_READY,
		PRIORITY_LEVEL_NORMAL,
		IoCtrlStart,
		NULL,
		NULL,
		"IO CTRL");
	if(NULL == lpIoCtrlThread)    //Can not create the IO control thread.
	{
		PrintLine("Can not create IO control thread.");
		return;
	}

    //Set the current focus thread to IO control application.
	DeviceInputManager.SetFocusThread((__COMMON_OBJECT*)&DeviceInputManager,
		(__COMMON_OBJECT*)lpIoCtrlThread);

	//Block the shell thread untile IoCtrlThread over.
	lpIoCtrlThread->WaitForThisObject((__COMMON_OBJECT*)lpIoCtrlThread);

	//Reset the current focus kernel thread to shell.
	DeviceInputManager.SetFocusThread((__COMMON_OBJECT*)&DeviceInputManager,
		NULL);

	//Destroy the application thread object.
	KernelThreadManager.DestroyKernelThread((__COMMON_OBJECT*)&KernelThreadManager,
		(__COMMON_OBJECT*)lpIoCtrlThread);
}
示例#3
0
//
//System diag application's shell start code.
//
VOID SysDiagApp(LPSTR pstr)
{
	__KERNEL_THREAD_OBJECT*        lpSysDiagThread    = NULL;

	lpSysDiagThread = KernelThreadManager.CreateKernelThread(
		(__COMMON_OBJECT*)&KernelThreadManager,
		0,
		KERNEL_THREAD_STATUS_READY,
		PRIORITY_LEVEL_NORMAL,
		SysDiagStart,
		NULL,
		NULL,
		"SYS DIAG");
	if(NULL == lpSysDiagThread)    //Can not create the kernel thread.
	{
		PrintLine("Can not start system diag application,please retry again.");
		return;
	}

	//Set current focus kernel thread to diagnostic thread.
	DeviceInputManager.SetFocusThread((__COMMON_OBJECT*)&DeviceInputManager,
		(__COMMON_OBJECT*)lpSysDiagThread);

	//Block current shell thread to wait the diagnostic application execute over.
	lpSysDiagThread->WaitForThisObject((__COMMON_OBJECT*)lpSysDiagThread);

	//Reset the current focus thread.
	DeviceInputManager.SetFocusThread((__COMMON_OBJECT*)&DeviceInputManager,
		NULL);

	//Destroy the diagnostic thread object.
	KernelThreadManager.DestroyKernelThread((__COMMON_OBJECT*)&KernelThreadManager,
		(__COMMON_OBJECT*)lpSysDiagThread);
}
void CollectMeshes(const aiScene* scene, OutModel& model, aiNode* node)
{

    // skip LOD for now
    String name = node->mName.C_Str();
    if (name.Find("LOD1") != String::NPOS || name.Find("LOD2") != String::NPOS)
    {
        return;
    }

    for (unsigned i = 0; i < node->mNumMeshes; ++i)
    {
        aiMesh* mesh = scene->mMeshes[node->mMeshes[i]];
        for (unsigned j = 0; j < model.meshes_.Size(); ++j)
        {
            if (mesh == model.meshes_[j])
            {
                PrintLine("Warning: same mesh found multiple times");
                break;
            }
        }

        model.meshIndices_.Insert(node->mMeshes[i]);
        model.meshes_.Push(mesh);
        model.meshNodes_.Push(node);
        model.totalVertices_ += mesh->mNumVertices;
        model.totalIndices_ += GetNumValidFaces(mesh) * 3;
    }

    for (unsigned i = 0; i < node->mNumChildren; ++i)
        CollectMeshes(scene, model, node->mChildren[i]);
}
示例#5
0
void gsFont::Print(int x, int Xend, int y, int z, unsigned long colour, gsFontAlign alignment, const char* string)
{
	// Safety ... dont try to access a null object
	if (m_pFontPipe == NULL)
		return;

	if (string == NULL)
		return;

	int curr_x;

	char* temp_string = (char*)string;

	int max_length = Xend-x;

	
	m_Bold=0;
	m_Underline=0;

	m_pFontPipe->TextureSet(m_TBbase, m_TBwidth,
		gsDriver::getTexSizeFromInt(m_TexWidth),
		gsDriver::getTexSizeFromInt(m_TexHeight), 
		m_PSM, 0, 0, 0, 0);


	while (temp_string[0] != '\0')	// while there are more lines ...
	{
		int pix_length = 0;		// length of current line in pixels
		int char_length = 0;	// length of current line in characters

		// Calculate width of current line
		GetCurrLineLength(temp_string, max_length, pix_length, char_length);

		// set start Xpos - based on alignment
		switch (alignment)
		{
		case GSFONT_ALIGN_RIGHT:
			curr_x = Xend-pix_length;
			break;

		case GSFONT_ALIGN_CENTRE:
			curr_x = x+((max_length-pix_length)/2);
			break;

		case GSFONT_ALIGN_LEFT:
		default:
			curr_x = x;
			break;
		}

		PrintLine(curr_x, y, z, colour, char_length, temp_string);


		// finished printing the current line, so move onto the next line
		y+=m_CharGridHeight;

		// move the string pointer onto the next line
		temp_string += char_length;
	}
}
示例#6
0
static DWORD JvmHandler(__CMD_PARA_OBJ* pCmdParaObj)
{
	__KERNEL_THREAD_OBJECT*    lpJVMThread = NULL;
	//char*                      className = "-version";

	//Create Java VM thread.
	lpJVMThread = KernelThreadManager.CreateKernelThread(
		(__COMMON_OBJECT*)&KernelThreadManager,
		0,
		KERNEL_THREAD_STATUS_READY,
		PRIORITY_LEVEL_NORMAL,
		JvmEntryPoint,
		pCmdParaObj,
		NULL,
		"JVM");
	if (NULL == lpJVMThread)    //Can not create the IO control thread.
	{
		PrintLine("Can not create Java VM thread.");
		return SHELL_CMD_PARSER_SUCCESS;
	}

	DeviceInputManager.SetFocusThread((__COMMON_OBJECT*)&DeviceInputManager,
		(__COMMON_OBJECT*)lpJVMThread);    //Set the current focus to IO control
	//application.

	lpJVMThread->WaitForThisObject((__COMMON_OBJECT*)lpJVMThread);  //Block the shell
	//thread until
	//the IO control
	//application end.
	DeviceInputManager.SetFocusThread((__COMMON_OBJECT*)&DeviceInputManager, NULL);
	KernelThreadManager.DestroyKernelThread((__COMMON_OBJECT*)&KernelThreadManager,
		(__COMMON_OBJECT*)lpJVMThread);  //Destroy the thread object.

	return SHELL_CMD_PARSER_SUCCESS;
}
示例#7
0
//Handler for 'ioctrl' command.
DWORD IoCtrlApp(__CMD_PARA_OBJ* pCmdParaObj)
{
	__KERNEL_THREAD_OBJECT*    lpIoCtrlThread    = NULL;

	lpIoCtrlThread = KernelThreadManager.CreateKernelThread(
		(__COMMON_OBJECT*)&KernelThreadManager,
		0,
		KERNEL_THREAD_STATUS_READY,
		PRIORITY_LEVEL_NORMAL,
		IoCtrlStart,
		NULL,
		NULL,
		"IO CTRL");
	if(NULL == lpIoCtrlThread)    //Can not create the IO control thread.
	{
		PrintLine("Can not create IO control thread.");
		return SHELL_CMD_PARSER_SUCCESS;
	}

	DeviceInputManager.SetFocusThread((__COMMON_OBJECT*)&DeviceInputManager,
		(__COMMON_OBJECT*)lpIoCtrlThread);    //Set the current focus to IO control
	//application.

	lpIoCtrlThread->WaitForThisObject((__COMMON_OBJECT*)lpIoCtrlThread);  //Block the shell
	//thread until
	//the IO control
	//application end.
	DeviceInputManager.SetFocusThread((__COMMON_OBJECT*)&DeviceInputManager,NULL);
	KernelThreadManager.DestroyKernelThread((__COMMON_OBJECT*)&KernelThreadManager,
		(__COMMON_OBJECT*)lpIoCtrlThread);  //Destroy the thread object.

	return SHELL_CMD_PARSER_SUCCESS;
}
示例#8
0
//
//System diag application's shell start code.
//
DWORD SysDiagApp(__CMD_PARA_OBJ* pCmdParaObj)
{
	__KERNEL_THREAD_OBJECT*        lpSysDiagThread    = NULL;

	lpSysDiagThread = KernelThreadManager.CreateKernelThread(
		(__COMMON_OBJECT*)&KernelThreadManager,
		0,
		KERNEL_THREAD_STATUS_READY,
		PRIORITY_LEVEL_NORMAL,
		SysDiagStart,
		NULL,
		NULL,
		"SYS DIAG");
	if(NULL == lpSysDiagThread)    //Can not create the kernel thread.
	{
		PrintLine("Can not start system diag application,please retry again.");
		return SHELL_CMD_PARSER_SUCCESS;
	}

	DeviceInputManager.SetFocusThread((__COMMON_OBJECT*)&DeviceInputManager,
		(__COMMON_OBJECT*)lpSysDiagThread);

	lpSysDiagThread->WaitForThisObject((__COMMON_OBJECT*)lpSysDiagThread);
	KernelThreadManager.DestroyKernelThread((__COMMON_OBJECT*)&KernelThreadManager,
		(__COMMON_OBJECT*)lpSysDiagThread);  //Destroy the kernel thread object.

	return SHELL_CMD_PARSER_SUCCESS;
}
示例#9
0
文件: SYSD_S.C 项目: CYY25/HelloX_OS
static DWORD pcilist(__CMD_PARA_OBJ* lpParamObj)
{
#ifdef __CFG_SYS_DDF
	DWORD                  dwLoop          = 0;
	__PHYSICAL_DEVICE*     lpPhyDev        = NULL;

	PrintLine("    Device ID/Vendor ID    Bus Number    Description");

	for(dwLoop = 0;dwLoop < MAX_BUS_NUM;dwLoop ++)
	{
		if(DeviceManager.SystemBus[dwLoop].dwBusType == BUS_TYPE_PCI)
		{
			lpPhyDev = DeviceManager.SystemBus[dwLoop].lpDevListHdr;
			while(lpPhyDev)  //Travel all list
			{
				OutputDevInfo(lpPhyDev);
				lpPhyDev = lpPhyDev->lpNext;
			}
		}
	}
	return SHELL_CMD_PARSER_SUCCESS;
#else
	return SHELL_CMD_PARSER_FAILED;
#endif
}
示例#10
0
BOOL CCmdDlg::Cmd_RTTI()
{
	if (GetParamCount() != 2) {

		PrintLine(_T("invalid command"));
		return TRUE;
	}

	ULONG_PTR addr = xtol(GetParam(1));
	if (!IsValidPtr(addr)) {

		PrintLine(_T("invalid address: %p"), addr );
		return TRUE;
	}

	ULONG_PTR vtablePtr = 0;
	g_dbgEng->ReadMemory((PVOID )addr, (PBYTE )&vtablePtr, sizeof(vtablePtr));	

	ULONG_PTR rttiPtr = vtablePtr - sizeof(ULONG_PTR);
	ULONG_PTR rtti;
	g_dbgEng->ReadMemory((PVOID )rttiPtr, (PBYTE )&rtti, sizeof(rtti));

	ULONG_PTR typeDescPtrPtr = rtti + offsetof(RTTICompleteObjectLocator, pTypeDescriptor);
	ULONG_PTR typeDescPtr;

	g_dbgEng->ReadMemory((PVOID )typeDescPtrPtr, (PBYTE )&typeDescPtr, sizeof(typeDescPtr));

	TypeDescriptor typeDesc;
	memset(&typeDesc, 0 , sizeof(typeDesc));

	g_dbgEng->ReadMemory((PVOID )typeDescPtr, (PBYTE )&typeDesc, sizeof(typeDesc));

	PrintLine("class name: %s", typeDesc.name);

	ULONG_PTR vtable[32];
	memset(vtable, 0 , sizeof(vtable));
	g_dbgEng->ReadMemory((PVOID )vtablePtr, (PBYTE )vtable, sizeof(vtable));

	PrintLine("vtable: %p", vtablePtr);
	for (int i = 0; i < 32; i ++) {
		if (!IsValidPtr(vtable[i]))
			break;
		PrintLine("\t%d\t%p", i, vtable[i]);
	}
	
	return TRUE;
}
//print welcome message
void Print_Welcome()
{
	PrintLine();
	strcpy(printTxt, "************************"); PrintLn(printTxt);
	strcpy(printTxt, "*    AVR IO CONTROL    *"); PrintLn(printTxt);
	strcpy(printTxt, "* (C) 2007, OLIMEX Ltd *"); PrintLn(printTxt);
	strcpy(printTxt, "************************"); PrintLn(printTxt);
}
int PostScriptDrv::PrintLine(char *s, unsigned max_len, 
			     GXSTD::ofstream &stream)
{
  if(s == 0 || max_len <= 0) return 0;
  
  if(strlen(s) > max_len) {
    char *buf = new char[max_len];
    // PC-lint 04/26/2005: Possible access of out-of-bounds pointer
    buf[max_len-1] = '\0';
    memmove(buf, s, max_len);
    int rv = PrintLine(buf, stream);
    delete [] buf;
    return rv;
  }
  else
    return PrintLine(s, stream);
}
//print welcome message
void Print_Welcome()
{
	PrintLine();
	strcpy(printTxt, "***********"); PrintLn(printTxt);
	strcpy(printTxt, "Welcome    "); PrintLn(printTxt);
	strcpy(printTxt, version      ); PrintLn(printTxt);
	strcpy(printTxt, "***********"); PrintLn(printTxt);
}
示例#14
0
static DWORD inputd(__CMD_PARA_OBJ* lpParamObj)
{
	DWORD                dwVal              = 0;
	WORD                 wPort              = 0;
	CHAR                 strBuffer[15];

	if(NULL == lpParamObj)    //Parameter check.
		return IOCTRL_TERMINAL;

	if(lpParamObj->byParameterNum < 2)    //Not enough parameters.
	{
		PrintLine("Please input the port value.");
		return IOCTRL_NORMAL;
	}

	if(!Str2Hex(lpParamObj->Parameter[1],&dwVal))  //Incorrect port value.
	{
		PrintLine("Please input the port correctly.");
		return IOCTRL_NORMAL;
	}

	wPort = (WORD)(dwVal);

#ifdef __I386__               //Read data from port.
	__asm{
		push eax
		push edx
		mov dx,wPort
		in eax,dx
		mov dwVal,eax
		pop edx
		pop eax
	}
#else
#endif

	strBuffer[0] = ' ';
	strBuffer[1] = ' ';
	strBuffer[2] = ' ';
	strBuffer[3] = ' ';

	Hex2Str(dwVal,&strBuffer[4]);
	PrintLine(strBuffer);    //Print out the byte.

	return 0;
}
示例#15
0
int main(void)
{
    int n = GetUserInput();
    for (int i = 1; i <= n; i++) 
    {
        PrintLine(n - i, i);
    }
}
示例#16
0
void cDexCodeWriter::PrintStartEndLine(
    CHAR* Arguments
    )
{
    PrintIndentation();
    PrintLine(Arguments);

}
示例#17
0
文件: test1.c 项目: MrAlun/server
void PrintPolygon(Polygon* polygon)
{
	for (int i = 0, j = polygon->n - 1; i < polygon->n; j = i++)
	{
		Line line = { { polygon->v[i].x, polygon->v[i].y },{ polygon->v[j].x, polygon->v[j].y} };
		PrintLine(line);
	}
}
示例#18
0
void FbxToHkxConverter::saveScenes(const char *path, const char *name)
{
	printf("Output path: %s\n", path);

	for (int sceneIndex = 0; sceneIndex < m_scenes.getSize(); sceneIndex++)
	{
		hkxScene *scene = m_scenes[sceneIndex];
		hkRootLevelContainer* currentRootContainer = new hkRootLevelContainer();
		currentRootContainer->m_namedVariants.setSize(1);

		hkRootLevelContainer::NamedVariant& sceneVariant = currentRootContainer->m_namedVariants[0];
		sceneVariant.set("Scene Data", scene, &hkxSceneClass);

		hkStringBuf filename = name;

		if (sceneIndex > 0)
		{
			filename.append("_");

			hkStringBuf name = scene->m_rootNode->m_name;

			char invalid_characters[] = { ' ', '.', '/', '?', '<', '>', '\\', ':', '*', '|' };
			for (int character_index = 0; character_index < sizeof(invalid_characters); character_index++ )
			{
				name.replace(invalid_characters[character_index], '_');
			}

			filename.append( name );
		}

		PrintLine();

		hkStringBuf tagfile = filename;
		tagfile.append(".hkt");

		hkStringBuf tagpath = path;
		tagpath.append(tagfile);

		if ( hkSerializeUtil::save(
				currentRootContainer,
				hkRootLevelContainerClass,
				hkOstream(tagpath).getStreamWriter(),
				hkSerializeUtil::SAVE_TEXT_FORMAT) == HK_SUCCESS )
		{
			printf("Saved tag file: %s\n", tagfile.cString());
		}
		else
		{
			printf("Cannot save file: %s\n", tagfile.cString());
		}

		printf("Number of frames: %d\n", scene->m_numFrames);
		printf("Scene length: %0.2f\n", scene->m_sceneLength);
		printf("Root node name: %s\n", scene->m_rootNode->m_name.cString());

		delete currentRootContainer;
	}
}
示例#19
0
//=============================================================================
void Amesos_Mumps::PrintStatus() const
{

  if (Comm().MyPID() != 0 ) return;

  //  The following lines are commented out to deal with bug #1887 - kss
#ifndef IRIX64
  PrintLine();
  std::cout << "Amesos_Mumps : Matrix has " << Matrix().NumGlobalRows() << " rows"
       << " and " << Matrix().NumGlobalNonzeros() << " nonzeros" << std::endl;
  std::cout << "Amesos_Mumps : Nonzero elements per row = "
       << 1.0*Matrix().NumGlobalNonzeros()/Matrix().NumGlobalRows() << std::endl;
  std::cout << "Amesos_Mumps : Percentage of nonzero elements = "
       << 100.0*Matrix().NumGlobalNonzeros()/(pow(Matrix().NumGlobalRows(),2.0)) << std::endl;
  std::cout << "Amesos_Mumps : Use transpose = " << UseTranspose_ << std::endl;
//  MatrixProperty_ is unused - see bug #2331 and bug #2332 in this file and bugzilla
  if (MatrixProperty_ == 0) std::cout << "Amesos_Mumps : Matrix is general unsymmetric" << std::endl;
  if (MatrixProperty_ == 2) std::cout << "Amesos_Mumps : Matrix is general symmetric" << std::endl;
  if (MatrixProperty_ == 1) std::cout << "Amesos_Mumps : Matrix is SPD" << std::endl;
  std::cout << "Amesos_Mumps : Available process(es) = " << Comm().NumProc() << std::endl;
  std::cout << "Amesos_Mumps : Using " << MaxProcs_ << " process(es)" << std::endl;
  
  std::cout << "Amesos_Mumps : Estimated FLOPS for elimination = "
       << MDS.RINFOG(1) << std::endl;
  std::cout << "Amesos_Mumps : Total FLOPS for assembly = "
       << MDS.RINFOG(2) << std::endl;
  std::cout << "Amesos_Mumps : Total FLOPS for elimination = "
       << MDS.RINFOG(3) << std::endl;
  
  std::cout << "Amesos_Mumps : Total real space to store the LU factors = "
       << MDS.INFOG(9) << std::endl;
  std::cout << "Amesos_Mumps : Total integer space to store the LU factors = "
       << MDS.INFOG(10) << std::endl;
  std::cout << "Amesos_Mumps : Total number of iterative steps refinement = "
       << MDS.INFOG(15) << std::endl;
  std::cout << "Amesos_Mumps : Estimated size of MUMPS internal data\n"
       << "Amesos_Mumps : for running factorization = "
       << MDS.INFOG(16) << " Mbytes" << std::endl;
  std::cout << "Amesos_Mumps : for running factorization = "
       << MDS.INFOG(17) << " Mbytes" << std::endl;
  std::cout << "Amesos_Mumps : Allocated during factorization = "
       << MDS.INFOG(19) << " Mbytes" << std::endl;
  PrintLine();
#endif
}
示例#20
0
文件: FAT32.C 项目: bladely/HelloX_OS
//Initialize FAT32 partition,this routine is called by CheckPartition,which is then
//called by CreateDevice of IOManager.
static __FAT32_FS* InitFat32(__COMMON_OBJECT* pPartObj)
{
    __DEVICE_OBJECT*  pPartition  = (__DEVICE_OBJECT*)pPartObj;
    __FAT32_FS*       pFatObject = NULL;
    BYTE              buff[SECTOR_SIZE];

    if(NULL == pPartition)
    {
        goto __TERMINAL;
    }

    //Check the validity of partition device object.
    if(DEVICE_OBJECT_SIGNATURE != pPartition->dwSignature)  //Invalid signature.
    {
        goto __TERMINAL;
    }

    if(!ReadDeviceSector(pPartObj,
                         0,
                         1,
                         buff))
    {
        PrintLine("Can not read sector 0.");
        goto __TERMINAL;
    }
    pFatObject = (__FAT32_FS*)CREATE_OBJECT(__FAT32_FS);
    if(NULL == pFatObject)  //Can not create FAT32 object.
    {
        goto __TERMINAL;
    }
    pFatObject->pPartition = pPartObj;    //Very important.
    //Initialize the FAT32 file system.
    if(!Fat32Init(pFatObject,buff))
    {
        PrintLine("Can not initialize the FAT32 file system.");
        RELEASE_OBJECT(pFatObject);       //Release it.
        pFatObject = NULL;
        goto __TERMINAL;
    }
    GetVolumeLbl(pFatObject,pFatObject->VolumeLabel);  //This operation may failed,but we no
    //need to concern it.
    DumpFat32(pFatObject);
__TERMINAL:
    return pFatObject;
}
示例#21
0
void  SDPContainer::PrintAllLines()
{
    if (fNumUsedLines > 0)
    {   for (int i = 0; i < fNumUsedLines; i++)
            PrintLine(i);
    }
    else
        qtss_printf("SDPContainer::PrintAllLines no lines\n"); 
}
示例#22
0
// ====================================================================== 
void Amesos_Umfpack::PrintStatus() const
{
  if (MyPID_ != 0) return;

  PrintLine();

  std::cout << "Amesos_Umfpack : Matrix has " << NumGlobalElements_ << " rows"
	    << " and " << numentries_ << " nonzeros" << std::endl;
  std::cout << "Amesos_Umfpack : Nonzero elements per row = "
       << 1.0*numentries_/NumGlobalElements_ << std::endl;
  std::cout << "Amesos_Umfpack : Percentage of nonzero elements = "
       << 100.0*numentries_/(pow(double(NumGlobalElements_),double(2.0))) << std::endl;
  std::cout << "Amesos_Umfpack : Use transpose = " << UseTranspose_ << std::endl;

  PrintLine();

  return;
}
示例#23
0
//Internal routine to print version info.
static VOID __VersionInfo()
{
	LPSTR       lpszVersion   = "hedit - Hello China Editor,version 0.1";

	//Print out version info.
	GotoHome();
	ChangeLine();
	PrintLine(lpszVersion);
}
示例#24
0
void CTextWindow::DrawWordJustified(const TDesC &aText)
	{
	TInt count=0;
	for(TInt index=0;index<aText.Length();index++)
		if (aText[index]==' ')
			count++;
	iGc->SetWordJustification(Size().iWidth-10-iTmpFont->TextWidthInPixels(aText),count);
	PrintLine(iTmpFont, aText);
	}
示例#25
0
static DWORD outputd(__CMD_PARA_OBJ* lpCmdObj)
{
	WORD            wPort              = 0;
	DWORD           dwVal              = 0;
	DWORD           dwPort             = 0;

	if(NULL == lpCmdObj)  //Parameter check.
		return IOCTRL_TERMINAL;

	if(lpCmdObj->byParameterNum < 3)    //Without enough parameter.
	{
		PrintLine("Please input the port and value.");
		return IOCTRL_NORMAL;
	}

	if(!Str2Hex(lpCmdObj->Parameter[1],&dwPort))  //Can not convert the port to hex.
	{
		PrintLine("Please input the port value correctly.");
		return IOCTRL_NORMAL;
	}

	if(!Str2Hex(lpCmdObj->Parameter[2],&dwVal))  //Can not convert the value to hex.
	{
		PrintLine("Please input the value correctly.");
		return IOCTRL_NORMAL;
	}

	wPort = (WORD)(dwPort);

#ifdef __I386__
	__asm{    //Output the double value to port.
		push edx
		push eax
		mov dx,wPort
		mov eax,dwVal
		out dx,eax
		pop eax
		pop edx
	}
#else
#endif

	return IOCTRL_NORMAL;
}
示例#26
0
//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;
}
示例#27
0
//This function just calls PrintLine() 24 times because there are 24 rows in a page in MTX
void PrintPage(int fd)
{
    int i;

    putc('\n');
    for (i = 0; i < 24; i++)
    {
        PrintLine(fd);
    }
}
示例#28
0
/**
	@brief Thread main function that handles messages from the server
*/
void NetLoop()
{
	
	std::string msg;
	while (sock != INVALID_SOCKET)
	{
		GetServerMessage(sock,msg);
		PrintLine(msg);
	}
}
示例#29
0
//Com interface debugging application.
static DWORD ComDebug(__CMD_PARA_OBJ* pCmdParaObj)
{
	HANDLE hCom1 = NULL;
	CHAR   *pData = "Hello China V1.76";  //Data to write to COM1 interface.
	DWORD  dwWriteSize = 0;
	CHAR   buff[16];

	//Try to open COM1 interface to debugging.
	hCom1 = IOManager.CreateFile(
		(__COMMON_OBJECT*)&IOManager,
		"\\\\.\\COM1",
		0,
		0,
		NULL);
	if(NULL == hCom1)
	{
		PrintLine("ComDebug : Can not open COM1 interface.");
		goto __TERMINAL;
	}
	else
	{
		PrintLine("ComDebug: Open COM1 interface successfully.");
		if(IOManager.WriteFile((__COMMON_OBJECT*)&IOManager,
			hCom1,
			strlen(pData),
			pData,
			&dwWriteSize))
		{
			PrintLine("Write data to COM1 interface successfully.");
		}
		else
		{
			PrintLine("Can not write data to COM1 interface.");
		}
		PrintLine("ComDebug: Try to read data from COM interface...");
		if(!IOManager.ReadFile((__COMMON_OBJECT*)&IOManager,
			hCom1,
			1,
			(LPVOID)&buff[0],
			NULL))
		{
			PrintLine("Can not read COM interface.");
		}
		else
		{
			PrintLine("Read COM interface sucessfully.");
		}
	}

__TERMINAL:
	if(NULL != hCom1)
	{
		IOManager.CloseFile((__COMMON_OBJECT*)&IOManager,
			hCom1);
	}

	return SHELL_CMD_PARSER_SUCCESS;
}
示例#30
0
static DWORD cintperf(__CMD_PARA_OBJ* lpCmdObj)
{
	CHAR              strBuffer[18];
	DWORD             dwFlags;
	__PERF_RECORDER   Pr;

	__ENTER_CRITICAL_SECTION(NULL,dwFlags);
	Pr = TimerIntPr;
	__LEAVE_CRITICAL_SECTION(NULL,dwFlags);

	u64Hex2Str(&Pr.u64Result,strBuffer);
	PrintLine("Last clock circle counter : ");
	PrintLine(strBuffer);
	u64Hex2Str(&Pr.u64Max,strBuffer);
	PrintLine("Max clock circle counter : ");
	PrintLine(strBuffer);

	return SYS_DIAG_CMD_PARSER_SUCCESS;
}