Changeset 2890 for trunk/kLdr/tstkLdrMod.c
- Timestamp:
- Nov 21, 2006, 5:33:25 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kLdr/tstkLdrMod.c
r2878 r2890 79 79 80 80 81 /** 82 * Verbose memcmp(). 83 */ 84 static int TestMemComp(const void *pv1, const void *pv2, size_t cb) 85 { 86 size_t off; 87 const uint8_t *pb1 = (const uint8_t *)pv1; 88 const uint8_t *pb2 = (const uint8_t *)pv2; 89 if (!memcmp(pb1, pb2, cb)) 90 return 0; 91 printf("Mismatching blocks pv1=%p pv2=%p cb=%#x:\n", pv1, pv2, cb); 92 for (off = 0; off < cb; off++) 93 { 94 if (pb1[off] == pb2[off]) 95 continue; 96 printf("%08x %02x != %02x\n", off, pb1[off], pb2[off]); 97 } 98 return memcmp(pb1, pb2, cb); /* lazy */ 99 } 100 81 101 82 102 /** … … 97 117 if (rc) 98 118 return Failure("failed to get image bits, rc=%d (a)", rc); 99 if ( memcmp(pvBits2, pvBits, cbImage))119 if (TestMemComp(pvBits2, pvBits, cbImage)) 100 120 return Failure("relocation test failed, mismatching bits (a)"); 101 121 … … 109 129 if (rc) 110 130 return Failure("failed to relocate, rc=%d (b2)"); 111 if ( memcmp(pvBits2, pvBits, cbImage))131 if (TestMemComp(pvBits2, pvBits, cbImage)) 112 132 return Failure("relocation test failed, mismatching bits (b)"); 113 133 … … 123 143 if (rc) 124 144 return Failure("failed to get image bits, rc=%d (c1)", rc); 125 if ( memcmp(pvBits2, pvBits, cbImage))145 if (TestMemComp(pvBits2, pvBits, cbImage)) 126 146 return Failure("relocation test failed, mismatching bits (c1)"); 127 147 … … 134 154 if (rc) 135 155 return Failure("failed to get image bits, rc=%d (c2)", rc); 136 if ( memcmp(pvBits2, pvBits, cbImage))156 if (TestMemComp(pvBits2, pvBits, cbImage)) 137 157 return Failure("relocation test failed, mismatching bits (c2)"); 138 158 … … 145 165 if (rc) 146 166 return Failure("failed to get image bits, rc=%d (c3)", rc); 147 if ( memcmp(pvBits2, pvBits, cbImage))167 if (TestMemComp(pvBits2, pvBits, cbImage)) 148 168 return Failure("relocation test failed, mismatching bits (c3)"); 149 169 … … 156 176 if (rc) 157 177 return Failure("failed to get image bits, rc=%d (c4)", rc); 158 if ( memcmp(pvBits2, pvBits, cbImage))178 if (TestMemComp(pvBits2, pvBits, cbImage)) 159 179 return Failure("relocation test failed, mismatching bits (c4)"); 160 180 … … 167 187 if (rc) 168 188 return Failure("failed to get image bits, rc=%d (c5)", rc); 169 if ( memcmp(pvBits2, pvBits, cbImage))189 if (TestMemComp(pvBits2, pvBits, cbImage)) 170 190 return Failure("relocation test failed, mismatching bits (c5)"); 171 191
Note:
See TracChangeset
for help on using the changeset viewer.