d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync/* $Id$ */
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync/** @file
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync * IPRT - Assertion Workers, Ring-0 Drivers, Linux.
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync */
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync/*
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync * Copyright (C) 2007-2011 Oracle Corporation
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync *
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync * available from http://www.virtualbox.org. This file is free software;
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync * you can redistribute it and/or modify it under the terms of the GNU
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync * General Public License (GPL) as published by the Free Software
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync *
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync * The contents of this file may alternatively be used under the terms
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync * of the Common Development and Distribution License Version 1.0
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync * VirtualBox OSE distribution, in which case the provisions of the
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync * CDDL are applicable instead of those of the GPL.
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync *
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync * You may elect to license modified versions of this file under the
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync * terms and conditions of either the GPL or the CDDL or both.
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync */
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync/*******************************************************************************
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync* Header Files *
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync*******************************************************************************/
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync#include "the-linux-kernel.h"
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsync#include "internal/iprt.h"
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync#include <iprt/assert.h>
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync#include <iprt/log.h>
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync#include <iprt/string.h>
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync#include <iprt/stdarg.h>
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync#include <iprt/asm.h>
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync
a7aa94e0115a73841f34ebbfa00f63fa1904e51fvboxsync#include "internal/assert.h"
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsyncDECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync{
6fffd38c4ef918b4aaa702d0768422e0be119ba7vboxsync printk(KERN_EMERG
6fffd38c4ef918b4aaa702d0768422e0be119ba7vboxsync "\r\n!!Assertion Failed!!\r\n"
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync "Expression: %s\r\n"
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync "Location : %s(%d) %s\r\n",
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync pszExpr, pszFile, uLine, pszFunction);
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync}
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsyncDECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync{
a7aa94e0115a73841f34ebbfa00f63fa1904e51fvboxsync char szMsg[256];
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync RTStrPrintfV(szMsg, sizeof(szMsg) - 1, pszFormat, va);
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync szMsg[sizeof(szMsg) - 1] = '\0';
6fffd38c4ef918b4aaa702d0768422e0be119ba7vboxsync printk(KERN_EMERG "%s", szMsg);
0e5731ab59b4ecead38375f26eeea698f00b19fdvboxsync
0e5731ab59b4ecead38375f26eeea698f00b19fdvboxsync NOREF(fInitial);
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync}
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsyncRTR0DECL(void) RTR0AssertPanicSystem(void)
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync{
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync panic("%s%s", g_szRTAssertMsg1, g_szRTAssertMsg2);
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync}
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsyncRT_EXPORT_SYMBOL(RTR0AssertPanicSystem);
d606b96aa8a4be8f7d2da410f982889804c27b92vboxsync