kerneltest/e32test/mmu/t_shadow.cpp
branchRCL_3
changeset 26 c734af59ce98
parent 0 a41df078684a
child 42 a179b74831c9
equal deleted inserted replaced
24:41f0cfe18c80 26:c734af59ce98
   336 	}
   336 	}
   337 
   337 
   338 const TUint KChunkShift = 20;
   338 const TUint KChunkShift = 20;
   339 const TUint KChunkSize = 1 << KChunkShift;
   339 const TUint KChunkSize = 1 << KChunkShift;
   340 
   340 
       
   341 const TUint KRomSizeAlign = 16;  // This should match CFG_RomSizeAlign defined in bootcpu.inc
       
   342 const TUint KRomSizeAlignMask = (1 << KRomSizeAlign) - 1;
       
   343 
   341 void TestRomIsSectionMapped()
   344 void TestRomIsSectionMapped()
   342 	{
   345 	{
   343 	test.Start(_L("Test ROM is section mapped"));
   346 	test.Start(_L("Test ROM is section mapped"));
   344 	
   347 	
   345 	TUint pdSize;
   348 	TUint pdSize;
   348 
   351 
   349 #ifdef __MARM__
   352 #ifdef __MARM__
   350 	test_KErrNone(Shadow.GetPdInfo(KGlobalPageDirectory, pdSize, pdBase, offset));
   353 	test_KErrNone(Shadow.GetPdInfo(KGlobalPageDirectory, pdSize, pdBase, offset));
   351 	test.Printf(_L("pd base == %08x, pd size == %08x, pd offset == %08x\n"), pdBase, pdSize, offset);
   354 	test.Printf(_L("pd base == %08x, pd size == %08x, pd offset == %08x\n"), pdBase, pdSize, offset);
   352 
   355 
   353 	for (TLinAddr addr = RomUnpagedStart ; addr <= RomUnpagedEnd ; addr += KChunkSize)
   356 	TUint romSize = RomUnpagedEnd - RomUnpagedStart;	
   354 		{
   357 	test.Printf(_L("rom size == %x\n"), romSize);
       
   358 	if (RomPagedStart == RomPagedEnd)
       
   359 		{
       
   360 		// If rom is not paged then we must round the ROM size up to a mutiple of 64KB (or whatever
       
   361 		// the CFG_RomSizeAlign settings is), because that's how the bootstrap maps it
       
   362 		romSize = (romSize + KRomSizeAlignMask) & ~KRomSizeAlignMask;
       
   363 		test.Printf(_L("rom size rounded up to %x\n"), romSize);
       
   364 		}
       
   365 	
       
   366 	for (TUint pos = 0 ; pos < romSize ; pos += KChunkSize)
       
   367 		{
       
   368 		TLinAddr addr = RomUnpagedStart + pos;
   355 		TUint i = (addr >> KChunkShift) - offset;
   369 		TUint i = (addr >> KChunkShift) - offset;
   356 		TUint pde = Shadow.Read(pdBase + i*4);
   370 		TUint pde = Shadow.Read(pdBase + i*4);
   357 		test.Printf(_L("  %08x: PDE %08x\n"), addr, pde);
   371 		test.Printf(_L("  %08x: PDE %08x\n"), addr, pde);
   358 
   372 
   359 		TUint expectedPdeType = (RomUnpagedEnd - addr) >= KChunkSize ? 2 : 1;
   373 		TUint expectedPdeType = (romSize - pos) >= KChunkSize ? 2 : 1;
   360 		test_Equal(expectedPdeType, pde & 3);
   374 		test_Equal(expectedPdeType, pde & 3);
   361 		}
   375 		}
   362 #else
   376 #else
   363 	test.Printf(_L("Test not supported on this architecture\n"));
   377 	test.Printf(_L("Test not supported on this architecture\n"));
   364 #endif
   378 #endif