VirtualBox

Ignore:
Timestamp:
Sep 27, 2013 11:03:53 AM (11 years ago)
Author:
vboxsync
Message:

EFI: EFI image load events, EFI debug points, always disabled frame-pointer optimizations on MSFT. Some cleanups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.c

    r48674 r48727  
    7979}
    8080
     81/**
     82 * Adds a character to the panic message.
     83 *
     84 * @param   ch          The ASCII char to add.
     85 */
     86static void
     87VBoxPanicMsgChar(int ch)
     88{
     89    ASMOutU16(EFI_PANIC_PORT, EFI_PANIC_CMD_MSG_FROM_CHAR(ch));
     90}
     91
     92/**
     93 * Adds a string to the panic message.
     94 *
     95 * @param   pszString   The string to add.
     96 */
     97static void
     98VBoxPanicMsgString(const char *pszString)
     99{
     100    char ch;
     101    while ((ch = *pszString++) != '\0')
     102        VBoxPanicMsgChar(ch);
     103}
     104
     105/**
     106 * Adds a unsigned decimal number to the panic message.
     107 *
     108 * @param   uValue      The value.
     109 */
     110static void
     111VBoxPanicMsgDecimalU32(uint32_t uValue)
     112{
     113    char     szTmp[32];
     114    unsigned off = sizeof(szTmp) - 1;
     115
     116    szTmp[off] = '\0';
     117    do
     118    {
     119        char chDigit = uValue % 10;
     120        uValue /= 10;
     121        szTmp[--off] = chDigit + '0';
     122    } while (uValue != 0 && off > 0);
     123
     124    VBoxPanicMsgString(&szTmp[off]);
     125}
    81126
    82127VOID EFIAPI
     
    85130    RTCCUINTREG SavedFlags = ASMIntDisableFlags();
    86131
    87     VBoxPrintString("EFI Assertion failed! File=");
    88     VBoxPrintString(FileName ? FileName : "<NULL>");
    89     VBoxPrintString(" line=0x");
    90     VBoxPrintHex(LineNumber, sizeof(LineNumber));
    91     VBoxPrintString("\nDescription: ");
    92     VBoxPrintString(Description ? Description : "<NULL>");
    93 
    94     ASMOutU8(EFI_PANIC_PORT, 2); /** @todo fix this. */
     132    ASMOutU8(EFI_PANIC_PORT, EFI_PANIC_CMD_START_MSG);
     133    VBoxPanicMsgString("EFI Assertion failed!"
     134                       "\nFile:  ");
     135    VBoxPanicMsgString(FileName ? FileName : "<NULL>");
     136    VBoxPanicMsgString("\nLine:  ");
     137    VBoxPanicMsgDecimalU32((uint32_t)LineNumber);
     138    VBoxPanicMsgString("\nEDescription: ");
     139    VBoxPanicMsgString(Description ? Description : "<NULL>");
     140    ASMOutU8(EFI_PANIC_PORT, EFI_PANIC_CMD_END_MSG);
    95141
    96142    ASMSetFlags(SavedFlags);
    97143}
    98144
    99 CHAR16* VBoxDebugDevicePath2Str(IN EFI_DEVICE_PATH_PROTOCOL  *pDevicePath)
     145CHAR16 *VBoxDebugDevicePath2Str(IN EFI_DEVICE_PATH_PROTOCOL  *pDevicePath)
    100146{
    101147#if 0
     
    116162}
    117163
    118 CHAR16* VBoxDebugHandleDevicePath2Str(IN EFI_HANDLE hHandle)
     164CHAR16 *VBoxDebugHandleDevicePath2Str(IN EFI_HANDLE hHandle)
    119165{
    120166#if 0
     
    143189#endif
    144190}
    145 CHAR16* VBoxDebugPrintDevicePath(IN EFI_DEVICE_PATH_PROTOCOL  *pDevicePath)
     191CHAR16 *VBoxDebugPrintDevicePath(IN EFI_DEVICE_PATH_PROTOCOL  *pDevicePath)
    146192{
    147193#if 0
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette