os/kernelhwsrv/kernel/eka/memmodel/epoc/direct/x86/xkernel.cpp
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) 1994-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\x86\xkernel.cpp
    15 // 
    16 //
    17 
    18 #include <x86_mem.h>
    19 
    20 /********************************************
    21  * Thread
    22  ********************************************/
    23 
    24 TInt DX86PlatThread::SetupContext(SThreadCreateInfo& anInfo)
    25 	{
    26 	return KErrNone;
    27 	}
    28 
    29 DX86PlatProcess::DX86PlatProcess()
    30 	{}
    31 
    32 DX86PlatProcess::~DX86PlatProcess()
    33 	{
    34 	__KTRACE_OPT(KMMU,Kern::Printf("DX86PlatProcess destruct"));
    35 	DMemModelProcess::Destruct();
    36 	}
    37 
    38 TBool Exc::IsMagic(TLinAddr /*anAddress*/)
    39 //
    40 // Return TRUE if anAddress is a 'magic' exception handling instruction
    41 //
    42 	{
    43 	return EFalse;
    44 	}
    45 
    46 void DThread::IpcExcHandler(TExcTrap* aTrap, DThread* aThread, TAny* aContext)
    47 	{
    48 	aThread->iIpcClient = 0;
    49 	TIpcExcTrap& xt=*(TIpcExcTrap*)aTrap;
    50 	TX86ExcInfo& info=*(TX86ExcInfo*)aContext;
    51 	if (info.iExcId==EX86VectorPageFault)
    52 		{
    53 		TLinAddr va=(TLinAddr)info.iFaultAddress;
    54 		if (va>=xt.iRemoteBase && (va-xt.iRemoteBase)<xt.iSize)
    55 			xt.Exception(KErrBadDescriptor);	// problem accessing remote address - 'leave' so an error code will be returned
    56 		if (xt.iLocalBase && va>=xt.iLocalBase && (va-xt.iLocalBase)<xt.iSize)
    57 			NKern::UnlockSystem();		// problem accessing local address - return and panic current thread as usual
    58 		}
    59 	// otherwise return and fault kernel
    60 	}
    61