thread-r0drv.cpp revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
/* $Id$ */
/** @file
* InnoTek Portable Runtime - Threads, Ring-0 Driver, Common Bits.
*/
/*
* Copyright (C) 2006 InnoTek Systemberatung GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP RTLOGGROUP_THREAD
#include "r0drv/thread-r0drv.h"
/* In ring-0 RTTHREAD == RTNATIVETHREAD. */
{
return (RTNATIVETHREAD)RTThreadSelf();
}
{
return (RTNATIVETHREAD)Thread;
}
{
return (RTTHREAD)NativeThread;
}
/**
* Checks that the give thread type is valid for a ring-0 context.
*
* @returns true if it's valid, otherwise false is returned.
* @param enmType The thread type.
*/
{
switch (enmType)
{
case RTTHREADTYPE_EMULATION:
case RTTHREADTYPE_DEFAULT:
case RTTHREADTYPE_MSG_PUMP:
case RTTHREADTYPE_IO:
case RTTHREADTYPE_TIMER:
return true;
default:
return false;
}
}
{
/*
* Validate input.
*/
AssertMsgReturn(RTThreadSelf() == Thread, ("%RTthrd != %RTthrd\n", RTThreadSelf(), Thread), VERR_INVALID_HANDLE);
/*
* Call the native function to do the actual job.
*/
}
/**
* Common thread wrapper function.
*
* This will adjust the priority and invoke the IPRT thread function.
*
* @param pArgs Pointer to the argument package.
* @param NativeThread The native thread handle.
*/
{
/*
* Set thread priority and invoke the thread function.
*/
}
{
LogFlow(("RTThreadCreate: pThread=%p pfnThread=%p pvUser=%p cbStack=%#x enmType=%d fFlags=%#x pszName=%p:{%s}\n",
/*
* Validate input.
*/
AssertMsgReturn(cbStack == 0, ("cbStack=%#x - only default (0) is allowed for Ring-0!\n", cbStack), VERR_INVALID_PARAMETER);
/*
* Allocate thread argument.
*/
if (!pArgs)
return VERR_NO_TMP_MEMORY;
if (RT_SUCCESS(rc))
{
if (pThread)
return VINF_SUCCESS;
}
return rc;
}