Changeset 3567 for trunk/kStuff/kLdr/tstkLdrMod.c
- Timestamp:
- Aug 27, 2007, 9:54:05 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kStuff/kLdr/tstkLdrMod.c
r3537 r3567 70 70 71 71 /** Dummy import resolver callback. */ 72 static int BasicTestsGetImport(PKLDRMOD pMod, uint32_t iImport, uint32_t iSymbol, const char *pchSymbol, size_tcchSymbol,73 const char *pszVersion, PKLDRADDR puValue, uint32_t*pfKind, void *pvUser)72 static int BasicTestsGetImport(PKLDRMOD pMod, KU32 iImport, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, 73 const char *pszVersion, PKLDRADDR puValue, KU32 *pfKind, void *pvUser) 74 74 { 75 75 *puValue = 0xdeadface; … … 82 82 * Verbose memcmp(). 83 83 */ 84 static int TestMemComp(const void *pv1, const void *pv2, size_tcb)85 { 86 size_toff;87 const uint8_t *pb1 = (const uint8_t*)pv1;88 const uint8_t *pb2 = (const uint8_t*)pv2;84 static int TestMemComp(const void *pv1, const void *pv2, KSIZE cb) 85 { 86 KSIZE off; 87 const KU8 *pb1 = (const KU8 *)pv1; 88 const KU8 *pb2 = (const KU8 *)pv2; 89 89 if (!memcmp(pb1, pb2, cb)) 90 90 return 0; … … 105 105 static int BasicTestsRelocate(PKLDRMOD pMod, void *pvBits, void *pvBits2) 106 106 { 107 const size_t cbImage = (size_t)kLdrModSize(pMod);107 const KSIZE cbImage = (KSIZE)kLdrModSize(pMod); 108 108 int rc; 109 109 … … 114 114 */ 115 115 memset(pvBits2, 0xfe, cbImage); 116 rc = kLdrModGetBits(pMod, pvBits2, ( uintptr_t)pvBits, BasicTestsGetImport, NULL);116 rc = kLdrModGetBits(pMod, pvBits2, (KUPTR)pvBits, BasicTestsGetImport, NULL); 117 117 if (rc) 118 118 return Failure("failed to get image bits, rc=%d (%s) (a)", rc, kLdrErrStr(rc)); … … 123 123 * Short relocation round trip. 124 124 */ 125 rc = kLdrModRelocateBits(pMod, pvBits2, 0x1000, ( uintptr_t)pvBits, BasicTestsGetImport, NULL);125 rc = kLdrModRelocateBits(pMod, pvBits2, 0x1000, (KUPTR)pvBits, BasicTestsGetImport, NULL); 126 126 if (rc) 127 127 return Failure("failed to relocate, rc=%d (%s) (b1)", rc, kLdrErrStr(rc)); 128 rc = kLdrModRelocateBits(pMod, pvBits2, ( uintptr_t)pvBits, 0x1000, BasicTestsGetImport, NULL);128 rc = kLdrModRelocateBits(pMod, pvBits2, (KUPTR)pvBits, 0x1000, BasicTestsGetImport, NULL); 129 129 if (rc) 130 130 return Failure("failed to relocate, rc=%d (%s) (b2)", rc, kLdrErrStr(rc)); … … 136 136 */ 137 137 /* stage one */ 138 rc = kLdrModRelocateBits(pMod, pvBits, 0x1000000, ( uintptr_t)pvBits, BasicTestsGetImport, NULL);138 rc = kLdrModRelocateBits(pMod, pvBits, 0x1000000, (KUPTR)pvBits, BasicTestsGetImport, NULL); 139 139 if (rc) 140 140 return Failure("failed to relocate, rc=%d (%s) (c1)", rc, kLdrErrStr(rc)); … … 147 147 148 148 /* stage two */ 149 rc = kLdrModRelocateBits(pMod, pvBits, ~( uintptr_t)0x1010000, 0x1000000, BasicTestsGetImport, NULL);149 rc = kLdrModRelocateBits(pMod, pvBits, ~(KUPTR)0x1010000, 0x1000000, BasicTestsGetImport, NULL); 150 150 if (rc) 151 151 return Failure("failed to relocate, rc=%d (%s) (c2)", rc, kLdrErrStr(rc)); 152 152 memset(pvBits2, 0xef, cbImage); 153 rc = kLdrModGetBits(pMod, pvBits2, ~( uintptr_t)0x1010000, BasicTestsGetImport, NULL);153 rc = kLdrModGetBits(pMod, pvBits2, ~(KUPTR)0x1010000, BasicTestsGetImport, NULL); 154 154 if (rc) 155 155 return Failure("failed to get image bits, rc=%d (%s) (c2)", rc, kLdrErrStr(rc)); … … 158 158 159 159 /* stage three */ 160 rc = kLdrModRelocateBits(pMod, pvBits, MY_BASEADDRESS, ~( uintptr_t)0x1010000, BasicTestsGetImport, NULL);160 rc = kLdrModRelocateBits(pMod, pvBits, MY_BASEADDRESS, ~(KUPTR)0x1010000, BasicTestsGetImport, NULL); 161 161 if (rc) 162 162 return Failure("failed to relocate, rc=%d (%s) (c3)", rc, kLdrErrStr(rc)); … … 169 169 170 170 /* stage four */ 171 rc = kLdrModRelocateBits(pMod, pvBits, ~( uintptr_t)0 / 2 - 0x10000, MY_BASEADDRESS, BasicTestsGetImport, NULL);171 rc = kLdrModRelocateBits(pMod, pvBits, ~(KUPTR)0 / 2 - 0x10000, MY_BASEADDRESS, BasicTestsGetImport, NULL); 172 172 if (rc) 173 173 return Failure("failed to relocate, rc=%d %(s) (c4)", rc, kLdrErrStr(rc)); 174 174 memset(pvBits2, 0xdc, cbImage); 175 rc = kLdrModGetBits(pMod, pvBits2, ~( uintptr_t)0 / 2 - 0x10000, BasicTestsGetImport, NULL);175 rc = kLdrModGetBits(pMod, pvBits2, ~(KUPTR)0 / 2 - 0x10000, BasicTestsGetImport, NULL); 176 176 if (rc) 177 177 return Failure("failed to get image bits, rc=%d (%s) (c4)", rc, kLdrErrStr(rc)); … … 180 180 181 181 /* return */ 182 rc = kLdrModRelocateBits(pMod, pvBits, ( uintptr_t)pvBits, ~(uintptr_t)0 / 2 - 0x10000, BasicTestsGetImport, NULL);182 rc = kLdrModRelocateBits(pMod, pvBits, (KUPTR)pvBits, ~(KUPTR)0 / 2 - 0x10000, BasicTestsGetImport, NULL); 183 183 if (rc) 184 184 return Failure("failed to relocate, rc=%d (%s) (c5)", rc, kLdrErrStr(rc)); 185 185 memset(pvBits2, 0xcd, cbImage); 186 rc = kLdrModGetBits(pMod, pvBits2, ( uintptr_t)pvBits, BasicTestsGetImport, NULL);186 rc = kLdrModGetBits(pMod, pvBits2, (KUPTR)pvBits, BasicTestsGetImport, NULL); 187 187 if (rc) 188 188 return Failure("failed to get image bits, rc=%d (%s) (c5)", rc, kLdrErrStr(rc)); … … 197 197 * Dump symbols and check that we can query each of them recursivly. 198 198 */ 199 static int BasicTestsEnumSymCallback(PKLDRMOD pMod, uint32_t iSymbol, const char *pchSymbol, size_tcchSymbol,200 const char *pszVersion, KLDRADDR uValue, uint32_tfKind, void *pvUser)199 static int BasicTestsEnumSymCallback(PKLDRMOD pMod, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, 200 const char *pszVersion, KLDRADDR uValue, KU32 fKind, void *pvUser) 201 201 { 202 202 KLDRADDR uValue2; 203 uint32_tfKind2;203 KU32 fKind2; 204 204 int rc; 205 205 … … 249 249 * Dump debugger information and check it for correctness. 250 250 */ 251 static int BasicTestEnumDbgInfoCallback(PKLDRMOD pMod, uint32_tiDbgInfo, KLDRDBGINFOTYPE enmType,252 int16_t iMajorVer, int16_tiMinorVer, KLDRFOFF offFile, KLDRADDR LinkAddress,251 static int BasicTestEnumDbgInfoCallback(PKLDRMOD pMod, KU32 iDbgInfo, KLDRDBGINFOTYPE enmType, 252 KI16 iMajorVer, KI16 iMinorVer, KLDRFOFF offFile, KLDRADDR LinkAddress, 253 253 KLDRSIZE cb, const char *pszExtFile, void *pvUser) 254 254 { … … 272 272 static int BasicTestsSub2(PKLDRMOD pMod, void *pvBits) 273 273 { 274 int32_tcImports;275 int32_ti;274 KI32 cImports; 275 KI32 i; 276 276 int rc; 277 uint32_tfKind;277 KU32 fKind; 278 278 KLDRADDR Value; 279 279 KLDRADDR MainEPAddress; … … 395 395 { 396 396 int rc; 397 uint32_ti;397 KU32 i; 398 398 void *pvBits; 399 size_tcbImage;399 KSIZE cbImage; 400 400 401 401 /* … … 479 479 printf("* Testing user mapping...\n"); 480 480 481 cbImage = ( size_t)kLdrModSize(pMod);481 cbImage = (KSIZE)kLdrModSize(pMod); 482 482 if (cbImage != kLdrModSize(pMod)) 483 483 return Failure("aborting test because the image is too huge!"); 484 pvBits = malloc(( size_t)cbImage);484 pvBits = malloc((KSIZE)cbImage); 485 485 if (!pvBits) 486 486 return Failure("failed to allocate %d bytes for the image", cbImage); 487 487 488 rc = kLdrModGetBits(pMod, pvBits, ( uintptr_t)pvBits, BasicTestsGetImport, NULL);488 rc = kLdrModGetBits(pMod, pvBits, (KUPTR)pvBits, BasicTestsGetImport, NULL); 489 489 if (rc) 490 490 return Failure("failed to get image bits, rc=%d (%s)", rc, kLdrErrStr(rc)); … … 499 499 * Test relocating the bits in a few different ways before we're done with them. 500 500 */ 501 void *pvBits2 = malloc(( size_t)cbImage);501 void *pvBits2 = malloc((KSIZE)cbImage); 502 502 if (pvBits2) 503 503 {
Note:
See TracChangeset
for help on using the changeset viewer.