VirtualBox

Ignore:
Timestamp:
Jul 14, 2011 2:37:23 PM (13 years ago)
Author:
vboxsync
Message:

SUPDrv: Use RTStrPrintfV instead of host snprintf in SUPR0Printf. (darwin+linux, todo: windows)

Location:
trunk/src/VBox/HostDrivers/Support
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp

    r37249 r37970  
    815815
    816816
    817 /** @todo move this to assembly where a simple "jmp printf" will to the trick. */
    818817RTDECL(int) SUPR0Printf(const char *pszFormat, ...)
    819818{
    820     va_list     args;
     819    va_list     va;
    821820    char        szMsg[512];
    822821
    823     va_start(args, pszFormat);
    824     vsnprintf(szMsg, sizeof(szMsg) - 1, pszFormat, args);
    825     va_end(args);
    826 
     822    va_start(va, pszFormat);
     823    RTStrPrintfV(szMsg, sizeof(szMsg) - 1, pszFormat, va);
     824    va_end(va);
    827825    szMsg[sizeof(szMsg) - 1] = '\0';
     826
    828827    printf("%s", szMsg);
    829828    return 0;
  • trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c

    r37249 r37970  
    782782RTDECL(int) SUPR0Printf(const char *pszFormat, ...)
    783783{
    784 #if 1
    785     va_list args;
     784    va_list va;
    786785    char    szMsg[512];
    787786
    788     va_start(args, pszFormat);
    789     vsnprintf(szMsg, sizeof(szMsg) - 1, pszFormat, args);
     787    va_start(va, pszFormat);
     788    SUPR0Printf(szMsg, sizeof(szMsg) - 1, pszFormat, va);
     789    va_end(va);
    790790    szMsg[sizeof(szMsg) - 1] = '\0';
     791
    791792    printk("%s", szMsg);
    792     va_end(args);
    793 #else
    794     /* forward to printf - needs some more GCC hacking to fix ebp... */
    795     __asm__ __volatile__ ("mov %0, %esp\n\t"
    796                           "jmp %1\n\t",
    797                           :: "r" ((uintptr_t)&pszFormat - 4),
    798                              "m" (printk));
    799 #endif
    800793    return 0;
    801794}
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