os/kernelhwsrv/kernel/eka/memmodel/epoc/multiple/arm/xmonitor.cia
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2004-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\multiple\arm\xmonitor.cia
    15 // Kernel crash debugger - ARM specific portion
    16 // 
    17 //
    18 
    19 #include <kernel/monitor.h>
    20 #include "memmodel.h"
    21 #include <mmboot.h>
    22 
    23 __NAKED__ TInt MapProcess(DMemModelProcess* aProcess, TBool)
    24 	{	
    25 	asm("mrc p15, 0, r3, c2, c0, 0 ");		// get TTBR0
    26 	asm("ldr r2, [r0, #%a0]" : : "i" _FOFF(DMemModelProcess, iLocalPageDir));
    27 	asm("and r3, r3, #%a0" : : "i" ((TInt)KTTBRExtraBitsMask));	// r3 = page table cache attributes
    28 	asm("mcr p15, 0, r2, c7, c10, 4 ");	// drain write buffer before changing MMU registers (see ARMv6 specs)
    29 	asm("orr r2, r2, r3 ");					// r2 = new TTBR0 value
    30 	UPDATE_PW_CACHING_ATTRIBUTES(,r2);		// ERRATUM 1136_317041
    31 	asm("mcr p15, 0, r2, c2, c0, 0 ");		// set TTBR0 - no TLB flush required due to ASID
    32 
    33 	asm("ldr r0, [r0, #%a0]" : : "i" _FOFF(DMemModelProcess, iOsAsid));
    34 	asm("mcr p15, 0, r0, c13, c0, 1 ");		// set ASID
    35 
    36 #if defined(__CPU_ARM11MP__)
    37 	// On other platforms, tha ASID change above has already flushed the branch prediction buffers 
    38 	asm("mcr p15, 0, r0, c7, c5, 6 ");	// flush BTAC
    39 #endif
    40 	
    41 	asm("mov r0, #0");
    42 	__JUMP(,lr);
    43 	}