assert-r0drv-solaris.c revision a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fc
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync/* $Id$ */
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync/** @file
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * innotek Portable Runtime - Assertion Workers, Ring-0 Drivers, Solaris.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync */
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync/*
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * Copyright (C) 2006-2007 innotek GmbH
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync *
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * available from http://www.virtualbox.org. This file is free software;
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync *
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * The contents of this file may alternatively be used under the terms
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * of the Common Development and Distribution License Version 1.0
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution, in which case the provisions of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * CDDL are applicable instead of those of the GPL.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync *
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * You may elect to license modified versions of this file under the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * terms and conditions of either the GPL or the CDDL or both.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync */
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync/*******************************************************************************
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync* Header Files *
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync*******************************************************************************/
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync#include "the-solaris-kernel.h"
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync#include <iprt/assert.h>
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync#include <iprt/log.h>
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync#include <iprt/string.h>
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync#include <iprt/stdarg.h>
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsyncRTDECL(void) AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync{
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync#ifdef IN_GUEST_R0
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync RTLogBackdoorPrintf("\n!!Assertion Failed!!\n"
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync "Expression: %s\n"
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync "Location : %s(%d) %s\n",
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync pszExpr, pszFile, uLine, pszFunction);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync#endif
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
089c21a647af46044cad04a78cfdcfae814d2105vboxsync uprintf("\r\n!!Assertion Failed!!\r\n"
089c21a647af46044cad04a78cfdcfae814d2105vboxsync "Expression: %s\r\n"
089c21a647af46044cad04a78cfdcfae814d2105vboxsync "Location : %s(%d) %s\r\n",
089c21a647af46044cad04a78cfdcfae814d2105vboxsync pszExpr, pszFile, uLine, pszFunction);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync}
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsyncRTDECL(void) AssertMsg2(const char *pszFormat, ...)
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync{
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync va_list va;
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync char szMsg[256];
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync#ifdef IN_GUEST_R0
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync va_start(va, pszFormat);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync RTLogBackdoorPrintfV(pszFormat, va);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync va_end(va);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync#endif
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync va_start(va, pszFormat);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync RTStrPrintfV(szMsg, sizeof(szMsg) - 1, pszFormat, va);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync szMsg[sizeof(szMsg) - 1] = '\0';
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync va_end(va);
089c21a647af46044cad04a78cfdcfae814d2105vboxsync uprintf("%s", szMsg);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync}
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync