~ubuntu-branches/ubuntu/vivid/virtualbox-ose/vivid

« back to all changes in this revision

Viewing changes to src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.c

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2010-03-11 17:16:37 UTC
  • mfrom: (0.3.4 upstream) (0.4.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100311171637-43z64ia3ccpj8vqn
Tags: 3.1.4-dfsg-2ubuntu1
* Merge from Debian unstable (LP: #528561), remaining changes:
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
  - Replace *-source packages with transitional packages for *-dkms
* Fix crash in vboxvideo_drm with kernel 2.6.33 / backported drm code
  (LP: #535297)
* Add a list of linux-headers packages to the apport hook
* Update debian/patches/u02-lp-integration.dpatch with a
  DEP-3 compliant header
* Add ${misc:Depends} to virtualbox-ose-source and virtualbox-ose-guest-source
  Depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: VBoxDebugLib.c $ */
 
2
/** @file
 
3
 * VBoxDebugLib.c - Debug logging and assertions support routines using DevEFI.
 
4
 */
 
5
 
 
6
/*
 
7
 * Copyright (C) 2009-2010 Sun Microsystems, Inc.
 
8
 *
 
9
 * This file is part of VirtualBox Open Source Edition (OSE), as
 
10
 * available from http://www.virtualbox.org. This file is free software;
 
11
 * you can redistribute it and/or modify it under the terms of the GNU
 
12
 * General Public License (GPL) as published by the Free Software
 
13
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 
14
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 
15
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 
16
 *
 
17
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
 
18
 * Clara, CA 95054 USA or visit http://www.sun.com if you need
 
19
 * additional information or have any questions.
 
20
 */
 
21
 
 
22
/*******************************************************************************
 
23
*   Header Files                                                               *
 
24
*******************************************************************************/
 
25
#include <Base.h>
 
26
#include <Library/PrintLib.h>
 
27
#include <Library/DebugLib.h>
 
28
 
 
29
#include "VBoxDebugLib.h"
 
30
#include "DevEFI.h"
 
31
 
 
32
 
 
33
 
 
34
VOID EFIAPI
 
35
DebugPrint(IN UINTN ErrorLevel, IN CONST CHAR8 *Format, ...)
 
36
{
 
37
    CHAR8       szBuf[256];
 
38
    VA_LIST     va;
 
39
    UINTN       cch;
 
40
    RTCCUINTREG SavedFlags;
 
41
 
 
42
    /* No pool noise, please. */
 
43
    if (ErrorLevel == DEBUG_POOL)
 
44
        return;
 
45
 
 
46
    VA_START(va, Format);
 
47
    cch = AsciiVSPrint(szBuf, sizeof(szBuf), Format, va);
 
48
    VA_END(va);
 
49
 
 
50
    /* make sure it's terminated and doesn't end with a newline */
 
51
    if (cch >= sizeof(szBuf))
 
52
        cch = sizeof(szBuf) - 1;
 
53
    while (cch > 0 && (szBuf[cch - 1] == '\n' || szBuf[cch - 1] == '\r'))
 
54
        cch--;
 
55
    szBuf[cch] = '\0';
 
56
 
 
57
    SavedFlags = ASMIntDisableFlags();
 
58
 
 
59
    VBoxPrintString("dbg/");
 
60
    VBoxPrintHex(ErrorLevel, sizeof(ErrorLevel));
 
61
    VBoxPrintChar(' ');
 
62
    VBoxPrintString(szBuf);
 
63
    VBoxPrintChar('\n');
 
64
 
 
65
    ASMSetFlags(SavedFlags);
 
66
 
 
67
}
 
68
 
 
69
 
 
70
VOID EFIAPI
 
71
DebugAssert(IN CONST CHAR8 *FileName, IN UINTN LineNumber, IN CONST CHAR8 *Description)
 
72
{
 
73
    RTCCUINTREG SavedFlags = ASMIntDisableFlags();
 
74
 
 
75
    VBoxPrintString("EFI Assertion failed! File=");
 
76
    VBoxPrintString(FileName ? FileName : "<NULL>");
 
77
    VBoxPrintString(" line=0x");
 
78
    VBoxPrintHex(LineNumber, sizeof(LineNumber));
 
79
    VBoxPrintString("\nDescription: ");
 
80
    VBoxPrintString(Description ? Description : "<NULL>");
 
81
 
 
82
    ASMOutU8(EFI_PANIC_PORT, 2); /** @todo fix this. */
 
83
 
 
84
    ASMSetFlags(SavedFlags);
 
85
}
 
86
 
 
87
 
 
88
VOID * EFIAPI
 
89
DebugClearMemory(OUT VOID *Buffer, IN UINTN Length)
 
90
{
 
91
    return Buffer;
 
92
}
 
93
 
 
94
 
 
95
BOOLEAN EFIAPI
 
96
DebugAssertEnabled(VOID)
 
97
{
 
98
    return TRUE;
 
99
}
 
100
 
 
101
 
 
102
BOOLEAN EFIAPI
 
103
DebugPrintEnabled(VOID)
 
104
{
 
105
    /** @todo some PCD for this so we can disable it in release builds. */
 
106
    return TRUE;
 
107
}
 
108
 
 
109
 
 
110
BOOLEAN EFIAPI
 
111
DebugCodeEnabled(VOID)
 
112
{
 
113
    /** @todo ditto */
 
114
    return TRUE;
 
115
}
 
116
 
 
117
 
 
118
BOOLEAN EFIAPI
 
119
DebugClearMemoryEnabled(VOID)
 
120
{
 
121
    return FALSE;
 
122
}
 
123