assert-r0drv-os2.cpp revision 88774d64402bfd32254fcc5a81bda121c68300e6
5b281ba489ca18f0380d7efc7a5108b606cce449vboxsync * IPRT - Assertion Workers, Ring-0 Drivers, OS/2.
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net>
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * Permission is hereby granted, free of charge, to any person
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * obtaining a copy of this software and associated documentation
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * files (the "Software"), to deal in the Software without
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * restriction, including without limitation the rights to use,
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * copy, modify, merge, publish, distribute, sublicense, and/or sell
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * copies of the Software, and to permit persons to whom the
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * Software is furnished to do so, subject to the following
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * conditions:
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * The above copyright notice and this permission notice shall be
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * included in all copies or substantial portions of the Software.
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
e86794d5ed13ea3053cb8f12be80630236ef2943vboxsync * OTHER DEALINGS IN THE SOFTWARE.
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync/*******************************************************************************
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync* Header Files *
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync*******************************************************************************/
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync/*******************************************************************************
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync* Global Variables *
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync*******************************************************************************/
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync/** The last assert message. (in DATA16) */
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync/** The length of the last assert message. (in DATA16) */
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync/*******************************************************************************
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync* Internal Functions *
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync*******************************************************************************/
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsyncstatic DECLCALLBACK(size_t) rtR0Os2AssertOutputCB(void *pvArg, const char *pachChars, size_t cbChars);
a7aa94e0115a73841f34ebbfa00f63fa1904e51fvboxsyncvoid rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync "Expression: %s\n"
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync "Location : %s(%d) %s\n",
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync g_cchRTAssertMsg = RTStrPrintf(g_szRTAssertMsg, sizeof(g_szRTAssertMsg),
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync "\r\n!!Assertion Failed!!\r\n"
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync "Expression: %s\r\n"
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync "Location : %s(%d) %s\r\n",
a7aa94e0115a73841f34ebbfa00f63fa1904e51fvboxsyncvoid rtR0AssertNativeMsg2V(const char *pszFormat, va_list va)
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync cch += RTStrFormatV(rtR0Os2AssertOutputCB, &pch, NULL, NULL, pszFormat, va);
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync * Output callback.
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync * @returns number of bytes written.
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync * @param pvArg Pointer to a char pointer with the current output position.
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync * @param pachChars Pointer to an array of utf-8 characters.
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync * @param cbChars Number of bytes in the character array pointed to by pachChars.
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsyncstatic DECLCALLBACK(size_t) rtR0Os2AssertOutputCB(void *pvArg, const char *pachChars, size_t cbChars)
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync while (cbChars-- > 0)
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync if (pch + 1 >= &g_szRTAssertMsg[sizeof(g_szRTAssertMsg)])
d1c5a03c19683c719b94496bb998fde2f2e5e622vboxsync if (pch + 1 >= &g_szRTAssertMsg[sizeof(g_szRTAssertMsg)])
88774d64402bfd32254fcc5a81bda121c68300e6vboxsync/* RTR0AssertPanicSystem is implemented in RTR0AssertPanicSystem-r0drv-os2.asm */