equal
deleted
inserted
replaced
3246 __IF_DEBUG(Printf("E32Image::FixupDlls OK")); |
3246 __IF_DEBUG(Printf("E32Image::FixupDlls OK")); |
3247 return KErrNone; |
3247 return KErrNone; |
3248 } |
3248 } |
3249 |
3249 |
3250 |
3250 |
3251 /** |
|
3252 This function is defined because RArray does not natively support |
|
3253 sorting 64-bit integers. |
|
3254 |
|
3255 It is used by FixupDlls to order the import fixup locations in the image |
|
3256 so they can be organized by page. |
|
3257 |
|
3258 @param aLeft 64-bit unsigned integer to compare against aRight. |
|
3259 @param aRight 64-bit unsigned integer to compare against aLeft. |
|
3260 @return -1 if aLeft < aRight; 0 if aLeft == aRight; and |
|
3261 +1 if aLeft > aRight. This conforms to the behavior |
|
3262 which is expected from a function used by TLinearOrder. |
|
3263 */ |
|
3264 static TInt Uint64LinearOrderFunc(const TUint64& aLeft, const TUint64& aRight) |
|
3265 { |
|
3266 if (aLeft < aRight) |
|
3267 return -1; |
|
3268 else if (aLeft > aRight) |
|
3269 return 1; |
|
3270 else |
|
3271 return 0; |
|
3272 } |
|
3273 |
|
3274 |
|
3275 TUint64* E32Image::ExpandFixups(TInt aNumFixups) |
3251 TUint64* E32Image::ExpandFixups(TInt aNumFixups) |
3276 { |
3252 { |
3277 __IF_DEBUG(Printf("ExpandFixups,%d+%d", iFixupCount,aNumFixups)); |
3253 __IF_DEBUG(Printf("ExpandFixups,%d+%d", iFixupCount,aNumFixups)); |
3278 TInt newCount = iFixupCount+aNumFixups; |
3254 TInt newCount = iFixupCount+aNumFixups; |
3279 TUint64* fixups = (TUint64*) User::ReAlloc(iFixups, sizeof(TUint64) * newCount); |
3255 TUint64* fixups = (TUint64*) User::ReAlloc(iFixups, sizeof(TUint64) * newCount); |
3313 } |
3289 } |
3314 #endif // DEBUG |
3290 #endif // DEBUG |
3315 |
3291 |
3316 // sort the array in address order, to organize by page |
3292 // sort the array in address order, to organize by page |
3317 RArray<TUint64> fixup64ToSort(sizeof(TUint64), iFixups, iFixupCount); |
3293 RArray<TUint64> fixup64ToSort(sizeof(TUint64), iFixups, iFixupCount); |
3318 // SortUnsigned doesn't work on TUint64 |
3294 |
3319 fixup64ToSort.Sort(TLinearOrder<TUint64>(Uint64LinearOrderFunc)); |
3295 // address is in high word of entry, offset 4 |
|
3296 fixup64ToSort.SetKeyOffset(4); |
|
3297 fixup64ToSort.SortUnsigned(); |
3320 |
3298 |
3321 // now have <address | new-value> pairs, organize into pages. |
3299 // now have <address | new-value> pairs, organize into pages. |
3322 // Each page is stored as fXXX YYYY ZZZZ where YYYY ZZZZ is written |
3300 // Each page is stored as fXXX YYYY ZZZZ where YYYY ZZZZ is written |
3323 // to the word at offset XXX. (See PREQ1110 Design Sketch v1.0 S3.1.1.2.3.2.) |
3301 // to the word at offset XXX. (See PREQ1110 Design Sketch v1.0 S3.1.1.2.3.2.) |
3324 |
3302 |