os/kernelhwsrv/kernel/eka/memmodel/epoc/direct/arm/xinit.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200 (2012-06-15)
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // e32\memmodel\epoc\direct\arm\xinit.cpp
    15 // 
    16 //
    17 
    18 #include "arm_mem.h"
    19 #include <e32uid.h>
    20 #include <kernel/cache.h>
    21 
    22 void MM::Init1()
    23 	{
    24 	__KTRACE_OPT(KBOOT,Kern::Printf("MM::Init1()"));
    25 
    26 	MM::RamBlockSize=0x1000;
    27 	MM::RamBlockShift=12;
    28 
    29 	PP::MaxUserThreadStack=0x14000;			// 80K - STDLIB asks for 64K for PosixServer!!!!
    30 	PP::UserThreadStackGuard=0x2000;		// 8K
    31 	PP::MaxStackSpacePerProcess=0x200000;	// 2Mb
    32 	K::SupervisorThreadStackSize=0x1000;	// 4K
    33 	PP::SupervisorThreadStackGuard=0x1000;	// 4K
    34 
    35 	K::MachineConfig=(TMachineConfig*)(((TUint8*)SuperPageAddress)+0x800);	// HACK!!
    36 	K::MaxMemCopyInOneGo = KDefaultMaxMemCopyInOneGo;
    37 	PP::RamDriveStartAddress = TheSuperPage().iKernelLimit;
    38 	PP::RamDriveMaxSize = TheRomHeader().iUserDataAddress - PP::RamDriveStartAddress;
    39 
    40 	__KTRACE_OPT(KBOOT,Kern::Printf("RamDriveBase %08x RamDriveMaxSize %08x",PP::RamDriveStartAddress,PP::RamDriveMaxSize));
    41 
    42 #ifdef __CPU_ARM_USE_DOMAINS
    43 	Arm::DefaultDomainAccess=Arm::Dacr();
    44 #endif
    45 
    46 	K::MemModelAttributes=EMemModelTypeDirect|EMemModelAttrNonExProt|EMemModelAttrKernProt|
    47 							EMemModelAttrWriteProt|EMemModelAttrSvKernProt;
    48 
    49 	__KTRACE_OPT(KBOOT,Kern::Printf("K::MaxMemCopyInOneGo=0x%x",K::MaxMemCopyInOneGo));
    50 	}
    51 
    52 #ifdef __CPU_HAS_CACHE
    53 // Set up virtual addresses used for cache flushing if this is
    54 // done by data read or line allocate
    55 void M::SetupCacheFlushPtr(TInt aCache, SCacheInfo& aInfo)
    56 	{
    57 #if defined(__CPU_CACHE_FLUSH_BY_DATA_READ) || defined(__CPU_CACHE_FLUSH_BY_LINE_ALLOC)
    58 #ifdef __CPU_HAS_ALT_D_CACHE
    59 	if (aCache==KCacheNumAltD)
    60 		{
    61 		aInfo.iFlushPtr=TheSuperPage().iAltDCacheFlushArea;
    62 		aInfo.iFlushMask=TheSuperPage().iAltDCacheFlushWrap;
    63 		}
    64 #endif
    65 	if (aCache==KCacheNumD)
    66 		{
    67 		aInfo.iFlushPtr=TheSuperPage().iDCacheFlushArea;
    68 		aInfo.iFlushMask=TheSuperPage().iDCacheFlushWrap;
    69 		}
    70 #endif
    71 	}
    72 #endif
    73 
    74 #ifdef __SMP__
    75 void M::GetAPBootInfo(TInt aCpu, volatile SAPBootInfo* aInfo)
    76 	{
    77 	volatile SArmAPBootInfo& info = *(volatile SArmAPBootInfo*)aInfo;
    78 	TSubScheduler& ss = SubScheduler();
    79 	TUint32 delta = aCpu*0x2000;
    80 	info.iInitR13Fiq = TLinAddr(ss.i_FiqStackTop) + delta;
    81 	info.iInitR13Irq = TLinAddr(ss.i_IrqStackTop) + delta;
    82 	info.iInitR13Abt = TLinAddr(ss.i_AbtStackTop) + delta;
    83 	info.iInitR13Und = TLinAddr(ss.i_UndStackTop) + delta;
    84 	}
    85 
    86 void M::Init2AP()
    87 	{
    88 	__KTRACE_OPT(KBOOT,Kern::Printf("M::Init2AP()"));
    89 	}
    90 #endif