Changeset 915 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Feb 15, 2007 1:14:36 AM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 18643
- Location:
- trunk/src/VBox/Runtime/testcase
- Files:
-
- 1 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/Makefile
r894 r915 29 29 tstLdr-2 \ 30 30 tstLdr-3 \ 31 tstLdr-4 \ 31 32 tstLdrLoad \ 32 33 tstAvl \ … … 64 65 PROGRAMS.l4 = \ 65 66 tstIoCtl 66 SYSMODS = tstLdrObj 67 SYSMODS = \ 68 tstLdrObj \ 69 tstLdrObjR0 67 70 # tstSems 68 71 endif # VBOX_WITH_TESTCASES … … 128 131 tstLdrObj_SYSSUFF = .gc 129 132 tstLdrObj_SOURCES = tstLdrObj.cpp 130 tstLdrObj_DEFS = IN_DIS_GC IN_RT_GC 133 tstLdrObj_DEFS = IN_DIS_GC IN_RT_GC DIS_CORE_ONLY 131 134 ifeq ($(VBOX_LDR_FMT32),elf) 132 135 tstLdrObj_DEFS += VBOX_SOME_IMPORT_FUNCTION … … 150 153 endif 151 154 155 152 156 tstLdr-3_SOURCES = tstLdr-3.cpp 153 157 tstLdr-3_DEFS = IN_DIS_R3 … … 155 159 $(PATH_LIB)/DisasmR3$(VBOX_SUFF_LIB) 156 160 161 tstLdrObjR0_TEMPLATE = VBOXR0 162 tstLdrObjR0_INST = $(INST_TESTCASE) 163 tstLdrObjR0_SYSSUFF = .r0 164 tstLdrObjR0_SOURCES = tstLdrObjR0.cpp tstLdrDisasmTest.cpp 165 tstLdrObjR0_DEFS = IN_DIS_R0 IN_RT_R0 DIS_CORE_ONLY 166 ifeq ($(VBOX_LDR_FMT32),elf) 167 tstLdrObjR0_DEFS += VBOX_SOME_IMPORT_FUNCTION 168 endif 169 tstLdrObjR0_LIBS = \ 170 $(PATH_LIB)/DisasmR0$(VBOX_SUFF_LIB) \ 171 $(PATH_LIB)/RuntimeR0$(VBOX_SUFF_LIB) 172 ifeq ($(VBOX_LDR_FMT),pe) 173 tstLdrObjR0_LDFLAGS = -Entry:Entrypoint 174 tstLdrObjR0_LIBS += \ 175 $(PATH_LIB)/SUPR0$(VBOX_SUFF_LIB) 176 endif 177 ifeq ($(VBOX_LDR_FMT),elf) 178 tstLdrObjR0_LDFLAGS = -entry=Entrypoint 179 endif 180 ifeq ($(VBOX_LDR_FMT),lx) 181 tstLdrObjR0_LIBS += \ 182 $(PATH_LIB)/SUPR0$(VBOX_SUFF_LIB) 183 endif 184 185 tstLdr-4_SOURCES = tstLdr-4.cpp tstLdrDisasmTest.cpp 186 tstLdr-4_DEFS = IN_DIS_R3 187 tstLdr-4_LIBS = \ 188 $(PATH_LIB)/DisasmR3$(VBOX_SUFF_LIB) 189 157 190 tstLdrLoad_SOURCES = tstLdrLoad.cpp 158 191 -
trunk/src/VBox/Runtime/testcase/tstLdr-4.cpp
r913 r915 1 1 /* $Id$ */ 2 2 /** @file 3 * InnoTek Portable Runtime - Testcase for parts of RTLdr*.3 * InnoTek Portable Runtime - Testcase for RTLdrOpen using ldrLdrObjR0.r0. 4 4 */ 5 5 … … 33 33 34 34 35 /******************************************************************************* 36 * Global Variables * 37 *******************************************************************************/ 38 /** If set, don't bitch when failing to resolve symbols. */ 39 static bool g_fDontBitchOnResolveFailure = false; 35 extern "C" DECLEXPORT(int) DisasmTest1(void); 36 40 37 41 38 /** … … 52 49 static DECLCALLBACK(int) testGetImport(RTLDRMOD hLdrMod, const char *pszModule, const char *pszSymbol, unsigned uSymbol, RTUINTPTR *pValue, void *pvUser) 53 50 { 54 /* check the name format and only permit certain names */ 55 *pValue = 0xabcdef0f; 51 if (!strcmp(pszSymbol, "AssertMsg1")) 52 *pValue = (uintptr_t)AssertMsg1; 53 else if (!strcmp(pszSymbol, "AssertMsg2")) 54 *pValue = (uintptr_t)AssertMsg2; 55 else if (!strcmp(pszSymbol, "RTLogDefaultInstance")) 56 *pValue = (uintptr_t)RTLogDefaultInstance; 57 else if (!strcmp(pszSymbol, "MyPrintf")) 58 *pValue = (uintptr_t)RTPrintf; 59 else 60 { 61 RTPrintf("tstLdr-4: Unexpected import '%s'!\n", pszSymbol); 62 return VERR_SYMBOL_NOT_FOUND; 63 } 56 64 return VINF_SUCCESS; 57 65 } … … 71 79 static int testLdrOne(const char *pszFilename) 72 80 { 73 int rcRet= 0;81 int cErrors = 0; 74 82 size_t cbImage = 0; 75 83 struct Load … … 77 85 RTLDRMOD hLdrMod; 78 86 void *pvBits; 79 RTUINTPTR Addr;80 87 char *pszName; 81 88 } aLoads[6] = 82 89 { 83 { NULL, NULL, 0xefefef00,"foo" },84 { NULL, NULL, 0x40404040,"bar" },85 { NULL, NULL, 0xefefef00,"foobar" },86 { NULL, NULL, 0xefefef00,"kLdr-foo" },87 { NULL, NULL, 0x40404040,"kLdr-bar" },88 { NULL, NULL, 0xefefef00,"kLdr-foobar" }90 { NULL, NULL, "foo" }, 91 { NULL, NULL, "bar" }, 92 { NULL, NULL, "foobar" }, 93 { NULL, NULL, "kLdr-foo" }, 94 { NULL, NULL, "kLdr-bar" }, 95 { NULL, NULL, "kLdr-foobar" } 89 96 }; 90 97 unsigned i; 98 int rc; 91 99 92 100 /* … … 95 103 for (i = 0; i < ELEMENTS(aLoads); i++) 96 104 { 97 int rc;98 105 if (!strncmp(aLoads[i].pszName, "kLdr-", sizeof("kLdr-") - 1)) 99 106 rc = RTLdrOpenkLdr(pszFilename, &aLoads[i].hLdrMod); … … 102 109 if (RT_FAILURE(rc)) 103 110 { 104 RTPrintf("tstLdr : Failed to open '%s'/%d, rc=%Rrc. aborting test.\n", pszFilename, i, rc);111 RTPrintf("tstLdr-4: Failed to open '%s'/%d, rc=%Rrc. aborting test.\n", pszFilename, i, rc); 105 112 Assert(aLoads[i].hLdrMod == NIL_RTLDRMOD); 106 rcRet++;113 cErrors++; 107 114 break; 108 115 } … … 112 119 if (cbImage && cb != cbImage) 113 120 { 114 RTPrintf("tstLdr : Size mismatch '%s'/%d. aborting test.\n", pszFilename, i);115 rcRet++;121 RTPrintf("tstLdr-4: Size mismatch '%s'/%d. aborting test.\n", pszFilename, i); 122 cErrors++; 116 123 break; 117 124 } … … 122 129 if (!aLoads[i].pvBits) 123 130 { 124 RTPrintf("tstLdr : Out of memory '%s'/%d cbImage=%d. aborting test.\n", pszFilename, i, cbImage);125 rcRet++;131 RTPrintf("tstLdr-4: Out of memory '%s'/%d cbImage=%d. aborting test.\n", pszFilename, i, cbImage); 132 cErrors++; 126 133 break; 127 134 } 128 135 129 136 /* Get the bits. */ 130 rc = RTLdrGetBits(aLoads[i].hLdrMod, aLoads[i].pvBits, aLoads[i].Addr, testGetImport, NULL);137 rc = RTLdrGetBits(aLoads[i].hLdrMod, aLoads[i].pvBits, (uintptr_t)aLoads[i].pvBits, testGetImport, NULL); 131 138 if (RT_FAILURE(rc)) 132 139 { 133 RTPrintf("tstLdr: Failed to get bits for '%s'/%d, rc=%Rrc. aborting test\n", pszFilename, i, rc); 134 rcRet++; 135 break; 136 } 137 } 138 139 /* 140 * Continue with the relocations and symbol resolving. 141 */ 142 if (!rcRet) 143 { 144 static RTUINTPTR aRels[] = 145 { 146 0xefefef00, /* same. */ 147 0x40404040, /* the other. */ 148 0xefefef00, /* back. */ 149 0x40404040, /* the other. */ 150 0xefefef00, /* back again. */ 151 0x77773420, /* somewhere entirely else. */ 152 0xf0000000, /* somewhere entirely else. */ 153 0x40404040, /* the other. */ 154 0xefefef00 /* back again. */ 155 }; 156 struct Symbols 157 { 158 /** The symbol offset. -1 indicates the first time. */ 159 unsigned off; 160 /** The symbol name. */ 161 const char *pszName; 162 } aSyms[] = 163 { 164 { ~0, "Entrypoint" }, 165 { ~0, "SomeExportFunction1" }, 166 { ~0, "SomeExportFunction2" }, 167 { ~0, "SomeExportFunction3" }, 168 { ~0, "SomeExportFunction4" }, 169 { ~0, "SomeExportFunction5" }, 170 { ~0, "SomeExportFunction5" }, 171 { ~0, "DISCoreOne" } 172 }; 173 174 unsigned iRel = 0; 175 for (;;) 176 { 177 /* Compare all which are at the same address. */ 178 for (i = 0; i < ELEMENTS(aLoads) - 1; i++) 179 { 180 for (unsigned j = i + 1; j < ELEMENTS(aLoads); j++) 181 { 182 if (aLoads[j].Addr == aLoads[i].Addr) 183 { 184 if (memcmp(aLoads[j].pvBits, aLoads[i].pvBits, cbImage)) 185 { 186 RTPrintf("tstLdr: Mismatch between load %d and %d. ('%s')\n", j, i, pszFilename); 187 const uint8_t *pu8J = (const uint8_t *)aLoads[j].pvBits; 188 const uint8_t *pu8I = (const uint8_t *)aLoads[i].pvBits; 189 for (uint32_t off = 0; off < cbImage; off++, pu8J++, pu8I++) 190 if (*pu8J != *pu8I) 191 RTPrintf(" %08x %02x != %02x\n", off, *pu8J, *pu8I); 192 rcRet++; 193 } 194 } 195 } 196 } 197 198 /* compare symbols. */ 199 for (i = 0; i < ELEMENTS(aLoads); i++) 200 { 201 for (unsigned iSym = 0; iSym < ELEMENTS(aSyms); iSym++) 202 { 203 RTUINTPTR Value; 204 int rc = RTLdrGetSymbolEx(aLoads[i].hLdrMod, aLoads[i].pvBits, aLoads[i].Addr, aSyms[iSym].pszName, &Value); 205 if (RT_SUCCESS(rc)) 206 { 207 unsigned off = Value - aLoads[i].Addr; 208 if (off < cbImage) 209 { 210 if (aSyms[iSym].off == ~0U) 211 aSyms[iSym].off = off; 212 else if (off != aSyms[iSym].off) 213 { 214 RTPrintf("tstLdr: Mismatching symbol '%s' in '%s'/%d. expected off=%d got %d\n", 215 aSyms[iSym].pszName, pszFilename, i, aSyms[iSym].off, off); 216 rcRet++; 217 } 218 } 219 else 220 { 221 RTPrintf("tstLdr: Invalid value for symbol '%s' in '%s'/%d. off=%#x Value=%#x\n", 222 aSyms[iSym].pszName, pszFilename, i, off, Value); 223 rcRet++; 224 } 225 } 226 else if (!g_fDontBitchOnResolveFailure) 227 { 228 RTPrintf("tstLdr: Failed to resolve symbol '%s' in '%s'/%d.\n", aSyms[iSym].pszName, pszFilename, i); 229 rcRet++; 230 } 231 } 232 } 233 234 if (iRel >= ELEMENTS(aRels)) 235 break; 236 237 /* relocate it stuff. */ 238 int rc = RTLdrRelocate(aLoads[2].hLdrMod, aLoads[2].pvBits, aRels[iRel], aLoads[2].Addr, testGetImport, NULL); 140 RTPrintf("tstLdr-4: Failed to get bits for '%s'/%d, rc=%Rrc. aborting test\n", pszFilename, i, rc); 141 cErrors++; 142 break; 143 } 144 } 145 146 /* 147 * Execute the code. 148 */ 149 if (!cErrors) 150 { 151 for (i = 0; i < ELEMENTS(aLoads); i += 1) 152 { 153 /* get the pointer. */ 154 RTUINTPTR Value; 155 rc = RTLdrGetSymbolEx(aLoads[i].hLdrMod, aLoads[i].pvBits, (uintptr_t)aLoads[i].pvBits, "DisasmTest1", &Value); 239 156 if (RT_FAILURE(rc)) 240 157 { 241 RTPrintf("tstLdr: Relocate of '%s' from %#x to %#x failed, rc=%Rrc. Aborting test.\n", 242 pszFilename, aRels[iRel], aLoads[2].Addr, rc); 243 rcRet++; 158 RTPrintf("tstLdr-4: Failed to get symbol \"Test1\" from load #%d: %Rrc\n", i, rc); 159 cErrors++; 244 160 break; 245 161 } 246 aLoads[2].Addr = aRels[iRel]; 247 248 /* next */ 249 iRel++; 250 } 251 } 162 DECLCALLBACKPTR(int, pfnDisasmTest1)(void) = (DECLCALLBACKPTR(int, )(void))(uintptr_t)Value; /* eeeh. */ 163 RTPrintf("tstLdr-4: pfnDisasmTest1=%p / add-symbol-file %s %#x\n", pfnDisasmTest1, pszFilename, aLoads[i].pvBits); 164 165 /* call the test function. */ 166 rc = pfnDisasmTest1(); 167 if (rc) 168 { 169 RTPrintf("tstLdr-4: load #%d Test1 -> %#x\n", i, rc); 170 cErrors++; 171 } 172 } 173 } 174 252 175 253 176 /* … … 263 186 if (RT_FAILURE(rc)) 264 187 { 265 RTPrintf("tstLdr : Failed to close '%s' i=%d, rc=%Rrc.\n", pszFilename, i, rc);266 rcRet++;188 RTPrintf("tstLdr-4: Failed to close '%s' i=%d, rc=%Rrc.\n", pszFilename, i, rc); 189 cErrors++; 267 190 } 268 191 } 269 192 } 270 193 271 return rcRet;194 return cErrors; 272 195 } 273 196 … … 276 199 int main(int argc, char **argv) 277 200 { 201 int cErrors = 0; 278 202 RTR3Init(); 279 203 280 int rcRet = 0; 281 if (argc <= 1) 282 { 283 RTPrintf("usage: %s <module> [more modules]\n", argv[0]); 204 /* 205 * Sanity check. 206 */ 207 int rc = DisasmTest1(); 208 if (rc) 209 { 210 RTPrintf("tstLdr-4: FATAL ERROR - DisasmTest1 is buggy: rc=%#x\n", rc); 284 211 return 1; 285 212 } 286 213 287 214 /* 288 * Iterate the files. 289 */ 290 for (int argi = 1; argi < argc; argi++) 291 { 292 if (argv[argi][0] == '-' && argv[argi][1] == 'n') 293 g_fDontBitchOnResolveFailure = true; 294 else 295 { 296 RTPrintf("tstLdr: TESTING '%s'...\n", argv[argi]); 297 rcRet += testLdrOne(argv[argi]); 298 } 215 * Execute the test. 216 */ 217 char szPath[RTPATH_MAX]; 218 rc = RTPathProgram(szPath, sizeof(szPath) - sizeof("/tstLdrObjR0.r0")); 219 if (RT_SUCCESS(rc)) 220 { 221 strcat(szPath, "/tstLdrObjR0.r0"); 222 RTPrintf("tstLdr-4: TESTING '%s'...\n", szPath); 223 cErrors += testLdrOne(szPath); 224 } 225 else 226 { 227 RTPrintf("tstLdr-4: RTPathProgram -> %Rrc\n", rc); 228 cErrors++; 299 229 } 300 230 … … 302 232 * Test result summary. 303 233 */ 304 if (! rcRet)305 RTPrintf("tstLdr : SUCCESS\n");234 if (!cErrors) 235 RTPrintf("tstLdr-4: SUCCESS\n"); 306 236 else 307 RTPrintf("tstLdr : FAILURE - %d errors\n", rcRet);308 return !! rcRet;237 RTPrintf("tstLdr-4: FAILURE - %d errors\n", cErrors); 238 return !!cErrors; 309 239 } -
trunk/src/VBox/Runtime/testcase/tstLdrDisasmTest.cpp
r913 r915 30 30 * Header Files * 31 31 *******************************************************************************/ 32 #ifndef IN_GC 33 # error "not IN_GC!" 32 #include <VBox/dis.h> 33 #include <VBox/disopcode.h> 34 #include <iprt/string.h> 35 36 #if 1 && defined(IN_RING0) 37 extern "C" DECLIMPORT(int) MyPrintf(const char *pszFormat, ...); 38 # define MY_PRINTF(a) MyPrintf a 39 #else 40 # define MY_PRINTF(a) do {} while (0) 34 41 #endif 35 #include <VBox/dis.h>36 #include <VBox/vm.h>37 #include <iprt/string.h>38 42 39 43 … … 41 45 * Global Variables * 42 46 *******************************************************************************/ 43 static const char szStr1[] = "some readonly string";44 static char szStr2[6000] = "some read/write string";45 static char achBss[8192];46 47 47 #ifdef VBOX_SOME_IMPORT_FUNCTION 48 extern "C" DECLIMPORT(int) SomeImportFunction(void); 49 #endif 48 /* 32-bit code */ 49 static uint8_t g_ab32BitCode[] = 50 { 51 0x55, // 1000ab50 55 push ebp 52 0x8b,0xec, // 1000ab51 8bec mov ebp,esp 53 0x8b,0x45,0x08, // 1000ab53 8b4508 mov eax,dword ptr [ebp+8] 54 0x81,0x38,0x07,0x07,// 1000ab56 813807076419 cmp dword ptr [eax],19640707h 55 0x64,0x19, 56 0x75,0x09, // 1000ab5c 7509 jne kLdr!kLdrModMap+0x17 (1000ab67) 57 0x8b,0x4d,0x08, // 1000ab5e 8b4d08 mov ecx,dword ptr [ebp+8] 58 0x83,0x79,0x2c,0x00,// 1000ab61 83792c00 cmp dword ptr [ecx+2Ch],0 59 0x75,0x07, // 1000ab65 7507 jne kLdr!kLdrModMap+0x1e (1000ab6e) 60 0xb8,0xc0,0x68,0x06,// 1000ab67 b8c0680600 mov eax,668C0h 61 0x00, 62 0xeb,0x14, // 1000ab6c eb14 jmp kLdr!kLdrModMap+0x32 (1000ab82) 63 0x33,0xd2, // 1000ab6e 33d2 xor edx,edx 64 0x75,0xe1, // 1000ab70 75e1 jne kLdr!kLdrModMap+0x3 (1000ab53) 65 0x8b,0x45,0x08, // 1000ab72 8b4508 mov eax,dword ptr [ebp+8] 66 0x50, // 1000ab75 50 push eax 67 0x8b,0x4d,0x08, // 1000ab76 8b4d08 mov ecx,dword ptr [ebp+8] 68 0x8b,0x51,0x2c, // 1000ab79 8b512c mov edx,dword ptr [ecx+2Ch] 69 0xff,0x52,0x3c, // 1000ab7c ff523c call dword ptr [edx+3Ch] 70 0x83,0xc4,0x04, // 1000ab7f 83c404 add esp,4 71 0x5d, // 1000ab82 5d pop ebp 72 0xc3, // 1000ab83 c3 ret 73 0xcc 74 }; 50 75 51 76 52 extern "C" DECLEXPORT(int) Entrypoint(void) 77 78 DECLCALLBACK(int32_t) DisasmTest1ReadCode(RTUINTPTR SrcAddr, uint8_t *pbDst, uint32_t cb, RTUINTPTR uUser) 53 79 { 54 g_VM.fRawR0Enabled = true; 55 g_VM.fRawR3Enabled = true; 56 g_VM.fForcedActions = 0; 57 strcpy(achBss, szStr2); 58 memcpy(achBss, szStr1, sizeof(szStr1)); 59 memcpy(achBss, &g_VM, RT_MIN(sizeof(g_VM), sizeof(achBss))); 60 memcpy(achBss, (void *)(uintptr_t)&Entrypoint, 32); 61 #ifdef VBOX_SOME_IMPORT_FUNCTION 62 memcpy(achBss, (void *)(uintptr_t)&SomeImportFunction, 32); 63 return SomeImportFunction(); 64 #else 80 while (cb > 0) 81 { 82 *pbDst = g_ab32BitCode[SrcAddr]; 83 /* next */ 84 pbDst++; 85 SrcAddr++; 86 cb--; 87 } 65 88 return 0; 66 #endif67 89 } 68 90 69 91 70 extern "C" DECLEXPORT( uint32_t) SomeExportFunction1(void *pvBuf)92 extern "C" DECLEXPORT(int) DisasmTest1(void) 71 93 { 72 memcpy(pvBuf, &g_VM, sizeof(g_VM)); 73 return g_VM.fForcedActions; 94 DISCPUSTATE Cpu = {0}; 95 uintptr_t CodeIndex = 0; 96 uint32_t cb; 97 int rc; 98 #define DISAS_AND_CHECK(cbInstr, enmOp) \ 99 do { \ 100 rc = DISCoreOneEx(CodeIndex, CPUMODE_32BIT, DisasmTest1ReadCode, 0, &Cpu, &cb); \ 101 MY_PRINTF(("%d: rc=%d cb=%d Cpu: opcode=%#x pCurInstr=%p pfnReadBytes=%p (42=42)\n", \ 102 __LINE__, rc, cb, Cpu.opcode, Cpu.pCurInstr, Cpu.pfnReadBytes, 42)); \ 103 if (RT_FAILURE(rc)) \ 104 return CodeIndex | 0xf000; \ 105 if (Cpu.pCurInstr->opcode != (enmOp)) \ 106 return CodeIndex| 0xe000; \ 107 if (cb != (cbInstr)) \ 108 return CodeIndex | 0xd000; \ 109 CodeIndex += cb; \ 110 } while (0) 111 112 DISAS_AND_CHECK(1, OP_PUSH); 113 DISAS_AND_CHECK(2, OP_MOV); 114 DISAS_AND_CHECK(3, OP_MOV); 115 DISAS_AND_CHECK(6, OP_CMP); 116 DISAS_AND_CHECK(2, OP_JNE); 117 DISAS_AND_CHECK(3, OP_MOV); 118 DISAS_AND_CHECK(4, OP_CMP); 119 DISAS_AND_CHECK(2, OP_JNE); 120 DISAS_AND_CHECK(5, OP_MOV); 121 DISAS_AND_CHECK(2, OP_JMP); 122 DISAS_AND_CHECK(2, OP_XOR); 123 DISAS_AND_CHECK(2, OP_JNE); 124 DISAS_AND_CHECK(3, OP_MOV); 125 DISAS_AND_CHECK(1, OP_PUSH); 126 DISAS_AND_CHECK(3, OP_MOV); 127 DISAS_AND_CHECK(3, OP_MOV); 128 DISAS_AND_CHECK(3, OP_CALL); 129 DISAS_AND_CHECK(3, OP_ADD); 130 DISAS_AND_CHECK(1, OP_POP); 131 DISAS_AND_CHECK(1, OP_RETN); 132 DISAS_AND_CHECK(1, OP_INT3); 133 134 return rc; 74 135 } 75 136 76 77 extern "C" DECLEXPORT(char *) SomeExportFunction2(void *pvBuf)78 {79 return (char *)memcpy(achBss, szStr1, sizeof(szStr1));80 }81 82 83 extern "C" DECLEXPORT(char *) SomeExportFunction3(void *pvBuf)84 {85 return (char *)memcpy(achBss, szStr2, strlen(szStr2));86 }87 88 89 extern "C" DECLEXPORT(void *) SomeExportFunction4(void)90 {91 static unsigned cb;92 DISCPUSTATE Cpu = {0};93 DISCoreOne(&Cpu, (RTGCUINTPTR)SomeExportFunction3, &cb);94 return (void *)(uintptr_t)&SomeExportFunction1;95 }96 97 98 extern "C" DECLEXPORT(uintptr_t) SomeExportFunction5(void)99 {100 return (uintptr_t)SomeExportFunction3(NULL) + (uintptr_t)SomeExportFunction2(NULL)101 + (uintptr_t)SomeExportFunction1(NULL) + (uintptr_t)&SomeExportFunction4;102 }103 104 -
trunk/src/VBox/Runtime/testcase/tstLdrObjR0.cpp
r913 r915 30 30 * Header Files * 31 31 *******************************************************************************/ 32 #ifndef IN_ GC33 # error "not IN_ GC!"32 #ifndef IN_RING0 33 # error "not IN_RING0!" 34 34 #endif 35 35 #include <VBox/dis.h> 36 #include <VBox/ vm.h>36 #include <VBox/disopcode.h> 37 37 #include <iprt/string.h> 38 38 … … 52 52 extern "C" DECLEXPORT(int) Entrypoint(void) 53 53 { 54 g_VM.fRawR0Enabled = true;55 g_VM.fRawR3Enabled = true;56 g_VM.fForcedActions = 0;57 54 strcpy(achBss, szStr2); 58 55 memcpy(achBss, szStr1, sizeof(szStr1)); 59 memcpy(achBss, &g_VM, RT_MIN(sizeof(g_VM), sizeof(achBss)));60 56 memcpy(achBss, (void *)(uintptr_t)&Entrypoint, 32); 61 57 #ifdef VBOX_SOME_IMPORT_FUNCTION … … 70 66 extern "C" DECLEXPORT(uint32_t) SomeExportFunction1(void *pvBuf) 71 67 { 72 memcpy(pvBuf, &g_VM, sizeof(g_VM)); 73 return g_VM.fForcedActions; 68 return achBss[0] + achBss[16384]; 74 69 } 75 70
Note:
See TracChangeset
for help on using the changeset viewer.