kernel/eka/memmodel/epoc/flexible/arm/xinit.cpp
changeset 9 96e5fb8b040d
equal deleted inserted replaced
-1:000000000000 9:96e5fb8b040d
       
     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 //
       
    15 
       
    16 #include "arm_mem.h"
       
    17 #include "../mmu/mm.h"
       
    18 
       
    19 // Set up virtual addresses used for cache flushing if this is
       
    20 // done by data read or line allocate
       
    21 void M::SetupCacheFlushPtr(TInt aCache, SCacheInfo& aInfo)
       
    22 	{
       
    23 	}
       
    24 
       
    25 #ifdef __SMP__
       
    26 extern DMemoryObject* ExceptionStacks;
       
    27 
       
    28 void M::GetAPBootInfo(TInt aCpu, volatile SAPBootInfo* aInfo)
       
    29 	{
       
    30 	SArmAPBootInfo* b = (SArmAPBootInfo*)aInfo;
       
    31 	TInt i;
       
    32 	for (i=1; i<=7; i+=2)
       
    33 		{
       
    34 		TUint ix = (TUint)(aCpu*8+i);
       
    35 		TInt r = MM::MemoryAlloc(ExceptionStacks, ix, 1);
       
    36 		__NK_ASSERT_ALWAYS(r==KErrNone);
       
    37 		TLinAddr addr = KExcptStacksLinearBase + (ix<<KPageShift);
       
    38 		TLinAddr top = addr + KPageSize;
       
    39 		TUint8 fill = 0xdd;
       
    40 		switch (i)
       
    41 			{
       
    42 			case 1:	b->iInitR13Irq = top; fill=0xaa; break;
       
    43 			case 3:	b->iInitR13Fiq = top; fill=0xbb; break;
       
    44 			case 5:	b->iInitR13Und = top; break;
       
    45 			case 7:	top-=sizeof(SFullArmRegSet); b->iInitR13Abt = top; memclr((TAny*)top,sizeof(SFullArmRegSet)); break;
       
    46 			default: __NK_ASSERT_ALWAYS(0); break;
       
    47 			}
       
    48 		memset((TAny*)addr, fill, top-addr);
       
    49 		}
       
    50 	}
       
    51 
       
    52 void M::Init2AP()
       
    53 	{
       
    54 	__KTRACE_OPT(KBOOT,Kern::Printf("M::Init2AP()"));
       
    55 	DThread& t = Kern::CurrentThread();
       
    56 	SubScheduler().iAddressSpace = t.iOwningProcess;
       
    57 	t.iNThread.SetAddressSpace(t.iOwningProcess);
       
    58 	t.iNThread.SetAttributes(KThreadAttAddressSpace);
       
    59 	}
       
    60 #endif