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.
sl@0
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32\memmodel\epoc\multiple\arm\xmonitor.cia
sl@0
    15
// Kernel crash debugger - ARM specific portion
sl@0
    16
// 
sl@0
    17
//
sl@0
    18
sl@0
    19
#include <kernel/monitor.h>
sl@0
    20
#include "memmodel.h"
sl@0
    21
#include <mmboot.h>
sl@0
    22
sl@0
    23
__NAKED__ TInt MapProcess(DMemModelProcess* aProcess, TBool)
sl@0
    24
	{	
sl@0
    25
	asm("mrc p15, 0, r3, c2, c0, 0 ");		// get TTBR0
sl@0
    26
	asm("ldr r2, [r0, #%a0]" : : "i" _FOFF(DMemModelProcess, iLocalPageDir));
sl@0
    27
	asm("and r3, r3, #%a0" : : "i" ((TInt)KTTBRExtraBitsMask));	// r3 = page table cache attributes
sl@0
    28
	asm("mcr p15, 0, r2, c7, c10, 4 ");	// drain write buffer before changing MMU registers (see ARMv6 specs)
sl@0
    29
	asm("orr r2, r2, r3 ");					// r2 = new TTBR0 value
sl@0
    30
	UPDATE_PW_CACHING_ATTRIBUTES(,r2);		// ERRATUM 1136_317041
sl@0
    31
	asm("mcr p15, 0, r2, c2, c0, 0 ");		// set TTBR0 - no TLB flush required due to ASID
sl@0
    32
sl@0
    33
	asm("ldr r0, [r0, #%a0]" : : "i" _FOFF(DMemModelProcess, iOsAsid));
sl@0
    34
	asm("mcr p15, 0, r0, c13, c0, 1 ");		// set ASID
sl@0
    35
sl@0
    36
#if defined(__CPU_ARM11MP__)
sl@0
    37
	// On other platforms, tha ASID change above has already flushed the branch prediction buffers 
sl@0
    38
	asm("mcr p15, 0, r0, c7, c5, 6 ");	// flush BTAC
sl@0
    39
#endif
sl@0
    40
	
sl@0
    41
	asm("mov r0, #0");
sl@0
    42
	__JUMP(,lr);
sl@0
    43
	}