- Timestamp:
- Jul 14, 2011 1:20:55 PM (13 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/linux/files_vboxguest
r37350 r37964 53 53 ${PATH_ROOT}/include/iprt/types.h=>include/iprt/types.h \ 54 54 ${PATH_ROOT}/include/iprt/uni.h=>include/iprt/uni.h \ 55 ${PATH_ROOT}/include/iprt/x86.h=>include/iprt/x86.h \ 55 56 ${PATH_ROOT}/include/VBox/cdefs.h=>include/VBox/cdefs.h \ 56 57 ${PATH_ROOT}/include/VBox/err.h=>include/VBox/err.h \ -
trunk/src/VBox/HostDrivers/VBoxNetAdp/linux/files_vboxnetadp
r36190 r37964 51 51 ${PATH_ROOT}/include/iprt/uni.h=>include/iprt/uni.h \ 52 52 ${PATH_ROOT}/include/iprt/uuid.h=>include/iprt/uuid.h \ 53 ${PATH_ROOT}/include/iprt/x86.h=>include/iprt/x86.h \ 53 54 ${PATH_ROOT}/include/iprt/nocrt/limits.h=>include/iprt/nocrt/limits.h \ 54 55 ${PATH_ROOT}/include/VBox/cdefs.h=>include/VBox/cdefs.h \ -
trunk/src/VBox/Runtime/common/string/strformatrt.cpp
r36555 r37964 45 45 #include <iprt/net.h> 46 46 #include <iprt/path.h> 47 #define STRFORMAT_WITH_X86 48 #ifdef STRFORMAT_WITH_X86 49 # include <iprt/x86.h> 50 #endif 47 51 #include "internal/string.h" 48 52 … … 68 72 { 69 73 const char *pszFormatOrg = *ppszFormat; 70 char ch = *(*ppszFormat)++; 74 char ch = *(*ppszFormat)++; 75 size_t cch; 76 char szBuf[80]; 77 71 78 if (ch == 'R') 72 79 { … … 206 213 PCRTUUID pUuid; 207 214 } u; 208 char szBuf[80];209 unsigned cch;210 215 211 216 AssertMsg(!chArgSize, ("Not argument size '%c' for RT types! '%.10s'\n", chArgSize, pszFormatOrg)); … … 646 651 case 'd': 647 652 { 648 size_t cch = 0;649 653 int off = 0; 654 cch = 0; 650 655 651 656 if (cchWidth <= 0) … … 684 689 if (cchPrecision-- > 0) 685 690 { 686 size_tcch = RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%02x", *pu8++);691 cch = RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%02x", *pu8++); 687 692 for (; cchPrecision > 0; cchPrecision--, pu8++) 688 693 cch += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, " %02x", *pu8); … … 986 991 #endif /* IN_RING3 */ 987 992 993 994 /* 995 * Groups 6 - CPU Architecture Register Formatters. 996 * "%RAarch[reg]" 997 */ 998 case 'A': 999 { 1000 char const * const pszArch = *ppszFormat; 1001 const char *pszReg = pszArch; 1002 size_t cchOutput = 0; 1003 int cPrinted = 0; 1004 size_t cchReg; 1005 1006 /* Parse out the */ 1007 while ((ch = *pszReg++) && ch != '[') 1008 { /* nothing */ } 1009 AssertMsgBreak(ch == '[', ("Malformed IPRT architecture register format type '%.10s'!\n", pszFormatOrg)); 1010 1011 cchReg = 0; 1012 while ((ch = pszReg[cchReg]) && ch != ']') 1013 cchReg++; 1014 AssertMsgBreak(ch == ']', ("Malformed IPRT architecture register format type '%.10s'!\n", pszFormatOrg)); 1015 1016 *ppszFormat = &pszReg[cchReg + 1]; 1017 1018 1019 #define REG_EQUALS(a_szReg) (sizeof(a_szReg) - 1 == cchReg && !strncmp(a_szReg, pszReg, sizeof(a_szReg) - 1)) 1020 #define REG_OUT_BIT(a_uVal, a_fBitMask, a_szName) \ 1021 do { \ 1022 if ((a_uVal) & (a_fBitMask)) \ 1023 { \ 1024 if (!cPrinted) \ 1025 cchOutput += pfnOutput(pvArgOutput, "{" a_szName, sizeof(a_szName)); \ 1026 else \ 1027 cchOutput += pfnOutput(pvArgOutput, "," a_szName, sizeof(a_szName)); \ 1028 (a_uVal) &= ~(a_fBitMask); \ 1029 } \ 1030 } while (0) 1031 #define REG_OUT_CLOSE(a_uVal) \ 1032 do { \ 1033 if ((a_uVal)) \ 1034 { \ 1035 cchOutput += pfnOutput(pvArgOutput, cPrinted ? "{unkn=" : ",unkn=", 6); \ 1036 cch = RTStrFormatNumber(&szBuf[0], (a_uVal), 16, 8, -1, fFlags); \ 1037 cchOutput += pfnOutput(pvArgOutput, szBuf, cch); \ 1038 cPrinted++; \ 1039 } \ 1040 if (cPrinted) \ 1041 cchOutput += pfnOutput(pvArgOutput, "}", 1); \ 1042 } while (0) 1043 1044 1045 if (0) 1046 { /* dummy */ } 1047 #ifdef STRFORMAT_WITH_X86 1048 /* 1049 * X86 & AMD64. 1050 */ 1051 else if ( pszReg - pszArch == 3 + 1 1052 && pszArch[0] == 'x' 1053 && pszArch[1] == '8' 1054 && pszArch[2] == '6') 1055 { 1056 if (REG_EQUALS("cr0")) 1057 { 1058 uint64_t cr0 = va_arg(*pArgs, uint64_t); 1059 fFlags |= RTSTR_F_64BIT; 1060 cch = RTStrFormatNumber(&szBuf[0], cr0, 16, 8, -1, fFlags); 1061 cchOutput += pfnOutput(pvArgOutput, szBuf, cch); 1062 REG_OUT_BIT(cr0, X86_CR0_PE, "PE"); 1063 REG_OUT_BIT(cr0, X86_CR0_MP, "MP"); 1064 REG_OUT_BIT(cr0, X86_CR0_EM, "EM"); 1065 REG_OUT_BIT(cr0, X86_CR0_TS, "DE"); 1066 REG_OUT_BIT(cr0, X86_CR0_ET, "ET"); 1067 REG_OUT_BIT(cr0, X86_CR0_NE, "NE"); 1068 REG_OUT_BIT(cr0, X86_CR0_WP, "WP"); 1069 REG_OUT_BIT(cr0, X86_CR0_AM, "AM"); 1070 REG_OUT_BIT(cr0, X86_CR0_NW, "NW"); 1071 REG_OUT_BIT(cr0, X86_CR0_CD, "CD"); 1072 REG_OUT_BIT(cr0, X86_CR0_PG, "PG"); 1073 REG_OUT_CLOSE(cr0); 1074 } 1075 else if (REG_EQUALS("cr4")) 1076 { 1077 uint64_t cr4 = va_arg(*pArgs, uint64_t); 1078 fFlags |= RTSTR_F_64BIT; 1079 cch = RTStrFormatNumber(&szBuf[0], cr4, 16, 8, -1, fFlags); 1080 cchOutput += pfnOutput(pvArgOutput, szBuf, cch); 1081 REG_OUT_BIT(cr4, X86_CR4_VME, "VME"); 1082 REG_OUT_BIT(cr4, X86_CR4_PVI, "PVI"); 1083 REG_OUT_BIT(cr4, X86_CR4_TSD, "TSD"); 1084 REG_OUT_BIT(cr4, X86_CR4_DE, "DE"); 1085 REG_OUT_BIT(cr4, X86_CR4_PSE, "PSE"); 1086 REG_OUT_BIT(cr4, X86_CR4_PAE, "PAE"); 1087 REG_OUT_BIT(cr4, X86_CR4_MCE, "MCE"); 1088 REG_OUT_BIT(cr4, X86_CR4_PGE, "PGE"); 1089 REG_OUT_BIT(cr4, X86_CR4_PCE, "PCE"); 1090 REG_OUT_BIT(cr4, X86_CR4_OSFSXR, "OSFSXR"); 1091 REG_OUT_BIT(cr4, X86_CR4_OSXMMEEXCPT, "OSXMMEEXCPT"); 1092 REG_OUT_BIT(cr4, X86_CR4_VMXE, "VMXE"); 1093 REG_OUT_BIT(cr4, X86_CR4_SMXE, "SMXE"); 1094 REG_OUT_BIT(cr4, X86_CR4_PCIDE, "PCIDE"); 1095 REG_OUT_BIT(cr4, X86_CR4_OSXSAVE, "OSXSAVE"); 1096 REG_OUT_BIT(cr4, X86_CR4_SMEP, "SMPE"); 1097 REG_OUT_CLOSE(cr4); 1098 } 1099 else 1100 AssertMsgFailed(("Unknown x86 register specified in '%.10s'!\n", pszFormatOrg)); 1101 } 1102 #endif 1103 else 1104 AssertMsgFailed(("Unknown architecture specified in '%.10s'!\n", pszFormatOrg)); 1105 #undef REG_OUT_BIT 1106 #undef REG_OUT_CLOSE 1107 #undef REG_EQUALS 1108 return cchOutput; 1109 } 1110 988 1111 /* 989 1112 * Invalid/Unknown. Bitch about it.
Note:
See TracChangeset
for help on using the changeset viewer.