- Timestamp:
- Oct 16, 2018 3:00:58 AM (6 years ago)
- Location:
- trunk/src/VBox/Runtime/testcase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstLdr-4.cpp
r74654 r74859 40 40 #include <iprt/string.h> 41 41 42 #include <VBox/sup.h> 43 44 45 /********************************************************************************************************************************* 46 * Global Variables * 47 *********************************************************************************************************************************/ 48 static SUPGLOBALINFOPAGE g_MyGip = { SUPGLOBALINFOPAGE_MAGIC, SUPGLOBALINFOPAGE_VERSION, SUPGIPMODE_INVARIANT_TSC, 42 }; 49 static PSUPGLOBALINFOPAGE g_pMyGip = &g_MyGip; 42 50 43 51 extern "C" DECLEXPORT(int) DisasmTest1(void); 52 53 54 static DECLCALLBACK(int) testEnumSegment(RTLDRMOD hLdrMod, PCRTLDRSEG pSeg, void *pvUser) 55 { 56 uint32_t *piSeg = (uint32_t *)pvUser; 57 RTPrintf(" Seg#%02u: %RTptr LB %RTptr %s\n" 58 " link=%RTptr LB %RTptr align=%RTptr fProt=%#x offFile=%RTfoff\n" 59 , *piSeg, pSeg->RVA, pSeg->cbMapped, pSeg->pszName, 60 pSeg->LinkAddress, pSeg->cb, pSeg->Alignment, pSeg->fProt, pSeg->offFile); 61 *piSeg += 1; 62 RT_NOREF(hLdrMod); 63 return VINF_SUCCESS; 64 } 44 65 45 66 … … 80 101 else if (!strcmp(pszSymbol, "MyPrintf") || !strcmp(pszSymbol, "_MyPrintf")) 81 102 *pValue = (uintptr_t)RTPrintf; 103 else if (!strcmp(pszSymbol, "SUPR0Printf") || !strcmp(pszSymbol, "_SUPR0Printf")) 104 *pValue = (uintptr_t)RTPrintf; 82 105 else if (!strcmp(pszSymbol, "SomeImportFunction") || !strcmp(pszSymbol, "_SomeImportFunction")) 83 106 *pValue = (uintptr_t)0; 107 else if (!strcmp(pszSymbol, "g_pSUPGlobalInfoPage") || !strcmp(pszSymbol, "_g_pSUPGlobalInfoPage")) 108 *pValue = (uintptr_t)&g_pMyGip; 109 else if (!strcmp(pszSymbol, "g_SUPGlobalInfoPage") || !strcmp(pszSymbol, "_g_SUPGlobalInfoPage")) 110 *pValue = (uintptr_t)&g_MyGip; 84 111 else 85 112 { … … 189 216 DECLCALLBACKPTR(int, pfnDisasmTest1)(void) = (DECLCALLBACKPTR(int, RT_NOTHING)(void))(uintptr_t)Value; /* eeeh. */ 190 217 RTPrintf("tstLdr-4: pfnDisasmTest1=%p / add-symbol-file %s %#x\n", pfnDisasmTest1, pszFilename, aLoads[i].pvBits); 218 uint32_t iSeg = 0; 219 RTLdrEnumSegments(aLoads[i].hLdrMod, testEnumSegment, &iSeg); 191 220 192 221 /* call the test function. */ -
trunk/src/VBox/Runtime/testcase/tstLdrDisasmTest.cpp
r69111 r74859 37 37 #include <VBox/dis.h> 38 38 #include <VBox/disopcode.h> 39 #include <VBox/sup.h> 39 40 #include <iprt/string.h> 40 41 41 #if defined(IN_RING0) && !defined(RT_OS_WINDOWS) /* Too lazy to make import libs. */ 42 extern "C" DECLIMPORT(int) MyPrintf(const char *pszFormat, ...); 43 # define MY_PRINTF(a) MyPrintf a 42 #if defined(IN_RING0) 43 # define MY_PRINTF(a) SUPR0Printf a 44 44 #else 45 45 # define MY_PRINTF(a) do {} while (0) … … 116 116 MY_PRINTF(("DisasmTest1: %p\n", &DisasmTest1)); 117 117 118 #if defined(IN_RING0) 119 MY_PRINTF(("GIP: g_pSUPGlobalInfoPage=%p\n", g_pSUPGlobalInfoPage)); 120 MY_PRINTF(("GIP: magic=%#x version=%#x mode=%d cCpus=%d\n", g_pSUPGlobalInfoPage->u32Magic, g_pSUPGlobalInfoPage->u32Version, 121 g_pSUPGlobalInfoPage->u32Mode, g_pSUPGlobalInfoPage->cCpus)); 122 if (g_pSUPGlobalInfoPage->u32Magic != SUPGLOBALINFOPAGE_MAGIC) 123 return 0xc001; 124 if (g_pSUPGlobalInfoPage->u32Version != SUPGLOBALINFOPAGE_VERSION) 125 return 0xc002; 126 if (g_pSUPGlobalInfoPage->u32Mode != SUPGIPMODE_INVARIANT_TSC) 127 return 0xc003; 128 if (g_pSUPGlobalInfoPage->cCpus != 42) 129 return 0xc004; 130 #endif 131 118 132 memset(&Cpu, 0, sizeof(Cpu)); 119 133
Note:
See TracChangeset
for help on using the changeset viewer.