556 r = iDevice->Read( &message, |
556 r = iDevice->Read( &message, |
557 linAddr, dataOffset >> readUnitShift, |
557 linAddr, dataOffset >> readUnitShift, |
558 KPageSize >> readUnitShift, DPagingDevice::EDriveRomPaging); |
558 KPageSize >> readUnitShift, DPagingDevice::EDriveRomPaging); |
559 __NK_ASSERT_DEBUG(r!=KErrNoMemory); // not allowed to allocated memory, therefore can't fail with KErrNoMemory |
559 __NK_ASSERT_DEBUG(r!=KErrNoMemory); // not allowed to allocated memory, therefore can't fail with KErrNoMemory |
560 END_PAGING_BENCHMARK(EPagingBmReadMedia); |
560 END_PAGING_BENCHMARK(EPagingBmReadMedia); |
|
561 if (r != KErrNone) |
|
562 { |
|
563 __KTRACE_OPT(KPANIC, Kern::Printf("DRomMemoryManager::ReadPage: error reading media at %08x + %x: %d", dataOffset, KPageSize, r)); |
|
564 } |
|
565 r = ThePager.EmbedErrorContext(EPagingErrorContextRomRead, r); |
561 } |
566 } |
562 else |
567 else |
563 { |
568 { |
564 // Work out where data for page is located |
569 // Work out where data for page is located |
565 SRomPageInfo* romPageInfo = iRomPageIndex + aIndex; |
570 SRomPageInfo* romPageInfo = iRomPageIndex + aIndex; |
582 __NK_ASSERT_DEBUG((readSize << readUnitShift) <= (DPageReadRequest::EMaxPages << KPageShift)); |
587 __NK_ASSERT_DEBUG((readSize << readUnitShift) <= (DPageReadRequest::EMaxPages << KPageShift)); |
583 START_PAGING_BENCHMARK; |
588 START_PAGING_BENCHMARK; |
584 r = iDevice->Read(&message, buffer, readStart, readSize, DPagingDevice::EDriveRomPaging); |
589 r = iDevice->Read(&message, buffer, readStart, readSize, DPagingDevice::EDriveRomPaging); |
585 __NK_ASSERT_DEBUG(r!=KErrNoMemory); // not allowed to allocated memory, therefore can't fail with KErrNoMemory |
590 __NK_ASSERT_DEBUG(r!=KErrNoMemory); // not allowed to allocated memory, therefore can't fail with KErrNoMemory |
586 END_PAGING_BENCHMARK(EPagingBmReadMedia); |
591 END_PAGING_BENCHMARK(EPagingBmReadMedia); |
|
592 if(r!=KErrNone) |
|
593 __KTRACE_OPT(KPANIC, Kern::Printf("DRomMemoryManager::ReadPage: error reading media at %08x + %x: %d", dataOffset, dataSize, r)); |
|
594 r = ThePager.EmbedErrorContext(EPagingErrorContextRomRead, r); |
587 if(r==KErrNone) |
595 if(r==KErrNone) |
588 { |
596 { |
589 // Decompress data, remembering that the data to decompress may be offset from |
597 // Decompress data, remembering that the data to decompress may be offset from |
590 // the start of the data just read in, due to reads having to be aligned by |
598 // the start of the data just read in, due to reads having to be aligned by |
591 // readUnitShift. |
599 // readUnitShift. |
592 const TLinAddr data = buffer + dataOffset - (readStart << readUnitShift); |
600 const TLinAddr data = buffer + dataOffset - (readStart << readUnitShift); |
593 __ASSERT_COMPILE(SRomPageInfo::ENoCompression==0); // decompress assumes this |
601 __ASSERT_COMPILE(SRomPageInfo::ENoCompression==0); // decompress assumes this |
594 r = Decompress(romPageInfo->iCompressionType, linAddr, KPageSize, data, dataSize); |
602 r = Decompress(romPageInfo->iCompressionType, linAddr, KPageSize, data, dataSize); |
595 if(r >= 0) |
603 if (r >= 0) |
596 { |
604 r = (r == KPageSize) ? KErrNone : KErrCorrupt; |
597 if (r != KPageSize) |
605 if (r != KErrNone) |
598 __KTRACE_OPT(KPANIC, Kern::Printf("DRomMemoryManager::ReadPage: error decompressing page at %08x + %x: %d", dataOffset, dataSize, r)); |
606 __KTRACE_OPT(KPANIC, Kern::Printf("DRomMemoryManager::ReadPage: error decompressing page at %08x + %x: %d", dataOffset, dataSize, r)); |
599 __NK_ASSERT_ALWAYS(r == KPageSize); |
607 __NK_ASSERT_DEBUG(r == KErrNone); |
600 r = KErrNone; |
608 r = ThePager.EmbedErrorContext(EPagingErrorContextRomDecompress, r); |
601 } |
|
602 } |
609 } |
603 else |
|
604 __KTRACE_OPT(KPANIC, Kern::Printf("DRomMemoryManager::ReadPage: error reading media at %08x + %x: %d", dataOffset, dataSize, r)); |
|
605 } |
610 } |
606 } |
611 } |
607 END_PAGING_BENCHMARK(EPagingBmReadRomPage); |
612 END_PAGING_BENCHMARK(EPagingBmReadRomPage); |
608 |
613 |
609 if(r!=KErrNone) |
614 if(r!=KErrNone) |
610 break; |
615 break; |
611 } |
616 } |
612 |
617 |
613 aRequest->UnmapPages(true); |
618 aRequest->UnmapPages(true); |
614 |
619 |
615 return r; |
620 return r; |
616 } |
621 } |
617 |
622 |
618 |
623 |
619 TBool DRomMemoryManager::IsAllocated(DMemoryObject* aMemory, TUint aIndex, TUint aCount) |
624 TBool DRomMemoryManager::IsAllocated(DMemoryObject* aMemory, TUint aIndex, TUint aCount) |