Catchup to latest Symbian^4 GCC_SURGE
authorWilliam Roberts <williamr@symbian.org>
Thu, 22 Jul 2010 16:46:39 +0100
branchGCC_SURGE
changeset 221 39b39e1a406e
parent 219 0ff03867bdb6 (current diff)
parent 217 96e53742b989 (diff)
child 223 9b475c7a1224
Catchup to latest Symbian^4
bsptemplate/asspandvariant/template_variant/bld.inf
kernel/eka/debug/trkdummyapp/group/bld.inf
kernel/eka/drivers/pbus/mmc/stack.cpp
kernel/eka/include/e32cia.h
kernel/eka/include/e32cmn.inl
kernel/eka/kernel/smonitor.cpp
kernel/eka/kernel/sprocess.cpp
kernel/eka/memmodel/epoc/mmubase/ramalloc.cpp
kernel/eka/nkernsmp/arm/ncsched.cia
kernel/eka/rombuild/rom_sbs.pl
kernel/eka/rombuild/user.iby
kerneltest/e32test/digitiser/t_traweventdigitiser.cpp
kerneltest/e32test/dmav2/dma_api_tests.cpp
kerneltest/e32test/group/bld.inf
kerneltest/e32test/group/t_traweventdigitiser.mmp
kerneltest/e32test/misc/d_testkerncorestats.cpp
kerneltest/e32utils/analyse/profiler.rtf
kerneltest/e32utils/group/bld.inf
kerneltest/e32utils/trace/btracevw.pl
kerneltest/f32test/demandpaging/t_nandpaging.cpp
kerneltest/f32test/filesystem/automounter/bld.inf
kerneltest/f32test/group/bld.inf
kerneltest/f32test/group/t_bigfile.mmp
kerneltest/f32test/group/t_cfileman.mmp
kerneltest/f32test/group/t_ftrace.mmp
kerneltest/f32test/group/t_romg.mmp
kerneltest/f32test/plugins/version_2beta/t_plugin_v2beta.cpp
kerneltest/f32test/server/t_file64bit.cpp
kerneltest/f32test/server/t_fsrv.cpp
kerneltest/f32test/server/t_ftrace.cpp
package_definition.xml
userlibandfileserver/fileserver/eabi/efileu.def
userlibandfileserver/fileserver/ftrace/d_ftrace.cpp
userlibandfileserver/fileserver/group/efile.mmh
userlibandfileserver/fileserver/group/efile.mmp
userlibandfileserver/fileserver/group/efile_instrumented.mmp
userlibandfileserver/fileserver/group/efsrv.mmh
userlibandfileserver/fileserver/group/efsrv.mmp
userlibandfileserver/fileserver/group/efsrv_instrumented.mmp
userlibandfileserver/fileserver/group/ftrace.mmp
userlibandfileserver/fileserver/inc/f32tracedef.h
userlibandfileserver/fileserver/inc/utraceefile.h
userlibandfileserver/fileserver/inc/utraceefsrv.h
userlibandfileserver/fileserver/sfile/sf_sys.cpp
userlibandfileserver/fileserver/sfile/sf_thread.cpp
userlibandfileserver/fileserver/sfsrv/cl_fman.cpp
--- a/baseapitest/basesvs/group/basesvs.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/baseapitest/basesvs/group/basesvs.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
-
 component		basesvs
 source			\sf\os\kernelhwsrv\baseapitest\basesvs
 notes_source	\sf\os\kernelhwsrv\baseapitest\basesvs\group\release.txt
--- a/brdbootldr/ubootldr/base_ubootldr.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/brdbootldr/ubootldr/base_ubootldr.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Bootstrap"
 
 component	base_ubootldr
--- a/brdbootldr/ubootldr/inflate.c	Wed Jul 21 14:46:58 2010 +0100
+++ b/brdbootldr/ubootldr/inflate.c	Thu Jul 22 16:46:39 2010 +0100
@@ -1,19 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
 /* inflate.c -- Not copyrighted 1992 by Mark Adler
    version c10p1, 10 January 1993 */
 
--- a/bsptemplate/asspandvariant/base_template.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/bsptemplate/asspandvariant/base_template.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Template Variant"
 
 component	base_template
--- a/bsptemplate/asspandvariant/template_assp/dma.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/bsptemplate/asspandvariant/template_assp/dma.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -27,19 +27,17 @@
 noexportlibrary
 
 sourcepath		../../../kernel/eka/drivers/dma
-source			dma2_pil.cpp dma2_shared.cpp
+source			dmapil.cpp
 
 sourcepath		.
 source			dmapsl.cpp
 
 library			VariantTarget(katemplate,lib)
 
-deffile			../../../kernel/eka/~/dma2.def
+deffile			../../../kernel/eka/~/dma.def
 
 epocallowdlldata
 
 capability		all
 
 VENDORID 0x70000001
-
-MACRO DMA_APIV2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bsptemplate/asspandvariant/template_assp/dma_v2.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,46 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// template/template_assp/dma_v2.mmp
+//
+//
+
+#include		<variant.mmh>
+#include		"kernel/kern_ext.mmh"
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SYMBIAN_BASE_SYSTEMINCLUDE(assp/template_assp)
+
+target			VariantTarget(dma_v2,dll)
+targettype		kext
+linkas			dma.dll
+noexportlibrary
+
+sourcepath		../../../kernel/eka/drivers/dma
+source			dma2_pil.cpp dma2_shared.cpp
+
+sourcepath		.
+source			dmapsl_v2.cpp
+
+library			VariantTarget(katemplate,lib)
+
+deffile			../../../kernel/eka/~/dma2.def
+
+epocallowdlldata
+
+capability		all
+
+VENDORID 0x70000001
+
+MACRO DMA_APIV2
--- a/bsptemplate/asspandvariant/template_assp/dmapsl.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/bsptemplate/asspandvariant/template_assp/dmapsl.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -21,16 +21,15 @@
 #include <template_assp.h>									// /assp/template_assp/
 
 #include <drivers/dma.h>
-#include <drivers/dma_hai.h>
 
 
 // Debug support
 static const char KDmaPanicCat[] = "DMA PSL - " __FILE__;
 
-static const TInt KMaxTransferLen = 0x1FE0;	// max transfer length for this DMAC
-static const TInt KMemAlignMask = 7; // memory addresses passed to DMAC must be multiple of 8
-static const TInt KChannelCount = 16;			// we got 16 channels
-static const TInt KDesCount = 160;				// Initial DMA descriptor count
+static const TInt KMaxTransferLen = 0x1FE0;					// max transfer length for this DMAC
+static const TInt KMemAlignMask = 7;				  // memory addresses passed to DMAC must be multiple of 8
+static const TInt KChannelCount = 16;						// we got 16 channels
+static const TInt KDesCount = 1024;							// DMA descriptor count
 
 
 class TDmaDesc
@@ -77,26 +76,6 @@
 	return TestInfo;
 	}
 
-/**
-TO DO: Fill in to provide information to the V2 test harness (t_dma2.exe)
-*/
-TDmaV2TestInfo TestInfov2 =
-	{
-	0,
-	0,
-	0,
-	0,
-	{0},
-	0,
-	{0},
-	0,
-	{0}
-	};
-
-EXPORT_C const TDmaV2TestInfo& DmaTestInfoV2()
-	{
-	return TestInfov2;
-	}
 
 //////////////////////////////////////////////////////////////////////////////
 // Helper Functions
@@ -111,14 +90,14 @@
 	}
 
 
-static TUint32 DmaCmdReg(TUint aCount, TUint aFlags, TUint32 aSrcPslInfo, TUint32 aDstPslInfo)
+static TUint32 DcmdReg(TInt aCount, TUint aFlags, TUint32 aPslInfo)
 //
 // Returns value to set in DMA command register or in descriptor command field.
 //
 	{
 	// TO DO: Construct CMD word from input values.
 	// The return value should reflect the actual control word.
-	return (aCount | aFlags | aSrcPslInfo | aDstPslInfo);
+	return (aCount | aFlags | aPslInfo);
 	}
 
 
@@ -145,15 +124,14 @@
 	TInt Create();
 private:
 	// from TDmac (PIL pure virtual)
+	virtual void Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aHdr);
 	virtual void StopTransfer(const TDmaChannel& aChannel);
 	virtual TBool IsIdle(const TDmaChannel& aChannel);
-	virtual TUint MaxTransferLength(TDmaChannel& aChannel, TUint aSrcFlags,
-									TUint aDstFlags, TUint32 aPslInfo);
-	virtual TUint AddressAlignMask(TDmaChannel& aChannel, TUint aSrcFlags,
-								   TUint aDstFlags, TUint32 aPslInfo);
+	virtual TInt MaxTransferSize(TDmaChannel& aChannel, TUint aFlags, TUint32 aPslInfo);
+	virtual TUint MemAlignMask(TDmaChannel& aChannel, TUint aFlags, TUint32 aPslInfo);
 	// from TDmac (PIL virtual)
-	virtual void Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aHdr);
-	virtual TInt InitHwDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs);
+	virtual void InitHwDes(const SDmaDesHdr& aHdr, TUint32 aSrc, TUint32 aDest, TInt aCount,
+ 						   TUint aFlags, TUint32 aPslInfo, TUint32 aCookie);
 	virtual void ChainHwDes(const SDmaDesHdr& aHdr, const SDmaDesHdr& aNextHdr);
 	virtual void AppendHwDes(const TDmaChannel& aChannel, const SDmaDesHdr& aLastHdr,
 							 const SDmaDesHdr& aNewHdr);
@@ -173,10 +151,11 @@
 
 const TDmac::SCreateInfo TTemplateDmac::KInfo =
 	{
-	ETrue,													// iCapsHwDes
-	KDesCount,												// iDesCount
-	sizeof(TDmaDesc),										// iDesSize
-	EMapAttrSupRw | EMapAttrFullyBlocking					// iDesChunkAttribs
+	KChannelCount,
+	KDesCount,
+	TDmac::KCapsBitHwDes,
+	sizeof(TDmaDesc),
+	EMapAttrSupRw | EMapAttrFullyBlocking
 	};
 
 
@@ -201,7 +180,7 @@
 			{
 			TDmaDesc* pD = HdrToHwDes(*iFreeHdr);
 			iChannels[i].iTmpDes = pD;
-			iChannels[i].iTmpDesPhysAddr = HwDesLinToPhys(pD);
+			iChannels[i].iTmpDesPhysAddr = DesLinToPhys(pD);
 			iFreeHdr = iFreeHdr->iNext;
 			}
 		r = Interrupt::Bind(EAsspIntIdDma, Isr, this);
@@ -265,10 +244,9 @@
 	}
 
 
-TUint TTemplateDmac::MaxTransferLength(TDmaChannel& /*aChannel*/, TUint /*aSrcFlags*/,
-									   TUint /*aDstFlags*/, TUint32 /*aPslInfo*/)
+TInt TTemplateDmac::MaxTransferSize(TDmaChannel& /*aChannel*/, TUint /*aFlags*/, TUint32 /*aPslInfo*/)
 //
-// Returns the maximum transfer length in bytes for a given transfer.
+// Returns the maximum transfer size for a given transfer.
 //
 	{
 	// TO DO: Determine the proper return value, based on the arguments.
@@ -278,8 +256,7 @@
 	}
 
 
-TUint TTemplateDmac::AddressAlignMask(TDmaChannel& aChannel, TUint /*aSrcFlags*/,
-									  TUint /*aDstFlags*/, TUint32 /*aPslInfo*/)
+TUint TTemplateDmac::MemAlignMask(TDmaChannel& /*aChannel*/, TUint /*aFlags*/, TUint32 /*aPslInfo*/)
 //
 // Returns the memory buffer alignment restrictions mask for a given transfer.
 //
@@ -291,7 +268,8 @@
 	}
 
 
-TInt TTemplateDmac::InitHwDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs)
+void TTemplateDmac::InitHwDes(const SDmaDesHdr& aHdr, TUint32 aSrc, TUint32 aDest, TInt aCount,
+							  TUint aFlags, TUint32 aPslInfo, TUint32 /*aCookie*/)
 //
 // Sets up (from a passed in request) the descriptor with that fragment's
 // source and destination address, the fragment size, and the (driver/DMA
@@ -306,15 +284,12 @@
 	// Unaligned descriptor? Bug in generic layer!
 	__DMA_ASSERTD(IsHwDesAligned(pD));
 
-	const TDmaTransferConfig& src = aTransferArgs.iSrcConfig;
-	const TDmaTransferConfig& dst = aTransferArgs.iDstConfig;
-	pD->iSrcAddr  = (src.iFlags & KDmaPhysAddr) ? src.iAddr : Epoc::LinearToPhysical(src.iAddr);
-	pD->iDestAddr = (dst.iFlags & KDmaPhysAddr) ? dst.iAddr : Epoc::LinearToPhysical(dst.iAddr);
-	pD->iCmd = DmaCmdReg(aTransferArgs.iTransferCount, aTransferArgs.iFlags,
-					   src.iPslTargetInfo, dst.iPslTargetInfo);
+	pD->iSrcAddr = (aFlags & KDmaPhysAddrSrc) ? aSrc : Epoc::LinearToPhysical(aSrc);
+	__DMA_ASSERTD(pD->iSrcAddr != KPhysAddrInvalid);
+	pD->iDestAddr = (aFlags & KDmaPhysAddrDest) ? aDest : Epoc::LinearToPhysical(aDest);
+	__DMA_ASSERTD(pD->iDestAddr != KPhysAddrInvalid);
+	pD->iCmd = DcmdReg(aCount, aFlags, aPslInfo);
 	pD->iDescAddr = TDmaDesc::KStopBitMask;
-
-	return KErrNone;
 	}
 
 
@@ -334,7 +309,7 @@
 
 	// TO DO: Modify pD->iCmd so that no end-of-transfer interrupt gets raised any longer.
 
-	pD->iDescAddr = HwDesLinToPhys(pN);
+	pD->iDescAddr = DesLinToPhys(pN);
 	}
 
 
@@ -354,7 +329,7 @@
 	// Unaligned descriptor? Bug in generic layer!
 	__DMA_ASSERTD(IsHwDesAligned(pL) && IsHwDesAligned(pN));
 
-	TPhysAddr newPhys = HwDesLinToPhys(pN);
+	TPhysAddr newPhys = DesLinToPhys(pN);
 
 	const TInt irq = NKern::DisableAllInterrupts();
 	StopTransfer(aChannel);
@@ -398,7 +373,7 @@
 
 	// TO DO: Implement the behaviour described above, call HandleIsr().
 
-	HandleIsr(me.iChannels[5], EDmaCallbackRequestCompletion, ETrue); // Example
+	HandleIsr(me.iChannels[5], 0);							// Example
 
 	}
 
@@ -416,7 +391,7 @@
 // Channel Opening/Closing (Channel Allocator)
 //////////////////////////////////////////////////////////////////////////////
 
-TDmaChannel* DmaChannelMgr::Open(TUint32 aOpenId, TBool /*aDynChannel*/, TUint /*aPriority*/)
+TDmaChannel* DmaChannelMgr::Open(TUint32 aOpenId)
 //
 //
 //
@@ -469,10 +444,5 @@
 	{
 	__KTRACE_OPT2(KBOOT, KDMA, Kern::Printf("Starting DMA Extension"));
 
-	const TInt r = DmaChannelMgr::Initialise();
-	if (r != KErrNone)
-		{
-		return r;
-		}
 	return Controller.Create();
 	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bsptemplate/asspandvariant/template_assp/dmapsl_v2.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,480 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// bsptemplate/asspvariant/template_assp/dmapsl_v2.cpp
+// Template DMA Platform Specific Layer (PSL).
+//
+//
+
+
+#include <kernel/kern_priv.h>
+#include <template_assp.h>									// /assp/template_assp/
+
+#include <drivers/dma.h>
+#include <drivers/dma_hai.h>
+
+
+// Debug support
+static const char KDmaPanicCat[] = "DMA PSL - " __FILE__;
+
+static const TInt KMaxTransferLen = 0x1FE0;	// max transfer length for this DMAC
+static const TInt KMemAlignMask = 7; // memory addresses passed to DMAC must be multiple of 8
+static const TInt KChannelCount = 16;			// we got 16 channels
+static const TInt KDesCount = 160;				// Initial DMA descriptor count
+
+
+class TDmaDesc
+//
+// Hardware DMA descriptor
+//
+	{
+public:
+	enum {KStopBitMask = 1};
+public:
+	TPhysAddr iDescAddr;
+	TPhysAddr iSrcAddr;
+	TPhysAddr iDestAddr;
+	TUint32 iCmd;
+	};
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Test Support
+//////////////////////////////////////////////////////////////////////////////
+
+/**
+TO DO: Fill in to provide information to the V1 test harness (t_dma.exe)
+*/
+TDmaTestInfo TestInfo =
+	{
+	0,
+	0,
+	0,
+	0,
+	NULL,
+	0,
+	NULL,
+	0,
+	NULL
+	};
+
+
+EXPORT_C const TDmaTestInfo& DmaTestInfo()
+//
+//
+//
+	{
+	return TestInfo;
+	}
+
+/**
+TO DO: Fill in to provide information to the V2 test harness (t_dma2.exe)
+*/
+TDmaV2TestInfo TestInfov2 =
+	{
+	0,
+	0,
+	0,
+	0,
+	{0},
+	0,
+	{0},
+	0,
+	{0}
+	};
+
+EXPORT_C const TDmaV2TestInfo& DmaTestInfoV2()
+	{
+	return TestInfov2;
+	}
+
+//////////////////////////////////////////////////////////////////////////////
+// Helper Functions
+//////////////////////////////////////////////////////////////////////////////
+
+inline TBool IsHwDesAligned(TAny* aDes)
+//
+// Checks whether given hardware descriptor is 16-bytes aligned.
+//
+	{
+	return ((TLinAddr)aDes & 0xF) == 0;
+	}
+
+
+static TUint32 DmaCmdReg(TUint aCount, TUint aFlags, TUint32 aSrcPslInfo, TUint32 aDstPslInfo)
+//
+// Returns value to set in DMA command register or in descriptor command field.
+//
+	{
+	// TO DO: Construct CMD word from input values.
+	// The return value should reflect the actual control word.
+	return (aCount | aFlags | aSrcPslInfo | aDstPslInfo);
+	}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Derived Channel (Scatter/Gather)
+//////////////////////////////////////////////////////////////////////////////
+
+class TTemplateSgChannel : public TDmaSgChannel
+	{
+public:
+	TDmaDesc* iTmpDes;
+	TPhysAddr iTmpDesPhysAddr;
+	};
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Derived Controller Class
+//////////////////////////////////////////////////////////////////////////////
+
+class TTemplateDmac : public TDmac
+	{
+public:
+	TTemplateDmac();
+	TInt Create();
+private:
+	// from TDmac (PIL pure virtual)
+	virtual void StopTransfer(const TDmaChannel& aChannel);
+	virtual TBool IsIdle(const TDmaChannel& aChannel);
+	virtual TUint MaxTransferLength(TDmaChannel& aChannel, TUint aSrcFlags,
+									TUint aDstFlags, TUint32 aPslInfo);
+	virtual TUint AddressAlignMask(TDmaChannel& aChannel, TUint aSrcFlags,
+								   TUint aDstFlags, TUint32 aPslInfo);
+	// from TDmac (PIL virtual)
+	virtual void Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aHdr);
+	virtual TInt InitHwDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs);
+	virtual void ChainHwDes(const SDmaDesHdr& aHdr, const SDmaDesHdr& aNextHdr);
+	virtual void AppendHwDes(const TDmaChannel& aChannel, const SDmaDesHdr& aLastHdr,
+							 const SDmaDesHdr& aNewHdr);
+	virtual void UnlinkHwDes(const TDmaChannel& aChannel, SDmaDesHdr& aHdr);
+	// other
+	static void Isr(TAny* aThis);
+	inline TDmaDesc* HdrToHwDes(const SDmaDesHdr& aHdr);
+private:
+	static const SCreateInfo KInfo;
+public:
+	TTemplateSgChannel iChannels[KChannelCount];
+	};
+
+
+static TTemplateDmac Controller;
+
+
+const TDmac::SCreateInfo TTemplateDmac::KInfo =
+	{
+	ETrue,													// iCapsHwDes
+	KDesCount,												// iDesCount
+	sizeof(TDmaDesc),										// iDesSize
+	EMapAttrSupRw | EMapAttrFullyBlocking					// iDesChunkAttribs
+	};
+
+
+TTemplateDmac::TTemplateDmac()
+//
+// Constructor.
+//
+	: TDmac(KInfo)
+	{}
+
+
+TInt TTemplateDmac::Create()
+//
+// Second phase construction.
+//
+	{
+	TInt r = TDmac::Create(KInfo);							// Base class Create()
+	if (r == KErrNone)
+		{
+		__DMA_ASSERTA(ReserveSetOfDes(KChannelCount) == KErrNone);
+		for (TInt i=0; i < KChannelCount; ++i)
+			{
+			TDmaDesc* pD = HdrToHwDes(*iFreeHdr);
+			iChannels[i].iTmpDes = pD;
+			iChannels[i].iTmpDesPhysAddr = HwDesLinToPhys(pD);
+			iFreeHdr = iFreeHdr->iNext;
+			}
+		r = Interrupt::Bind(EAsspIntIdDma, Isr, this);
+		if (r == KErrNone)
+			{
+			// TO DO: Map DMA clients (requests) to DMA channels here.
+
+			r = Interrupt::Enable(EAsspIntIdDma);
+			}
+		}
+	return r;
+	}
+
+
+void TTemplateDmac::Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aHdr)
+//
+// Initiates a (previously constructed) request on a specific channel.
+//
+	{
+	const TUint8 i = static_cast<TUint8>(aChannel.PslId());
+	TDmaDesc* pD = HdrToHwDes(aHdr);
+
+	__KTRACE_OPT(KDMA, Kern::Printf(">TTemplateDmac::Transfer channel=%d des=0x%08X", i, pD));
+
+	// TO DO (for instance): Load the first descriptor address into the DMAC and start it
+	// by setting the RUN bit.
+	(void) *pD, (void) i;
+
+	}
+
+
+void TTemplateDmac::StopTransfer(const TDmaChannel& aChannel)
+//
+// Stops a running channel.
+//
+	{
+	const TUint8 i = static_cast<TUint8>(aChannel.PslId());
+
+	__KTRACE_OPT(KDMA, Kern::Printf(">TTemplateDmac::StopTransfer channel=%d", i));
+
+	// TO DO (for instance): Clear the RUN bit of the channel.
+	(void) i;
+
+	}
+
+
+TBool TTemplateDmac::IsIdle(const TDmaChannel& aChannel)
+//
+// Returns the state of a given channel.
+//
+	{
+	const TUint8 i = static_cast<TUint8>(aChannel.PslId());
+
+	__KTRACE_OPT(KDMA, Kern::Printf(">TTemplateDmac::IsIdle channel=%d", i));
+
+	// TO DO (for instance): Return the state of the RUN bit of the channel.
+	// The return value should reflect the actual state.
+	(void) i;
+
+	return ETrue;
+	}
+
+
+TUint TTemplateDmac::MaxTransferLength(TDmaChannel& /*aChannel*/, TUint /*aSrcFlags*/,
+									   TUint /*aDstFlags*/, TUint32 /*aPslInfo*/)
+//
+// Returns the maximum transfer length in bytes for a given transfer.
+//
+	{
+	// TO DO: Determine the proper return value, based on the arguments.
+
+	// For instance:
+	return KMaxTransferLen;
+	}
+
+
+TUint TTemplateDmac::AddressAlignMask(TDmaChannel& aChannel, TUint /*aSrcFlags*/,
+									  TUint /*aDstFlags*/, TUint32 /*aPslInfo*/)
+//
+// Returns the memory buffer alignment restrictions mask for a given transfer.
+//
+	{
+	// TO DO: Determine the proper return value, based on the arguments.
+
+	// For instance:
+	return KMemAlignMask;
+	}
+
+
+TInt TTemplateDmac::InitHwDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs)
+//
+// Sets up (from a passed in request) the descriptor with that fragment's
+// source and destination address, the fragment size, and the (driver/DMA
+// controller) specific transfer parameters (mem/peripheral, burst size,
+// transfer width).
+//
+	{
+	TDmaDesc* pD = HdrToHwDes(aHdr);
+
+	__KTRACE_OPT(KDMA, Kern::Printf("TTemplateDmac::InitHwDes 0x%08X", pD));
+
+	// Unaligned descriptor? Bug in generic layer!
+	__DMA_ASSERTD(IsHwDesAligned(pD));
+
+	const TDmaTransferConfig& src = aTransferArgs.iSrcConfig;
+	const TDmaTransferConfig& dst = aTransferArgs.iDstConfig;
+	pD->iSrcAddr  = (src.iFlags & KDmaPhysAddr) ? src.iAddr : Epoc::LinearToPhysical(src.iAddr);
+	__DMA_ASSERTD(pD->iSrcAddr != KPhysAddrInvalid);
+	pD->iDestAddr = (dst.iFlags & KDmaPhysAddr) ? dst.iAddr : Epoc::LinearToPhysical(dst.iAddr);
+	__DMA_ASSERTD(pD->iDestAddr != KPhysAddrInvalid);
+	pD->iCmd = DmaCmdReg(aTransferArgs.iTransferCount, aTransferArgs.iFlags,
+					   src.iPslTargetInfo, dst.iPslTargetInfo);
+	pD->iDescAddr = TDmaDesc::KStopBitMask;
+
+	return KErrNone;
+	}
+
+
+void TTemplateDmac::ChainHwDes(const SDmaDesHdr& aHdr, const SDmaDesHdr& aNextHdr)
+//
+// Chains hardware descriptors together by setting the next pointer of the original descriptor
+// to the physical address of the descriptor to be chained.
+//
+	{
+	TDmaDesc* pD = HdrToHwDes(aHdr);
+	TDmaDesc* pN = HdrToHwDes(aNextHdr);
+
+	__KTRACE_OPT(KDMA, Kern::Printf("TTemplateDmac::ChainHwDes des=0x%08X next des=0x%08X", pD, pN));
+
+	// Unaligned descriptor? Bug in generic layer!
+	__DMA_ASSERTD(IsHwDesAligned(pD) && IsHwDesAligned(pN));
+
+	// TO DO: Modify pD->iCmd so that no end-of-transfer interrupt gets raised any longer.
+
+	pD->iDescAddr = HwDesLinToPhys(pN);
+	}
+
+
+void TTemplateDmac::AppendHwDes(const TDmaChannel& aChannel, const SDmaDesHdr& aLastHdr,
+								const SDmaDesHdr& aNewHdr)
+//
+// Appends a descriptor to the chain while the channel is running.
+//
+	{
+	const TUint8 i = static_cast<TUint8>(aChannel.PslId());
+
+	TDmaDesc* pL = HdrToHwDes(aLastHdr);
+	TDmaDesc* pN = HdrToHwDes(aNewHdr);
+
+	__KTRACE_OPT(KDMA, Kern::Printf(">TTemplateDmac::AppendHwDes channel=%d last des=0x%08X new des=0x%08X",
+									i, pL, pN));
+	// Unaligned descriptor? Bug in generic layer!
+	__DMA_ASSERTD(IsHwDesAligned(pL) && IsHwDesAligned(pN));
+
+	TPhysAddr newPhys = HwDesLinToPhys(pN);
+
+	const TInt irq = NKern::DisableAllInterrupts();
+	StopTransfer(aChannel);
+
+	pL->iDescAddr = newPhys;
+	const TTemplateSgChannel& channel = static_cast<const TTemplateSgChannel&>(aChannel);
+	TDmaDesc* pD = channel.iTmpDes;
+
+	// TO DO: Implement the appropriate algorithm for appending a descriptor here.
+	(void) *pD, (void) i;
+
+	NKern::RestoreInterrupts(irq);
+
+	__KTRACE_OPT(KDMA, Kern::Printf("<TTemplateDmac::AppendHwDes"));
+	}
+
+
+void TTemplateDmac::UnlinkHwDes(const TDmaChannel& /*aChannel*/, SDmaDesHdr& aHdr)
+//
+// Unlink the last item in the h/w descriptor chain from a subsequent chain that it was
+// possibly linked to.
+//
+	{
+ 	__KTRACE_OPT(KDMA, Kern::Printf(">TTemplateDmac::UnlinkHwDes"));
+  	TDmaDesc* pD = HdrToHwDes(aHdr);
+  	pD->iDescAddr = TDmaDesc::KStopBitMask;
+
+	// TO DO: Modify pD->iCmd so that an end-of-transfer interrupt will get raised.
+
+	}
+
+
+void TTemplateDmac::Isr(TAny* aThis)
+//
+// This ISR reads the interrupt identification and calls back into the base class
+// interrupt service handler with the channel identifier and an indication whether the
+// transfer completed correctly or with an error.
+//
+	{
+	TTemplateDmac& me = *static_cast<TTemplateDmac*>(aThis);
+
+	// TO DO: Implement the behaviour described above, call HandleIsr().
+
+	HandleIsr(me.iChannels[5], EDmaCallbackRequestCompletion, ETrue); // Example
+
+	}
+
+
+inline TDmaDesc* TTemplateDmac::HdrToHwDes(const SDmaDesHdr& aHdr)
+//
+// Changes return type of base class call.
+//
+	{
+	return static_cast<TDmaDesc*>(TDmac::HdrToHwDes(aHdr));
+	}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Channel Opening/Closing (Channel Allocator)
+//////////////////////////////////////////////////////////////////////////////
+
+TDmaChannel* DmaChannelMgr::Open(TUint32 aOpenId, TBool /*aDynChannel*/, TUint /*aPriority*/)
+//
+//
+//
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf(">DmaChannelMgr::Open aOpenId=%d", aOpenId));
+
+	__DMA_ASSERTA(aOpenId < static_cast<TUint32>(KChannelCount));
+
+	TDmaChannel* pC = Controller.iChannels + aOpenId;
+	if (pC->IsOpened())
+		{
+		pC = NULL;
+		}
+	else
+		{
+		pC->iController = &Controller;
+		pC->iPslId = aOpenId;
+		}
+
+	return pC;
+	}
+
+
+void DmaChannelMgr::Close(TDmaChannel* /*aChannel*/)
+//
+//
+//
+	{
+	// NOP
+	}
+
+
+TInt DmaChannelMgr::StaticExtension(TInt /*aCmd*/, TAny* /*aArg*/)
+//
+//
+//
+	{
+	return KErrNotSupported;
+	}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// DLL Exported Function
+//////////////////////////////////////////////////////////////////////////////
+
+DECLARE_STANDARD_EXTENSION()
+//
+// Creates and initializes a new DMA controller object on the kernel heap.
+//
+	{
+	__KTRACE_OPT2(KBOOT, KDMA, Kern::Printf("Starting DMA Extension"));
+
+	const TInt r = DmaChannelMgr::Initialise();
+	if (r != KErrNone)
+		{
+		return r;
+		}
+	return Controller.Create();
+	}
--- a/bsptemplate/asspandvariant/template_assp/pa_usbc.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/bsptemplate/asspandvariant/template_assp/pa_usbc.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1904,7 +1904,7 @@
 #ifdef _DEBUG
 	_LIT(KIns, "inserted");
 	_LIT(KRem, "removed");
-	__KTRACE_OPT(KUSB, Kern::Printf(" > USB cable now %lS", ptr->iCableConnected ? &KIns : &KRem));
+	__KTRACE_OPT(KUSB, Kern::Printf(" > USB cable now %S", ptr->iCableConnected ? &KIns : &KRem));
 #endif
 	if (ptr->iCableConnected)
 		{
--- a/bsptemplate/asspandvariant/template_assp/template_assp.inf	Wed Jul 21 14:46:58 2010 +0100
+++ b/bsptemplate/asspandvariant/template_assp/template_assp.inf	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -38,5 +38,6 @@
 
 katemplate
 dma
+dma_v2
 usbcc
 gpio
--- a/bsptemplate/asspandvariant/template_variant/bld.inf	Wed Jul 21 14:46:58 2010 +0100
+++ b/bsptemplate/asspandvariant/template_variant/bld.inf	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -81,6 +81,7 @@
 cakdtemplate
 medlffstemplate
 soundsctemplate
+soundsctemplate_v2
 camerasctemplate
 exi2s
 //epbus
--- a/bsptemplate/asspandvariant/template_variant/hal/config.hcf	Wed Jul 21 14:46:58 2010 +0100
+++ b/bsptemplate/asspandvariant/template_variant/hal/config.hcf	Thu Jul 22 16:46:39 2010 +0100
@@ -99,3 +99,4 @@
 ECustomResourceDrive : set = 0
 EDisplayNumberOfScreens=0
 ENumCpus=GetNumCpus
+EDigitiserOrientation : set = DigitiserOrientation
--- a/bsptemplate/asspandvariant/template_variant/rom/base_template.iby	Wed Jul 21 14:46:58 2010 +0100
+++ b/bsptemplate/asspandvariant/template_variant/rom/base_template.iby	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -39,7 +39,11 @@
 extension[VARID]=KERNEL_DIR\DEBUG_DIR\_template_exmoncommon.dll			\sys\bin\exmoncommon.dll
 extension[VARID]=KERNEL_DIR\DEBUG_DIR\_template_exmondebug.dll			\sys\bin\exmondebug.dll
 extension[VARID]=KERNEL_DIR\DEBUG_DIR\_template_power.dll				\sys\bin\power.dll
+#ifdef SYMBIAN_USE_DMA_V2
+extension[VARID]=KERNEL_DIR\DEBUG_DIR\_template_dma_v2.dll			\sys\bin\dma.dll
+#else
 extension[VARID]=KERNEL_DIR\DEBUG_DIR\_template_dma.dll					\sys\bin\dma.dll
+#endif
 extension[VARID]=KERNEL_DIR\DEBUG_DIR\_template_lcd.dll					\sys\bin\lcd.dll
 extension[VARID]=KERNEL_DIR\DEBUG_DIR\_template_ekeyb.dll				\sys\bin\ekeyb.dll
 extension[VARID]=KERNEL_DIR\DEBUG_DIR\_template_exyin.dll				\sys\bin\exyin.dll
--- a/bsptemplate/asspandvariant/template_variant/rom/kernel.iby	Wed Jul 21 14:46:58 2010 +0100
+++ b/bsptemplate/asspandvariant/template_variant/rom/kernel.iby	Thu Jul 22 16:46:39 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -30,7 +30,11 @@
 extension[VARID]=	\Epoc32\Release\##KMAIN##\##BUILD##\_##VARIANT##_EXMONCOMMON.DLL \sys\bin\exmoncommon.dll
 extension[VARID]=	\Epoc32\Release\##KMAIN##\##BUILD##\_##VARIANT##_EXMONDEBUG.DLL \sys\bin\exmondebug.dll
 extension[VARID]=	\Epoc32\Release\##KMAIN##\##BUILD##\_##VARIANT##_POWER.DLL		\sys\bin\power.dll
-extension[VARID]=	\Epoc32\Release\##KMAIN##\##BUILD##\_##VARIANT##_DMA.DLL		\sys\bin\DMA.DLL
+#ifdef SYMBIAN_USE_DMA_V2
+extension[VARID]=	\Epoc32\Release\##KMAIN##\##BUILD##\_##VARIANT##_DMA_V2.DLL		\sys\bin\dma.dll
+#else
+extension[VARID]=	\Epoc32\Release\##KMAIN##\##BUILD##\_##VARIANT##_DMA.DLL		\sys\bin\dma.dll
+#endif
 //
 // TO DO: (mandatory)
 //
@@ -46,7 +50,11 @@
 extension[VARID]=	\Epoc32\Release\##KMAIN##\##BUILD##\_##VARIANT##_EXYIN.DLL		\sys\bin\exyin.dll
 device[VARID]=		\Epoc32\Release\##KMAIN##\##BUILD##\_##VARIANT##_EUART.PDD		\sys\bin\euart.pdd
 // SYM_BRANCH: Delete old sound driver
+#ifdef SYMBIAN_USE_DMA_V2
+device[VARID]= 		\Epoc32\Release\##KMAIN##\##BUILD##\_##VARIANT##_SOUNDSC_V2.PDD		\sys\bin\soundsc.pdd
+#else
 device[VARID]= 		\Epoc32\Release\##KMAIN##\##BUILD##\_##VARIANT##_SOUNDSC.PDD    	\sys\bin\soundsc.pdd
+#endif
 extension[VARID]=	\Epoc32\Release\##KMAIN##\##BUILD##\ELOCD.LDD					\sys\bin\elocd.ldd
 extension[VARID]=	\Epoc32\Release\##KMAIN##\##BUILD##\_##VARIANT##_MEDINT.PDD		\sys\bin\medint.pdd
 //extension[VARID]=	\Epoc32\Release\##KMAIN##\##BUILD##\_##VARIANT##_EPBUS.DLL		\sys\bin\epbus.dll
@@ -84,10 +92,15 @@
 // Include optional test drivers for e32test
 
 // Include if platform supports the standard Symbian DMA framework
-//device[VARID]=		\epoc32\release\##KMAIN##\##BUILD##\d_dma.ldd					\sys\bin\d_dma.ldd
+#ifdef SYMBIAN_USE_DMA_V2
+device[VARID]=		\epoc32\release\##KMAIN##\##BUILD##\d_dma2.ldd					\sys\bin\d_dma2.ldd
+device[VARID]=		\epoc32\release\##KMAIN##\##BUILD##\d_dma_compat.ldd			\sys\bin\d_dma_compat.ldd
+#else
+device[VARID]=		\epoc32\release\##KMAIN##\##BUILD##\d_dma.ldd					\sys\bin\d_dma.ldd
+device[VARID]=		\epoc32\release\##KMAIN##\##BUILD##\d_dma2_compat.ldd			\sys\bin\d_dma2_compat.ldd
+#endif
 
 // Include if platform supports MMC
 //device[VARID]=		\epoc32\release\##KMAIN##\##BUILD##\d_medch.ldd					\sys\bin\d_medch.ldd
 
 #endif
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bsptemplate/asspandvariant/template_variant/soundsctemplate_v2.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,52 @@
+// Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// template/template_variant/soundsctemplate.mmp
+// soundsc.pdd Template shared chunk sound PDD
+// 
+//
+
+/**
+ @file
+*/
+#define __USING_ASSP_REGISTER_API__
+#define __USING_ASSP_INTERRUPT_API__
+
+#include		<variant.mmh>
+#include		"kernel/kern_ext.mmh"
+
+target          	VariantTarget(soundsc_v2,pdd)
+targettype      	pdd
+romtarget		soundsc.pdd
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+SYMBIAN_BASE_SYSTEMINCLUDE(assp/template_assp)
+SYMBIAN_BASE_SYSTEMINCLUDE(template)
+SYMBIAN_BASE_SYSTEMINCLUDE(template/specific)
+USERINCLUDE		inc
+
+sourcepath		specific
+source          	soundsc_tx.cpp
+source          	soundsc_rx.cpp
+
+library         	dma2.lib
+library			VariantTarget(ecust,lib)
+
+uid             	0x100039d0 0x1000015c
+
+VENDORID 0x70000001
+
+capability		all
+EPOCALLOWDLLDATA
+
+MACRO DMA_APIV2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build.config.xml	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,284 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition [
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+  name CDATA #REQUIRED
+  schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+  name CDATA #REQUIRED
+  levels CDATA #IMPLIED
+  span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset 
+  name CDATA #REQUIRED
+  levels CDATA #IMPLIED  
+  span CDATA #IMPLIED
+  level CDATA #IMPLIED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+  name CDATA #REQUIRED
+  level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+  unitID ID #REQUIRED
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  bldFile CDATA #REQUIRED
+  priority CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+  name CDATA #REQUIRED
+  version CDATA #REQUIRED
+  late (Y|N) #IMPLIED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+  name ID #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+  name ID #REQUIRED
+  abldTarget CDATA #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+  name ID #REQUIRED
+  abldOption CDATA #REQUIRED
+  description CDATA #REQUIRED
+  enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+  command CDATA #REQUIRED
+  targetList IDREFS #IMPLIED
+  unitParallel (Y | N | y | n) #REQUIRED
+  targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+  name CDATA #REQUIRED
+  cwd CDATA #REQUIRED
+  command CDATA #REQUIRED>
+ <!ENTITY layer_real_source_path "/sf/os/kernelhwsrv" >
+]>
+<SystemDefinition name="KHS" schema="1.4.0">
+  <systemModel>
+	<layer name="os_layer">
+
+		<module name="KHS_HalServices"> 
+			<unit name="khs_hal" unitID="sos.khs_hal" bldFile="\sf\os\kernelhwsrv\halservices\hal" mrp="\sf\os\kernelhwsrv\halservices\hal\base_hal.mrp"/> 
+		</module> 
+		<module name="KHS_Kernel"> 
+			<unit name="eka" unitID="sos.eka" bldFile="\sf\os\kernelhwsrv\kernel\eka" mrp="\sf\os\kernelhwsrv\kernel\eka\base_e32.mrp"/>
+			<unit name="eka_compsupp" unitID="sos.eka_compsupp" bldFile="\sf\os\kernelhwsrv\kernel\eka\compsupp" mrp="\sf\os\kernelhwsrv\kernel\eka\compsupp\base_e32_compsupp.mrp"/>
+			<unit name="eka_drivers_bsp" unitID="sos.eka_drivers_bsp" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\bsp\" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\bsp\base_e32_drivers_bsp.mrp.mrp"/>
+			<unit name="eka_drivers_camerasc" unitID="sos.eka_drivers_camerasc" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\camerasc" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\camerasc\base_drivers_camerasc.mrp"/>
+			<unit name="eka_drivers_cf_unistore2" unitID="sos.eka_drivers_cf_unistore2" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\crashflash\unistore2" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\crashflash\unistore2\base_crashflash_unistore2.mrp"/>
+			<unit name="eka_drivers_debug" unitID="sos.eka_drivers_debug" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\debug\group" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\debug\group\base_e32_drivers_debug.mrp"/>
+			<unit name="eka_drivers_display" unitID="sos.eka_drivers_display" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\display" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\display\base_e32_drivers_display.mrp"/>
+			<unit name="eka_drivers_ecomm" unitID="sos.eka_drivers_ecomm" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\ecomm" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\ecomm\base_e32_drivers_ecomm.mrp"/>
+			<unit name="eka_drivers_ethernet" unitID="sos.eka_drivers_ethernet" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\ethernet" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\ethernet\base_e32_drivers_ethernet.mrp"/>
+			<unit name="eka_drivers_locmedia" unitID="sos.eka_drivers_locmedia" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\locmedia" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\locmedia\base_e32_drivers_locmedia.mrp"/>
+			<unit name="eka_drivers_media" unitID="sos.eka_drivers_media" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\media" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\media\base_e32_drivers_media.mrp"/>
+			<unit name="eka_drivers_medsd3c" unitID="sos.eka_drivers_medsd3c" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\medsd3c" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\medsd3c\base_e32_sd3c.mrp"/>
+			<unit name="eka_drivers_sdcard4c" unitID="sos.eka_drivers_sdcard4c" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\pbus\mmc\sdcard\sdcard4c" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\pbus\mmc\sdcard\sdcard4c\base_e32_sd4c.mrp"/>
+			<unit name="eka_drivers_soundsc" unitID="sos.eka_drivers_soundsc" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\soundsc" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\soundsc\base_e32_drivers_sound.mrp"/>
+			<unit name="eka_drivers_trace" unitID="sos.eka_drivers_trace" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\trace" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\trace\base_e32_drivers_trace.mrp"/>
+			<unit name="eka_drivers_unistore2" unitID="sos.eka_drivers_unistore2" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\unistore2" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\unistore2\base_drivers_unistore2.mrp"/>
+			<unit name="eka_drivers_usbdescriptors" unitID="sos.eka_drivers_usbdescriptors" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\usbho\usbdescriptors" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\usbho\usbdescriptors\base_drivers_usbdescriptors.mrp"/>
+			<unit name="eka_drivers_usbdi_utils" unitID="sos.eka_drivers_usbdi_utils" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\usbho\usbdi_utils" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\usbho\usbdi_utils\base_drivers_usbdi_utils.mrp"/>
+			<unit name="eka_drivers_usbc" unitID="sos.eka_drivers_usbc" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\usbc" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\usbc\base_e32_drivers_usbcli.mrp"/>
+			<unit name="eka_drivers_usbho" unitID="sos.eka_drivers_usbho" bldFile="\sf\os\kernelhwsrv\kernel\eka\drivers\usbho" mrp="\sf\os\kernelhwsrv\kernel\eka\drivers\usbho\base_drivers_usbhostotg.mrp"/>
+			<unit name="eka_euser" unitID="sos.eka_euser" bldFile="\sf\os\kernelhwsrv\kernel\eka\euser" mrp="\sf\os\kernelhwsrv\kernel\eka\euser\base_e32_euser.mrp"/>
+			<unit name="eka_ewsrv" unitID="sos.eka_ewsrv" bldFile="\sf\os\kernelhwsrv\kernel\eka\ewsrv\" mrp="\sf\os\kernelhwsrv\kernel\eka\ewsrv\base_e32_ewsrv.mrp"/>
+		</module> 
+
+		<module name="KHS_UserLibraryAndFileServer"> 
+			<unit name="usrlibflsrv_domainmgr" unitID="sos.usrlibflsrv_domainmgr" bldFile="\sf\os\kernelhwsrv\userlibandfileserver\domainmgr\group" mrp="\sf\os\kernelhwsrv\userlibandfileserver\domainmgr\group\base_domain.mrp"/>
+			<unit name="usrlibflsrv_flsrv_automounter" unitID="sos.usrlibflsrv_flsrv_automounter" bldFile="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\automounter" mrp="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\automounter\base_domain.mrp"/>
+			<unit name="usrlibflsrv_flsrv_estart" unitID="sos.usrlibflsrv_flsrv_estart" bldFile="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\estart" mrp="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\estart\base_f32_estart.mrp"/>
+			<unit name="usrlibflsrv_flsrv_etshell" unitID="sos.usrlibflsrv_flsrv_etshell" bldFile="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\etshell" mrp="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\etshell\base_f32_eshell.mrp"/>
+			<unit name="usrlibflsrv_flsrv" unitID="sos.usrlibflsrv_flsrv" bldFile="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\group" mrp="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\group\base_f32.mrp"/>
+			<unit name="usrlibflsrv_flsrv_iso9660" unitID="sos.usrlibflsrv_flsrv_iso9660" bldFile="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\iso9660" mrp="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\base_f32_siso9660.mrp"/>
+			<unit name="usrlibflsrv_flsrv_ntfs" unitID="sos.usrlibflsrv_flsrv_ntfs" bldFile="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\ntfs" mrp="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\ntfs\base_f32_sntfs.mrp"/>
+			<unit name="usrlibflsrv_flsrv_scomp" unitID="sos.usrlibflsrv_flsrv_scomp" bldFile="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\scomp" mrp="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\scomp\base_f32_scomp.mrp"/>
+			<unit name="usrlibflsrv_flsrv_sfat" unitID="sos.usrlibflsrv_flsrv_sfat" bldFile="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\sfat" mrp="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\sfat\base_f32_sfat.mrp"/>
+			<unit name="usrlibflsrv_flsrv_sfat32" unitID="sos.usrlibflsrv_flsrv_sfat32" bldFile="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\sfat32" mrp="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\sfat32\base_f32_sfat32.mrp"/>
+			<unit name="usrlibflsrv_flsrv_shostmassstorage" unitID="sos.usrlibflsrv_flsrv_shostmassstorage" bldFile="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\shostmassstorage" mrp="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\shostmassstorage\base_f32_shostmassstorage.mrp"/>
+			<unit name="usrlibflsrv_flsrv_smassstorage" unitID="sos.usrlibflsrv_flsrv_smassstorage" bldFile="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\smassstorage" mrp="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\smassstorage\base_f32_smassstorage.mrp"/>
+			<unit name="usrlibflsrv_flsrv_srofs" unitID="sos.usrlibflsrv_flsrv_srofs" bldFile="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\srofs" mrp="\sf\os\kernelhwsrv\userlibandfileserver\fileserver\srofs\base_f32_srofs.mrp"/>
+		</module> 
+
+		<module name="KHS_Unistore2"> 
+			<unit name="unistore2_uiibootsupport" unitID="sos.unistore2_uiibootsupport" bldFile="\sf\os\kernelhwsrv\unistore2\uiibootsupport" mrp="\sf\os\kernelhwsrv\unistore2\uiibootsupport\base_nandboot_unistore2.mrp"/>
+		</module>
+
+		<module name="KHS_E32utils"> 
+			<unit name="e32utils" unitID="sos.e32utils" bldFile="\sf\os\kernelhwsrv\kerneltest\e32utils\group" mrp="\sf\os\kernelhwsrv\kerneltest\e32utils\group\base_e32utils.mrp"/>
+			<unit name="e32utils_restricted" unitID="sos.e32utils_restricted" bldFile="\sf\os\kernelhwsrv\kerneltest\e32utils\group\restricted" mrp="\sf\os\kernelhwsrv\kerneltest\e32utils\group\restricted\base_e32utils_restricted.mrp"/>
+		</module> 
+		<!--
+		<module name="BSP_Emulator"> 
+			<unit name="emulatorbsp" unitID="sos.emulatorbsp" bldFile="\sf\os\boardsupport\emulator\emulatorbsp" mrp="\sf\os\boardsupport\emulator\emulatorbsp\base_wins.mrp"/>
+			<unit name="unistore2emulatorsupport" unitID="sos.unistore2emulatorsupport" bldFile="\sf\os\boardsupport\emulator\unistore2emulatorsupport" mrp="\sf\os\boardsupport\emulator\unistore2emulatorsupport\base_wins_unistore2.mrp"/>
+		</module>
+		<module name="BSP_NaviEngine"> 
+			<unit name="navienginebootldr" unitID="sos.navienginebootldr" bldFile="\sf\os\boardsupport\naviengine\navienginebootldr" mrp="\sf\os\boardsupport\naviengine\navienginebootldr\base_wins.mrp"/>
+			<unit name="navienginebsp_ne1_tb" unitID="sos.navienginebsp_ne1_tb" bldFile="\sf\os\boardsupport\naviengine\navienginebsp\ne1_tb" mrp=""/>
+			<unit name="navienginebsp_ne1_tb_single" unitID="sos.navienginebsp_ne1_tb_single" bldFile="\sf\os\boardsupport\naviengine\navienginebsp\ne1_tb\single" mrp=""/>
+			<unit name="navienginebspflexible" unitID="sos.navienginebspflexible" bldFile="\sf\os\boardsupport\naviengine\navienginebspflexible" mrp="\sf\os\boardsupport\naviengine\navienginebspflexible\base_naviengine_flexible.mrp"/>
+			<unit name="naviengineunistore2" unitID="sos.naviengineunistore2" bldFile="\sf\os\boardsupport\naviengine\naviengineunistore2" mrp="\sf\os\boardsupport\naviengine\naviengineunistore2\base_nec_naviengine_unistore2.mrp"/>
+			<unit name="naviengineunistore2flex" unitID="sos.naviengineunistore2flex" bldFile="\sf\os\boardsupport\naviengine\naviengineunistore2flex" mrp="\sf\os\boardsupport\naviengine\naviengineunistore2flex\base_nec_naviengine_unistore2_flexible.mrp"/>
+			<unit name="naviengineusbhcd" unitID="sos.naviengineusbhcd" bldFile="\sf\os\boardsupport\naviengine\naviengineusbhcd" mrp="\sf\os\boardsupport\naviengine\naviengineusbhcd\base_naviengine_usbhost.mrp"/>
+			<unit name="naviengineusbhcd_flexible" unitID="sos.naviengineusbhcd_flexible" bldFile="\sf\os\boardsupport\naviengine\naviengineusbhcd\flexible" mrp=""/>
+		</module>
+		<module name="BSP_OMAP3Variants"> 
+			<unit name="34xx_sdp" unitID="sos.34xx_sdp" bldFile="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\34xx_sdp" mrp=""/>
+			<unit name="34xx_sdp_bootloader" unitID="sos.34xx_sdp_bootloader" bldFile="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\34xx_sdp\34xx_sdp_bootloader" mrp=""/>
+			<unit name="34xx_sdp_bootstrap" unitID="sos.34xx_sdp_bootstrap" bldFile="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\34xx_sdp\bootstrap" mrp=""/>
+			<unit name="34xx_sdp_flexible" unitID="sos.34xx_sdp_flexible" bldFile="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\34xx_sdp\flexible" mrp="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\34xx_sdp\flexible\base_tiomap3_flexible.mrp"/>
+			<unit name="34xx_sdp_restricted_sdio" unitID="sos.34xx_sdp_restricted_sdio" bldFile="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\34xx_sdp_restricted\sdio" mrp="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\34xx_sdp_restricted\sdio\base_tiomap3_sdio.mrp"/>
+			<unit name="34xx_sdp_restricted_unistore2" unitID="sos.34xx_sdp_restricted_unistore2" bldFile="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\34xx_sdp_restricted\unistore2" mrp=""/>
+			<unit name="34xx_sdp_restricted_unistore2_flexible" unitID="sos.34xx_sdp_restricted_unistore2_flexible" bldFile="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\34xx_sdp_restricted\unistore2\flexible" mrp="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\34xx_sdp_restricted\unistore2\flexible\base_tiomap3_unistore2_flexible.mrp"/>
+			<unit name="lab" unitID="sos.lab" bldFile="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\lab" mrp="\base_tiomap3_lab.mrp"/>
+			<unit name="lab_bootloader" unitID="sos.lab_bootloader" bldFile="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\lab\lab_bootloader" mrp=""/>
+			<unit name="lab_restricted_sdio" unitID="sos.lab_restricted_sdio" bldFile="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\lab_restricted\sdio" mrp="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\lab_restricted\sdio\base_tiomap3_lab_sdio.mrp"/>
+			<unit name="lab_restricted_unistore2" unitID="sos.lab_restricted_unistore2" bldFile="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\lab_restricted\unistore2" mrp="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\lab_restricted\unistore2\base_tiomap3_lab_unistore2.mrp"/>
+		</module>
+		<module name="BSP_OMAPH2"> 
+			<unit name="omaph2bsp_h2" unitID="sos.omaph2bsp_h2" bldFile="\sf\os\boardsupport\omaph2\omaph2bsp\h2" mrp="\sf\os\boardsupport\omaph2\omaph2bsp\h2\base_omaph2.mrp"/>
+			<unit name="omaph2bsp_h2_single" unitID="sos.omaph2bsp_h2_single" bldFile="\sf\os\boardsupport\omaph2\omaph2bsp\h2\single" mrp=""/>
+			<unit name="omaph2sdio" unitID="sos.omaph2sdio" bldFile="\sf\os\boardsupport\omaph2\omaph2sdio" mrp="\sf\os\boardsupport\omaph2\omaph2sdio\base_h2_sdio.mrp"/>
+			<unit name="omaph2unistore2" unitID="sos.omaph2unistore2" bldFile="\sf\os\boardsupport\omaph2\omaph2unistore2" mrp="\sf\os\boardsupport\omaph2\omaph2unistore2\base_h2_unistore2.mrp"/>
+		</module>
+		<module name="BSP_OMAPH4"> 
+			<unit name="h4bootloader" unitID="sos.h4bootloader" bldFile="\sf\os\boardsupport\omaph4\h4bootloader" mrp="\sf\os\boardsupport\omaph4\h4bootloader\base_omaph4hrp_bootldr.mrp"/>
+			<unit name="omaph4bsp_h4" unitID="sos.omaph4bsp_h4" bldFile="\sf\os\boardsupport\omaph4\omaph4bsp\h4" mrp="\sf\os\boardsupport\omaph4\omaph4bsp\h4\base_omaph4hrp.mrp"/>
+			<unit name="omaph4bsp_h4_flexible" unitID="sos.omaph4bsp_h4_flexible" bldFile="\sf\os\boardsupport\omaph4\omaph4bsp\h4\flexible" mrp="\sf\os\boardsupport\omaph4\omaph4bsp\h4\flexible\base_omaph4hrp_flexible.mrp"/>
+			<unit name="omaph4minienvbootloader" unitID="sos.omaph4minienvbootloader" bldFile="\sf\os\boardsupport\omaph4\omaph4minienvbootloader" mrp="\sf\os\boardsupport\omaph4\omaph4minienvbootloader\base_omaph4hrp_mebootldr.mrp"/>
+			<unit name="omaph4sdio" unitID="sos.omaph4sdio" bldFile="\sf\os\boardsupport\omaph4\omaph4sdio" mrp="\sf\os\boardsupport\omaph4\omaph4sdio\base_omaph4hrp_sdio.mrp"/>
+			<unit name="omaph4unistore2" unitID="sos.omaph4unistore2" bldFile="\sf\os\boardsupport\omaph4\omaph4unistore2" mrp="\sf\os\boardsupport\omaph4\omaph4unistore2\base_omaph4hrp_unistore2.mrp"/>
+			<unit name="omapusbhotgdrivers" unitID="sos.omapusbhotgdrivers" bldFile="\sf\os\boardsupport\omaph4\omapusbhotgdrivers" mrp="\sf\os\boardsupport\omaph4\omapusbhotgdrivers\base_omaph4hrp_usbhostotg_usbware.mrp"/>
+		</module>
+		<module name="BSP_STVariants"> 
+			<unit name="montblanc_test" unitID="sos.montblanc_test" bldFile="\sf\os\boardsupport\stvariants\montblanc\test" mrp=""/>
+			<unit name="nokia_smpower" unitID="sos.nokia_smpower" bldFile="\sf\os\boardsupport\emulator\unistore2emulatorsupport" mrp=""/>
+		</module>
+		-->
+		<module name="NCP_Rapu"> 
+			<!-- <unit name="PRM" unitID="sos.PRM" bldFile="\ncp_sw\core7.0\base_rapu\rapu\PowerResourceManager" mrp=""/> -->
+			<unit name="power" unitID="sos.power" bldFile="\ncp_sw\core7.0\base_rapu\rapu\power" mrp=""/>
+			<unit name="ip_devices_keymap" unitID="sos.ip_devices_keymap" bldFile="\ncp_sw\corecom\bbc_components\input_devices\keymap\group" mrp=""/>
+			<unit name="security_components" unitID="sos.security_components" bldFile="\ncp_sw\corecom\security_components\group" mrp=""/>
+			<unit name="power_common" unitID="sos.power_common" bldFile="\ncp_sw\corecom\base_components\power_common\group" mrp=""/>
+
+			<unit name="I2C" unitID="sos.I2C" bldFile="\ncp_sw\corecom\base_components\I2C\group" mrp=""/>
+			<unit name="hal" unitID="sos.hal" bldFile="\overlay\10.1_overlay\79.01_vasco_overlay\variation\group" mrp=""/>
+			<unit name="ip_devices_mednand_common" unitID="sos.ip_devices_mednand_common" bldFile="\ncp_sw\corecom\bbc_components\memory\mednand_common" mrp=""/>
+			<unit name="ip_devices_medusii17" unitID="sos.ip_devices_medusii17" bldFile="\ncp_sw\corecom\bbc_components\memory\medusii17\group" mrp=""/>
+			<unit name="ip_devices_memcard_sd_devlon" unitID="sos.ip_devices_memcard_sd_devlon" bldFile="\ncp_sw\corecom\bbc_components\memory\memcard\rapu\devlon70" mrp=""/>
+			<unit name="display_chipset" unitID="sos.display_chipset" bldFile="\ncp_sw\core7.0\IVE3_Engine\IVE3_rapu_drivers\display\display_chipset_drv_ive_bc" mrp=""/>
+
+			<unit name="vcdriver" unitID="sos.vcdriver" bldFile="\ncp_sw\core7.0\IVE3_Engine\IVE3_rapu_drivers\interface\vcdriver\group" mrp=""/>
+			<unit name="vchi" unitID="sos.vchi" bldFile="\ncp_sw\core7.0\IVE3_Engine\IVE3_rapu_drivers\interface\vchi" mrp=""/>
+			<unit name="rmi" unitID="sos.rmi" bldFile="\ncp_sw\core7.0\IVE3_Engine\IVE3_rapu_drivers\interface\rmi" mrp=""/>
+			<unit name="test_logger" unitID="sos.test_logger" bldFile="\ncp_sw\core7.0\IVE3_Engine\IVE3_rapu_drivers\test\logger" mrp=""/>
+			<unit name="dispcommanddrv" unitID="sos.dispcommanddrv" bldFile="\ncp_sw\core7.0\IVE3_Engine\IVE3_rapu_drivers\display\dispcommanddrv" mrp=""/>
+			<unit name="tv_out" unitID="sos.tv_out" bldFile="\ncp_sw\core7.0\IVE3_Engine\IVE3_rapu_drivers\display\tv_out" mrp=""/>
+			<unit name="vc_dispman" unitID="sos.vc_dispman" bldFile="\ncp_sw\core7.0\IVE3_Engine\IVE3_rapu_drivers\display\vc_dispman\group" mrp=""/>
+			<unit name="dgsw_s60display_group_common" unitID="sos.dgsw_s60display_group_common" bldFile="\ncp_sw\corecom\dgsw_s60display\group_common" mrp=""/>
+			<unit name="dgsw_s60display_group_variation" unitID="sos.dgsw_s60display_group_variation" bldFile="\ncp_sw\corecom\dgsw_s60display\group_variation" mrp=""/>
+			<unit name="cts79" unitID="sos.cts79" bldFile="\ncp_sw\corecom\dgsw_s60display\group_variation\cts79" mrp=""/>
+			<unit name="isaaccessdriver" unitID="sos.isaaccessdriver" bldFile="\ncp_sw\corecom\modemadaptation_ext\connectivitylayer_ext\isaaccessdriver\group" mrp=""/>
+			<unit name="ist" unitID="sos.ist" bldFile="\ncp_sw\corecom\modemadaptation_ext\connectivitylayer_ext\ist\group" mrp=""/>
+			<unit name="isimessage" unitID="sos.isimessage" bldFile="\ncp_sw\corecom\modemadaptation_ext\connectivitylayer_ext\isimessage\group" mrp=""/>
+			<unit name="TraceCore" unitID="sos.TraceCore" bldFile="\ncp_sw\corecom\SWATI_Symbian_Tools\Trace\TraceCore\group" mrp=""/>
+			<unit name="rapu" unitID="sos.rapu" bldFile="\ncp_sw\core7.0\base_rapu\rapu" mrp=""/>
+            <!-- RJC added -->
+			<unit name="rapu_flexible" unitID="sos.rapu.flexible" bldFile="\ncp_sw\core7.0\base_rapu\rapu\flexible" mrp=""/>
+			<unit name="gape" unitID="sos.gape" bldFile="\ncp_sw\corecom\base_components\gape\group" mrp=""/>
+			<unit name="srawfs" unitID="sos.srawfs" bldFile="\ncp_sw\corecom\bbc_components\memory\srawfs\group" mrp=""/>
+			<unit name="rebootdrv" unitID="sos.rebootdrv" bldFile="\ncp_sw\corecom\modemadaptation_ext\adaptationlayer_ext\rebootdriver\group" mrp=""/>
+			<unit name="vcbufmanx" unitID="sos.vcbufmanx" bldFile="\ncp_sw\core7.0\IVE3_Engine\IVE3_rapu_drivers\interface\bufmanx" mrp=""/>
+            
+		</module>
+	</layer>
+	
+	<layer name="api_test_layer">
+		<module name="KHS_Test_E32test"> 
+			<unit name="e32test_dll" unitID="sos.e32test_dll" bldFile="\sf\os\kernelhwsrv\kerneltest\e32test\dll\oe\group" mrp=""/>
+			<unit name="e32test" unitID="sos.e32test" bldFile="\sf\os\kernelhwsrv\kerneltest\e32test\group" mrp="\sf\os\kernelhwsrv\kerneltest\e32test\groupbase_e32test.mrp"/>
+			<unit name="e32test_resourceman_acctst" unitID="sos.e32test_resourceman_acctst" bldFile="\sf\os\kernelhwsrv\kerneltest\e32test\resourceman\acctst" mrp=""/>
+			<unit name="e32test_otgdi" unitID="sos.e32test_otgdi" bldFile="\sf\os\kernelhwsrv\kerneltest\e32test\usbho\t_otgdi" mrp=""/>
+			<unit name="e32test_usbdi" unitID="sos.e32test_usbdi" bldFile="\sf\os\kernelhwsrv\kerneltest\e32test\usbho\t_usbdi" mrp=""/>
+		</module> 
+
+		<!-- <module name="KHS_Test_F32test"> 
+			<unit name="f32test_automounter" unitID="sos.f32test_automounter" bldFile="\sf\os\kernelhwsrv\kerneltest\f32test\filesystem\automounter" mrp=""/>
+			<unit name="f32test" unitID="sos.f32test" bldFile="\sf\os\kernelhwsrv\kerneltest\f32test\group" mrp="\sf\os\kernelhwsrv\kerneltest\f32test\group\base_f32test.mrp"/>
+			<unit name="f32test_loader" unitID="sos.f32test_loader" bldFile="\sf\os\kernelhwsrv\kerneltest\f32test\loader" mrp="\sf\os\kernelhwsrv\kerneltest\f32test\loader\base_loader.mrp"/>
+			<unit name="f32test_rofs" unitID="sos.f32test_rofs" bldFile="\sf\os\kernelhwsrv\kerneltest\f32test\rofs" mrp=""/>
+			<unit name="f32test_shostmassstorage" unitID="sos.f32test_shostmassstorage" bldFile="\sf\os\kernelhwsrv\kerneltest\f32test\shostmassstorage" mrp=""/>
+			<unit name="f32test_tools" unitID="sos.f32test_tools" bldFile="\sf\os\kernelhwsrv\kerneltest\f32test\tools" mrp=""/>
+		</module> -->
+
+		<module name="KHS_Test_SDIOTest"> 
+			<unit name="sdiotest" unitID="sos.sdiotest" bldFile="\sf\os\kernelhwsrv\kerneltest\sdiotest" mrp="\sf\os\kernelhwsrv\kerneltest\sdiotest\base_sdiotests.mrp"/>
+			<unit name="sdiotest_restricted" unitID="sos.sdiotest_restricted" bldFile="\sf\os\kernelhwsrv\kerneltest\sdiotest_restricted" mrp="\sf\os\kernelhwsrv\kerneltest\sdiotest_restricted\base_sdiotests_restricted.mrp"/>
+			<unit name="sdiotest_restricted_btsdiodriver" unitID="sos.sdiotest_restricted_btsdiodriver" bldFile="\sf\os\kernelhwsrv\kerneltest\sdiotest_restricted\btsdiodriver\group" mrp=""/>
+		</module>
+		<!--
+		<module name="BSP_Test_Emulator"> 
+			<unit name="emulatorbsp_test" unitID="sos.emulatorbsp_test" bldFile="\sf\os\boardsupport\emulator\emulatorbsp\test" mrp=""/>
+		</module>
+		<module name="BSP_Test_NaviEngine"> 
+			<unit name="navienginebsp_ne1_tb_test" unitID="sos.navienginebsp_ne1_tb_test" bldFile="\sf\os\boardsupport\naviengine\navienginebsp\ne1_tb\test" mrp=""/>
+			<unit name="navienginebspflexible_test" unitID="sos.navienginebspflexible_test" bldFile="\sf\os\boardsupport\naviengine\navienginebspflexible\test" mrp=""/>
+		</module>
+		<module name="BSP_Test_OMAP3Variants"> 
+			<unit name="34xx_sdp_flexible_test" unitID="sos.34xx_sdp_flexible_test" bldFile="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\34xx_sdp\flexible\test" mrp=""/>
+			<unit name="34xx_sdp_test" unitID="sos.34xx_sdp_test" bldFile="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\34xx_sdp\test" mrp=""/>
+			<unit name="lab_test" unitID="sos.lab_test" bldFile="\sf\os\boardsupport\omap3variants\tiomap3bsp\variant\lab\test" mrp=""/>
+		</module>
+		<module name="BSP_Test_OMAPH2"> 
+			<unit name="omaph2bsp_h2_test" unitID="sos.omaph2bsp_h2_test" bldFile="\sf\os\boardsupport\omaph2\omaph2bsp\h2\test" mrp=""/>
+		</module>
+		<module name="BSP_Test_OMAPH4"> 
+			<unit name="omaph4bsp_h4_test" unitID="sos.omaph4bsp_h4_test" bldFile="\sf\os\boardsupport\omaph4\omaph4bsp\h4\test" mrp=""/>
+			<unit name="omaph4bsp_h4_flexible_test" unitID="sos.omaph4bsp_h4_flexible_test" bldFile="\sf\os\boardsupport\omaph4\omaph4bsp\h4\flexible\test" mrp=""/>
+		</module>
+		-->
+	</layer>
+  </systemModel>
+</SystemDefinition>
\ No newline at end of file
--- a/halservices/hal/base_hal.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/halservices/hal/base_hal.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "User Side Hardware Abstraction"
 
 component	base_hal
--- a/halservices/hal/bld.inf	Wed Jul 21 14:46:58 2010 +0100
+++ b/halservices/hal/bld.inf	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -25,16 +25,30 @@
 
 BASEUSERDEFAULT
 
+
 PRJ_EXPORTS
-inc/hal_int.h						SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(kernel/)
-inc/hal_data.h						SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(hal_data.h)
-inc/hal.h							SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(hal.h)
-rom/hal.iby		/epoc32/rom/hal/	//
-rom/hal.hby		/epoc32/rom/hal/	//
+
+inc/hal_int.h			SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(kernel/)
+inc/hal_data.h			SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(hal_data.h)
+inc/hal.h				SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(hal.h)
+
+rom/hal.iby				/epoc32/rom/hal/	//
+rom/hal.hby				/epoc32/rom/hal/	//
+
+
+PRJ_TESTEXPORTS
+
+rom/haltests.iby		/epoc32/rom/include/haltests.iby
+rom/haltests.auto.bat	/epoc32/rom/include/haltests.auto.bat
+
+rom/tshell_haltests.oby	 ../../kernel/eka/rombuild/tshell_haltests.oby
+
+
 
 PRJ_MMPFILES
 src/hal_lib
 
 PRJ_TESTMMPFILES
-tsrc/t_newhal
-tsrc/savehal
+tsrc/t_newhal		manual
+tsrc/savehal		manual
+tsrc/t_haldefect
--- a/halservices/hal/inc/hal.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/halservices/hal/inc/hal.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -124,14 +124,17 @@
     Gets all HAL attributes, and their properties.
 
     For attributes that are not meaningful on this device (ie. those which have
-	not been defined in the config.hcf file),
-	the attribute value and its associated property value are set to zero in
-	the returned array.
+	not been defined in the config.hcf file), the attribute value and its 
+	associated property value are set to zero in the returned array.
 
 	Attributes for which multiple values can be retrieved
 	ie. EDisplayIsPalettized, EDisplayBitsPerPixel, EDisplayOffsetToFirstPixel,
 	EDisplayOffsetBetweenLines, and EDisplayPaletteEntry will also be zero in
 	the returned array.
+	
+	Attributes that allocate resources and open handles are also not returned 
+	by this API. Their value and property values will be set to zero in the
+	returned array. Use HAL::Get() for these attributes.
 
     @param aNumEntries On successful return, contains the total number
                        of HAL attributes.
--- a/halservices/hal/inc/hal_data.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/halservices/hal/inc/hal_data.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -35,6 +35,11 @@
     
     They are also used by the HAL accessor functions.
     
+    Note: It is not recommended to use HAL attributes to pass handles from the  
+	kernel to user-side clients due to resource overhead's that will affect 
+	existing clients of HAL. HAL is designed to allow simply hardware parameters
+	to be shared with user-side clients without resource allocation overheads.
+    
     @see HAL::Get()
     @see HAL::Set()
     */
@@ -1080,6 +1085,9 @@
 		
 		/**
 		A Handle to the display memory.
+		This attribute opens a chunk, the client is responsible for closing it.
+		Using HAL attribtues to open handles is not recommended and this 
+		attribute may be removed in the future. 
 
 		@prototype 9.5
 		*/
@@ -1102,6 +1110,13 @@
 		*/
 		ENumCpus,
 
+		/**
+		The orientation of the Digitiser. Usually mirrors device orientation.
+		
+		@see TDigitiserOrientation for allowed values
+		@capability WriteDeviceData needed to Set this attribute
+		*/
+		EDigitiserOrientation,
 
 		/*
 		 * NOTE:
@@ -1320,6 +1335,29 @@
 		EPowerBackupStatus_Good,
 		};
 	
+	
+    /**
+    Describes the orientation of the screen digitiser, usually mirrors the
+    device orientation not necessarily the display rotation as this might be
+	limited to upright and left 90 only. The values in degrees measures 
+	the anti-clockwise angle from the left edge of the digitiser from the 
+	normal default position of the device. 
+	
+	User-side clients can use attribute to inform the digitiser driver of the
+	digitiser orientation. The driver may then use this information to adjust 
+	X.Y sampling depending on input pointer type.
+	
+    @see HALData::TAttribute
+    */
+	enum TDigitiserOrientation
+		{
+		EDigitiserOrientation_default,	///< Driver using build-in default
+		EDigitiserOrientation_000,		///< Device normal 'make-call' position
+		EDigitiserOrientation_090,		///< Device rotated left 90 degrees
+		EDigitiserOrientation_180,		///< Device rotated 180 degrees
+		EDigitiserOrientation_270		///< Device rotated right 90 degrees
+		};
+	
 	};
 
 #endif
--- a/halservices/hal/rom/hal.hby	Wed Jul 21 14:46:58 2010 +0100
+++ b/halservices/hal/rom/hal.hby	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -139,3 +139,5 @@
 #define ESerialNumber					117
 #define ECpuProfilingDefaultInterruptBase		118
 #define ENumCpus						119
+#define EDigitiserOrientation			120
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/halservices/hal/rom/haltests.auto.bat	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,17 @@
+rem
+rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of the License "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+t_haldefect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/halservices/hal/rom/haltests.iby	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,28 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// HAL Test Applications
+//
+
+#ifndef __HALTESTS_IBY__
+#define __HALTESTS_IBY__
+
+
+file=\Epoc32\Release\##MAIN##\##BUILD##\t_haldefect.exe 	\sys\bin\t_haldefect.exe
+file=\Epoc32\Release\##MAIN##\##BUILD##\t_newhal.exe 		\sys\bin\t_newhal.exe
+file=\Epoc32\Release\##MAIN##\##BUILD##\savehal.exe 		\sys\bin\savehal.exe
+
+data=\epoc32\rom\include\haltests.auto.bat					\haltests.auot.bat
+
+
+#endif // __HALTESTS_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/halservices/hal/rom/tshell_haltests.oby	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#define BASE_ROM
+#include <rom\##VARIANT##\header.iby>
+
+
+files=
+
+#include <rom\##VARIANT##\kernel.iby>
+#include "user.iby"
+#include <rom\hal\hal.iby>
+#include <rom\f32\f32.iby>
+
+#include <rom\include\haltests.iby>
--- a/halservices/hal/src/hal_gcc_shim.cia	Wed Jul 21 14:46:58 2010 +0100
+++ b/halservices/hal/src/hal_gcc_shim.cia	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,18 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
 //
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// hal/src/hal_gcc_shim.cia
+// 
 // HAL_GCC_SHIM.CIA - generated by GENSHIMSRC.BAT
 //
 
--- a/halservices/hal/src/hal_main.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/halservices/hal/src/hal_main.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -119,7 +119,14 @@
 			{
 			TInt offset = device*(TInt)ENumHalAttributes + i;
 			TInt properties=HalInternal::Properties[i];
-			if (properties & HAL::EValid)
+			// Exclusion of the EDisplayMemoryHandle attribute is a work around
+			// to avoid the handle and resources related to it from being 
+			// allocated. Callers of this API (halsettings - to save modifiable 
+			// atrributes) need to avoid this resource overhead. Clients of 
+			// this attribute need to use HAL::Get() directly.
+			// HAL should not be used for handle opening and this
+			// attribute should be replaced with a better API.
+			if ((properties & HAL::EValid) && (i != EDisplayMemoryHandle))
 				{
 				THalImplementation f=HalInternal::Implementation[i];
 				if (f)
--- a/halservices/hal/src/userhal.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/halservices/hal/src/userhal.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -41,7 +41,8 @@
 	EInvalidAttribKeybd=13,
 	EInvalidAttribPen=14,
 	EInvalidAttribMouse=15,
-	EInvalidAttrib3DPointer=16
+	EInvalidAttrib3DPointer=16,
+	EInvalidAttribDigitiserOrientation=17
 	};
 
 void Panic(THalUserHalPanic aPanic)
@@ -929,3 +930,27 @@
 	return KErrNone;
 	}
 
+// EDigitiserOrientation
+#if defined(_DEBUG)
+TInt DigitiserOrientation(TInt aDeviceNumber, TInt aAttrib, TBool aSet, TAny* aInOut)
+#else
+TInt DigitiserOrientation(TInt aDeviceNumber, TInt /*aAttrib*/, TBool aSet, TAny* aInOut)
+#endif
+	{
+	__ASSERT_DEBUG(aAttrib == HALData::EDigitiserOrientation, Panic(EInvalidAttribDigitiserOrientation));
+	__ASSERT_DEBUG(aDeviceNumber >= 0, Panic(EInvalidAttribDigitiserOrientation));	
+	
+	if (aSet)
+		{
+		//Set
+		if ( ((TInt)aInOut) < 0 || ((TInt)aInOut) > HALData::EDigitiserOrientation_270) 
+			return KErrArgument;
+		return UserSvr::HalFunction(EHalGroupDigitiser, EDigitiserOrientation, aInOut, (TAny*)ETrue, aDeviceNumber);
+		}
+		
+	//Get
+	__ASSERT_DEBUG(aInOut != 0, Panic(EInvalidAttribDigitiserOrientation));
+	return UserSvr::HalFunction(EHalGroupDigitiser, EDigitiserOrientation, aInOut, (TAny*)EFalse, aDeviceNumber);
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/halservices/hal/tsrc/t_haldefect.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,109 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#define __E32TEST_EXTENSION__
+#include <e32test.h>
+#include <e32svr.h>
+#include <e32cmn.h>
+#include <e32cmn_private.h>
+#include <hal.h>
+
+LOCAL_D RTest test(_L("T_HalDefect Testcases"));
+
+
+	
+void DoTestRC_361803()
+	{
+	__UHEAP_MARK;
+	test.Start(_L("DoTestRC_361803 tests"));
+
+	TInt origValue = 0;
+	TInt r = HAL::Get(HALData::EDisplayMemoryHandle, origValue);
+	// Standard base emulator PSL without "-1 check", HAL::Get, r==KErrArgument
+	// Standard base emulator PSL, no mods, HAL::GetAll, r==KErrNone, origValue==0
+	// NaviEngine PSL, no mods, r==KErrNotSupported
+	// Platforms that support it: r==KErrNone, origValue==+ve 
+	if ((r == KErrNotSupported) || (r == KErrArgument) || 
+	    (origValue == 0))						 // Skip test if not supported
+		{
+		test.Printf(_L("Platform doesn't support EDigitiserOrientation, skipping, (%d, %d)\n"), r, origValue);
+		test.End();
+		__UHEAP_MARKEND;
+		return;
+		}
+	// Attribute supported
+	test_KErrNone(r);
+	RHandleBase handle;
+	handle.SetHandle(origValue);
+	handle.Close();
+	test.Printf(_L("Platform DOES support EDigitiserOrientation, handle closed\n"));
+			
+	HAL::SEntry* pE = 0;
+	TInt pC = 0;
+	r = HAL::GetAll(pC, pE);
+	test_KErrNone(r);
+	
+	const HAL::SEntry* pS=pE;
+	const HAL::SEntry* pEnd=pS + pC;
+	TBool displayMemHandleFound = EFalse;
+		
+    test.Printf(_L("ENumHalAttributes == %d, nEntries == %d\n"), HALData::ENumHalAttributes, pC);
+	for (TInt s = 0; pS<pEnd; ++pS, ++s)
+		{
+		// Following line only needed for development and debug of test case.
+		// test.Printf(_L("Attr: %d; Prop: %x; Value: %x\n"), s, pS->iProperties, pS->iValue );
+ 
+		if ((pS->iProperties & HAL::EEntryValid ) &&
+		    ((s%HAL::ENumHalAttributes) == HALData::EDisplayMemoryHandle))
+		    {		    
+		    // Note, GetAll on Emulator PSL will set r==KErrNone and value to 0
+		    // So check value to ensure a handle has been allocated.
+		    if( pS->iValue >= 0 )
+		        {
+		        displayMemHandleFound++;
+		        RHandleBase handle;
+		        handle.SetHandle(pS->iValue);
+		        handle.Close();
+				break;
+		        }
+		    }	
+		}
+	
+	test.Printf(_L("HAL::GetAll() DisplayMemHandle should not have been found (0), result == (%d)\n"), displayMemHandleFound );
+	test_Equal(displayMemHandleFound, 0);
+		
+	test.Printf(_L("DoTestRC_361803 - complete\n"));
+	test.End();
+	__UHEAP_MARKEND;
+	}
+
+
+GLDEF_C TInt E32Main()
+    {
+	__UHEAP_MARK;
+	
+ 	test.Title();
+	test.Start(_L("User-side HAL Defect Test Cases"));
+	
+	DoTestRC_361803();	// ox1cimx1#361803
+	
+	test.Printf(_L("\n"));
+	test.End();
+	test.Close();
+
+	__UHEAP_MARKEND;
+    return KErrNone;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/halservices/hal/tsrc/t_haldefect.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+TARGET		t_haldefect.exe
+TARGETTYPE	EXE
+
+CAPABILITY	WriteDeviceData
+VENDORID	0x70000001
+SMPSAFE
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH	.
+SOURCE		t_haldefect.cpp
+
+LIBRARY		euser.lib
+LIBRARY		hal.lib
+
+
+
--- a/halservices/hal/tsrc/t_newhal.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/halservices/hal/tsrc/t_newhal.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -144,7 +144,7 @@
 	_S("ESerialNumber"),
 	_S("ECpuProfilingDefaultInterruptBase"),
 	_S("ENumCpus"),
-
+	_S("EDigitiserOrientation")
 	};
 
 TInt MatchAbbrev(const TDesC& anInput, const TText** aList, TInt aListLen)
@@ -159,7 +159,7 @@
 		if (r>=0)
 			{
 			// substring matches
-			if (r==0 && list_entry.Length()==anInput.Length())
+			if (r==0 && list_entry.Length()==anInput.Length()) 
 				{
 				// exact match
 				return i;
@@ -236,8 +236,11 @@
 			}
 		else
 			{
-			test.Printf(_L("Attribute %S not supported on this platform or requires parameter\n"),&att_name,r);
-			test(r==KErrNotSupported || r==KErrArgument);
+			test.Printf(_L("Attribute %S not supported on this platform or requires parameter: r==%d\n"),&att_name,r);
+			// For some reason the following attribtues come back "KErrNone" on 
+			// emulator...so guard added
+			if (i != HALData::EDisplayMemoryHandle)
+				test(r==KErrNotSupported || r==KErrArgument);
 			}
 		}
 	User::Free(pE);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/base_e32.history.xml	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<relnotes name="Kernel Architecture 2">
+  <purpose>
+  </purpose>
+
+  <minorchange revision="001">
+    MINOR CHANGE: Improved test code T_Match by adding more cases to test for INC092513 (SYSLIB-UNICODE-CT-3337)
+  </minorchange>
+</relnotes>
--- a/kernel/eka/base_e32.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/base_e32.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Kernel Architecture 2"
 
 component	base_e32
--- a/kernel/eka/bld.inf	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/bld.inf	Thu Jul 22 16:46:39 2010 +0100
@@ -262,6 +262,8 @@
 include/drivers/resourcecontrol_trace.h			SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
 include/drivers/resource_category.h				SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
 include/drivers/resource_extend.h				SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
+include/drivers/resourcecontrol_settings.h		SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
+include/drivers/resourcecontrol_clientsettings.h	SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
 
 // Power Resource Manager User-Side API
 include/drivers/resmanus_trace.h				SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
--- a/kernel/eka/bmarm/ekernsmp.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/bmarm/ekernsmp.def	Thu Jul 22 16:46:39 2010 +0100
@@ -1054,4 +1054,8 @@
 	SetNumberOfActiveCpus__5NKerni @ 1053 NONAME
 	SetIdleHandler__3ArmPFPvUlPVv_vPv @ 1054 NONAME R3UNUSED ; Arm::SetIdleHandler(void (*)(void *, unsigned long, void volatile *), void *)
 	FreeRamZone__4EpocUi @ 1055 NONAME R3UNUSED ; Epoc::FreeRamZone(unsigned int)
+	SelectiveAlloc__16TBitMapAllocatorii @ 1056 NONAME R3UNUSED ; TBitMapAllocator::SelectiveAlloc(int, int)
+	SetKeyOffset__10RArrayBasei @ 1057  NONAME R3UNUSED ; RArrayBase::SetKeyOffset(int)
+	CpuRetires__5Cache @ 1058 NONAME R3UNUSED ; Cache::CpuRetires(void)
+	KernelRetires__5Cache @ 1059 NONAME R3UNUSED ; Cache::KernelRetires(void)
 
--- a/kernel/eka/bmarm/ekernu.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/bmarm/ekernu.def	Thu Jul 22 16:46:39 2010 +0100
@@ -1051,3 +1051,7 @@
 	Stats__13KernCoreStatsPv @ 1050 NONAME R3UNUSED ; KernCoreStats::Stats(void *)
 	SetIdleHandler__3ArmPFPvUl_vPv @ 1051 NONAME R3UNUSED ; Arm::SetIdleHandler(void (*)(void *, unsigned long), void *)
 	FreeRamZone__4EpocUi @ 1052 NONAME R3UNUSED ; Epoc::FreeRamZone(unsigned int)
+	SelectiveAlloc__16TBitMapAllocatorii @ 1053 NONAME R3UNUSED ; TBitMapAllocator::SelectiveAlloc(int, int)
+	SetKeyOffset__10RArrayBasei @ 1054  NONAME R3UNUSED ; RArrayBase::SetKeyOffset(int)
+	CpuRetires__5Cache @ 1055 NONAME R3UNUSED ; Cache::CpuRetires(void)
+	KernelRetires__5Cache @ 1056 NONAME R3UNUSED ; Cache::KernelRetires(void)
--- a/kernel/eka/bmarm/euseru.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/bmarm/euseru.def	Thu Jul 22 16:46:39 2010 +0100
@@ -2267,4 +2267,10 @@
 	Size__C10RAllocator @ 2266 NONAME R3UNUSED ; RAllocator::Size(void) const
 	__DbgGetAllocFail__10RAllocator @ 2267 NONAME R3UNUSED ; RAllocator::__DbgGetAllocFail(void)
 	__DbgGetAllocFail__4Useri @ 2268 NONAME R3UNUSED ; User::__DbgGetAllocFail(int)
+	SetKeyOffset__10RArrayBasei @ 2269  NONAME R3UNUSED ; RArrayBase::SetKeyOffset(int)
+	Poll__10RSemaphore @ 2270 NONAME R3UNUSED ; RSemaphore::Poll(void)
+	Wait__6RMutexi @ 2271 NONAME R3UNUSED ; RMutex::Wait(int)
+	Poll__6RMutex @ 2272 NONAME R3UNUSED ; RMutex::Poll(void)
+	Poll__9RFastLock @ 2273 NONAME R3UNUSED ; RFastLock::Poll(void)
+	Wait__9RFastLocki @ 2274 NONAME R3UNUSED ; RFastLock::Wait(int)
 	
--- a/kernel/eka/bwins/ekernu.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/bwins/ekernu.def	Thu Jul 22 16:46:39 2010 +0100
@@ -934,4 +934,8 @@
 	?Engage@KernCoreStats@@SAHH@Z @ 933 NONAME	;  public: static int KernCoreStats::Engage(int)
 	?Retire@KernCoreStats@@SAHHH@Z @ 934 NONAME	;  public: static int KernCoreStats::Retire(int, int)
 	?Stats@KernCoreStats@@SAHPAX@Z @ 935 NONAME	;  public: static int KernCoreStats::Stats(void *)
+	?SelectiveAlloc@TBitMapAllocator@@QAEIHH@Z @ 936 NONAME ; public: unsigned int __thiscall TBitMapAllocator::SelectiveAlloc(int,int)
+	?SetKeyOffset@RArrayBase@@IAEXH@Z @ 937  NONAME ; void RArrayBase::SetKeyOffset(int)
+	?CpuRetires@Cache@@SAXXZ @ 938 NONAME ; public: static void __cdecl Cache::CpuRetires(void)
+	?KernelRetires@Cache@@SAXXZ @ 939 NONAME ; public: static void __cdecl Cache::KernelRetires(void)
 
--- a/kernel/eka/bwins/euseru.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/bwins/euseru.def	Thu Jul 22 16:46:39 2010 +0100
@@ -2215,4 +2215,9 @@
 	?MaxLength@RAllocator@@QBEHXZ @ 2214 NONAME ; int RAllocator::MaxLength(void) const
 	?__DbgGetAllocFail@RAllocator@@QAE?AW4TAllocFail@1@XZ @ 2215 NONAME ; enum RAllocator::TAllocFail RAllocator::__DbgGetAllocFail(void)
 	?__DbgGetAllocFail@User@@SA?AW4TAllocFail@RAllocator@@H@Z @ 2216 NONAME ; enum RAllocator::TAllocFail User::__DbgGetAllocFail(int)
-
+	?SetKeyOffset@RArrayBase@@IAEXH@Z @ 2217  NONAME ; void RArrayBase::SetKeyOffset(int)
+	?Poll@RFastLock@@QAEHXZ @ 2218 NONAME ; public: int __thiscall RFastLock::Poll(void)
+	?Poll@RMutex@@QAEHXZ @ 2219 NONAME ; public: int __thiscall RMutex::Poll(void)
+	?Poll@RSemaphore@@QAEHXZ @ 2220 NONAME ; public: int __thiscall RSemaphore::Poll(void)
+	?Wait@RMutex@@QAEHH@Z @ 2221 NONAME ; public: int __thiscall RMutex::Wait(int)
+	?Wait@RFastLock@@QAEHH@Z @ 2222 NONAME ; public: int __thiscall RFastLock::Wait(int)
--- a/kernel/eka/bx86/ekernsmp.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/bx86/ekernsmp.def	Thu Jul 22 16:46:39 2010 +0100
@@ -1011,4 +1011,8 @@
 	?Stats@KernCoreStats@@SAHPAX@Z @ 1010 NONAME	;  public: static int KernCoreStats::Stats(void *)
 	?SetNumberOfActiveCpus@NKern@@SAXH@Z @ 1011 NONAME ; public: static void __cdecl NKern::SetNumberOfActiveCpus(int)
 	?FreeRamZone@Epoc@@SAHI@Z @ 1012 NONAME ; public: static int Epoc::FreeRamZone(unsigned int)
+	?SelectiveAlloc@TBitMapAllocator@@QAEIHH@Z @ 1013 NONAME ; public: unsigned int __thiscall TBitMapAllocator::SelectiveAlloc(int,int)
+	?SetKeyOffset@RArrayBase@@IAEXH@Z @ 1014  NONAME ; void RArrayBase::SetKeyOffset(int)
+	?CpuRetires@Cache@@SAXXZ @ 1015 NONAME ; public: static void __cdecl Cache::CpuRetires(void)
+	?KernelRetires@Cache@@SAXXZ @ 1016 NONAME ; public: static void __cdecl Cache::KernelRetires(void)
 
--- a/kernel/eka/bx86/ekernu.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/bx86/ekernu.def	Thu Jul 22 16:46:39 2010 +0100
@@ -956,4 +956,8 @@
 	?Retire@KernCoreStats@@SAHHH@Z @ 955 NONAME	;  public: static int KernCoreStats::Retire(int, int)
 	?Stats@KernCoreStats@@SAHPAX@Z @ 956 NONAME	;  public: static int KernCoreStats::Stats(void *)
 	?FreeRamZone@Epoc@@SAHI@Z @ 957 NONAME ; public: static int Epoc::FreeRamZone(unsigned int)
+	?SelectiveAlloc@TBitMapAllocator@@QAEIHH@Z @ 958 NONAME ; public: unsigned int __thiscall TBitMapAllocator::SelectiveAlloc(int,int)
+	?SetKeyOffset@RArrayBase@@IAEXH@Z @ 959  NONAME ; void RArrayBase::SetKeyOffset(int)
+	?CpuRetires@Cache@@SAXXZ @ 960 NONAME ; public: static void __cdecl Cache::CpuRetires(void)
+	?KernelRetires@Cache@@SAXXZ @ 961 NONAME ; public: static void __cdecl Cache::KernelRetires(void)
 
--- a/kernel/eka/bx86/euseru.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/bx86/euseru.def	Thu Jul 22 16:46:39 2010 +0100
@@ -2215,4 +2215,9 @@
 	?Size@RAllocator@@QBEHXZ @ 2214 NONAME ; public: int __thiscall RAllocator::Size(void)const 
 	?__DbgGetAllocFail@RAllocator@@QAE?AW4TAllocFail@1@XZ @ 2215 NONAME ; enum RAllocator::TAllocFail RAllocator::__DbgGetAllocFail(void)
 	?__DbgGetAllocFail@User@@SA?AW4TAllocFail@RAllocator@@H@Z @ 2216 NONAME ; enum RAllocator::TAllocFail User::__DbgGetAllocFail(int)
-	
+	?SetKeyOffset@RArrayBase@@IAEXH@Z @ 2217  NONAME ; void RArrayBase::SetKeyOffset(int)
+	?Poll@RFastLock@@QAEHXZ @ 2218 NONAME ; public: int __thiscall RFastLock::Poll(void)
+	?Poll@RMutex@@QAEHXZ @ 2219 NONAME ; public: int __thiscall RMutex::Poll(void)
+	?Poll@RSemaphore@@QAEHXZ @ 2220 NONAME ; public: int __thiscall RSemaphore::Poll(void)
+	?Wait@RMutex@@QAEHH@Z @ 2221 NONAME ; public: int __thiscall RMutex::Wait(int)
+	?Wait@RFastLock@@QAEHH@Z @ 2222 NONAME ; public: int __thiscall RFastLock::Wait(int)
--- a/kernel/eka/bx86gcc/ekernsmp.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/bx86gcc/ekernsmp.def	Thu Jul 22 16:46:39 2010 +0100
@@ -1099,4 +1099,9 @@
 	_ZN13KernCoreStats9ConfigureEj @ 1098 NONAME
 	_ZN5NKern21SetNumberOfActiveCpusEi @ 1099 NONAME
 	_ZN4Epoc11FreeRamZoneEj @ 1100 NONAME
+	_ZN16TBitMapAllocator14SelectiveAllocEii @ 1101 NONAME
+	_ZN10RArrayBase12SetKeyOffsetEi @ 1102 NONAME
+	_ZN5Cache10CpuRetiresEv @ 1103 NONAME
+	_ZN5Cache13KernelRetiresEv @ 1104 NONAME
 
+
--- a/kernel/eka/bx86gcc/ekernu.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/bx86gcc/ekernu.def	Thu Jul 22 16:46:39 2010 +0100
@@ -1039,4 +1039,8 @@
 	_ZN13KernCoreStats9EnterIdleEv @ 1038 NONAME
 	_ZN13KernCoreStats9LeaveIdleEj @ 1039 NONAME
 	_ZN4Epoc11FreeRamZoneEj @ 1040 NONAME
+	_ZN16TBitMapAllocator14SelectiveAllocEii @ 1041 NONAME
+	_ZN10RArrayBase12SetKeyOffsetEi @ 1042 NONAME
+	_ZN5Cache10CpuRetiresEv @ 1043 NONAME
+	_ZN5Cache13KernelRetiresEv @ 1044 NONAME
 
--- a/kernel/eka/bx86gcc/euseru.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/bx86gcc/euseru.def	Thu Jul 22 16:46:39 2010 +0100
@@ -2494,4 +2494,9 @@
 	_ZNK10RAllocator9MaxLengthEv @ 2493 NONAME
 	_ZN10RAllocator17__DbgGetAllocFailEv @ 2494 NONAME
 	_ZN4User17__DbgGetAllocFailEi @ 2495 NONAME
-
+	_ZN10RArrayBase12SetKeyOffsetEi @ 2496 NONAME
+	_ZN10RSemaphore4PollEv @ 2497 NONAME ; RSemaphore::Poll()
+	_ZN6RMutex4WaitEi @ 2498 NONAME ; RMutex::Wait(int)
+	_ZN6RMutex4PollEv @ 2499 NONAME ; RMutex::Poll()
+	_ZN9RFastLock4PollEv @ 2500 NONAME ; RFastLock::Poll()
+	_ZN9RFastLock4WaitEi @ 2501 NONAME ; RFastLock::Wait(int)
--- a/kernel/eka/common/array.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/common/array.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -663,6 +663,12 @@
 	return iCount;
 	}
 
+EXPORT_C void RArrayBase::SetKeyOffset(TInt aKeyOffset)
+	{
+	__ASSERT_ALWAYS(TUint(aKeyOffset)<TUint(iEntrySize) && (aKeyOffset&3)==0, Panic(EBadArrayKeyOffset));
+	iKeyOffset = aKeyOffset;
+	}
+
 #ifndef __ARRAY_MACHINE_CODED__
 EXPORT_C TAny* RArrayBase::At(TInt anIndex) const
 	{
--- a/kernel/eka/common/heap_hybrid.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/common/heap_hybrid.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -2890,7 +2890,7 @@
                      byte alignment is guaranteed for all allocations 8 bytes or
                      more in size.  4 byte allocations will be aligned to a 4
                      byte boundary.  Best to pass in zero.
-@param aSingleThread ETrue if the heap is to be accessed from multiple threads.
+@param aSingleThread EFalse if the heap is to be accessed from multiple threads.
                      This will cause internal locks to be created, guaranteeing
                      thread safety.
 
@@ -3030,7 +3030,7 @@
                      byte alignment is guaranteed for all allocations 8 bytes or
                      more in size.  4 byte allocations will be aligned to a 4
                      byte boundary.  Best to pass in zero.
-@param aSingleThread ETrue if the heap is to be accessed from multiple threads.
+@param aSingleThread EFalse if the heap is to be accessed from multiple threads.
                      This will cause internal locks to be created, guaranteeing
                      thread safety.
 
@@ -3077,7 +3077,7 @@
                      byte alignment is guaranteed for all allocations 8 bytes or
                      more in size.  4 byte allocations will be aligned to a 4
                      byte boundary.  Best to pass in zero.
-@param aSingleThread ETrue if the heap is to be accessed from multiple threads.
+@param aSingleThread EFalse if the heap is to be accessed from multiple threads.
                      This will cause internal locks to be created, guaranteeing
                      thread safety.
 @param aMode         Flags controlling the heap creation.  See RAllocator::TFlags.
@@ -3137,7 +3137,7 @@
                      byte alignment is guaranteed for all allocations 8 bytes or
                      more in size.  4 byte allocations will be aligned to a 4
                      byte boundary.  Best to pass in zero.
-@param aSingleThread ETrue if the heap is to be accessed from multiple threads.
+@param aSingleThread EFalse if the heap is to be accessed from multiple threads.
                      This will cause internal locks to be created, guaranteeing
                      thread safety.
 @param aMode         Flags controlling the heap creation.  See RAllocator::TFlags.
--- a/kernel/eka/compsupp/compsupp.iby	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/compsupp/compsupp.iby	Thu Jul 22 16:46:39 2010 +0100
@@ -25,9 +25,9 @@
 #   error "RVCT 2.1 is not supported."
 #endif
 
-// Set a default run-time version. In the future, 3.1 or 4.X should be the default.
+// Set a default run-time version. Default to 3.1 which is always available.
 #if !( defined(RVCT2_2) || defined(RVCT3_1) || defined(RVCT4_0) )
-#   define RVCT2_2
+#   define RVCT3_1
 #endif
 
 #if defined(VFPHELPERS) && !defined(NOVFPHELPERS)
--- a/kernel/eka/debug/trkdummyapp/group/bld.inf	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_MMPFILES
-trkdummyapp.mmp
-trkdummyapp2.mmp
-trkdummyapp200159D8.mmp
-trkdummyapp200170BC.mmp
--- a/kernel/eka/drivers/adc/base_e32_drivers_adc.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/adc/base_e32_drivers_adc.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "ADC controller"
 
 component	base_e32_drivers_adc
--- a/kernel/eka/drivers/bsp/base_e32_drivers_bsp.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/bsp/base_e32_drivers_bsp.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Generic Board Support Packages"
 
 component	base_e32_drivers_bsp
--- a/kernel/eka/drivers/bsp/bld.inf	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/bsp/bld.inf	Thu Jul 22 16:46:39 2010 +0100
@@ -51,13 +51,9 @@
 ../resmanus/resmanus
 ../resmanus/resmanusextended
 
+#if !defined(WINS)
 ../power/smppower/idlehelper_lib.mmp
 ../power/smppower/sample_idlehandler/smpidlehandler_lib.mmp
-
-#endif
-
-#if !defined(X86)
-#if !defined(WINS)
 ../iic/iic
 #endif
 #endif
--- a/kernel/eka/drivers/camerasc/base_drivers_camerasc.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/camerasc/base_drivers_camerasc.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Camera Driver - Shared Chunk"
 
 component	base_drivers_camerasc
--- a/kernel/eka/drivers/debug/group/base_e32_drivers_debug.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/debug/group/base_e32_drivers_debug.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Run mode debugger"
 
 component	base_e32_drivers_debug
--- a/kernel/eka/drivers/display/base_e32_drivers_display.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/display/base_e32_drivers_display.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Graphics GCE Driver"
 
 component	base_e32_drivers_display
--- a/kernel/eka/drivers/dma/dma2_pil.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/dma/dma2_pil.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -118,11 +118,12 @@
 // Return minimum of aMaxSize and size of largest physically contiguous block
 // starting at aLinAddr.
 //
-static TInt MaxPhysSize(TLinAddr aLinAddr, const TInt aMaxSize)
+static TUint MaxPhysSize(TLinAddr aLinAddr, const TUint aMaxSize)
 	{
 	const TPhysAddr physBase = LinToPhys(aLinAddr);
+	__DMA_ASSERTD(physBase != KPhysAddrInvalid);
 	TLinAddr lin = aLinAddr;
-	TInt size = 0;
+	TUint size = 0;
 	for (;;)
 		{
 		// Round up the linear address to the next MMU page boundary
@@ -152,6 +153,7 @@
 	  iCapsHwDes(aInfo.iCapsHwDes),
 	  iFreeHdr(NULL)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmac::TDmac"));
 	__DMA_ASSERTD(iMaxDesCount > 0);
 	__DMA_ASSERTD(iDesSize > 0);
 	}
@@ -162,6 +164,7 @@
 //
 TInt TDmac::Create(const SCreateInfo& aInfo)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmac::Create"));
 	iHdrPool = new SDmaDesHdr[iMaxDesCount];
 	if (iHdrPool == NULL)
 		{
@@ -187,6 +190,7 @@
 
 TDmac::~TDmac()
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmac::~TDmac"));
 	__DMA_INVARIANT();
 
 	FreeDesPool();
@@ -229,6 +233,7 @@
 
 TInt TDmac::AllocDesPool(TUint aAttribs)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmac::AllocDesPool"));
 	// Calling thread must be in CS
 	__ASSERT_CRITICAL;
 	TInt r;
@@ -269,6 +274,7 @@
 
 void TDmac::FreeDesPool()
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmac::FreeDesPool"));
 	// Calling thread must be in CS
 	__ASSERT_CRITICAL;
 	if (iCapsHwDes)
@@ -317,6 +323,7 @@
 //
 void TDmac::ReleaseSetOfDes(TInt aCount)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmac::ReleaseSetOfDes count=%d", aCount));
 	__DMA_ASSERTD(aCount >= 0);
 	Wait();
 	iAvailDesCount += aCount;
@@ -386,6 +393,12 @@
 			// complete the request via the DFC in the usual way.
 			}
 		}
+	else
+		{
+		// The PIL doesn't support yet any completion types other than
+		// EDmaCallbackRequestCompletion.
+		__DMA_CANT_HAPPEN();
+		}
 
 	// Now queue a DFC if necessary. The possible scenarios are:
 	// a) DFC not queued (orig == 0)              -> update iIsrDfc + queue DFC
@@ -607,7 +620,7 @@
 	{
 	Wait();
 	__DMA_ASSERTD(0 <= iAvailDesCount && iAvailDesCount <= iMaxDesCount);
-	__DMA_ASSERTD(! iFreeHdr || IsValidHdr(iFreeHdr));
+	__DMA_ASSERTD(!iFreeHdr || IsValidHdr(iFreeHdr));
 	for (TInt i = 0; i < iMaxDesCount; i++)
 		__DMA_ASSERTD(iHdrPool[i].iNext == NULL || IsValidHdr(iHdrPool[i].iNext));
 	Signal();
@@ -622,8 +635,6 @@
 #endif
 
 
-
-
 //
 // Internal compat version, used by legacy Fragment()
 //
@@ -644,10 +655,13 @@
 	  iDelta(~0u),
 	  iReserved(0)
 	{
+	__KTRACE_OPT(KDMA,
+				 Kern::Printf("TDmaTransferConfig::TDmaTransferConfig "
+							  "aAddr=0x%08X aFlags=0x%08X aAddrInc=%d",
+							  aAddr, aFlags, aAddrInc));
 	}
 
 
-
 //
 // Internal compat version, used by legacy Fragment()
 //
@@ -661,11 +675,16 @@
 	  iFlags(0),
 	  iChannelPriority(KDmaPriorityNone),
 	  iPslRequestInfo(aPslInfo),
+	  iChannelCookie(0),
 	  iDelta(~0u),
 	  iReserved1(0),
-	  iChannelCookie(0),
 	  iReserved2(0)
 	{
+	__KTRACE_OPT(KDMA,
+				 Kern::Printf("TDmaTransferArgs::TDmaTransferArgs"));
+	__KTRACE_OPT(KDMA,
+				 Kern::Printf("  aSrc=0x%08X aDest=0x%08X aCount=%d aFlags=0x%08X aPslInfo=0x%08X",
+							  aSrc, aDest, aCount, aFlags, aPslInfo));
 	}
 
 
@@ -695,6 +714,7 @@
 	  iTotalNumSrcElementsTransferred(0),
 	  iTotalNumDstElementsTransferred(0)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::DDmaRequest =0x%08X (old style)", this));
 	iChannel.iReqCount++;
 	__DMA_ASSERTD(0 <= aMaxTransferSize);
 	__DMA_INVARIANT();
@@ -727,6 +747,7 @@
 	  iTotalNumSrcElementsTransferred(0),
 	  iTotalNumDstElementsTransferred(0)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::DDmaRequest =0x%08X (new style)", this));
 	__e32_atomic_add_ord32(&iChannel.iReqCount, 1);
 	__DMA_INVARIANT();
 	}
@@ -734,9 +755,18 @@
 
 EXPORT_C DDmaRequest::~DDmaRequest()
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::~DDmaRequest"));
 	__DMA_ASSERTD(!iQueued);
 	__DMA_INVARIANT();
-	FreeDesList();
+	if (iChannel.iDmacCaps->iAsymHwDescriptors)
+		{
+		FreeSrcDesList();
+		FreeDstDesList();
+		}
+	else
+		{
+		FreeDesList();
+		}
 	__e32_atomic_add_ord32(&iChannel.iReqCount, TUint32(-1));
 	}
 
@@ -744,9 +774,9 @@
 EXPORT_C TInt DDmaRequest::Fragment(TUint32 aSrc, TUint32 aDest, TInt aCount,
 									TUint aFlags, TUint32 aPslInfo)
 	{
-	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::Fragment thread %O "
-									"src=0x%08X dest=0x%08X count=%d flags=0x%X psl=0x%08X",
-									&Kern::CurrentThread(), aSrc, aDest, aCount, aFlags, aPslInfo));
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::Fragment thread %O (old style)",
+									&Kern::CurrentThread()));
+
 	__DMA_ASSERTD(aCount > 0);
 
 	TDmaTransferArgs args(aSrc, aDest, aCount, aFlags, aPslInfo);
@@ -757,7 +787,8 @@
 
 EXPORT_C TInt DDmaRequest::Fragment(const TDmaTransferArgs& aTransferArgs)
 	{
-	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::Fragment thread %O", &Kern::CurrentThread()));
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::Fragment thread %O (new style)",
+									&Kern::CurrentThread()));
 
 	// Writable temporary working copy of the transfer arguments.
 	// We need this because we may have to modify some fields before passing it
@@ -769,10 +800,170 @@
 	}
 
 
-TUint DDmaRequest::GetTransferCount(const TDmaTransferArgs& aTransferArgs)
+TInt DDmaRequest::CheckTransferConfig(const TDmaTransferConfig& aTarget, TUint aCount) const
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::CheckTransferConfig"));
+
+	if (aTarget.iElementSize != 0)
+		{
+		if ((aCount % aTarget.iElementSize) != 0)
+			{
+			// 2, 7 (These strange numbers refer to some test cases documented
+			// elsewhere - they will be removed eventually.)
+			__KTRACE_OPT(KPANIC,
+						 Kern::Printf("Error: ((aCount %% iElementSize) != 0)"));
+			return KErrArgument;
+			}
+		if (aTarget.iElementsPerFrame != 0)
+			{
+			if ((aTarget.iElementSize * aTarget.iElementsPerFrame *
+				 aTarget.iFramesPerTransfer) != aCount)
+				{
+				// 3, 8
+				__KTRACE_OPT(KPANIC,
+							 Kern::Printf("Error: ((iElementSize * "
+										  "iElementsPerFrame * "
+										  "iFramesPerTransfer) != aCount)"));
+				return KErrArgument;
+				}
+			}
+		}
+	else
+		{
+		if (aTarget.iElementsPerFrame != 0)
+			{
+			// 4, 9
+			__KTRACE_OPT(KPANIC,
+						 Kern::Printf("Error: (iElementsPerFrame != 0)"));
+			return KErrArgument;
+			}
+		if (aTarget.iFramesPerTransfer != 0)
+			{
+			// 5, 10
+			__KTRACE_OPT(KPANIC,
+						 Kern::Printf("Error: (iFramesPerTransfer != 0)"));
+			return KErrArgument;
+			}
+		if (aTarget.iElementsPerPacket != 0)
+			{
+			// 6, 11
+			__KTRACE_OPT(KPANIC,
+						 Kern::Printf("Error: (iElementsPerPacket != 0)"));
+			return KErrArgument;
+			}
+		}
+	return KErrNone;
+	}
+
+
+TInt DDmaRequest::CheckMemFlags(const TDmaTransferConfig& aTarget, TUint aCount) const
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::CheckMemFlags"));
+
+	const TBool mem_target = (aTarget.iFlags & KDmaMemAddr);
+
+	if (mem_target && (aTarget.iFlags & KDmaPhysAddr) && !(aTarget.iFlags & KDmaMemIsContiguous))
+		{
+		// Physical memory address implies contiguous range
+		// 13, 15
+		__KTRACE_OPT(KPANIC, Kern::Printf("Error: mem_target && KDmaPhysAddr && !KDmaMemIsContiguous"));
+		return KErrArgument;
+		}
+	else if ((aTarget.iFlags & KDmaMemIsContiguous) && !mem_target)
+		{
+		// Contiguous range implies memory address
+		// 14, 16
+		__KTRACE_OPT(KPANIC, Kern::Printf("Error: KDmaMemIsContiguous && !mem_target"));
+		return KErrArgument;
+		}
+	return KErrNone;
+	}
+
+
+// Makes sure an element or frame never straddles two DMA subtransfer
+// fragments. This would be a fragmentation error by the PIL.
+//
+TInt DDmaRequest::AdjustFragmentSize(TUint& aFragSize, TUint aElementSize,
+									 TUint aFrameSize)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::AdjustFragmentSize FragSize=%d ES=%d FS=%d",
+									aFragSize, aElementSize, aFrameSize));
+
+	TUint rem = 0;
+	TInt r = KErrNone;
+
+	while (1)
+		{
+		// If an element size is defined, make sure the fragment size is
+		// greater or equal.
+		if (aElementSize)
+			{
+			if (aFragSize < aElementSize)
+				{
+				__KTRACE_OPT(KPANIC, Kern::Printf("Error: aFragSize < aElementSize"));
+				r = KErrArgument;
+				break;
+				}
+			}
+		// If a frame size is defined, make sure the fragment size is greater
+		// or equal.
+		if (aFrameSize)
+			{
+			if (aFragSize < aFrameSize)
+				{
+				__KTRACE_OPT(KPANIC, Kern::Printf("Error: aFragSize < aFrameSize"));
+				r = KErrArgument;
+				break;
+				}
+			}
+		// If a frame size is defined, make sure the fragment ends on a frame
+		// boundary.
+		if (aFrameSize)
+			{
+			rem = aFragSize % aFrameSize;
+			if (rem != 0)
+				{
+				aFragSize -= rem;
+				// 20, 22
+				__KTRACE_OPT(KDMA, Kern::Printf("aFragSize %% aFrameSize != 0 --> aFragSize = %d",
+												aFragSize));
+				// aFragSize has changed, so we have to do all the checks
+				// again.
+				continue;
+				}
+			}
+		// If an element size is defined, make sure the fragment ends on an
+		// element boundary.
+		if (aElementSize)
+			{
+			rem = aFragSize % aElementSize;
+			if (rem != 0)
+				{
+				aFragSize -= rem;
+				// 21, 23
+				__KTRACE_OPT(KDMA, Kern::Printf("aFragSize %% aElementSize != 0 --> aFragSize = %d",
+												aFragSize));
+				// aFragSize has changed, so we have to do all the checks
+				// again.
+				continue;
+				}
+			}
+		// Done - all checks passed. Let's get out.
+		break;
+		}
+
+	return r;
+	}
+
+
+TUint DDmaRequest::GetTransferCount(const TDmaTransferArgs& aTransferArgs) const
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::GetTransferCount"));
+
 	const TDmaTransferConfig& src = aTransferArgs.iSrcConfig;
+#ifdef _DEBUG
 	const TDmaTransferConfig& dst = aTransferArgs.iDstConfig;
+#endif	// #ifdef _DEBUG
 
 	TUint count = aTransferArgs.iTransferCount;
 	if (count == 0)
@@ -780,137 +971,117 @@
 		__KTRACE_OPT(KDMA, Kern::Printf("iTransferCount == 0"));
 		count = src.iElementSize * src.iElementsPerFrame *
 			src.iFramesPerTransfer;
+#ifdef _DEBUG
 		const TUint dst_cnt = dst.iElementSize * dst.iElementsPerFrame *
 			dst.iFramesPerTransfer;
 		if (count != dst_cnt)
 			{
+			// 1
 			__KTRACE_OPT(KPANIC, Kern::Printf("Error: (count != dst_cnt)"));
 			return 0;
 			}
+#endif	// #ifdef _DEBUG
 		}
 	else
 		{
 		__KTRACE_OPT(KDMA, Kern::Printf("iTransferCount == %d", count));
+#ifdef _DEBUG
 		// Client shouldn't specify contradictory or incomplete things
-		if (src.iElementSize != 0)
+		if (CheckTransferConfig(src, count) != KErrNone)
 			{
-			if ((count % src.iElementSize) != 0)
-				{
-				__KTRACE_OPT(KPANIC,
-							 Kern::Printf("Error: ((count %% src.iElementSize) != 0)"));
-				return 0;
-				}
-			if (src.iElementsPerFrame != 0)
-				{
-				if ((src.iElementSize * src.iElementsPerFrame * src.iFramesPerTransfer) != count)
-					{
-					__KTRACE_OPT(KPANIC,
-								 Kern::Printf("Error: ((src.iElementSize * "
-											  "src.iElementsPerFrame * "
-											  "src.iFramesPerTransfer) != count)"));
-					return 0;
-					}
-				}
-			}
-		else
-			{
-			if (src.iElementsPerFrame != 0)
-				{
-				__KTRACE_OPT(KPANIC,
-							 Kern::Printf("Error: (src.iElementsPerFrame != 0)"));
-				return 0;
-				}
-			if (src.iFramesPerTransfer != 0)
-				{
-				__KTRACE_OPT(KPANIC,
-							 Kern::Printf("Error: (src.iFramesPerTransfer != 0)"));
-				return 0;
-				}
-			if (src.iElementsPerPacket != 0)
-				{
-				__KTRACE_OPT(KPANIC,
-							 Kern::Printf("Error: (src.iElementsPerPacket != 0)"));
-				return 0;
-				}
+			__KTRACE_OPT(KPANIC, Kern::Printf("Error: CheckTransferConfig(src)"));
+			return 0;
 			}
-		if (dst.iElementSize != 0)
+		if (CheckTransferConfig(dst, count) != KErrNone)
 			{
-			if ((count % dst.iElementSize) != 0)
-				{
-				__KTRACE_OPT(KPANIC,
-							 Kern::Printf("Error: ((count %% dst.iElementSize) != 0)"));
-				return 0;
-				}
-			if (dst.iElementsPerFrame != 0)
-				{
-				if ((dst.iElementSize * dst.iElementsPerFrame * dst.iFramesPerTransfer) != count)
-					{
-					__KTRACE_OPT(KPANIC,
-								 Kern::Printf("Error: ((dst.iElementSize * "
-											  "dst.iElementsPerFrame * "
-											  "dst.iFramesPerTransfer) != count)"));
-					return 0;
-					}
-				}
+			__KTRACE_OPT(KPANIC, Kern::Printf("Error: CheckTransferConfig(dst)"));
+			return 0;
 			}
-		else
-			{
-			if (dst.iElementsPerFrame != 0)
-				{
-				__KTRACE_OPT(KPANIC,
-							 Kern::Printf("Error: (dst.iElementsPerFrame != 0)"));
-				return 0;
-				}
-			if (dst.iFramesPerTransfer != 0)
-				{
-				__KTRACE_OPT(KPANIC,
-							 Kern::Printf("Error: (dst.iFramesPerTransfer != 0)"));
-				return 0;
-				}
-			if (dst.iElementsPerPacket != 0)
-				{
-				__KTRACE_OPT(KPANIC,
-							 Kern::Printf("Error: (dst.iElementsPerPacket != 0)"));
-				return 0;
-				}
-			}
+#endif	// #ifdef _DEBUG
 		}
 	return count;
 	}
 
 
+TUint DDmaRequest::GetMaxTransferlength(const TDmaTransferArgs& aTransferArgs, TUint aCount) const
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::GetMaxTransferlength"));
+
+	const TDmaTransferConfig& src = aTransferArgs.iSrcConfig;
+	const TDmaTransferConfig& dst = aTransferArgs.iDstConfig;
+
+	// Ask the PSL what the maximum length is for a single transfer
+	TUint max_xfer_len = iChannel.MaxTransferLength(src.iFlags, dst.iFlags,
+													aTransferArgs.iPslRequestInfo);
+	if (iMaxTransferSize)
+		{
+		// (User has set a transfer size cap)
+		__KTRACE_OPT(KDMA, Kern::Printf("iMaxTransferSize: %d", iMaxTransferSize));
+		if ((max_xfer_len != 0) && (iMaxTransferSize > max_xfer_len))
+			{
+			// Not really an error, but still...
+			__KTRACE_OPT(KPANIC, Kern::Printf("Warning: iMaxTransferSize > max_xfer_len"));
+			}
+		max_xfer_len = iMaxTransferSize;
+		}
+	else
+		{
+		// (User doesn't care about max transfer size)
+		if (max_xfer_len == 0)
+			{
+			// '0' = no maximum imposed by controller
+			max_xfer_len = aCount;
+			}
+		}
+	__KTRACE_OPT(KDMA, Kern::Printf("max_xfer_len: %d", max_xfer_len));
+
+	// Some sanity checks
+#ifdef _DEBUG
+	if ((max_xfer_len < src.iElementSize) || (max_xfer_len < dst.iElementSize))
+		{
+		// 18
+		__KTRACE_OPT(KPANIC, Kern::Printf("Error: max_xfer_len < iElementSize"));
+		return 0;
+		}
+	if ((max_xfer_len < (src.iElementSize * src.iElementsPerFrame)) ||
+		(max_xfer_len < (dst.iElementSize * dst.iElementsPerFrame)))
+		{
+		// 19
+		__KTRACE_OPT(KPANIC,
+					 Kern::Printf("Error: max_xfer_len < (iElementSize * iElementsPerFrame)"));
+		return 0;
+		}
+#endif	// #ifdef _DEBUG
+
+	return max_xfer_len;
+	}
+
+
+// Unified internal fragmentation routine, called by both the old and new
+// exported Fragment() functions.
+//
+// Depending on whether the DMAC uses a single or two separate descriptor
+// chains, this function branches into either FragSym() or FragAsym(), and the
+// latter function further into either FragAsymSrc()/FragAsymDst() or
+// FragBalancedAsym().
+//
 TInt DDmaRequest::Frag(TDmaTransferArgs& aTransferArgs)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::Frag"));
 	__DMA_ASSERTD(!iQueued);
 
-	// Transfer count checks
+	// Transfer count + checks
 	const TUint count = GetTransferCount(aTransferArgs);
 	if (count == 0)
 		{
 		return KErrArgument;
 		}
 
-	const TDmaTransferConfig& src = aTransferArgs.iSrcConfig;
-	const TDmaTransferConfig& dst = aTransferArgs.iDstConfig;
-
-	// Ask the PSL what the maximum length possible for this transfer is
-	TUint max_xfer_len = iChannel.MaxTransferLength(src.iFlags, dst.iFlags,
-													aTransferArgs.iPslRequestInfo);
-	if (iMaxTransferSize)
+	// Max transfer length + checks
+	const TUint max_xfer_len = GetMaxTransferlength(aTransferArgs, count);
+	if (max_xfer_len == 0)
 		{
-		// User has set a size cap
-		__KTRACE_OPT(KDMA, Kern::Printf("iMaxTransferSize != 0"));
-		__DMA_ASSERTA((iMaxTransferSize <= max_xfer_len) || (max_xfer_len == 0));
-		max_xfer_len = iMaxTransferSize;
-		}
-	else
-		{
-		// User doesn't care about max size
-		if (max_xfer_len == 0)
-			{
-			// No maximum imposed by controller
-			max_xfer_len = count;
-			}
+		return KErrArgument;
 		}
 
 	// ISR callback requested?
@@ -920,6 +1091,8 @@
 		// Requesting an ISR callback w/o supplying one?
 		if (!iDmaCb)
 			{
+			// 12
+			__KTRACE_OPT(KPANIC, Kern::Printf("Error: !iDmaCb"));
 			return KErrArgument;
 			}
 		}
@@ -927,8 +1100,21 @@
 	// Set the channel cookie for the PSL
 	aTransferArgs.iChannelCookie = iChannel.PslId();
 
+	// Client shouldn't specify contradictory or invalid things
+	TInt r = CheckMemFlags(aTransferArgs.iSrcConfig, count);
+	if (r != KErrNone)
+		{
+		__KTRACE_OPT(KPANIC, Kern::Printf("Error: CheckMemFlags(src)"));
+		return r;
+		}
+	r =  CheckMemFlags(aTransferArgs.iDstConfig, count);
+	if (r != KErrNone)
+		{
+		__KTRACE_OPT(KPANIC, Kern::Printf("Error: CheckMemFlags(dst)"));
+		return r;
+		}
+
 	// Now the actual fragmentation
-	TInt r;
 	if (iChannel.iDmacCaps->iAsymHwDescriptors)
 		{
 		r = FragAsym(aTransferArgs, count, max_xfer_len);
@@ -951,64 +1137,193 @@
 TInt DDmaRequest::FragSym(TDmaTransferArgs& aTransferArgs, TUint aCount,
 						  TUint aMaxTransferLen)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::FragSym"));
+
 	TDmaTransferConfig& src = aTransferArgs.iSrcConfig;
 	TDmaTransferConfig& dst = aTransferArgs.iDstConfig;
-
 	const TBool mem_src = (src.iFlags & KDmaMemAddr);
 	const TBool mem_dst = (dst.iFlags & KDmaMemAddr);
 
 	const TUint align_mask_src = iChannel.AddressAlignMask(src.iFlags,
 														   src.iElementSize,
 														   aTransferArgs.iPslRequestInfo);
+	__KTRACE_OPT(KDMA, Kern::Printf("align_mask_src: 0x%x", align_mask_src));
 	const TUint align_mask_dst = iChannel.AddressAlignMask(dst.iFlags,
 														   dst.iElementSize,
 														   aTransferArgs.iPslRequestInfo);
+	__KTRACE_OPT(KDMA, Kern::Printf("align_mask_dst: 0x%x", align_mask_dst));
+
 	// Memory buffers must satisfy alignment constraint
 	__DMA_ASSERTD(!mem_src || ((src.iAddr & align_mask_src) == 0));
 	__DMA_ASSERTD(!mem_dst || ((dst.iAddr & align_mask_dst) == 0));
 
+	// Max aligned length is used to make sure the beginnings of subtransfers
+	// (i.e. fragments) are correctly aligned.
 	const TUint max_aligned_len = (aMaxTransferLen &
 								   ~(Max(align_mask_src, align_mask_dst)));
+	__KTRACE_OPT(KDMA, Kern::Printf("max_aligned_len: %d", max_aligned_len));
 	// Client and PSL sane?
 	__DMA_ASSERTD(max_aligned_len > 0);
 
-	FreeDesList();			   // revert any previous fragmentation attempt
+	if (mem_src && mem_dst &&
+		align_mask_src && align_mask_dst &&
+		(align_mask_src != align_mask_dst) &&
+		(!(src.iFlags & KDmaMemIsContiguous) || !(dst.iFlags & KDmaMemIsContiguous)))
+		{
+		// We don't support transfers which satisfy ALL of the following conditions:
+		// 1) from memory to memory,
+		// 2) both sides have address alignment requirements,
+		// 3) those alignment requirements are not the same,
+		// 4) the memory is non-contiguous on at least one end.
+		//
+		// [A 5th condition is that the channel doesn't support fully
+		// asymmetric h/w descriptor lists,
+		// i.e. TDmaChannel::DmacCaps::iAsymHwDescriptors is reported as EFalse
+		// or iBalancedAsymSegments as ETrue. Hence this check is done in
+		// FragSym() and FragBalancedAsym() but not in FragAsym().]
+		//
+		// The reason for this is that fragmentation could be impossible. The
+		// memory layout (page break) on the side with the less stringent
+		// alignment requirement can result in a misaligned target address on
+		// the other side.
+		//
+		// Here is an example:
+		//
+		// src.iAddr =  3964 (0x0F7C), non-contiguous,
+		// align_mask_src = 1 (alignment = 2 bytes)
+		// dst.iAddr = 16384 (0x4000), contiguous,
+		// align_mask_dst = 7 (alignment = 8 bytes)
+		// count = max_xfer_len = 135 bytes
+		// => max_aligned_len = 128 bytes
+		//
+		// Now, suppose MaxPhysSize() returns 132 bytes because src has 132
+		// contiguous bytes to the end of its current mem page.
+		// Trying to fragment this leads to:
+		//
+		// frag_1 = 128 bytes: src reads from 3964 (0x0F7C),
+		//                     dst writes to 16384 (0x4000).
+		// (Fragment 1 uses the max_aligned_len instead of 132 bytes because
+		// otherwise the next fragment would start for the destination at
+		// dst.iAddr + 132 = 16516 (0x4084), which is not 8-byte aligned.)
+		//
+		// frag_2 = 4 bytes: src reads from 4092 (0x0FFC),
+		//                   dst writes to 16512 (0x4080).
+		// (Fragment 2 uses just 4 bytes instead of the remaining 7 bytes
+		// because there is a memory page break on the source side after 4 bytes.)
+		//
+		// frag_3 = 3 bytes: src reads from 4096 (0x1000),
+		//                   dst writes to 16516 (0x4084).
+		//
+		// And there's the problem: the start address of frag_3 is going to be
+		// misaligned for the destination side - it's not 8-byte aligned!
+		//
+		// 17
+		__KTRACE_OPT(KPANIC, Kern::Printf("Error: Different alignments for src & dst"
+										  " + non-contiguous target(s)"));
+		return KErrArgument;
+		}
+
 	TInt r;
+	// Revert any previous fragmentation attempt
+	FreeDesList();
 	do
 		{
 		// Allocate fragment
 		r = ExpandDesList(/*1*/);
 		if (r != KErrNone)
 			{
-			FreeDesList();
 			break;
 			}
 		// Compute fragment size
 		TUint c = Min(aMaxTransferLen, aCount);
-		if (mem_src && !(src.iFlags & KDmaPhysAddr))
+		__KTRACE_OPT(KDMA, Kern::Printf("c = Min(aMaxTransferLen, aCount) = %d", c));
+
+		// SRC
+		if (mem_src && !(src.iFlags & KDmaMemIsContiguous))
 			{
-			__KTRACE_OPT(KDMA, Kern::Printf("mem_src && !(src.iFlags & KDmaPhysAddr)"));
-			// @@@ Should also take into account (src.iFlags & KDmaMemIsContiguous)!
 			c = MaxPhysSize(src.iAddr, c);
+			__KTRACE_OPT(KDMA, Kern::Printf("c = MaxPhysSize(src.iAddr, c) = %d", c));
 			}
-		if (mem_dst && !(dst.iFlags & KDmaPhysAddr))
+
+		// DST
+		if (mem_dst && !(dst.iFlags & KDmaMemIsContiguous))
 			{
-			__KTRACE_OPT(KDMA, Kern::Printf("mem_dst && !(dst.iFlags & KDmaPhysAddr)"));
-			// @@@ Should also take into account (dst.iFlags & KDmaMemIsContiguous)!
 			c = MaxPhysSize(dst.iAddr, c);
+			__KTRACE_OPT(KDMA, Kern::Printf("c = MaxPhysSize(dst.iAddr, c) = %d", c));
 			}
+
+		// SRC & DST
 		if ((mem_src || mem_dst) && (c < aCount) && (c > max_aligned_len))
 			{
 			// This is not the last fragment of a transfer to/from memory.
 			// We must round down the fragment size so the next one is
 			// correctly aligned.
-			__KTRACE_OPT(KDMA, Kern::Printf("(mem_src || mem_dst) && (c < aCount) && (c > max_aligned_len)"));
 			c = max_aligned_len;
+			__KTRACE_OPT(KDMA, Kern::Printf("c = max_aligned_len = %d", c));
+			//
+			// But can this condition actually occur if src and dst are
+			// properly aligned to start with?
+			//
+			// If we disallow unequal alignment requirements in connection with
+			// non-contiguous memory buffers (see the long comment above in
+			// this function for why) and if both target addresses are
+			// correctly aligned at the beginning of the transfer then it
+			// doesn't seem possible to end up with a fragment which is not
+			// quite the total remaining size (c < aCount) but still larger
+			// than the greatest aligned length (c > max_aligned_len).
+			//
+			// That's because address alignment values are always a power of
+			// two (at least that's what we assume - otherwise
+			// AddressAlignMask() doesn't work), and memory page sizes are also
+			// always a power of two and hence a multiple of the alignment
+			// value (as long as the alignment is not greater than the page
+			// size, which seems a reasonable assumption regardless of the
+			// actual page size). So if we start properly aligned anywhere in a
+			// memory page then the number of bytes to the end of that page is
+			// always a multiple of the aligment value - there's no remainder.
+			//
+			// So let's see if we ever hit this assertion:
+			Kern::Printf("Unexpected: (mem_src || mem_dst) && (c < aCount) && (c > max_aligned_len)");
+			__DMA_ASSERTA(EFalse);
 			}
 
-		// TODO: Make sure an element or frame on neither src or dst side
-		// (which can be of different sizes) never straddles a DMA subtransfer.
-		// (This would be a fragmentation error by the PIL.)
+		// If this is not the last fragment...
+		if (c < aCount)
+			{
+			const TUint es_src = src.iElementSize;
+			const TUint es_dst = dst.iElementSize;
+			const TUint fs_src = es_src * src.iElementsPerFrame;
+			const TUint fs_dst = es_dst * dst.iElementsPerFrame;
+			TUint c_prev;
+			do
+				{
+				c_prev = c;
+				// If fs_src is !0 then es_src must be !0 as well (see
+				// CheckTransferConfig).
+				if (es_src)
+					{
+					r = AdjustFragmentSize(c, es_src, fs_src);
+					if (r != KErrNone)
+						{
+						break;							// while (c != c_prev);
+						}
+					}
+				// If fs_dst is !0 then es_dst must be !0 as well (see
+				// CheckTransferConfig).
+				if (es_dst)
+					{
+					r = AdjustFragmentSize(c, es_dst, fs_dst);
+					if (r != KErrNone)
+						{
+						break;							// while (c != c_prev);
+						}
+					}
+				} while (c != c_prev);
+			if (r != KErrNone)
+				{
+				break;									 // while (aCount > 0);
+				}
+			}
 
 		// Set transfer count for the PSL
 		aTransferArgs.iTransferCount = c;
@@ -1018,18 +1333,24 @@
 		r = iChannel.iController->InitDes(*iLastHdr, aTransferArgs);
 		if (r != KErrNone)
 			{
-			FreeDesList();
 			break;
 			}
 		// Update for next iteration
 		aCount -= c;
 		if (mem_src)
+			{
 			src.iAddr += c;
+			}
 		if (mem_dst)
+			{
 			dst.iAddr += c;
+			}
+		} while (aCount > 0);
+
+	if (r != KErrNone)
+		{
+		FreeDesList();
 		}
-	while (aCount > 0);
-
 	return r;
 	}
 
@@ -1037,7 +1358,20 @@
 TInt DDmaRequest::FragAsym(TDmaTransferArgs& aTransferArgs, TUint aCount,
 						   TUint aMaxTransferLen)
 	{
-	TInt r = FragAsymSrc(aTransferArgs, aCount, aMaxTransferLen);
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::FragAsym"));
+
+	TInt r;
+	if (iChannel.iDmacCaps->iBalancedAsymSegments)
+		{
+		r = FragBalancedAsym(aTransferArgs, aCount, aMaxTransferLen);
+		if (r != KErrNone)
+			{
+			FreeSrcDesList();
+			FreeDstDesList();
+			}
+		return r;
+		}
+	r = FragAsymSrc(aTransferArgs, aCount, aMaxTransferLen);
 	if (r != KErrNone)
 		{
 		FreeSrcDesList();
@@ -1056,21 +1390,29 @@
 TInt DDmaRequest::FragAsymSrc(TDmaTransferArgs& aTransferArgs, TUint aCount,
 							  TUint aMaxTransferLen)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::FragAsymSrc"));
+
 	TDmaTransferConfig& src = aTransferArgs.iSrcConfig;
-
 	const TBool mem_src = (src.iFlags & KDmaMemAddr);
 
 	const TUint align_mask = iChannel.AddressAlignMask(src.iFlags,
 													   src.iElementSize,
 													   aTransferArgs.iPslRequestInfo);
+	__KTRACE_OPT(KDMA, Kern::Printf("align_mask: 0x%x", align_mask));
+
 	// Memory buffers must satisfy alignment constraint
 	__DMA_ASSERTD(!mem_src || ((src.iAddr & align_mask) == 0));
 
+	// Max aligned length is used to make sure the beginnings of subtransfers
+	// (i.e. fragments) are correctly aligned.
 	const TUint max_aligned_len = (aMaxTransferLen & ~align_mask);
-	__DMA_ASSERTD(max_aligned_len > 0);				  // bug in PSL if not true
-
+	__KTRACE_OPT(KDMA, Kern::Printf("max_aligned_len: %d", max_aligned_len));
+	// Client and PSL sane?
+	__DMA_ASSERTD(max_aligned_len > 0);
+
+	TInt r;
+	// Revert any previous fragmentation attempt
 	FreeSrcDesList();
-	TInt r;
 	do
 		{
 		// Allocate fragment
@@ -1081,19 +1423,62 @@
 			}
 		// Compute fragment size
 		TUint c = Min(aMaxTransferLen, aCount);
-		if (mem_src && !(src.iFlags & KDmaPhysAddr))
+		__KTRACE_OPT(KDMA, Kern::Printf("c = Min(aMaxTransferLen, aCount) = %d", c));
+
+		if (mem_src && !(src.iFlags & KDmaMemIsContiguous))
 			{
-			__KTRACE_OPT(KDMA, Kern::Printf("mem_src && !(src.iFlags & KDmaPhysAddr)"));
 			c = MaxPhysSize(src.iAddr, c);
+			__KTRACE_OPT(KDMA, Kern::Printf("c = MaxPhysSize(src.iAddr, c) = %d", c));
 			}
+
 		if (mem_src && (c < aCount) && (c > max_aligned_len))
 			{
 			// This is not the last fragment of a transfer from memory.
 			// We must round down the fragment size so the next one is
 			// correctly aligned.
-			__KTRACE_OPT(KDMA, Kern::Printf("mem_src && (c < aCount) && (c > max_aligned_len)"));
-			c = max_aligned_len;
+			__KTRACE_OPT(KDMA, Kern::Printf("c = max_aligned_len = %d", c));
+			//
+			// But can this condition actually occur if src is properly aligned
+			// to start with?
+			//
+			// If the target address is correctly aligned at the beginning of
+			// the transfer then it doesn't seem possible to end up with a
+			// fragment which is not quite the total remaining size (c <
+			// aCount) but still larger than the greatest aligned length (c >
+			// max_aligned_len).
+			//
+			// That's because address alignment values are always a power of
+			// two (at least that's what we assume - otherwise
+			// AddressAlignMask() doesn't work), and memory page sizes are also
+			// always a power of two and hence a multiple of the alignment
+			// value (as long as the alignment is not greater than the page
+			// size, which seems a reasonable assumption regardless of the
+			// actual page size). So if we start properly aligned anywhere in a
+			// memory page then the number of bytes to the end of that page is
+			// always a multiple of the aligment value - there's no remainder.
+			//
+			// So let's see if we ever hit this assertion:
+			Kern::Printf("Unexpected: mem_src && (c < aCount) && (c > max_aligned_len)");
+			__DMA_ASSERTA(EFalse);
 			}
+
+		// If this is not the last fragment...
+		if (c < aCount)
+			{
+			const TUint es = src.iElementSize;
+			const TUint fs = es * src.iElementsPerFrame;
+			// If fs is !0 then es must be !0 as well (see
+			// CheckTransferConfig).
+			if (es)
+				{
+				r = AdjustFragmentSize(c, es, fs);
+				if (r != KErrNone)
+					{
+					break;								 // while (aCount > 0);
+					}
+				}
+			}
+
 		// Set transfer count for the PSL
 		aTransferArgs.iTransferCount = c;
 		__KTRACE_OPT(KDMA, Kern::Printf("this fragm.: %d (0x%x) total remain.: %d (0x%x)",
@@ -1107,9 +1492,10 @@
 		// Update for next iteration
 		aCount -= c;
 		if (mem_src)
+			{
 			src.iAddr += c;
-		}
-	while (aCount > 0);
+			}
+		} while (aCount > 0);
 
 	return r;
 	}
@@ -1118,21 +1504,29 @@
 TInt DDmaRequest::FragAsymDst(TDmaTransferArgs& aTransferArgs, TUint aCount,
 							  TUint aMaxTransferLen)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::FragAsymDst"));
+
 	TDmaTransferConfig& dst = aTransferArgs.iDstConfig;
-
 	const TBool mem_dst = (dst.iFlags & KDmaMemAddr);
 
 	const TUint align_mask = iChannel.AddressAlignMask(dst.iFlags,
 													   dst.iElementSize,
 													   aTransferArgs.iPslRequestInfo);
+	__KTRACE_OPT(KDMA, Kern::Printf("align_mask: 0x%x", align_mask));
+
 	// Memory buffers must satisfy alignment constraint
 	__DMA_ASSERTD(!mem_dst || ((dst.iAddr & align_mask) == 0));
 
+	// Max aligned length is used to make sure the beginnings of subtransfers
+	// (i.e. fragments) are correctly aligned.
 	const TUint max_aligned_len = (aMaxTransferLen & ~align_mask);
-	__DMA_ASSERTD(max_aligned_len > 0);				  // bug in PSL if not true
-
+	__KTRACE_OPT(KDMA, Kern::Printf("max_aligned_len: %d", max_aligned_len));
+	// Client and PSL sane?
+	__DMA_ASSERTD(max_aligned_len > 0);
+
+	TInt r;
+	// Revert any previous fragmentation attempt
 	FreeDstDesList();
-	TInt r;
 	do
 		{
 		// Allocate fragment
@@ -1143,19 +1537,62 @@
 			}
 		// Compute fragment size
 		TUint c = Min(aMaxTransferLen, aCount);
-		if (mem_dst && !(dst.iFlags & KDmaPhysAddr))
+		__KTRACE_OPT(KDMA, Kern::Printf("c = Min(aMaxTransferLen, aCount) = %d", c));
+
+		if (mem_dst && !(dst.iFlags & KDmaMemIsContiguous))
 			{
-			__KTRACE_OPT(KDMA, Kern::Printf("mem_dst && !(dst.iFlags & KDmaPhysAddr)"));
 			c = MaxPhysSize(dst.iAddr, c);
+			__KTRACE_OPT(KDMA, Kern::Printf("c = MaxPhysSize(dst.iAddr, c) = %d", c));
 			}
+
 		if (mem_dst && (c < aCount) && (c > max_aligned_len))
 			{
 			// This is not the last fragment of a transfer to memory.
 			// We must round down the fragment size so the next one is
 			// correctly aligned.
-			__KTRACE_OPT(KDMA, Kern::Printf("mem_dst && (c < aCount) && (c > max_aligned_len)"));
-			c = max_aligned_len;
+			__KTRACE_OPT(KDMA, Kern::Printf("c = max_aligned_len = %d", c));
+			//
+			// But can this condition actually occur if dst is properly aligned
+			// to start with?
+			//
+			// If the target address is correctly aligned at the beginning of
+			// the transfer then it doesn't seem possible to end up with a
+			// fragment which is not quite the total remaining size (c <
+			// aCount) but still larger than the greatest aligned length (c >
+			// max_aligned_len).
+			//
+			// That's because address alignment values are always a power of
+			// two (at least that's what we assume - otherwise
+			// AddressAlignMask() doesn't work), and memory page sizes are also
+			// always a power of two and hence a multiple of the alignment
+			// value (as long as the alignment is not greater than the page
+			// size, which seems a reasonable assumption regardless of the
+			// actual page size). So if we start properly aligned anywhere in a
+			// memory page then the number of bytes to the end of that page is
+			// always a multiple of the aligment value - there's no remainder.
+			//
+			// So let's see if we ever hit this assertion:
+			Kern::Printf("Unexpected: mem_dst && (c < aCount) && (c > max_aligned_len)");
+			__DMA_ASSERTA(EFalse);
 			}
+
+		// If this is not the last fragment...
+		if (c < aCount)
+			{
+			const TUint es = dst.iElementSize;
+			const TUint fs = es * dst.iElementsPerFrame;
+			// If fs is !0 then es must be !0 as well (see
+			// CheckTransferConfig).
+			if (es)
+				{
+				r = AdjustFragmentSize(c, es, fs);
+				if (r != KErrNone)
+					{
+					break;								 // while (aCount > 0);
+					}
+				}
+			}
+
 		// Set transfer count for the PSL
 		aTransferArgs.iTransferCount = c;
 		__KTRACE_OPT(KDMA, Kern::Printf("this fragm.: %d (0x%x) total remain.: %d (0x%x)",
@@ -1169,7 +1606,238 @@
 		// Update for next iteration
 		aCount -= c;
 		if (mem_dst)
+			{
 			dst.iAddr += c;
+			}
+		}
+	while (aCount > 0);
+
+	return r;
+	}
+
+
+TInt DDmaRequest::FragBalancedAsym(TDmaTransferArgs& aTransferArgs, TUint aCount,
+								   TUint aMaxTransferLen)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::FragBalancedAsym"));
+
+	TDmaTransferConfig& src = aTransferArgs.iSrcConfig;
+	TDmaTransferConfig& dst = aTransferArgs.iDstConfig;
+	const TBool mem_src = (src.iFlags & KDmaMemAddr);
+	const TBool mem_dst = (dst.iFlags & KDmaMemAddr);
+
+	const TUint align_mask_src = iChannel.AddressAlignMask(src.iFlags,
+														   src.iElementSize,
+														   aTransferArgs.iPslRequestInfo);
+	__KTRACE_OPT(KDMA, Kern::Printf("align_mask_src: 0x%x", align_mask_src));
+	const TUint align_mask_dst = iChannel.AddressAlignMask(dst.iFlags,
+														   dst.iElementSize,
+														   aTransferArgs.iPslRequestInfo);
+	__KTRACE_OPT(KDMA, Kern::Printf("align_mask_dst: 0x%x", align_mask_dst));
+
+	// Memory buffers must satisfy alignment constraint
+	__DMA_ASSERTD(!mem_src || ((src.iAddr & align_mask_src) == 0));
+	__DMA_ASSERTD(!mem_dst || ((dst.iAddr & align_mask_dst) == 0));
+
+	// Max aligned length is used to make sure the beginnings of subtransfers
+	// (i.e. fragments) are correctly aligned.
+	const TUint max_aligned_len = (aMaxTransferLen &
+								   ~(Max(align_mask_src, align_mask_dst)));
+	__KTRACE_OPT(KDMA, Kern::Printf("max_aligned_len: %d", max_aligned_len));
+	// Client and PSL sane?
+	__DMA_ASSERTD(max_aligned_len > 0);
+
+	if (mem_src && mem_dst &&
+		align_mask_src && align_mask_dst &&
+		(align_mask_src != align_mask_dst) &&
+		(!(src.iFlags & KDmaMemIsContiguous) || !(dst.iFlags & KDmaMemIsContiguous)))
+		{
+		// We don't support transfers which satisfy ALL of the following conditions:
+		// 1) from memory to memory,
+		// 2) both sides have address alignment requirements,
+		// 3) those alignment requirements are not the same,
+		// 4) the memory is non-contiguous on at least one end.
+		//
+		// [A 5th condition is that the channel doesn't support fully
+		// asymmetric h/w descriptor lists,
+		// i.e. TDmaChannel::DmacCaps::iAsymHwDescriptors is reported as EFalse
+		// or iBalancedAsymSegments as ETrue. Hence this check is done in
+		// FragSym() and FragBalancedAsym() but not in FragAsym().]
+		//
+		// The reason for this is that fragmentation could be impossible. The
+		// memory layout (page break) on the side with the less stringent
+		// alignment requirement can result in a misaligned target address on
+		// the other side.
+		//
+		// Here is an example:
+		//
+		// src.iAddr =  3964 (0x0F7C), non-contiguous,
+		// align_mask_src = 1 (alignment = 2 bytes)
+		// dst.iAddr = 16384 (0x4000), contiguous,
+		// align_mask_dst = 7 (alignment = 8 bytes)
+		// count = max_xfer_len = 135 bytes
+		// => max_aligned_len = 128 bytes
+		//
+		// Now, suppose MaxPhysSize() returns 132 bytes because src has 132
+		// contiguous bytes to the end of its current mem page.
+		// Trying to fragment this leads to:
+		//
+		// frag_1 = 128 bytes: src reads from 3964 (0x0F7C),
+		//                     dst writes to 16384 (0x4000).
+		// (Fragment 1 uses the max_aligned_len instead of 132 bytes because
+		// otherwise the next fragment would start for the destination at
+		// dst.iAddr + 132 = 16516 (0x4084), which is not 8-byte aligned.)
+		//
+		// frag_2 = 4 bytes: src reads from 4092 (0x0FFC),
+		//                   dst writes to 16512 (0x4080).
+		// (Fragment 2 uses just 4 bytes instead of the remaining 7 bytes
+		// because there is a memory page break on the source side after 4 bytes.)
+		//
+		// frag_3 = 3 bytes: src reads from 4096 (0x1000),
+		//                   dst writes to 16516 (0x4084).
+		//
+		// And there's the problem: the start address of frag_3 is going to be
+		// misaligned for the destination side - it's not 8-byte aligned!
+		//
+		__KTRACE_OPT(KPANIC, Kern::Printf("Error: Different alignments for src & dst"
+										  " + non-contiguous target(s)"));
+		return KErrArgument;
+		}
+
+	TInt r;
+	// Revert any previous fragmentation attempt
+	FreeSrcDesList();
+	FreeDstDesList();
+	do
+		{
+		// Allocate fragment
+		r = ExpandSrcDesList(/*1*/);
+		if (r != KErrNone)
+			{
+			break;
+			}
+		r = ExpandDstDesList(/*1*/);
+		if (r != KErrNone)
+			{
+			break;
+			}
+		// Compute fragment size
+		TUint c = Min(aMaxTransferLen, aCount);
+		__KTRACE_OPT(KDMA, Kern::Printf("c = Min(aMaxTransferLen, aCount) = %d", c));
+
+		// SRC
+		if (mem_src && !(src.iFlags & KDmaMemIsContiguous))
+			{
+			c = MaxPhysSize(src.iAddr, c);
+			__KTRACE_OPT(KDMA, Kern::Printf("c = MaxPhysSize(src.iAddr, c) = %d", c));
+			}
+
+		// DST
+		if (mem_dst && !(dst.iFlags & KDmaMemIsContiguous))
+			{
+			c = MaxPhysSize(dst.iAddr, c);
+			__KTRACE_OPT(KDMA, Kern::Printf("c = MaxPhysSize(dst.iAddr, c) = %d", c));
+			}
+
+		// SRC & DST
+		if ((mem_src || mem_dst) && (c < aCount) && (c > max_aligned_len))
+			{
+			// This is not the last fragment of a transfer to/from memory.
+			// We must round down the fragment size so the next one is
+			// correctly aligned.
+			c = max_aligned_len;
+			__KTRACE_OPT(KDMA, Kern::Printf("c = max_aligned_len = %d", c));
+			//
+			// But can this condition actually occur if src and dst are
+			// properly aligned to start with?
+			//
+			// If we disallow unequal alignment requirements in connection with
+			// non-contiguous memory buffers (see the long comment above in
+			// this function for why) and if both target addresses are
+			// correctly aligned at the beginning of the transfer then it
+			// doesn't seem possible to end up with a fragment which is not
+			// quite the total remaining size (c < aCount) but still larger
+			// than the greatest aligned length (c > max_aligned_len).
+			//
+			// That's because address alignment values are always a power of
+			// two (at least that's what we assume - otherwise
+			// AddressAlignMask() doesn't work), and memory page sizes are also
+			// always a power of two and hence a multiple of the alignment
+			// value (as long as the alignment is not greater than the page
+			// size, which seems a reasonable assumption regardless of the
+			// actual page size). So if we start properly aligned anywhere in a
+			// memory page then the number of bytes to the end of that page is
+			// always a multiple of the aligment value - there's no remainder.
+			//
+			// So let's see if we ever hit this assertion:
+			Kern::Printf("Unexpected: (mem_src || mem_dst) && (c < aCount) && (c > max_aligned_len)");
+			__DMA_ASSERTA(EFalse);
+			}
+
+		// If this is not the last fragment...
+		if (c < aCount)
+			{
+			const TUint es_src = src.iElementSize;
+			const TUint es_dst = dst.iElementSize;
+			const TUint fs_src = es_src * src.iElementsPerFrame;
+			const TUint fs_dst = es_dst * dst.iElementsPerFrame;
+			TUint c_prev;
+			do
+				{
+				c_prev = c;
+				// If fs_src is !0 then es_src must be !0 as well (see
+				// CheckTransferConfig).
+				if (es_src)
+					{
+					r = AdjustFragmentSize(c, es_src, fs_src);
+					if (r != KErrNone)
+						{
+						break;							// while (c != c_prev);
+						}
+					}
+				// If fs_dst is !0 then es_dst must be !0 as well (see
+				// CheckTransferConfig).
+				if (es_dst)
+					{
+					r = AdjustFragmentSize(c, es_dst, fs_dst);
+					if (r != KErrNone)
+						{
+						break;							// while (c != c_prev);
+						}
+					}
+				} while (c != c_prev);
+			if (r != KErrNone)
+				{
+				break;									 // while (aCount > 0);
+				}
+			}
+
+		// Set transfer count for the PSL
+		aTransferArgs.iTransferCount = c;
+		__KTRACE_OPT(KDMA, Kern::Printf("this fragm.: %d (0x%x) total remain.: %d (0x%x)",
+										c, c, aCount, aCount));
+		// Initialise SRC fragment
+		r = iChannel.iController->InitSrcHwDes(*iSrcLastHdr, aTransferArgs);
+		if (r != KErrNone)
+			{
+			break;
+			}
+		// Initialise DST fragment
+		r = iChannel.iController->InitDstHwDes(*iDstLastHdr, aTransferArgs);
+		if (r != KErrNone)
+			{
+			break;
+			}
+		// Update for next iteration
+		aCount -= c;
+		if (mem_src)
+			{
+			src.iAddr += c;
+			}
+		if (mem_dst)
+			{
+			dst.iAddr += c;
+			}
 		}
 	while (aCount > 0);
 
@@ -1180,7 +1848,15 @@
 EXPORT_C TInt DDmaRequest::Queue()
 	{
 	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::Queue thread %O", &Kern::CurrentThread()));
-	__DMA_ASSERTD(iDesCount > 0);	// Not configured? Call Fragment() first!
+	// Not configured? Call Fragment() first!
+	if (iChannel.iDmacCaps->iAsymHwDescriptors)
+		{
+		__DMA_ASSERTD((iSrcDesCount < 0) && (iDstDesCount < 0));
+		}
+	else
+		{
+		__DMA_ASSERTD(iDesCount > 0);
+		}
 	__DMA_ASSERTD(!iQueued);
 
 	// Append request to queue and link new descriptor list to existing one.
@@ -1270,18 +1946,21 @@
 
 EXPORT_C TInt DDmaRequest::ExpandDesList(TInt aCount)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::ExpandDesList aCount=%d", aCount));
 	return ExpandDesList(aCount, iDesCount, iFirstHdr, iLastHdr);
 	}
 
 
 EXPORT_C TInt DDmaRequest::ExpandSrcDesList(TInt aCount)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::ExpandSrcDesList"));
 	return ExpandDesList(aCount, iSrcDesCount, iSrcFirstHdr, iSrcLastHdr);
 	}
 
 
 EXPORT_C TInt DDmaRequest::ExpandDstDesList(TInt aCount)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::ExpandDstDesList"));
 	return ExpandDesList(aCount, iDstDesCount, iDstFirstHdr, iDstLastHdr);
 	}
 
@@ -1290,6 +1969,7 @@
 								SDmaDesHdr*& aFirstHdr,
 								SDmaDesHdr*& aLastHdr)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::ExpandDesList"));
 	__DMA_ASSERTD(!iQueued);
 	__DMA_ASSERTD(aCount > 0);
 
@@ -1340,24 +2020,28 @@
 
 EXPORT_C void DDmaRequest::FreeDesList()
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::FreeDesList"));
 	FreeDesList(iDesCount, iFirstHdr, iLastHdr);
 	}
 
 
 EXPORT_C void DDmaRequest::FreeSrcDesList()
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::FreeSrcDesList"));
 	FreeDesList(iSrcDesCount, iSrcFirstHdr, iSrcLastHdr);
 	}
 
 
 EXPORT_C void DDmaRequest::FreeDstDesList()
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::FreeDstDesList"));
 	FreeDesList(iDstDesCount, iDstFirstHdr, iDstLastHdr);
 	}
 
 
 void DDmaRequest::FreeDesList(TInt& aDesCount, SDmaDesHdr*& aFirstHdr, SDmaDesHdr*& aLastHdr)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::FreeDesList count=%d", aDesCount));
 	__DMA_ASSERTD(!iQueued);
 
 	if (aDesCount > 0)
@@ -1367,13 +2051,20 @@
 		const SDmaDesHdr* hdr = aFirstHdr;
 		while (hdr)
 			{
+			__DMA_ASSERTD(c.IsValidHdr(hdr));
+
+			// This (potential) PSL call doesn't follow the "overhead
+			// principle", and something should be done about this.
 			c.ClearHwDes(*hdr);
 			hdr = hdr->iNext;
 			};
+
 		c.Wait();
+		__DMA_ASSERTD(c.IsValidHdr(c.iFreeHdr));
 		aLastHdr->iNext = c.iFreeHdr;
 		c.iFreeHdr = aFirstHdr;
 		c.Signal();
+
 		aFirstHdr = aLastHdr = NULL;
 		aDesCount = 0;
 		}
@@ -1382,6 +2073,8 @@
 
 EXPORT_C void DDmaRequest::EnableSrcElementCounting(TBool /*aResetElementCount*/)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::EnableSrcElementCounting"));
+
 	// Not yet implemented.
 	return;
 	}
@@ -1389,6 +2082,8 @@
 
 EXPORT_C void DDmaRequest::EnableDstElementCounting(TBool /*aResetElementCount*/)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::EnableDstElementCounting"));
+
 	// Not yet implemented.
 	return;
 	}
@@ -1396,6 +2091,8 @@
 
 EXPORT_C void DDmaRequest::DisableSrcElementCounting()
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::DisableSrcElementCounting"));
+
 	// Not yet implemented.
 	return;
 	}
@@ -1403,6 +2100,8 @@
 
 EXPORT_C void DDmaRequest::DisableDstElementCounting()
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::DisableDstElementCounting"));
+
 	// Not yet implemented.
 	return;
 	}
@@ -1410,6 +2109,8 @@
 
 EXPORT_C TUint32 DDmaRequest::TotalNumSrcElementsTransferred()
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::TotalNumSrcElementsTransferred"));
+
 	// Not yet implemented.
 
 	// So far largely bogus code (just to touch some symbols)...
@@ -1432,6 +2133,8 @@
 
 EXPORT_C TUint32 DDmaRequest::TotalNumDstElementsTransferred()
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::TotalNumDstElementsTransferred"));
+
 	// Not yet implemented.
 	return iTotalNumDstElementsTransferred;
 	}
@@ -1439,24 +2142,28 @@
 
 EXPORT_C TInt DDmaRequest::FragmentCount()
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::FragmentCount"));
 	return FragmentCount(iFirstHdr);
 	}
 
 
 EXPORT_C TInt DDmaRequest::SrcFragmentCount()
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::SrcFragmentCount"));
 	return FragmentCount(iSrcFirstHdr);
 	}
 
 
 EXPORT_C TInt DDmaRequest::DstFragmentCount()
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::DstFragmentCount"));
 	return FragmentCount(iDstFirstHdr);
 	}
 
 
 TInt DDmaRequest::FragmentCount(const SDmaDesHdr* aHdr)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::FragmentCount aHdr=0x%08x", aHdr));
 	TInt count = 0;
 	for (const SDmaDesHdr* pH = aHdr; pH != NULL; pH = pH->iNext)
 		{
@@ -1472,8 +2179,18 @@
 inline void DDmaRequest::OnDeque()
 	{
 	iQueued = EFalse;
-	iLastHdr->iNext = NULL;
-	iChannel.DoUnlink(*iLastHdr);
+	if (iChannel.iDmacCaps->iAsymHwDescriptors)
+		{
+		iSrcLastHdr->iNext = NULL;
+		iDstLastHdr->iNext = NULL;
+		iChannel.DoUnlink(*iSrcLastHdr);
+		iChannel.DoUnlink(*iDstLastHdr);
+		}
+	else
+		{
+		iLastHdr->iNext = NULL;
+		iChannel.DoUnlink(*iLastHdr);
+		}
 	}
 
 
@@ -1508,6 +2225,10 @@
 			__DMA_ASSERTD(iChannel.iController->IsValidHdr(iDstFirstHdr));
 			__DMA_ASSERTD(iChannel.iController->IsValidHdr(iDstLastHdr));
 			}
+		if (iChannel.iDmacCaps->iBalancedAsymSegments)
+			{
+			__DMA_ASSERTD(iSrcDesCount == iDstDesCount);
+			}
 		}
 	else
 		{
@@ -1554,7 +2275,7 @@
 	  iRedoRequest(EFalse),
 	  iIsrCbRequest(EFalse)
 	{
-	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::TDmaChannel"));
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::TDmaChannel =0x%08X", this));
 	__DMA_INVARIANT();
 	}
 
@@ -1566,7 +2287,12 @@
 	{
 	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::Open thread %O", &Kern::CurrentThread()));
 
-	__DMA_ASSERTD(aInfo.iDesCount >= 1);
+	if (aInfo.iDesCount < 1)
+		{
+		__KTRACE_OPT(KPANIC, Kern::Printf("DMA channel failed to open: iDescount<1"));
+		return KErrArgument;
+		}
+
 	__DMA_ASSERTD(aInfo.iPriority <= KDmaPriority8);
 	__DMA_ASSERTD(aInfo.iDfcQ != NULL);
 	__DMA_ASSERTD(aInfo.iDfcPriority < KNumDfcPriorities);
@@ -1760,11 +2486,10 @@
 										  TUint32 aPslRequestInfo,
 										  TBool aIsrCb)
 	{
-	__KTRACE_OPT(KDMA,
-				 Kern::Printf("TDmaChannel::IsrRedoRequest src=0x%08x, "
-							  "dst=0x%08x, count=%d, pslInfo=0x%08x, isrCb=%d",
-							  aSrcAddr, aDstAddr, aTransferCount, aPslRequestInfo,
-							  aIsrCb));
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::IsrRedoRequest src=0x%08X, "
+									"dst=0x%08X, count=%d, pslInfo=0x%08X, isrCb=%d",
+									aSrcAddr, aDstAddr, aTransferCount, aPslRequestInfo,
+									aIsrCb));
 	// Function needs to be called in ISR context.
 	__DMA_ASSERTD(NKern::CurrentContext() == NKern::EInterrupt);
 
@@ -1775,7 +2500,7 @@
 	if ((aSrcAddr != KPhysAddrInvalid) && (aSrcAddr == aDstAddr))
 		{
 		__KTRACE_OPT(KPANIC,
-					 Kern::Printf("Error: Updating src & dst to same address: 0x%08x",
+					 Kern::Printf("Error: Updating src & dst to same address: 0x%08X",
 								  aSrcAddr));
 		return KErrArgument;
 		}
@@ -1791,8 +2516,12 @@
 
 	if (iDmacCaps->iAsymHwDescriptors)
 		{
-		// We don't allow multiple-descriptor chains to be updated here
+		// We don't allow multiple-descriptor chains to be updated here.
+		// That we just panic (instead of returning an error), and also only in
+		// the UDEB case (instead of always) is not ideal, but done here in the
+		// interest of performance.
 		__DMA_ASSERTD((pCurReq->iSrcDesCount == 1) && (pCurReq->iDstDesCount == 1));
+
 		// Adjust parameters if necessary (asymmetrical s/g variety)
 		const SDmaDesHdr* const pSrcFirstHdr = pCurReq->iSrcFirstHdr;
 		if ((aSrcAddr != KPhysAddrInvalid) || aTransferCount || aPslRequestInfo)
@@ -1821,8 +2550,12 @@
 		}
 	else
 		{
-		// We don't allow multiple-descriptor chains to be updated here
+		// We don't allow a multiple-descriptor chain to be updated here.
+		// That we just panic (instead of returning an error), and also only in
+		// the UDEB case (instead of always) is not ideal, but done here in the
+		// interest of performance.
 		__DMA_ASSERTD(pCurReq->iDesCount == 1);
+
 		// Adjust parameters if necessary (symmetrical s/g and non-s/g variety)
 		const SDmaDesHdr* const pFirstHdr = pCurReq->iFirstHdr;
 		if ((aSrcAddr != KPhysAddrInvalid) || (aDstAddr != KPhysAddrInvalid) ||
@@ -1853,18 +2586,21 @@
 
 EXPORT_C TInt TDmaChannel::FailNext(TInt /*aFragmentCount*/)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::FailNext"));
 	return iController->FailNext(*this);
 	}
 
 
 EXPORT_C TInt TDmaChannel::MissNextInterrupts(TInt aInterruptCount)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::MissNextInterrupts"));
 	return iController->MissNextInterrupts(*this, aInterruptCount);
 	}
 
 
 EXPORT_C TInt TDmaChannel::Extension(TInt aCmd, TAny* aArg)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::Extension"));
 	return iController->Extension(*this, aCmd, aArg);
 	}
 
@@ -1874,6 +2610,7 @@
 //
 EXPORT_C TInt TDmaChannel::StaticExtension(TInt aCmd, TAny* aArg)
 	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::StaticExtension"));
 	return DmaChannelMgr::StaticExtension(aCmd, aArg);
 	}
 
@@ -1932,7 +2669,7 @@
 		{
 		--count;
 
-		__DMA_ASSERTD(!iReqQ.IsEmpty());
+		__DMA_ASSERTA(!iReqQ.IsEmpty());
 
 		// If an error occurred it must have been reported on the last
 		// interrupt since transfers are suspended after an error.
@@ -1945,12 +2682,30 @@
 			{
 			// Update state machine, current fragment, completed fragment and
 			// tell the DMAC to transfer the next fragment if necessary.
-			SDmaDesHdr* pCompletedHdr = NULL;
-			DoDfc(const_cast<const DDmaRequest&>(*pCurReq), pCompletedHdr);
-
+			TBool complete;
+			if (iDmacCaps->iAsymHwDescriptors)
+				{
+				SDmaDesHdr* pCompletedSrcHdr = NULL;
+				SDmaDesHdr* pCompletedDstHdr = NULL;
+				DoDfc(const_cast<const DDmaRequest&>(*pCurReq),
+					  pCompletedSrcHdr, pCompletedDstHdr);
+				// We don't support asymmetrical ISR notifications and request
+				// completions yet, hence we can do the following assert test
+				// here; also 'complete' is determined equally by either the
+				// SRC or DST side.
+				__DMA_ASSERTD(!LOGICAL_XOR((pCompletedSrcHdr == pCurReq->iSrcLastHdr),
+										   (pCompletedDstHdr == pCurReq->iDstLastHdr)));
+				complete = (pCompletedDstHdr == pCurReq->iDstLastHdr);
+				}
+			else
+				{
+				SDmaDesHdr* pCompletedHdr = NULL;
+				DoDfc(const_cast<const DDmaRequest&>(*pCurReq), pCompletedHdr);
+				complete = (pCompletedHdr == pCurReq->iLastHdr);
+				}
 			// If just completed last fragment from current request, switch to
 			// next request (if any).
-			if (pCompletedHdr == pCurReq->iLastHdr)
+			if (complete)
 				{
 				pCompletedReq = pCurReq;
 				pCurReq->iLink.Deque();
--- a/kernel/eka/drivers/dma/dma2_shared.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/dma/dma2_shared.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -137,9 +137,9 @@
 	  iFlags(0),
 	  iChannelPriority(KDmaPriorityNone),
 	  iPslRequestInfo(0),
+	  iChannelCookie(0),
 	  iDelta(~0u),
 	  iReserved1(0),
-	  iChannelCookie(0),
 	  iReserved2(0)
 	{
 	}
@@ -202,9 +202,9 @@
 	  iFlags(aFlags),
 	  iChannelPriority(aChannelPriority),
 	  iPslRequestInfo(aPslRequestInfo),
+	  iChannelCookie(0),
 	  iDelta(~0u),
 	  iReserved1(0),
-	  iChannelCookie(0),
 	  iReserved2(0)
 	{
 	}
--- a/kernel/eka/drivers/dma/dmapil.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/dma/dmapil.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -800,7 +800,7 @@
 		// If an error occurred it must have been reported on the last interrupt since transfers are
 		// suspended after an error.
 		DDmaRequest::TResult res = (count==0 && error) ? DDmaRequest::EError : DDmaRequest::EOk;
-		__DMA_ASSERTD(!iReqQ.IsEmpty());
+		__DMA_ASSERTA(!iReqQ.IsEmpty());
 		DDmaRequest* pCompletedReq = NULL;
 		DDmaRequest* pCurReq = _LOFF(iReqQ.First(), DDmaRequest, iLink);
 		DDmaRequest::TCallback cb = 0;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/drivers/eabi/rm_debug_extu.def	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,22 @@
+EXPORTS
+	_Z19CreateLogicalDevicev @ 1 NONAME
+	_ZN5Debug7GetListEPKNS_9TListItemEi @ 2 NONAME
+	_ZTI11DDebugAgent @ 3 NONAME
+	_ZTI12DRMDStepping @ 4 NONAME
+	_ZTI14DBufferManager @ 5 NONAME
+	_ZTI14DTargetProcess @ 6 NONAME
+	_ZTI15DProcessTracker @ 7 NONAME
+	_ZTI16DRM_DebugChannel @ 8 NONAME
+	_ZTI17D_RMD_Breakpoints @ 9 NONAME
+	_ZTI21DRM_DebugEventHandler @ 10 NONAME
+	_ZTI22DRM_DebugDriverFactory @ 11 NONAME
+	_ZTV11DDebugAgent @ 12 NONAME
+	_ZTV12DRMDStepping @ 13 NONAME
+	_ZTV14DBufferManager @ 14 NONAME
+	_ZTV14DTargetProcess @ 15 NONAME
+	_ZTV15DProcessTracker @ 16 NONAME
+	_ZTV16DRM_DebugChannel @ 17 NONAME
+	_ZTV17D_RMD_Breakpoints @ 18 NONAME
+	_ZTV21DRM_DebugEventHandler @ 19 NONAME
+	_ZTV22DRM_DebugDriverFactory @ 20 NONAME
+
--- a/kernel/eka/drivers/ecomm/base_e32_drivers_ecomm.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/ecomm/base_e32_drivers_ecomm.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Serial Port Driver"
 
 component	base_e32_drivers_ecomm
--- a/kernel/eka/drivers/ethernet/base_e32_drivers_ethernet.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/ethernet/base_e32_drivers_ethernet.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Ethernet Driver"
 
 component	base_e32_drivers_ethernet
--- a/kernel/eka/drivers/locmedia/base_e32_drivers_locmedia.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/locmedia/base_e32_drivers_locmedia.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Local Media Subsystem"
 
 component	base_e32_drivers_locmedia
--- a/kernel/eka/drivers/locmedia/dmasupport.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/locmedia/dmasupport.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -743,43 +743,79 @@
 	{
 	OstTraceFunctionEntry0( DDMAHELPER_GETPHYSICALADDRESS_ENTRY );
 	__ASSERT_DEBUG( (aReq.Flags() & TLocDrvRequest::ETClientBuffer) == 0,  PHYSADDR_FAULT());
-	TLinAddr linAddr = (TLinAddr) aReq.RemoteDes();
-	TInt& offset = aReq.RemoteDesOffset();
-	TLinAddr currLinAddr = linAddr + offset;
-	TInt reqLen = I64LOW(aReq.Length());
-	__ASSERT_DEBUG(I64HIGH(aReq.Length()) == 0,  PHYSADDR_FAULT());
-
-	aAddr = Epoc::LinearToPhysical(currLinAddr);
 
-	// Set the initial length to be the length remaining in this page or the request length (whichever is shorter).
-	// If there are subsequent pages, we then need to determine whether they are contiguous
-	aLen = Min( (TInt) (PageAlign(currLinAddr+iPageSize) - currLinAddr), reqLen - offset);
+	TInt reqLen = I64LOW(aReq.Length());
+    __ASSERT_DEBUG(I64HIGH(aReq.Length()) == 0,  PHYSADDR_FAULT());
+    
+    TInt& offset = aReq.RemoteDesOffset();    
+	if (aReq.Flags() & TLocDrvRequest::EPhysAddrOnly)
+        {        
+        __KTRACE_DMA(Kern::Printf("-Physical Address Only"));
+        __ASSERT_DEBUG(IsPageAligned((TLinAddr)reqLen), PHYSADDR_FAULT());
+        
+        TPhysAddr* physArray = (TPhysAddr*)aReq.RemoteDes();        
+        
+        // Adjust start to the next element to be issued                 
+        TUint pageNo = offset>>iPageSizeLog2;
+        TPhysAddr currPhysPageAddr = aAddr = physArray[pageNo];
+        __ASSERT_DEBUG(IsPageAligned((TLinAddr)currPhysPageAddr), PHYSADDR_FAULT());
+        offset+=iPageSize; 
+        aLen=iPageSize;
 
-	__ASSERT_DEBUG(aLen > 0,  PHYSADDR_FAULT());
-	
-	TPhysAddr currPhysPageAddr = PageAlign((TLinAddr) aAddr);
-
-	offset+= aLen;
-
+        //Determine how many pages are contiguous
+        TPhysAddr nextPhysPageAddr;        
+        while (offset < reqLen)
+            {
+            pageNo++;
+            nextPhysPageAddr = physArray[pageNo];            
+            __ASSERT_DEBUG(PageOffset((TLinAddr) nextPhysPageAddr) == 0,  PHYSADDR_FAULT());
 
-	while (offset < reqLen)
-		{
-		TPhysAddr nextPhysPageAddr = Epoc::LinearToPhysical(linAddr + offset);
-		__ASSERT_DEBUG(PageOffset((TLinAddr) nextPhysPageAddr) == 0,  PHYSADDR_FAULT());
+            if (nextPhysPageAddr != currPhysPageAddr + iPageSize)
+                break;
+            
+            currPhysPageAddr = nextPhysPageAddr;            
+            offset+= iPageSize;
+            aLen+= iPageSize;
+            }
+        
+        __KTRACE_DMA(Kern::Printf(">PHYSADDR:DP:GetPhysS(PhysAddrOnly), physAddr %08X, len %x reqLen %x", aAddr, aLen, reqLen));
+        }
+	else
+	    {	
+        TLinAddr linAddr = (TLinAddr) aReq.RemoteDes();
+        TLinAddr currLinAddr = linAddr + offset;	
+    
+        aAddr = Epoc::LinearToPhysical(currLinAddr);
+    
+        // Set the initial length to be the length remaining in this page or the request length (whichever is shorter).
+        // If there are subsequent pages, we then need to determine whether they are contiguous
+        aLen = Min( (TInt) (PageAlign(currLinAddr+iPageSize) - currLinAddr), reqLen - offset);
+    
+        __ASSERT_DEBUG(aLen > 0,  PHYSADDR_FAULT());
+        
+        TPhysAddr currPhysPageAddr = PageAlign((TLinAddr) aAddr);
+    
+        offset+= aLen;
+    
+        while (offset < reqLen)
+            {
+            TPhysAddr nextPhysPageAddr = Epoc::LinearToPhysical(linAddr + offset);
+            __ASSERT_DEBUG(PageOffset((TLinAddr) nextPhysPageAddr) == 0,  PHYSADDR_FAULT());
+    
+            if (nextPhysPageAddr != currPhysPageAddr + iPageSize)
+                break;
+            
+            currPhysPageAddr = nextPhysPageAddr;
+    
+            TInt len = Min(iPageSize, reqLen - offset);
+            offset+= len;
+            aLen+= len;
+            }
 
-		if (nextPhysPageAddr != currPhysPageAddr + iPageSize)
-			break;
-		
-		currPhysPageAddr = nextPhysPageAddr;
-
-		TInt len = Min(iPageSize, reqLen - offset);
-		offset+= len;
-		aLen+= len;
-		}
-
-
-	__KTRACE_DMA(Kern::Printf(">PHYSADDR:DP:GetPhysS(), linAddr %08X, physAddr %08X, len %x reqLen %x", linAddr + offset, aAddr, aLen, reqLen));
-	OstTraceExt4(TRACE_DEMANDPAGING, DDMAHELPER_GETPHYSICALADDRESS_DP, "linAddr=0x%x; physAddr=0x%x; length=0x%x; reqLen=0x%x", linAddr + offset, aAddr, aLen, reqLen);
+        __KTRACE_DMA(Kern::Printf(">PHYSADDR:DP:GetPhysS(), linAddr %08X, physAddr %08X, len %x reqLen %x", linAddr + offset, aAddr, aLen, reqLen));
+        OstTraceExt4(TRACE_DEMANDPAGING, DDMAHELPER_GETPHYSICALADDRESS_DP, "linAddr=0x%x; physAddr=0x%x; length=0x%x; reqLen=0x%x", linAddr + offset, aAddr, aLen, reqLen);
+	    }
+	
 	OstTraceFunctionExit0( DDMAHELPER_GETPHYSICALADDRESS_EXIT );
 	return KErrNone;
 	}
--- a/kernel/eka/drivers/locmedia/locmedia.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/locmedia/locmedia.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -29,7 +29,6 @@
 #include "locmediaTraces.h"
 #endif
 
-
 #if defined(_DEBUG) && defined(__DEMAND_PAGING__)
 //#define __DEBUG_DEMAND_PAGING__
 #endif
@@ -79,6 +78,7 @@
 #ifdef __DEMAND_PAGING__
 	DMediaPagingDevice* iPagingDevice;
 	TInt iPageSizeMsk;			// Mask of page size (e.g. 4096-1 -> 4095)
+	TInt iPageSizeLog2;        // LOG2 of page size (i.e. 4096 -> 12)
 	TInt iMediaChanges;
 #endif
 
@@ -586,10 +586,12 @@
 			if (r==KErrNone)
 				{
 				__TRACE_TIMING(2);
-				OstTraceDefExt4( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_READ, "ERead iDriveNumber=%d; length=0x%x; position=0x%x; TLocDrvRequest Object=0x%x", (TInt) iDrive->iDriveNumber, (TUint) m.Length(), (TUint) m.Pos(), (TUint) &m);
+				OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_READ, "ERead iDriveNumber=%d; TLocDrvRequest Object=0x%x", (TInt) iDrive->iDriveNumber, (TUint) &m);
+				OstTraceDefExt4( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_READ2, "ERead length=%x:%x, pos=%x:%x", (TUint) I64HIGH(m.Length()), (TUint) I64LOW(m.Length()), (TUint) I64HIGH(m.Pos()), (TUint) I64LOW(m.Pos()));
 				r=iDrive->Request(m);
 				__TRACE_TIMING(3);
-				OstTraceDefExt4( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_READ_RETURN, "ERead Return iDriveNumber=%d; length=0x%x; position=0x%x; TLocDrvRequest Object=0x%x", (TInt) iDrive->iDriveNumber, (TUint) m.Length(), (TUint) m.Pos(), (TUint) &m );
+				OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_READ_RETURN, "ERead Return iDriveNumber=%d; TLocDrvRequest Object=0x%x", (TInt) iDrive->iDriveNumber, (TUint) &m );
+				OstTraceDefExt4( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_READ_RETURN2, "ERead Return length=%x:%x, pos=%x:%x", (TUint) I64HIGH(m.Length()), (TUint) I64LOW(m.Length()), (TUint) I64HIGH(m.Pos()), (TUint) I64LOW(m.Pos()));
 				}
 			m.CloseRemoteThread();
 			break;
@@ -600,9 +602,11 @@
 			r=m.ProcessMessageData(a1);
 			if (r==KErrNone)
 				{
-				OstTraceDefExt4( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_WRITE, "EWrite iDriveNumber=%d; length=0x%x; position=0x%x; TLocDrvRequest Object=0x%x", (TInt) iDrive->iDriveNumber, (TUint) m.Length(), (TUint) m.Pos(), (TUint) &m );
+				OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_WRITE, "EWrite iDriveNumber=%d; TLocDrvRequest Object=0x%x", (TInt) iDrive->iDriveNumber, (TUint) &m );
+				OstTraceDefExt4( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_WRITE2, "EWrite length=%x:%x, pos=%x:%x", (TUint) I64HIGH(m.Length()), (TUint) I64LOW(m.Length()), (TUint) I64HIGH(m.Pos()), (TUint) I64LOW(m.Pos()));
 				r=iDrive->Request(m);
-				OstTraceDefExt4( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_WRITE_RETURN, "EWrite Return iDriveNumber=%d; length=0x%x; position=0x%x; TLocDrvRequest Object=0x%x", (TInt) iDrive->iDriveNumber, (TUint) m.Length(), (TUint) m.Pos(), (TUint) &m );
+				OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_WRITE_RETURN, "EWrite Return iDriveNumber=%d; TLocDrvRequest Object=0x%x", (TInt) iDrive->iDriveNumber, (TUint) &m );
+				OstTraceDefExt4( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_WRITE_RETURN2, "EWrite Return length=%x:%x, pos=%x:%x", (TUint) I64HIGH(m.Length()), (TUint) I64LOW(m.Length()), (TUint) I64HIGH(m.Pos()), (TUint) I64LOW(m.Pos()));
 				}
 			m.CloseRemoteThread();
 			break;
@@ -1526,6 +1530,10 @@
 	RemoteDes()=(TAny*)d.iPtr;
 	RemoteDesOffset()=d.iOffset;
 	DriverFlags()=d.iFlags;
+	
+	// EPhysAddrOnly should not be set for client requests
+	Flags() &= ~TLocDrvRequest::EPhysAddrOnly;
+	
 	if (Pos()<0 || Length()<0)
 	    {
 		OstTraceFunctionExitExt( TLOCDRVREQUEST_PROCESSMESSAGEDATA_EXIT2, this, KErrArgument );
@@ -1557,7 +1565,7 @@
 	OstTraceFunctionEntry1( TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION_ENTRY, this );
 	TLocDrv& d=*Drive();
 	__KTRACE_OPT(KLOCDRV,Kern::Printf("CheckAndAdjustForPartition drive %d partition len %lx",d.iDriveNumber,d.iPartitionLen));
-	OstTraceExt2( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION1, "iDriveNumber=%d; partition length=0x%lx", d.iDriveNumber, (TInt) d.iPartitionLen );
+	OstTraceExt3( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION1, "iDriveNumber=%d; partition length=%x:%x", d.iDriveNumber, (TInt) I64HIGH (d.iPartitionLen), (TInt) I64LOW (d.iPartitionLen));
 	Flags() |= EAdjusted;
 	TInt r;
 	switch (Id())
@@ -1578,7 +1586,7 @@
 		    }
 		case DLocalDrive::EEnlarge:
 			__KTRACE_OPT(KLOCDRV,Kern::Printf("Enlarge request %lx",Length()));
-			OstTrace1( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION2, "Enlarge request=0x%lx", Length() );
+			OstTraceExt2( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION2, "Enlarge request=%x:%x", (TInt) I64HIGH(Length()), (TInt) I64LOW(Length()) );
 			if (Length()>KMaxTInt)
 				r = KErrArgument;
 			else
@@ -1586,7 +1594,7 @@
 			break;
 		case DLocalDrive::EReduce:
 			__KTRACE_OPT(KLOCDRV,Kern::Printf("Reduce request %lx@%lx",Length(),Pos()));
-			OstTraceExt2( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION3, "Reduce request length=0x%lx; position=0x%lx", (TUint) Length(), (TUint) Pos() );
+			OstTraceExt4( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION3, "Reduce request length=%x:%x; position=%x:%x", (TUint) I64HIGH(Length()), (TUint) I64LOW(Length()), (TUint) I64HIGH (Pos()), (TUint) I64LOW (Pos()) );
 			if (Pos()+Length()>d.iPartitionLen)
 				r = KErrArgument;
 			else
@@ -1594,7 +1602,7 @@
 			break;
 		case DLocalDrive::EFormat:
 			__KTRACE_OPT(KLOCDRV,Kern::Printf("Format request %lx@%lx",Length(),Pos()));
-			OstTraceExt2( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION4, "Format request length=0x%lx; position=0x%lx", (TUint) Length(), (TUint) Pos() );
+			OstTraceExt4( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION4, "Format request length=%x:%x; position=%x:%x", (TUint) I64HIGH(Length()),(TUint) I64LOW(Length()), (TUint) I64HIGH (Pos()), (TUint) I64LOW (Pos()) );
 			if (!(DriverFlags() & RLocalDrive::ELocDrvWholeMedia))
 				{
 				if (Pos()>d.iPartitionLen)
@@ -1622,7 +1630,7 @@
 //		    Otherwise the media driver adjust it internally
 		case DMediaPagingDevice::ECodePageInRequest:
 			__KTRACE_OPT(KLOCDPAGING,Kern::Printf("Adjusted Paging read request %lx@%lx",Length(),Pos()));
-			OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, TLOCDRVREQUESTCHECKANDADJUSTFORPARTITION5, "Adjusted Paging read request length=0x%lx; position=0x%lx", (TUint) Length(),  (TUint) Pos());
+			OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, TLOCDRVREQUESTCHECKANDADJUSTFORPARTITION5, "Adjusted Paging read request length=%x:%x; position=%x%:%x", (TUint) I64HIGH(Length()), (TUint) I64LOW(Length()),  (TUint) I64HIGH (Pos()), (TUint) I64LOW (Pos()));
 			if (Pos()+Length()>d.iPartitionLen)
 			    {
 				r = KErrArgument;
@@ -1635,7 +1643,7 @@
 		
 		default:	// read or write or fragment
 			__KTRACE_OPT(KLOCDRV,Kern::Printf("R/W request %lx@%lx",Length(),Pos()));
-			OstTraceExt2( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION6, "Read/Write request length=0x%x; position=0x%x", (TUint) Length(), (TUint) Pos() );
+			OstTraceExt4( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION6, "Read/Write request length=%x:%x; position=%x:%x", (TUint)I64HIGH (Length()), (TUint)I64LOW (Length()), (TUint) I64HIGH (Pos()), (TUint) I64LOW (Pos()));
 			if (DriverFlags() & RLocalDrive::ELocDrvWholeMedia)
 				{
 				if (d.iMedia && d.iMedia->iDriver && Pos()+Length() > d.iMedia->iPartitionInfo.iMediaSizeInBytes)
@@ -1825,6 +1833,7 @@
 #ifdef __DEMAND_PAGING__
 	TInt pageSize = Kern::RoundToPageSize(1);
 	iBody->iPageSizeMsk = pageSize-1;
+	iBody->iPageSizeLog2 = __e32_find_ms1_32(pageSize);
 #endif
 
 	iLastMediaId=aLastMediaId;
@@ -2021,7 +2030,8 @@
 	__KTRACE_OPT(KLOCDRV,Kern::Printf("DPrimaryMediaBase(%d)::Request(%08x)",iMediaId,&aReq));
 	__KTRACE_OPT(KLOCDRV,Kern::Printf("this=%x, ReqId=%d, Pos=%lx, Len=%lx, remote thread %O",this,aReq.Id(),aReq.Pos(),aReq.Length(),aReq.RemoteThread()));
 
-	OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DPRIMARYMEDIABASE_REQUEST, "reqId=%d; length=0x%lx; position=0x%lx; remote thread=0x%x", (TInt) aReq.Id(), (TUint) aReq.Length(),  (TUint) aReq.Pos(), (TUint) aReq.RemoteThread());
+	OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DPRIMARYMEDIABASE_REQUEST, "reqId=%d; remote thread=0x%x", (TInt) aReq.Id(), (TUint) aReq.RemoteThread());
+	OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DPRIMARYMEDIABASE_REQUEST2, "length=%x:%x; position=%x:%x", (TUint) I64HIGH(aReq.Length()), (TUint) I64LOW(aReq.Length()), (TUint) I64HIGH(aReq.Pos()), (TUint) I64LOW(aReq.Pos()));
 	
 	TInt reqId = aReq.Id();
 
@@ -2309,7 +2319,8 @@
 		fragment.Flags() = aReq.Flags();
 
 		__KTRACE_OPT2(KLOCDPAGING,KLOCDRV,Kern::Printf("Send fragment (0x%08x) type(%d), length(0x%x), offset within original req(0x%x), pos in media(0x%lx)",&fragment,fragment.Id(), pinnedLen, pos, fragment.Pos()));
-		OstTraceDefExt5(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_PINFRAGMENTSENDRECEIVE3, "Send fragment 0x%08x; type=%d; length=0x%x; offset within original req=0x%x; position in media=0x%lx", (TUint) &fragment, (TInt) fragment.Id(), (TUint) pinnedLen, (TUint) pos, (TUint) fragment.Pos());
+		OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_PINFRAGMENTSENDRECEIVE3, "Send fragment 0x%08x; type=%d; length=0x%x; offset within original req=0x%x", (TUint) &fragment, (TInt) fragment.Id(), (TUint) pinnedLen, (TUint) pos);
+		OstTraceDefExt3(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_PINFRAGMENTSENDRECEIVE4, "Send fragment 0x%08x; position in media=%x:%x",(TUint) &fragment, (TUint) I64HIGH(fragment.Pos()), (TUint) I64LOW(fragment.Pos()));
 		
 #ifdef BTRACE_PAGING_MEDIA
 		TInt buf[4];
@@ -2748,7 +2759,7 @@
 	DMedia* media=pL->iMedia;
 	TInt r=KErrNone;
 	
-	OstTraceDefExt3( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DPRIMARYMEDIABASE_DOREQUEST, "req Id=%d; length=0x%x; position=0x%x", (TInt) m.Id(), (TInt) m.Length(), (TInt) m.Pos());
+	OstTraceDefExt5( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DPRIMARYMEDIABASE_DOREQUEST, "req Id=%d; length=%x:%x; position=%x:%x", (TInt) m.Id(), (TUint) I64HIGH(m.Length()), (TUint) I64LOW(m.Length()), (TUint) I64HIGH(m.Pos()), (TUint) I64LOW(m.Pos()) );
 	
 	// re-open this drive's media driver ?
 	if (m.iValue == DLocalDrive::EForceMediaChange)
@@ -2878,9 +2889,10 @@
 			}
 		else
 #endif
-
-		CompleteRequest(m, s);
-		OstTraceDefExt3( OST_TRACE_CATEGORY_RND, TRACE_INTERNALS, DPRIMARYMEDIABASE_DOREQUEST_RETURN, "Return req Id=%d; Remote Thread=0x%x; retval=%d", (TInt) m.Id(), (TUint) m.RemoteThread(), (TInt) s);
+			{
+			CompleteRequest(m, s);
+			OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_INTERNALS, DPRIMARYMEDIABASE_DOREQUEST_RETURN, "Return Remote Thread=0x%x; retval=%d", (TUint) m.RemoteThread(), (TInt) s);
+			}
 		}
 
 	iCurrentReq=NULL;
@@ -4064,19 +4076,23 @@
 	TInt len = I64LOW(m.Length());
 
 	TBool needSyncAfterRead = EFalse;
-	if (m.Drive()->iDmaHelper)
-		{
-		m.Flags() |= TLocDrvRequest::EPhysAddr;
-		if (m.Id() == DLocalDrive::EWrite)
-			{
-			Cache::SyncMemoryBeforeDmaWrite(addr, len);
-			}
-		else
-			{
-			Cache::SyncMemoryBeforeDmaRead(addr, len);
-			needSyncAfterRead = ETrue;
-			}
-		}
+    if (m.Drive()->iDmaHelper)
+        {        
+        m.Flags() |= TLocDrvRequest::EPhysAddr;
+        // don't cache sync for zero mapping...
+        if (!(m.Flags() & TLocDrvRequest::EPhysAddrOnly))
+            {
+            if (m.Id() == DLocalDrive::EWrite)
+                {
+                Cache::SyncMemoryBeforeDmaWrite(addr, len);
+                }
+            else
+                {
+                Cache::SyncMemoryBeforeDmaRead(addr, len);
+                needSyncAfterRead = ETrue;
+                }
+            }
+	    }
 
 	// Count the number of outstanding requests if this is the data-paging media, so that
 	// we can call DPagingDevice::NotifyBusy() / DPagingDevice::NotifyIdle()
@@ -4133,6 +4149,17 @@
 	}
 
 TInt DMediaPagingDevice::Read(TThreadMessage* aReq,TLinAddr aBuffer,TUint aOffset,TUint aSize,TInt aDrvNumber)
+    {
+    return BaseRead(aReq,(TUint32)aBuffer,aOffset,aSize,aDrvNumber,EFalse);
+    }
+
+TInt DMediaPagingDevice::ReadPhysical(TThreadMessage* aReq, TPhysAddr* aPageArray, TUint aPageCount, TUint aOffset, TInt aDrvNumber)
+    {    
+    TUint adjSize = (aPageCount << iPrimaryMedia->iBody->iPageSizeLog2) >> iReadUnitShift; // translate to Read Units
+    return BaseRead(aReq,(TUint32)aPageArray,aOffset,adjSize,aDrvNumber,ETrue);
+    }
+
+TInt DMediaPagingDevice::BaseRead(TThreadMessage* aReq,TUint32 aBuffer,TUint aOffset,TUint aSize,TInt aDrvNumber, TBool aPhysAddr)
 	{
 	OstTraceFunctionEntry1( DMEDIAPAGINGDEVICE_READ_ENTRY, this );
 	__ASSERT_ALWAYS(NKern::CurrentThread()!=iPrimaryMedia->iDfcQ->iThread,LOCM_FAULT());	// that would lock up the system, thus better die now
@@ -4281,9 +4308,13 @@
 		m.Length()=Int64(size);
 		m.RemoteDes()=(TAny*)aBuffer;
 		m.RemoteDesOffset()=0;		// pre-aligned
-		m.DriverFlags()=0;
+		m.DriverFlags() = 0;
+		if (aPhysAddr)
+		    m.Flags() |= TLocDrvRequest::EPhysAddrOnly;
+
 		__KTRACE_OPT2(KLOCDRV,KLOCDPAGING,Kern::Printf("ReqId=%d, Pos=0x%lx, Len=0x%lx, remote Des 0x%x",m.Id(),m.Pos(),m.Length(),m.RemoteDes()));
-		OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_READ2, "reqId=%d; position=0x%lx; length=0x%x; remote Des=0x%x", (TInt) m.Id(), (TUint) m.Pos(), (TUint) m.Length(), (TUint) m.RemoteDes());
+		OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_READ2, "reqId=%d; remote Des=0x%x", (TInt) m.Id(), (TUint) m.RemoteDes());
+		OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_READ3, "length=%x:%x, pos=%x:%x", (TUint) I64HIGH(m.Length()), (TUint) I64LOW(m.Length()), (TUint) I64HIGH(m.Pos()), (TUint) I64LOW(m.Pos()));
 		
 		__ASSERT_DEBUG(iPrimaryMedia->iBody, LOCM_FAULT());
 		TInt mediaChanges = iPrimaryMedia->iBody->iMediaChanges;
@@ -4329,7 +4360,18 @@
 	}
 
 TInt DMediaPagingDevice::Write(TThreadMessage* aReq,TLinAddr aBuffer,TUint aOffset,TUint aSize,TBool aBackground)
-	{
+    {
+    return BaseWrite(aReq,(TUint32)aBuffer,aOffset,aSize,aBackground,EFalse);
+    }
+
+TInt DMediaPagingDevice::WritePhysical(TThreadMessage* aReq, TPhysAddr* aPageArray, TUint aPageCount, TUint aOffset, TBool aBackground)
+	{
+    TUint adjSize = (aPageCount << iPrimaryMedia->iBody->iPageSizeLog2) >> iReadUnitShift; // translate to Read Units
+    return BaseWrite(aReq,(TUint32)aPageArray,aOffset,adjSize,aBackground,ETrue);
+	}
+
+TInt DMediaPagingDevice::BaseWrite(TThreadMessage* aReq,TUint32 aBuffer,TUint aOffset,TUint aSize,TBool aBackground, TBool aPhysAddr)
+    {
 	OstTraceFunctionEntry1( DMEDIAPAGINGDEVICE_WRITE_ENTRY, this );
 	__ASSERT_ALWAYS(NKern::CurrentThread()!=iPrimaryMedia->iDfcQ->iThread,LOCM_FAULT());	// that would lock up the system, thus better die now
 	__ASSERT_ALWAYS(aReq,LOCM_FAULT());
@@ -4389,7 +4431,11 @@
 	TInt retVal = KErrGeneral;
 	for (TInt i=0; retVal != KErrNone && i < KPageOutRetries; i++)
 		{
-		m.Flags() = TLocDrvRequest::EKernelBuffer | TLocDrvRequest::EPaging | TLocDrvRequest::EDataPaging | (aBackground ? TLocDrvRequest::EBackgroundPaging : 0);
+		m.Flags() = TLocDrvRequest::EKernelBuffer |
+					TLocDrvRequest::EPaging | 
+                    TLocDrvRequest::EDataPaging | 
+                    (aBackground ? TLocDrvRequest::EBackgroundPaging : 0) |
+                    (aPhysAddr ? TLocDrvRequest::EPhysAddrOnly : 0);
 
 		m.Id() = DLocalDrive::EWrite;
 		m.Drive() = TheDrives[iDataPagingDriveNumber];
@@ -4399,9 +4445,11 @@
 		m.Length()=Int64(size);
 		m.RemoteDes()=(TAny*)aBuffer;
 		m.RemoteDesOffset()=0;		// pre-aligned
-		m.DriverFlags()=0;
+		m.DriverFlags() = 0;        
+
 		__KTRACE_OPT2(KLOCDRV,KLOCDPAGING,Kern::Printf("ReqId=%d, Pos=0x%lx, Len=0x%lx, remote Des 0x%x",m.Id(),m.Pos(),m.Length(),m.RemoteDes()));
-		OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_WRITE2, "reqId=%d; position=0x%lx; length=0x%lx; remote Des=0x%x", (TInt) m.Id(), (TUint) m.Pos(), (TUint) m.Length(), (TUint) m.RemoteDes());
+		OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_WRITE2, "reqId=%d; remote Des=0x%x", (TInt) m.Id(), (TUint) m.RemoteDes());
+		OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_WRITE3, "length=%x:%x, pos=%x:%x", (TUint) I64HIGH(m.Length()), (TUint) I64LOW(m.Length()),  (TUint) I64HIGH(m.Pos()), (TUint) I64LOW(m.Pos()));
 		
 		__ASSERT_DEBUG(iPrimaryMedia->iBody, LOCM_FAULT());
 		TInt mediaChanges = iPrimaryMedia->iBody->iMediaChanges;
@@ -4496,8 +4544,8 @@
 	m.RemoteDesOffset() = 0;		// pre-aligned
 	m.DriverFlags()=0;
 	__KTRACE_OPT2(KLOCDRV,KLOCDPAGING,Kern::Printf("ReqId=%d, Pos=0x%lx, Len=0x%lx, remote Des 0x%x",m.Id(),m.Pos(),m.Length(),m.RemoteDes()));
-	OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_DELETENOTIFY2 , "reqId=%d; position=0x%lx; length=0x%lx; remote Des=0x%x", m.Id(), m.Pos(), m.Length(), (TUint) m.RemoteDes());
-
+	OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_DELETENOTIFY2 , "reqId=%d; remote Des=0x%x", m.Id(),(TUint) m.RemoteDes());
+	OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_DELETENOTIFY3 , "length=%x:%x, pos=%x:%x", (TUint) I64HIGH(m.Length()), (TUint) I64LOW(m.Length()), (TUint) I64HIGH(m.Pos()), (TUint) I64LOW(m.Pos()));
 	// send request aynchronously as we don't particularly care about the result 
 	// and waiting would slow down the thread taking the page fault
 	iPrimaryMedia->RequestCountInc();
@@ -4956,7 +5004,7 @@
 	{
 	OstTraceFunctionEntry0( LOCDRV_REGISTERMEDIADEVICE_ENTRY );
 	// Create TLocDrv / DMedia objects to handle a media device
-	__KTRACE_OPT(KBOOT,Kern::Printf("RegisterMediaDevice %lS dev=%1d #drives=%d 1st=%d PM=%08x #media=%d",&aName,aDevice,aDriveCount,*aDriveList,aPrimaryMedia,aNumMedia));
+	__KTRACE_OPT(KBOOT,Kern::Printf("RegisterMediaDevice %S dev=%1d #drives=%d 1st=%d PM=%08x #media=%d",&aName,aDevice,aDriveCount,*aDriveList,aPrimaryMedia,aNumMedia));
 	OstTraceExt5( TRACE_INTERNALS, LOCDRV_REGISTERMEDIADEVICE1, "aDevice=%d; aDriveCount=%d; aDriveList=%d; aPrimaryMedia=0x%08x; aNumMedia=%d", (TInt) aDevice, (TInt) aDriveCount, (TInt) *aDriveList, (TUint) aPrimaryMedia, (TInt) aNumMedia );
 
 	if (UsedMedia+aNumMedia>KMaxLocalDrives)
@@ -5259,6 +5307,8 @@
 
 	TInt dataPagingDriveNumber = KErrNotFound;
 	TInt swapSize = 0;
+	TInt blockSize = 0;
+	TUint16 flags = 0;
 
 	// find the local drive assocated with the primary media
 	for (i=0; i<KMaxLocalDrives; ++i)
@@ -5293,9 +5343,10 @@
 
 
 		TLocDrvRequest m;
+        TBuf8<KMaxLocalDriveCapsLength> capsBuf;
+        
 		memclr(&m, sizeof(m));
 		
-
 		// Get the Caps from the device. NB for MMC/SD we may need to retry as some PSLs start up
 		// in "door open" or "media not present" state which can result in the cancellation of requests
 		TInt i;
@@ -5303,7 +5354,6 @@
 		TInt r = KErrNotReady;
 		for (i=0; r == KErrNotReady && i < KRetries; i++)
 			{
-			TBuf8<KMaxLocalDriveCapsLength> capsBuf;
 			capsBuf.SetMax();
 			capsBuf.FillZ();
 			m.Drive() = TheDrives[firstLocalDriveNumber];
@@ -5325,13 +5375,18 @@
 			return KErrNotSupported;
 		    }
 
+		TLocalDriveCapsV6& caps = *(TLocalDriveCapsV6*)capsBuf.Ptr();
+		blockSize = caps.iBlockSize;
+		__ASSERT_DEBUG(blockSize,LOCM_FAULT());
+		__ASSERT_DEBUG(__e32_bit_count_32(blockSize)==1,LOCM_FAULT());
+		
 		TLocDrv* drive;
 		for (i=0; i<KMaxLocalDrives; ++i)
 			{
 			drive = TheDrives[i];
 			if(drive && drive->iPrimaryMedia == aPrimaryMedia)
 				{
-				__KTRACE_OPT2(KBOOT,KLOCDPAGING, Kern::Printf("RegisterPagingDevice: local drive %d, partition type %x base %lx size %lx name %lS", i, drive->iPartitionType, drive->iPartitionBaseAddr, drive->iPartitionLen, DriveNames[i] ? DriveNames[i] : &KNullDesC8));
+				__KTRACE_OPT2(KBOOT,KLOCDPAGING, Kern::Printf("RegisterPagingDevice: local drive %d, partition type %x base %lx size %lx name %S", i, drive->iPartitionType, drive->iPartitionBaseAddr, drive->iPartitionLen, DriveNames[i] ? DriveNames[i] : &KNullDesC8));
 				// ROM partition ?
 				if ((romPagingDriveNumber == KErrNotFound) && 
 					(drive->iPartitionType == KPartitionTypeROM) &&
@@ -5351,6 +5406,10 @@
 					dataPagingDriveNumber = i;
 					TheDataPagingDrive = drive;
 					swapSize = drive->iPartitionLen >> aReadShift;
+					
+			        // Mark Paging Device capable of utilising physical addresss only accesses
+			        if (drive->iDmaHelper)
+			            flags |= DPagingDevice::ESupportsPhysicalAccess;  
 					}
 				}
 			}
@@ -5385,16 +5444,20 @@
 
 	pagingDevice->iDataPagingDriveNumber = dataPagingDriveNumber;
 	pagingDevice->iSwapSize = swapSize;
+		
+	pagingDevice->iPreferredWriteShift = (blockSize) ? __e32_find_ms1_32(blockSize) : 0;
 
 #ifdef __DEBUG_DEMAND_PAGING__
 	Kern::Printf("PagingDevice :");
-	Kern::Printf("Name %lS", firstLocalDriveNumber >= 0 && DriveNames[firstLocalDriveNumber] ? DriveNames[firstLocalDriveNumber] : &KNullDesC8);
+	Kern::Printf("Name %S", firstLocalDriveNumber >= 0 && DriveNames[firstLocalDriveNumber] ? DriveNames[firstLocalDriveNumber] : &KNullDesC8);
 	Kern::Printf("iType 0x%x", pagingDevice->iType);
+	Kern::Printf("iFlags 0x%x\n", pagingDevice->iFlags);
 	Kern::Printf("iReadUnitShift 0x%x", pagingDevice->iReadUnitShift);
 	Kern::Printf("iFirstLocalDriveNumber 0x%x", pagingDevice->iFirstLocalDriveNumber);
 	Kern::Printf("iRomPagingDriveNumber 0x%x", pagingDevice->iRomPagingDriveNumber);
 	Kern::Printf("iDataPagingDriveNumber 0x%x", pagingDevice->iDataPagingDriveNumber);
 	Kern::Printf("iSwapSize 0x%x", pagingDevice->iSwapSize);
+	Kern::Printf("iPreferredWriteShift 0x%x\n", pagingDevice->iPreferredWriteShift);
 #endif
 
 
@@ -5612,7 +5675,7 @@
 				if (!(sock_mask & (1<<sockNum)))
 					{
 					info.iSocketName[sockNum]=*DriveNames[i];
-					__KTRACE_OPT(KLOCDRV,Kern::Printf("Socket %d device %d name %lS", sockNum, pM->iDevice, DriveNames[i]));
+					__KTRACE_OPT(KLOCDRV,Kern::Printf("Socket %d device %d name %S", sockNum, pM->iDevice, DriveNames[i]));
 					OstTraceExt2( TRACE_INTERNALS, GETDRIVEINFO1, "Socket=%d; device=%d", sockNum, (TUint) pM->iDevice );
 					if ( (sockNum + 1) > sockets )
 						sockets = sockNum + 1;
@@ -5620,7 +5683,7 @@
 				sock_mask |= (1<<sockNum);
 				}
 			info.iDriveName[i]=*DriveNames[i];
-			__KTRACE_OPT(KLOCDRV,Kern::Printf("Drive %d device %d name %lS",i,pM->iDevice,DriveNames[i]));
+			__KTRACE_OPT(KLOCDRV,Kern::Printf("Drive %d device %d name %S",i,pM->iDevice,DriveNames[i]));
 			OstTraceExt2( TRACE_INTERNALS, GETDRIVEINFO2, "Drive=%d; device=%d", i, (TUint) pM->iDevice );
 			
 			info.iRegisteredDriveBitmask |= (0x01 << i);
--- a/kernel/eka/drivers/media/base_e32_drivers_media.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/media/base_e32_drivers_media.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Media Drivers"
 
 component	base_e32_drivers_media
@@ -25,6 +10,7 @@
 source	\sf\os\kernelhwsrv\kernel\eka\drivers\medlfs
 source	\sf\os\kernelhwsrv\kernel\eka\drivers\medmmc
 source	\sf\os\kernelhwsrv\kernel\eka\drivers\mednand
+source	\sf\os\kernelhwsrv\kernel\eka\drivers\sdapc
 source	\sf\os\kernelhwsrv\kernel\eka\drivers\pbus\pbusmedia.cpp
 source	\sf\os\kernelhwsrv\kernel\eka\drivers\pbus\spbus.cpp
 source	\sf\os\kernelhwsrv\kernel\eka\drivers\pbus\distribution.policy.s60
--- a/kernel/eka/drivers/media/bld.inf	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/media/bld.inf	Thu Jul 22 16:46:39 2010 +0100
@@ -42,6 +42,7 @@
 ../pbus/mmc/sdcard/sdcard3c/sdio/dummyexp.h     SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/sdio/)
 ../pbus/mmc/sdcard/sdcard3c/sdio/sdiocard.h     SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/sdio/)
 ../pbus/mmc/sdcard/sdcard3c/sdio/sdiocard.inl     SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/sdio/)
+../sdapc/d_sdapc.h				SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(drivers/)
 
 PRJ_MMPFILES
 
@@ -59,6 +60,7 @@
 #if !defined(WINS) && !defined(GENERIC_X86)
 ../../drivers/pbus/mmc/sdcard/sdcard3c/epbussd
 ../../drivers/pbus/mmc/sdcard/sdcard3c/sdio/epbussdio
+../../drivers/sdapc/d_sdapc
 #endif
 
 // Build the folowing from variant if required.
--- a/kernel/eka/drivers/medmmc/medmmc.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/medmmc/medmmc.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -759,7 +759,7 @@
 	TUint32 length(I64LOW(iCurrentReq->Length()));
 
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:dr:0x%lx,0x%x", pos, length));
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DO_READ, "Position=0x%lx; Length=0x%x", (TUint) pos, (TUint) length);
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DO_READ, "Position=%x:%x; Length=0x%x", (TUint) I64HIGH(pos), (TUint) I64LOW(pos), (TUint) length);
 	__ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDRInUse));
 	__ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDRStart));
 	__ASSERT_DEBUG(iCurrentReq->Length() >= 0, Panic(EDRNotPositive));
@@ -821,7 +821,7 @@
 //
 	{
 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHREAD_ENTRY, this );
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHREAD, "position=0x%lx; length=0x%x", (TUint) iCurrentReq->Pos(), (TUint) I64LOW(iCurrentReq->Length()));
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHREAD, "position=%x:%x; length=0x%x", (TUint) I64HIGH(iCurrentReq->Pos()), (TUint) I64LOW(iCurrentReq->Pos()) ,(TUint) I64LOW(iCurrentReq->Length()));
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:lr:0x%lx,0x%x", aStart, aLength));
 	__ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELRStart));
 	__ASSERT_DEBUG(aLength > 0, Panic(ELRNotPositive));
@@ -887,7 +887,7 @@
 	{
 	OstTraceFunctionEntry1( DMMCMEDIADRIVERFLASH_LAUNCHDBREAD_ENTRY, this );
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:ldbr:0x%lx,0x%x", iReqCur, I64LOW(iReqEnd - iReqCur)));
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHDBREAD, "position=0x%lx; length=0x%x", (TInt) iReqCur, (TInt) I64LOW(iReqEnd - iReqCur));
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHDBREAD, "position=%x:%x; length=0x%x", (TInt) I64HIGH(iReqCur), (TInt) I64LOW(iReqCur), (TInt) I64LOW(iReqEnd - iReqCur));
 	__ASSERT_DEBUG(TotalSizeInBytes() > iReqCur, Panic(ELRStart));
 	__ASSERT_DEBUG(I64LOW(iReqEnd - iReqCur) > 0, Panic(ELRNotPositive));
 	__ASSERT_DEBUG(TotalSizeInBytes() >= iReqEnd, Panic(ELREnd));
@@ -948,7 +948,7 @@
 //
 	{
 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHPHYSREAD_ENTRY, this );
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHPHYSREAD, "position=0x%lx; length=0x%x", (TInt) iReqCur, (TInt) I64LOW(iReqEnd - iReqCur));
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHPHYSREAD, "position=%x:%x; length=0x%x", (TInt) I64HIGH(iReqCur), (TInt) I64LOW(iReqCur), (TInt) I64LOW(iReqEnd - iReqCur));
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:physr:0x%lx,0x%x", aStart, aLength));
 	__ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELRStart));
 	__ASSERT_DEBUG(aLength > 0, Panic(ELRNotPositive));
@@ -1040,7 +1040,7 @@
 	const TUint32 length = I64LOW(iCurrentReq->Length());
 
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:dw:0x%lx,0x%x", pos, length));
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DOWRITE, "position=0x%lx; length=0x%x", (TUint) pos, (TUint) length);
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DOWRITE, "position=%x:%x; length=0x%x", (TUint) I64HIGH(pos), (TUint) I64LOW(pos), (TUint) length);
 	__ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDWInUse));
 	__ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDWStart));
 	__ASSERT_DEBUG(length > 0, Panic(EDWNotPositive));
@@ -1075,7 +1075,7 @@
 	const TUint32 length = I64LOW(iCurrentReq->Length());
 
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:df:0x%lx,0x%x", pos, length));
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DOFORMAT, "position=0x%lx; length=0x%x", (TUint) pos, (TUint) length);
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DOFORMAT, "position=%x:%x; length=0x%x", (TUint) I64HIGH(pos), (TUint) I64LOW(pos), (TUint) length);
 	__ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDFInUse));
 	__ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDFStart));
 	__ASSERT_DEBUG(length > 0, Panic(EDFNotPositive));
@@ -1116,7 +1116,7 @@
 //
 	{
 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHFORMAT_ENTRY, this );
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHFORMAT, "position=0x%lx; length=0x%x", (TInt) iReqCur, (TInt) I64LOW(iReqEnd - iReqCur));
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHFORMAT, "position=%x:%x; length=0x%x", (TInt) I64HIGH(iReqCur), (TInt) I64LOW(iReqCur), (TInt) I64LOW(iReqEnd - iReqCur));
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:lf:0x%lx,0x%x", aStart, aLength));
 	__ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELFStart));
 	__ASSERT_DEBUG((aStart & iBlkMsk) == 0, Panic(ELWFmtStAlign));
@@ -1132,8 +1132,8 @@
 		iPhysStart = aStart & ~iBlkMsk;
 
 		// formats are always block-aligned, and the buffer is initialized to 0xff
-		//  Check whether erase commands are supported by this card
-		if (iCard->CSD().CCC() & KMMCCmdClassErase)
+		//  Check whether erase commands are supported by this card		
+		if ( (iCard->CSD().CCC() & KMMCCmdClassErase) && iEraseInfo.iEraseFlags) 		       
 			{
 			// Determine the erase end point for the next command. We don't erase past the preferred erase unit
 			// size. Therefore, check which is lower, the preferred erase unit size or the end of the requested range.
@@ -1215,7 +1215,7 @@
 //
 	{
 	OstTraceExt4(TRACE_FLOW, DMMCMEDIADRIVERFLASH_LAUNCHWRITE_ENTRY, "DMmcMediaDriverFlash::LaunchWrite;aStart=%Ld;aLength=%x;aMedReq=%d;this=%x", aStart, (TUint) aLength, (TInt) aMedReq, (TUint) this);
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHWRITE, "position=0x%lx; length=0x%x", (TInt) iReqCur, (TInt) I64LOW(iReqEnd - iReqCur));
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHWRITE, "position=%x:%x; length=0x%x", (TInt) I64HIGH(iReqCur), (TInt) I64LOW(iReqCur),(TInt) I64LOW(iReqEnd - iReqCur));
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf("\n>mmd:lw:0x%lx,%d,%d", aStart, aLength, aMedReq));
 	__ASSERT_DEBUG(aMedReq == EMReqWrite || aMedReq == EMReqFormat, Panic(ELWRequest));
 	__ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELWStart));
@@ -1485,7 +1485,8 @@
 					}
 				}
 			}
-	
+
+#ifdef _ENABLE_EMMC_RELIABLE_WRITE_		
 			//Reliable Write only supported by v4.3+ MMC media
 			if (iCard->ExtendedCSD().ExtendedCSDRev() >= 3)
 				{
@@ -1497,6 +1498,7 @@
 					iSession->Command().iFlags|= KMMCCmdFlagReliableWrite;
 					}
 				}
+#endif //_ENABLE_EMMC_RELIABLE_WRITE_			
 		
 			// Engage the data transfer session...
 			r = EngageAndSetWriteRequest(aMedReq);
@@ -2885,9 +2887,9 @@
 	{
 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED_ENTRY, this );
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:rdc:%x,%x", iReqCur, iReqEnd));
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED, "iReqCur=0x%x; iReqEnd=0x%x", (TUint) iReqCur, (TUint) iReqEnd );
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED, "iReqCur=%x:%x; iReqEnd=0x%x", (TUint) I64HIGH(iReqCur), (TUint) I64LOW(iReqCur), (TUint) iReqEnd );
 	
-	if ( iCurrentReq->IsPhysicalAddress()
+	if ( (iCurrentReq->DriverFlags() & RLocalDrive::ELocDrvDirectIO) || iCurrentReq->IsPhysicalAddress()
 #if defined(__DEMAND_PAGING__) && !defined(__WINS__)
 	     || DMediaPagingDevice::PageInRequest(*iCurrentReq)
 #endif //DEMAND_PAGING 
--- a/kernel/eka/drivers/pbus/mmc/mmccd_init.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/pbus/mmc/mmccd_init.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -278,6 +278,16 @@
 			break;
 
 #if !defined(__WINS__)
+        if ((mi.iFlags & TMMCMachineInfo::ESupportsDMA) == TMMCMachineInfo::ESupportsDMA)
+            {
+            err = LocDrv::RegisterDmaDevice(pMedia,
+                                            KMMCardHighCapBlockSize, 
+                                            pS->MaxDataTransferLength(), 
+                                            pS->DmaAlignment());
+            if (err != KErrNone)
+                break;
+            }		
+		
 		if (demandPagingSupported && demandPagingInfo.iSlotNumber == i)
 			{
 			err = LocDrv::RegisterPagingDevice(
@@ -295,16 +305,6 @@
 			if (err != KErrNone)
 				break;
 			}
-
-		if ((mi.iFlags & TMMCMachineInfo::ESupportsDMA) == TMMCMachineInfo::ESupportsDMA)
-			{
-			err = LocDrv::RegisterDmaDevice(pMedia,
-											KMMCardHighCapBlockSize, 
-											pS->MaxDataTransferLength(), 
-											pS->DmaAlignment());
-			if (err != KErrNone)
-				break;
-			}
 #endif // __WINS__
 
 		driveListIndex+= drivesPerSlot;
--- a/kernel/eka/drivers/pbus/mmc/sdcard/sdcard3c/sdcard.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/pbus/mmc/sdcard/sdcard3c/sdcard.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -27,7 +27,7 @@
 // ======== TSDCard ========
 
 TSDCard::TSDCard()
-:	iProtectedAreaSize(0), iPARootDirEnd(KPARootDirEndUnknown)
+:	iProtectedAreaSize(0), iPARootDirEnd(KPARootDirEndUnknown), iClientCountSD(0)
 	{
 	// empty
 	}
--- a/kernel/eka/drivers/pbus/mmc/stack.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/pbus/mmc/stack.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -3517,13 +3517,10 @@
 		OstTrace0( TRACE_INTERNALS, DMMCSTACK_DETERMINEBUSWIDTHANDCLOCKSM3, "EStWritePowerClass" );
 	
 		// Check the card type is valid
-		// The only currently valid values for this field are 0x01 or 0x03
-		TUint cardType = cardP->iExtendedCSD.CardType();
-		if (cardType != (TExtendedCSD::EHighSpeedCard26Mhz) && 
-			cardType != (TExtendedCSD::EHighSpeedCard26Mhz | TExtendedCSD::EHighSpeedCard52Mhz))
-			{
-			__KTRACE_OPT(KPBUS1, Kern::Printf("Unsupported card type %u", cardType));
-			OstTrace1( TRACE_INTERNALS, DMMCSTACK_DETERMINEBUSWIDTHANDCLOCKSM4, "Unsupported card type=%u", cardType );
+		if (!(cardP->iExtendedCSD.IsSupportedCardType()))
+			{            
+			__KTRACE_OPT(KPBUS1, Kern::Printf("Unsupported card type %u", cardP->iExtendedCSD.CardType()));
+			OstTrace1( TRACE_INTERNALS, DMMCSTACK_DETERMINEBUSWIDTHANDCLOCKSM4, "Unsupported card type=%u", cardP->iExtendedCSD.CardType() );
 			
 			SMF_GOTOS(EStExit);
 			}
@@ -3618,13 +3615,10 @@
 		cardP->SetHighSpeedClock(0);
 
 		// Check the card type is valid
-		// The only currently valid values for this field are 0x01 or 0x03
-		TUint cardType = cardP->iExtendedCSD.CardType();
-		if (cardType != (TExtendedCSD::EHighSpeedCard26Mhz) && 
-			cardType != (TExtendedCSD::EHighSpeedCard26Mhz | TExtendedCSD::EHighSpeedCard52Mhz))
-			{
-			__KTRACE_OPT(KPBUS1, Kern::Printf("Unsupported card type %u", cardType));
-			OstTrace1( TRACE_INTERNALS, DMMCSTACK_CONFIGUREHIGHSPEEDSM4, "Unsupported card type=%u", cardType );
+        if (!(cardP->iExtendedCSD.IsSupportedCardType()))
+            {            
+			__KTRACE_OPT(KPBUS1, Kern::Printf("Unsupported card type %u", cardP->iExtendedCSD.CardType()));
+			OstTrace1( TRACE_INTERNALS, DMMCSTACK_CONFIGUREHIGHSPEEDSM4, "Unsupported card type=%u", cardP->iExtendedCSD.CardType() );
 			SMF_GOTOS(EStExit);
 			}
 
@@ -6414,6 +6408,9 @@
 			{
 			EStBegin=0,
 			EStNextIndex,
+			EStSendStatus,
+			EStGetStatus,
+			EStUnlock,
 			EStInitStackAfterUnlock,
 			EStIssuedLockUnlock,
 			EStDone,
@@ -6476,6 +6473,25 @@
 		//
 		// Upon completion, test the next card before performing further initialisation.
 		//
+		
+		SMF_STATE(EStSendStatus)
+		        
+		s.FillCommandDesc(ECmdSendStatus, 0);
+		                        
+		SMF_INVOKES(ExecCommandSMST,EStGetStatus)
+		                        
+		SMF_STATE(EStGetStatus)
+		                        
+		const TMMCStatus st = s.LastStatus();
+		if((st & KMMCStatCardIsLocked) == 0)
+			{
+		    SMF_RETURN(err)
+		    }
+		                        
+		SMF_STATE(EStUnlock)
+		                        
+		const TMapping *mp = NULL;
+		mp = iSocket->iPasswordStore->FindMappingInStore(iCardArray->CardP(iAutoUnlockIndex)->CID());
 
 		TMMCard &cd = *(iCardArray->CardP(iAutoUnlockIndex++));
 		OstTrace1( TRACE_INTERNALS, DMMCSTACK_CIMAUTOUNLOCKSM4, "Attempting to unlock card %d", cd.Number() );
--- a/kernel/eka/drivers/pbus/pccard/epoc/pccd_init.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/pbus/pccard/epoc/pccd_init.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -122,7 +122,7 @@
 			if (!pM)
 				return KErrNoMemory;
 			r=LocDrv::RegisterMediaDevice(mdi.iDevice,mdi.iDriveCount,mdi.iDriveList,pM,mdi.iNumMedia,*mdi.iDeviceName);
-			__KTRACE_OPT(KPBUS1,Kern::Printf("Registering PcCard device %lS (socket %d) for %d drives returns %d",mdi.iDeviceName,pM->iSocket->iSocketNumber,mdi.iDriveCount,r));
+			__KTRACE_OPT(KPBUS1,Kern::Printf("Registering PcCard device %S (socket %d) for %d drives returns %d",mdi.iDeviceName,pM->iSocket->iSocketNumber,mdi.iDriveCount,r));
 			if (r!=KErrNone)
 				return r;
 			}
--- a/kernel/eka/drivers/pbus/pccard/socket.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/pbus/pccard/socket.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -141,7 +141,7 @@
 //
 	{
 
-	__KTRACE_OPT(KPBUS1,Kern::Printf(">Skt(%d):Create(%lS)",iSocketNumber,aName));
+	__KTRACE_OPT(KPBUS1,Kern::Printf(">Skt(%d):Create(%S)",iSocketNumber,aName));
 
 	TInt r=DPBusSocket::Create(aName);
 	if (r!=KErrNone)
--- a/kernel/eka/drivers/pbus/spbus.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/pbus/spbus.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -683,7 +683,7 @@
 TInt DPBusSocket::Create(const TDesC* aName)
 	{
 	OstTraceFunctionEntry1( DPBUSSOCKET_CREATE_ENTRY, this );
-	__KTRACE_OPT(KPBUS1,Kern::Printf(">DPBusSocket(%d)::Create %lS",iSocketNumber,aName));
+	__KTRACE_OPT(KPBUS1,Kern::Printf(">DPBusSocket(%d)::Create %S",iSocketNumber,aName));
 	OstTrace1(TRACE_INTERNALS, DPBUSSOCKET_CREATE, "iSocketNumber=%d",iSocketNumber);
 	iName=aName;
 	DPBusPowerHandler* pH=new DPBusPowerHandler(this);
--- a/kernel/eka/drivers/power/smppower/idlehelper.cia	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/power/smppower/idlehelper.cia	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -85,12 +85,12 @@
 	LDREX(3,1);                                                       // r3 = iIdlingCpus
     asm("orr    r3,r0,r3");                                           // orr in mask for this CPU
     asm("cmp    r3,r2");                                              // compare to iAllEngagedCpusMask
-    asm("orreq  r3,r3,#%a0" : : "i" (TIdleSupport::KGlobalIdleFlag)); // if equal orr in KGlobalIdleFlag
+    asm("orreq  r3,r3,#%a0" : : "i" ((TInt)TIdleSupport::KGlobalIdleFlag)); // if equal orr in KGlobalIdleFlag
     STREX(12,3,1);
     asm("cmp    r12, #0 ");                                              // 
 	asm("bne    1b ");                                                   // write didn't succeed try again
     __DATA_MEMORY_BARRIER__(r12);
-    asm("and    r0,r3,#%a0" : : "i" (TIdleSupport::KGlobalIdleFlag));
+    asm("and    r0,r3,#%a0" : : "i" ((TInt)TIdleSupport::KGlobalIdleFlag));
 	__JUMP(,lr);
     asm("__iAllEngagedCpusMask:");
     asm(".word %a0" : : "i" ((TInt)&TIdleSupport::iAllEngagedCpusMask));//
@@ -125,7 +125,7 @@
     asm("stmfd sp!, {r4-r5,lr} ");	
     asm("add r0,r0,#%a0" : : "i"  _FOFF(TSyncPointBase, iStageAndCPUWaitingMask)); // skip vt
     asm("ldr r4,[r0,#4]"); 
-    asm("ldr r4,[r4]")
+    asm("ldr r4,[r4]");
    __DATA_MEMORY_BARRIER_Z__(r12);          // 
     asm("1: ");
 	LDREX(2,0);                             // r2 =  iStageAndCPUWaitingMask, r4 = iAllEnagedCpusMask
@@ -149,7 +149,7 @@
 #endif		
     asm("2: ");
     asm("cmp r3,r5");                       // all (old stage does not equal new stage)
-    asm("ldmfdne sp!, {r4-r5,pc}");         // yup return
+    asm("ldmnefd sp!, {r4-r5,pc}");         // yup return
 #ifdef SYNCPOINT_WFE		
 	__DATA_MEMORY_BARRIER__(r12);        
 	ARM_WFE;
@@ -188,7 +188,7 @@
     asm("stmfd sp!, {r4,lr} ");	
     asm("add r0,r0,#%a0" : : "i"  _FOFF(TSyncPointBase, iStageAndCPUWaitingMask)); // skip vt
     asm("ldr r4,[r0,#4]");
-    asm("ldr r4,[r4]")
+    asm("ldr r4,[r4]");
     __DATA_MEMORY_BARRIER_Z__(r12);          // 
     asm("1: ");
 	LDREX(2,0);                             // r2 =  iStageAndCPUWaitingMask, r4 = iAllEnagedCpusMask
@@ -208,7 +208,7 @@
 #endif		
     asm("2: ");
     asm("ands r3,r2,#0x80000000");          // MSB set?	
-    asm("ldmfdne sp!, {r4,pc}");            // yup return
+    asm("ldmnefd sp!, {r4,pc}");            // yup return
 #ifdef SYNCPOINT_WFE		
 	__DATA_MEMORY_BARRIER__(r12);
 	ARM_WFE;
--- a/kernel/eka/drivers/power/smppower/idlehelper.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/power/smppower/idlehelper.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -70,7 +70,7 @@
 
 TBool TIdleSupport::IsIntPending()
 	{
-	return (IntPending()!=KNoInterruptsPending);
+	return ((TUint32)IntPending()!=KNoInterruptsPending);
 	}
 		
 /**
@@ -190,7 +190,8 @@
 /**
    mark a core as retired
 
-   @pre called by idle handler
+   @pre called by idle handler as part of idle entry before 
+          any syncpoint or calls to SetLocalAndCheckSetGlobalIdle
 */	
 void TIdleSupport::MarkCoreRetired(TUint32 aCpuMask)
     {
@@ -200,7 +201,8 @@
 
 /**
    mark a core as enaged
-   @pre called outside idle handler
+   @pre called outside idle handler ( can be called in idle entry before 
+        any syncpoint or calls to SetLocalAndCheckSetGlobalIdle
  */	
 void TIdleSupport::MarkCoreEngaged(TUint32 aCpuMask)
     {
--- a/kernel/eka/drivers/power/smppower/idlehelper_lib.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/power/smppower/idlehelper_lib.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,7 +1,7 @@
-// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
+// under the terms of the License "Eclipse Public License v1.0"
 // which accompanies this distribution, and is available
 // at the URL " http://www.eclipse.org/legal/epl-v10.html ".
 //
@@ -11,13 +11,13 @@
 // Contributors:
 //
 // Description:
-// e32\drivers\power\smppower\smpidlehelper_lib.mmp
+// \drivers\power\smppower\smpidlehelper_lib.mmp
 // Helper library required to implement CPU idle
 // functionality in a SMP BSP.
 
 
 #define NO_EKERN_LIB
-#include "../../kernel/kern_ext.mmh"
+#include "kernel/kern_ext.mmh"
 
 target				idlehelper.lib
 targettype			klib
--- a/kernel/eka/drivers/power/smppower/sample_idlehandler/smpidlehandler.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/power/smppower/sample_idlehandler/smpidlehandler.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -11,7 +11,7 @@
 // Contributors:
 //
 // Description:
-// os\kernelhwsrv\kernel\eka\drivers\power\smppower\sample_idlehandler\smpidlehandler.cpp
+// eka\drivers\power\smppower\sample_idlehandler\smpidlehandler.cpp
 // implements a basic smp idle handler generic layer that can be derived from 
 // to create platform specific SMP idle handlers
 
@@ -41,6 +41,11 @@
       }
 
 
+DSMPIdleHandler::~DSMPIdleHandler()
+	{
+	}
+
+
 /**
    To be called after construction in a thread context with interrupts enabled. Power extension entry point ideal
    @pre thread context ints enable no kernel locks or fast mutexes
--- a/kernel/eka/drivers/power/smppower/sample_idlehandler/smpidlehandler_lib.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/power/smppower/sample_idlehandler/smpidlehandler_lib.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,7 +1,7 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
+// under the terms of the License "Eclipse Public License v1.0"
 // which accompanies this distribution, and is available
 // at the URL " http://www.eclipse.org/legal/epl-v10.html ".
 //
@@ -17,7 +17,7 @@
 
 
 #define NO_EKERN_LIB
-#include "../../kernel/kern_ext.mmh"
+#include "kernel/kern_ext.mmh"
 
 target				sample_smpidlehandler.lib
 targettype			klib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/drivers/sdapc/d_sdapc.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,307 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL " http://www.eclipse.org/legal/epl-v10.html ".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+
+#include <kernel/kernel.h>
+#include <drivers/mmc.h>
+#include <drivers/sdcard.h>
+#include <drivers/sdio/sdio.h>
+#include <drivers/d_sdapc.h>
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "locmedia_ost.h"
+#ifdef __VC32__
+#pragma warning(disable: 4127) // disabling warning "conditional expression is constant"
+#endif
+#include "d_sdapcTraces.h"
+#endif
+
+_LIT(KLddName,"D_SDAPC");
+
+const TInt KMajorVersionNumber=1;
+const TInt KMinorVersionNumber=0;
+const TInt KBuildVersionNumber=1;
+
+const TInt KSocketNumber = 0;
+const TInt KStackNumber  = 0;
+const TInt KCardNumber   = 0;
+
+// global Dfc Que
+TDynamicDfcQue* gDfcQ;
+
+class DSDAuxiliaryPowerControlFactory : public DLogicalDevice
+//
+// LDD factory
+//
+	{
+public:
+	DSDAuxiliaryPowerControlFactory();
+	~DSDAuxiliaryPowerControlFactory();
+	virtual TInt Install(); 					//overriding pure virtual
+	virtual void GetCaps(TDes8& aDes) const;	//overriding pure virtual
+	virtual TInt Create(DLogicalChannelBase*& aChannel); 	//overriding pure virtual
+	};
+
+
+class DSDAuxiliaryPowerControl : public DLogicalChannel
+//
+// Logical channel
+//
+	{
+public:
+	DSDAuxiliaryPowerControl();
+	virtual ~DSDAuxiliaryPowerControl();
+
+protected:
+	virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
+	virtual void HandleMsg(class TMessageBase *);
+
+private:
+	static void BusCallBack(TAny* aPtr, TInt aReason, TAny* a1, TAny* a2);
+	TInt PowerUpStack();
+
+private:
+	DMMCSocket* iSocketP;
+	DMMCStack*  iStackP;
+	TSDCard*  iCardP;
+    
+	DThread* iClient;
+	
+	TPBusCallBack iBusCallBack;		
+	DSemaphore* iPowerUpSemaphore;
+	TBool iInitialised;
+	};
+
+
+DECLARE_STANDARD_LDD()
+	{
+	return new DSDAuxiliaryPowerControlFactory;
+	}
+
+DSDAuxiliaryPowerControlFactory::DSDAuxiliaryPowerControlFactory()
+//
+// Constructor
+//
+	{
+    OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROLFACTORY_DSDAUXILIARYPOWERCONTROLFACTORY, "DSDAuxiliaryPowerControlFactory::DSDAuxiliaryPowerControlFactory");
+	__KTRACE_OPT(KPBUS1, Kern::Printf(">DSDAuxiliaryPowerControlFactory::DSDAuxiliaryPowerControlFactory"));
+    iParseMask=KDeviceAllowUnit;
+	iUnitsMask=0xffffffff;
+	iVersion=TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);
+	}
+
+TInt DSDAuxiliaryPowerControlFactory::Create(DLogicalChannelBase*& aChannel)
+//
+// Create a new DSDAuxiliaryPowerControl on this logical device
+//
+	{
+    OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROLFACTORY_CREATE, "DSDAuxiliaryPowerControlFactory::Create");
+	__KTRACE_OPT(KPBUS1, Kern::Printf(">DSDAuxiliaryPowerControlFactory::Create"));
+	aChannel=new DSDAuxiliaryPowerControl;
+	return aChannel ? KErrNone : KErrNoMemory;
+	}
+
+const TInt KDSDAuxiliaryPowerControlApiThreadPriority = 27;
+_LIT(KDSDAuxiliaryPowerControlApiThread,"DSDAuxiliaryPowerControlApiThread");
+
+TInt DSDAuxiliaryPowerControlFactory::Install()
+//
+// Install the LDD - overriding pure virtual
+//
+	{
+	// Allocate a kernel thread to run the DFC 
+	TInt r = Kern::DynamicDfcQCreate(gDfcQ, KDSDAuxiliaryPowerControlApiThreadPriority, KDSDAuxiliaryPowerControlApiThread);
+
+	if (r != KErrNone)
+		return r; 	
+
+	return SetName(&KLddName);
+	}
+
+void DSDAuxiliaryPowerControlFactory::GetCaps(TDes8& aDes) const
+//
+// Get capabilities - overriding pure virtual
+//
+	{
+	TCapsTestV01 b;
+	b.iVersion=TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);
+    Kern::InfoCopy(aDes,(TUint8*)&b,sizeof(b));
+	}
+
+/**
+  Destructor
+*/
+DSDAuxiliaryPowerControlFactory::~DSDAuxiliaryPowerControlFactory()
+	{
+    OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROLFACTORY_DSDAUXILIARYPOWERCONTROLFACTORY_DTOR, "DSDAuxiliaryPowerControlFactory::~DSDAuxiliaryPowerControlFactory");
+	__KTRACE_OPT(KPBUS1, Kern::Printf(">DSDAuxiliaryPowerControlFactory::~DSDAuxiliaryPowerControlFactory"));
+	if (gDfcQ)
+		gDfcQ->Destroy();
+	}
+
+void DSDAuxiliaryPowerControl::BusCallBack(TAny* aPtr, TInt aReason, TAny* a1, TAny* a2)
+	{
+	DSDAuxiliaryPowerControl* pTest = (DSDAuxiliaryPowerControl*)aPtr;
+	TPBusState busState = (TPBusState) (TInt) a1;
+	switch (aReason)
+		{
+		case TPBusCallBack::EPBusStateChange:
+			if (busState != EPBusPoweringUp)
+				Kern::SemaphoreSignal(*(pTest->iPowerUpSemaphore));
+			break;
+		}
+	}
+
+TInt DSDAuxiliaryPowerControl::PowerUpStack()
+	{
+	iBusCallBack.iFunction = BusCallBack;
+	iBusCallBack.iPtr=this;
+	iBusCallBack.SetSocket(iSocketP->iSocketNumber);
+	iBusCallBack.Add();
+	TInt r = Kern::SemaphoreCreate(iPowerUpSemaphore, _L("SDPowerUpSem"), 0);
+	if (r == KErrNone)
+		{
+		r = iSocketP->PowerUp();
+		if (r == KErrNone)
+			Kern::SemaphoreWait(*iPowerUpSemaphore);
+		}
+	return r;
+	}
+
+TInt DSDAuxiliaryPowerControl::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& aVer)
+//
+// Create channel
+//
+	{
+    OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROL_DOCREATE_1, "DSDAuxiliaryPowerControl::DoCreate()");
+	__KTRACE_OPT(KPBUS1, Kern::Printf(">DSDAuxiliaryPowerControl::DoCreate()"));
+
+	if (!Kern::QueryVersionSupported(TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber),aVer))
+		return KErrNotSupported;
+
+	//
+	// Obtain the appropriate card from the socket/stack
+	//
+	iSocketP = static_cast<DMMCSocket*>(DPBusSocket::SocketFromId(KSocketNumber));
+	if(iSocketP == NULL)
+		{
+        OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROL_DOCREATE_2, "DSDAuxiliaryPowerControl::DoCreate() : Didn't obtain socket");
+		__KTRACE_OPT(KPBUS1, Kern::Printf("DSDAuxiliaryPowerControl::DoCreate() : Didn't obtain socket"));
+		return KErrNoMemory;
+		}
+
+	iStackP = static_cast<DSDStack*>(iSocketP->Stack(KStackNumber));
+	if(iStackP == NULL)
+		{
+        OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROL_DOCREATE_3, "DSDAuxiliaryPowerControl::DoCreate() : Didn't obtain stack");
+		__KTRACE_OPT(KPBUS1, Kern::Printf("DSDAuxiliaryPowerControl::DoCreate() : Didn't obtain stack"));
+		return KErrNoMemory;
+		}
+
+	iCardP = static_cast<TSDCard*>(iStackP->CardP(KCardNumber));
+	if(iCardP == NULL)
+		{
+        OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROL_DOCREATE_4, "DSDAuxiliaryPowerControl::DoCreate() : Didn't obtain card");
+		__KTRACE_OPT(KPBUS1, Kern::Printf("DSDAuxiliaryPowerControl::DoCreate() : Didn't obtain card"));
+		return KErrNoMemory;
+		}
+
+	SetDfcQ(gDfcQ);
+	iMsgQ.Receive();
+
+	// Make sure stack is powered up
+	TInt r = PowerUpStack();
+	if (r != KErrNone && r != KErrCompletion)
+		{
+        OstTrace1( TRACE_FLOW, DSDAUXILIARYPOWERCONTROL_DOCREATE_5, "DSDAuxiliaryPowerControl::DoCreate() : Failed To Power up stack, r = %d", r);
+		__KTRACE_OPT(KPBUS1, Kern::Printf("DSDAuxiliaryPowerControl::DoCreate() : Failed To Power up stack, r = %d", r));
+		return r;
+		}
+		
+	if(!iCardP->IsReady())
+		{
+        OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROL_DOCREATE_6, "DSDAuxiliaryPowerControl::DoCreate() : Card not ready");
+		__KTRACE_OPT(KPBUS1, Kern::Printf("DSDAuxiliaryPowerControl::DoCreate() : Card not ready"));
+		return KErrNotReady;
+		}
+    	
+	if(!iCardP->ClientsRegistered())
+		{		
+		iCardP->RegisterClient();
+		((DSDIOPsu*)(iSocketP->iVcc))->Lock();
+		TBool locked = ((DSDIOPsu*)(iSocketP->iVcc))->IsLocked();
+		OstTrace1( TRACE_FLOW, DSDAUXILIARYPOWERCONTROL_DOCREATE_7, "DSDAuxiliaryPowerControl::DoCreate() : PSU IsLocked(), locked = %d", locked);
+		__KTRACE_OPT(KPBUS1, Kern::Printf("DSDAuxiliaryPowerControl::DoCreate() : PSU IsLocked(), locked = %d", locked));
+		if(!locked)
+			return KErrNotReady;
+		}
+		
+	return KErrNone;
+	}
+
+DSDAuxiliaryPowerControl::DSDAuxiliaryPowerControl()
+//
+// Constructor
+//
+	{
+	iClient=&Kern::CurrentThread();
+	((DObject*)iClient)->Open();
+	}
+
+
+DSDAuxiliaryPowerControl::~DSDAuxiliaryPowerControl()
+//
+// Destructor
+//
+	{
+    OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROL_DSDAUXILIARYPOWERCONTROL_DTOR, "DSDAuxiliaryPowerControl::~DSDAuxiliaryPowerControl");
+	__KTRACE_OPT(KPBUS1, Kern::Printf("DSDAuxiliaryPowerControl::~DSDAuxiliaryPowerControl"));
+	iBusCallBack.Remove();
+
+	if (iSocketP)
+		iSocketP->ControlIO(DPBusSocket::EControlMediaState, (TAny*)DPBusSocket::EPeriphBusMediaNormal, NULL);
+
+	
+	if(iCardP->ClientsRegistered())
+		{		
+		iCardP->DeregisterClient();
+		((DSDIOPsu*)(iSocketP->iVcc))->Unlock();
+		}
+
+	iPowerUpSemaphore->Close(NULL);
+
+	Kern::SafeClose((DObject*&)iClient,NULL);
+	}
+
+void DSDAuxiliaryPowerControl::HandleMsg(TMessageBase* aMsg)
+    {
+    TThreadMessage& m=*(TThreadMessage*)aMsg;
+    TInt id=m.iValue;
+    
+	if (id==(TInt)ECloseMsg)
+		{
+		if (iSocketP)
+			iSocketP->ControlIO(DPBusSocket::EControlMediaState, (TAny*)DPBusSocket::EPeriphBusMediaNormal, NULL);
+
+		m.Complete(KErrNone, EFalse);
+		return;
+		}
+    else if (id==KMaxTInt)
+		{
+		// DoCancel
+		m.Complete(KErrNone,ETrue);
+		return;
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/drivers/sdapc/d_sdapc.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,55 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL " http://www.eclipse.org/legal/epl-v10.html ".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+
+#ifndef __D_SDAPC_H__
+#define __D_SDAPC_H__
+#include <e32cmn.h>
+
+
+
+
+class TCapsTestV01
+	{
+public:
+	TVersion	iVersion;
+	};
+
+/**
+
+A user-side interface to the SD PSU auxiliary-control driver.
+
+*/
+class RSDAuxiliaryPowerControlAPI : public RBusLogicalChannel
+	{
+public:
+	enum
+		{
+		EMajorVersionNumber=1,
+		EMinorVersionNumber=0,
+		EBuildVersionNumber=1
+		};
+
+public:
+	inline void Cancel();
+	
+	inline TInt Open(TInt aSocket,const TVersion& aVer)
+		{return(DoCreate(_L("D_SDAPC"),aVer,(TInt)aSocket,NULL,NULL));}
+	
+	inline TVersion VersionRequired() const
+		{return(TVersion(EMajorVersionNumber,EMinorVersionNumber,EBuildVersionNumber));}
+	
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/drivers/sdapc/d_sdapc.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,32 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL " http://www.eclipse.org/legal/epl-v10.html ".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+#include "kernel/kern_ext.mmh"
+
+TARGET         d_sdapc.ldd
+TARGETTYPE     LDD
+
+SOURCEPATH		.
+SOURCE		d_sdapc.cpp
+LIBRARY		epbussd.lib
+epocallowdlldata
+
+USERINCLUDE		traces
+USERINCLUDE		../../include/drivers
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+capability	all
+
+SMPSAFE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/drivers/sdapc/traces/OstTraceDefinitions.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,21 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <OpenSystemTrace.h>
+#endif
--- a/kernel/eka/drivers/soundsc/base_e32_drivers_sound.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/soundsc/base_e32_drivers_sound.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Audio Driver"
 
 component	base_e32_drivers_sound
--- a/kernel/eka/drivers/trace/base_e32_drivers_trace.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/trace/base_e32_drivers_trace.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Kernel Trace Tool"
 
 component	base_e32_drivers_trace
--- a/kernel/eka/drivers/usbc/base_e32_drivers_usbcli.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/usbc/base_e32_drivers_usbcli.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "USB Client Driver"
 
 component	base_e32_drivers_usbcli
--- a/kernel/eka/drivers/usbcc/chapter9.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/usbcc/chapter9.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1136,8 +1136,19 @@
 	// New configuration is the same as the old one (but not 0)
 	if (iCurrentConfig == aValue)
 		{
-		// no-op
 		__KTRACE_OPT(KUSB, Kern::Printf("  Configuration: New == Old == %d --> exiting", aValue));
+
+		// From the spec 9.1.1.5, Data toggle is reset to zero here when 
+		// setconfiguration(x->x)(x!=0) received, although we only support
+		// single configuration currently.
+		TInt num = 0;
+		TInt ret = DoForEveryEndpointInUse(&DUsbClientController::ResetDataToggle, num);
+		if(ret != KErrNone)
+			{
+			__KTRACE_OPT(KPANIC, Kern::Printf("  Error: Endpoint data toggle reset failed"));
+			}
+		__KTRACE_OPT(KUSB, Kern::Printf("  Called ResetDataToggle()for %d endpoints", num));	
+	
 		return;
 		}
 	// Device is already configured
--- a/kernel/eka/drivers/usbho/usbdescriptors/base_drivers_usbdescriptors.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/usbho/usbdescriptors/base_drivers_usbdescriptors.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "USB Descriptors"
 
 component	base_drivers_usbdescriptors
--- a/kernel/eka/drivers/usbho/usbdi_utils/base_drivers_usbdi_utils.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/usbho/usbdi_utils/base_drivers_usbdi_utils.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "USB DI Utils"
 
 component	base_drivers_usbdi_utils
--- a/kernel/eka/drivers/xyin/d_xyin.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/drivers/xyin/d_xyin.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -19,6 +19,7 @@
 
 #include <drivers/xyin.h>
 #include <kernel/kern_priv.h>
+#include <hal_data.h>
 
 _LIT(KLitDigitiser,"Digitiser");
 
@@ -50,7 +51,8 @@
 	:	DPowerHandler(KLitDigitiser),
 		iMsgQ(rxMsg,this,NULL,1),
 		iSampleDfc(sampleDfc,this,5),
-		iPenUpDfc(penUpDfc,this,5)
+		iPenUpDfc(penUpDfc,this,5),
+		iOrientation(HALData::EDigitiserOrientation_default)
 	{
 //	iBufferIndex=0;
 //	iLastPos=TPoint(0,0);
@@ -358,6 +360,26 @@
 		case EDigitiserHalXYState:
 			kumemput32(a1, (TBool*)&iPointerOn, sizeof(TBool));
 			break;
+			
+		// a2 = TBool aSet (ETrue for setting, EFalse for retrieval) 
+		// a1 = TDigitizerOrientation (set)
+		// a1 = &TDigitizerOrientation (get)
+		case EDigitiserOrientation:	
+			if ((TBool)a2)
+				{
+				// Set the orientation attribute
+				// In case user thread, check it has WDD capability
+				if(!Kern::CurrentThreadHasCapability(ECapabilityWriteDeviceData,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDigitiserOrientation")))
+					return KErrPermissionDenied;
+				iOrientation = (TInt)a1;
+				}
+			else
+				{
+				// Get the orientation attribute, safe copy it into user memory
+				kumemput32(a1, &iOrientation, sizeof(TInt));	
+				}
+			break; 
+			
 		default:
 			r=KErrNotSupported;
 			break;
--- a/kernel/eka/eabi/ekernsmp.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/eabi/ekernsmp.def	Thu Jul 22 16:46:39 2010 +0100
@@ -1188,4 +1188,8 @@
 	_ZN5NKern21SetNumberOfActiveCpusEi @ 1187 NONAME
 	_ZN3Arm14SetIdleHandlerEPFvPvmPVvES0_ @ 1188 NONAME
 	_ZN4Epoc11FreeRamZoneEj @ 1189 NONAME
+	_ZN16TBitMapAllocator14SelectiveAllocEii @ 1190 NONAME
+	_ZN10RArrayBase12SetKeyOffsetEi @ 1191 NONAME
+	_ZN5Cache10CpuRetiresEv @ 1192 NONAME
+	_ZN5Cache13KernelRetiresEv @ 1193 NONAME
 
--- a/kernel/eka/eabi/ekernu.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/eabi/ekernu.def	Thu Jul 22 16:46:39 2010 +0100
@@ -1180,4 +1180,8 @@
 	_ZN13KernCoreStats9LeaveIdleEj @ 1179 NONAME
 	_ZN3Arm14SetIdleHandlerEPFvPvmES0_ @ 1180 NONAME
 	_ZN4Epoc11FreeRamZoneEj @ 1181 NONAME
+	_ZN16TBitMapAllocator14SelectiveAllocEii @ 1182 NONAME
+	_ZN10RArrayBase12SetKeyOffsetEi @ 1183 NONAME
+	_ZN5Cache10CpuRetiresEv @ 1184 NONAME
+	_ZN5Cache13KernelRetiresEv @ 1185 NONAME
 
--- a/kernel/eka/eabi/euseru.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/eabi/euseru.def	Thu Jul 22 16:46:39 2010 +0100
@@ -2537,4 +2537,9 @@
 	_ZNK10RAllocator9MaxLengthEv @ 2536 NONAME
 	_ZN10RAllocator17__DbgGetAllocFailEv @ 2537 NONAME
 	_ZN4User17__DbgGetAllocFailEi @ 2538 NONAME
-
+	_ZN10RArrayBase12SetKeyOffsetEi @ 2539 NONAME
+	_ZN10RSemaphore4PollEv @ 2540 NONAME ; RSemaphore::Poll()
+	_ZN6RMutex4WaitEi @ 2541 NONAME ; RMutex::Wait(int)
+	_ZN6RMutex4PollEv @ 2542 NONAME ; RMutex::Poll()
+	_ZN9RFastLock4PollEv @ 2543 NONAME ; RFastLock::Poll()
+	_ZN9RFastLock4WaitEi @ 2544 NONAME ; RFastLock::Wait(int)
--- a/kernel/eka/euser/base_e32_euser.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/euser/base_e32_euser.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "User Library"
 
 component	base_e32_euser
--- a/kernel/eka/euser/epoc/arm/uc_utl.cia	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/euser/epoc/arm/uc_utl.cia	Thu Jul 22 16:46:39 2010 +0100
@@ -1321,6 +1321,42 @@
 #endif
 	}
 
+EXPORT_C __NAKED__ TInt RFastLock::Poll()
+	{
+	asm("1: ");
+	asm("add	r0, r0, #4 ");					// point to iCount
+
+#ifdef __CPU_ARM_HAS_LDREX_STREX
+	asm("2:		");
+	LDREX(		2, 0);							// read
+	asm("subs	r1, r2, #1 ");					// decrement
+	asm("bcs	3f ");							// if no borrow, lock cannot be obtained so bail out
+	STREX(		3, 1, 0);						// write
+	asm("teq	r3, #0 ");						// success?
+	asm("bne	2b ");							// no!
+	asm("mov	r0, #0 ");						// lock acquired so return KErrNone
+#ifdef __SMP__
+	__DATA_MEMORY_BARRIER__(r3);				// need acquire barrier
+#endif
+	__JUMP(,	lr);
+
+	asm("3:		");
+	asm("mov	r0, #%a0" : : "i" ((TInt)KErrTimedOut));	// else can't get it immediately so return KErrTimedOut
+	__JUMP(,	lr);
+#else	// no LDREX/STREX - ARM arch 5 CPU
+	asm("mov	r1, #1 ");						// 'looking' value
+	asm("swp	r1, r1, [r0] ");				// write looking value, read original
+	asm("subs	r2, r1, #1 ");					// decrement count
+	asm("strcc	r2, [r0] ");					// if borrow, was originally zero so write back -1 and return KErrNone
+	asm("movcc	r0, #0 ");						// got lock - return KErrNone
+ 	__JUMP(cc,	lr);
+
+	asm("strlt	r1, [r0] ");					// else if result<0 (i.e. wasn't looking value) write back original
+	asm("mov	r0, #%a0" : : "i" ((TInt)KErrTimedOut));	// else can't get it immediately so return KErrTimedOut
+ 	__JUMP(,	lr);
+#endif
+	}
+
 EXPORT_C __NAKED__ void RFastLock::Signal()
 	{
 	asm("1: ");
@@ -1356,6 +1392,122 @@
 	}
 
 
+/**
+Acquire the lock, if necessary waiting up to a specified maximum amount of time
+for it to become free.
+
+This function checks if the lock is currently held. If not the lock is marked
+as held by the current thread and the call returns immediately. If the lock is
+held by another thread the current thread will suspend until the lock becomes
+free or until the specified timeout period has elapsed.
+
+@param aTimeout The timeout value in microseconds
+
+@return KErrNone if the lock was acquired successfully.
+        KErrTimedOut if the timeout has expired.
+        KErrGeneral if the lock is being reset, i.e the lock
+        is about to  be deleted.
+        KErrArgument if aTimeout is negative;
+        otherwise one of the other system wide error codes.
+*/
+EXPORT_C __NAKED__ TInt RFastLock::Wait(TInt /*aTimeout*/)
+	{
+	asm("stmfd	sp!, {r4-r6,lr} ");
+	asm("add	r4, r0, #4 ");					// r4->iCount
+	asm("subs	r5, r1, #0 ");					// r5=aTimeout
+	asm("mov	r6, #1000 ");
+	asm("movle	r0, #%a0" : : "i" ((TInt)KErrArgument));	
+	__CPOPRET(le, "r4-r6,");					// if aTimeout<=0 return KErrArgument
+	asm("1:		");
+
+#ifdef __CPU_ARM_HAS_LDREX_STREX
+	asm("2:		");
+	LDREX(		2, 4);							// read
+	asm("subs	r12, r2, #1 ");					// decrement
+	STREX(		3, 12, 4);						// write
+	asm("teq	r3, #0 ");						// success?
+	asm("bne	2b ");							// no!
+	asm("bcs	8f ");							// if no borrow from decrement, need to wait
+#ifdef __SMP__
+	__DATA_MEMORY_BARRIER__(r3);				// no need to wait, but still need acquire barrier
+#endif
+#else	// no LDREX/STREX - ARM arch 5 CPU
+	asm("mov	r2, #1 ");						// 'looking' value
+	asm("swp	r2, r2, [r4] ");				// write looking value, read original
+	asm("subs	r12, r2, #1 ");					// decrement count
+	asm("strlt	r12, [r4] ");					// if it becomes negative, no-one was looking
+	asm("bcs	8f ");							// if no borrow, we have to wait
+#endif
+	asm("mov	r0, #0 ");						// return KErrNone
+	__POPRET("r4-r6,");
+
+// We need to wait
+	asm("8:		");
+#ifndef __CPU_ARM_HAS_LDREX_STREX
+// no LDREX/STREX - ARM arch 5 CPU
+	asm("blt	3f ");							// if it wasn't 'looking' value, branch
+
+	// it was the 'looking' value, so wait a little bit
+	asm("cmp	r5, #0 ");
+	asm("ble	9f ");							// waited too long already, return KErrTimedOut
+	asm("sub	r5, r5, r6 ");
+	asm("mov	r6, #2000 ");
+	asm("mov	r0, #1000 ");					// wait 1ms
+	asm("cmp	r5, r0 ");
+	asm("movlt	r5, r0 ");						// remaining time at least 1ms
+	asm("bl "	CSM_ZN4User12AfterHighResE27TTimeIntervalMicroSeconds32);
+	asm("b		1b ");							// try again
+#endif
+	asm("3:		");
+	asm("sub	r0, r4, #4 ");					// r0=this
+	asm("mov	r1, r5 ");						// r1=aTimeout
+	asm("bl "	CSM_ZN10RSemaphore4WaitEi);	// try to acquire semaphore
+	asm("cmp	r0, #%a0" : : "i" ((TInt)KErrTimedOut));
+	__CPOPRET(ne, "r4-r6,");					// if wait didn't time out, return
+	asm("mov	r5, #1 ");						// any further timed waits will be for minimum period
+	
+	// Before we can return KErrTimedOut we must increment iCount (since we
+	// previously decremented it in anticipation of acquiring the lock.
+	// However we must not increment iCount if it would become zero, since
+	// the semaphore will have been signalled (to counterbalance the Wait()
+	// which timed out and thus never happened). This would result in two
+	// threads being able to acquire the lock simultaneously - one by
+	// decrementing iCount from 0 to -1 without looking at the semaphore,
+	// and the other by decrementing iCount from -1 to -2 and then absorbing
+	// the spurious semaphore signal.
+	//	orig = __e32_atomic_tas_ord32(&iCount, -1, 0, 1);	// don't release lock completely
+	//	if (orig < -1)
+	//		return KErrTimedOut;	// count corrected - don't need to touch semaphore
+	// lock is actually free at this point, try again to claim it
+	//	aTimeout = 1;
+#ifdef __CPU_ARM_HAS_LDREX_STREX
+#ifdef __SMP__
+	__DATA_MEMORY_BARRIER_Z__(r3);
+#endif
+	asm("4:		");
+	LDREX(		2, 4);							// read
+	asm("adds	r2, r2, #1 ");					// increment
+	asm("bge	3b ");							// if increment would make result >=0, wait again
+	STREX(		3, 2, 4);						// write
+	asm("teq	r3, #0 ");						// success?
+	asm("bne	4b ");							// no!
+#ifdef __SMP__
+	__DATA_MEMORY_BARRIER__(r3);
+#endif
+#else	// no LDREX/STREX - ARM arch 5 CPU
+	asm("mov	r2, #1 ");						// 'looking' value
+	asm("swp	r2, r2, [r4] ");				// write looking value, read original
+	asm("adds	r12, r2, #1 ");					// increment count
+	asm("strlt	r12, [r4] ");					// if still negative, count now fixed, so return KErrTimedOut
+	asm("streq	r2, [r4] ");					// else if not 'looking' value, write back original
+	asm("bge	3b ");							// if 'looking' value or -1, wait again
+#endif
+	asm("9:		");
+	asm("mov	r0, #%a0" : : "i" ((TInt)KErrTimedOut));	// return KErrTimedOut
+	__POPRET("r4-r6,");
+	}
+
+
 // Entry point stub to allow EKA1 binaries to be executed under EKA2
 // Only called when process is first loaded
 
--- a/kernel/eka/euser/epoc/win32/emulator.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/euser/epoc/win32/emulator.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -79,6 +79,51 @@
 	return WideCharToMultiByte(Data.iCodePage,0,aUnicode,-1,aNarrow,aLength,"@",NULL);
 	}
 
+LOCAL_C TInt GetSectionsSize(const IMAGE_NT_HEADERS32* aBase)
+//
+// Iterates through the section headers at the start of an image and determines the minimum amount of the
+// PE file that must be read in in order to examine the sections themselves
+//
+	{
+    // List of sections are are interested in examining
+	const BYTE* sectionNames[] =
+			{
+			KWin32SectionName_Symbian, KWin32SectionName_Import, KWin32SectionName_EpocData, KWin32SectionName_EpocBss,
+			KWin32SectionName_Text, KWin32SectionName_RData, KWin32SectionName_NmdExpData
+			};
+
+	// Get a ptr to the first section header in preparation for examining all the section headers
+	DWORD maxOffset = 0;
+	const IMAGE_NT_HEADERS32* ntHead = aBase;
+	const IMAGE_SECTION_HEADER* imgHead = (const IMAGE_SECTION_HEADER*) ((TUint8*) &ntHead->OptionalHeader + ntHead->FileHeader.SizeOfOptionalHeader);
+	const IMAGE_SECTION_HEADER* end = imgHead + ntHead->FileHeader.NumberOfSections;
+
+	for (; imgHead < end; ++imgHead)
+		{
+		TBool SectionUsed = EFalse;
+
+		// Go through each of the sections that we need to examine and see if the current section is in the list
+		for (TInt index = 0; index < (sizeof(sectionNames) / sizeof(BYTE*)); ++index)
+			{
+			if (memcmp(imgHead->Name, sectionNames[index], IMAGE_SIZEOF_SHORT_NAME)==0)
+				SectionUsed = ETrue;
+			}
+
+		// If the current section is one we are interested in, calculate its offset in the raw file and add its size;
+		// this gives us the minimum amount of the file to be mapped in order to examine this section and all those
+		// preceding it
+		if (SectionUsed)
+			{
+			if ((imgHead->PointerToRawData + imgHead->SizeOfRawData) > maxOffset)
+				{
+				maxOffset = (imgHead->PointerToRawData + imgHead->SizeOfRawData);
+				}
+			}
+		}
+
+	return(maxOffset);
+	}
+
 template <TUint S>
 struct Buf8
 	{
@@ -810,7 +855,32 @@
 		if (!iMapping)
 			return LastError();
 
-		iBase = MapViewOfFile(iMapping, FILE_MAP_READ, 0, 0, 0);
+		// First we need to read in the PE file's image headers, which consist of a 4 byte signature, the file header
+		// containing general information and up to 96 section headers.  Map this amount of the file into memory so
+		// that we can examine it and calculate the minimum size of the sections themselves that need to be mapped into
+		// memory in order to examine the actual sections
+		SIZE_T headersSize = (sizeof(DWORD) + sizeof(IMAGE_FILE_HEADER) + (96 * sizeof(IMAGE_OPTIONAL_HEADER)));
+		iBase = MapViewOfFile(iMapping, FILE_MAP_READ, 0, 0, headersSize);
+
+		if (iBase)
+			{
+			// Scan through the section headers and determine the minimum amount of the file to be mapped into memory
+			// in order for us to safely examine the sections, and map the file into memory.  We do this rather than
+			// map the entire PE file into memory because with full debug information, DLLs can be anything up to 100 MB!!!
+			TInt sectionsSize = GetSectionsSize(NtHeader());
+
+			// Before remapping the file with its new size, unmap it.  While one would think that it is safe to
+			// increase the size of the file's mapping it is not, and doing so triggers behaviour in Windows that
+			// results in quickly using up all available virtual memory address space!
+			if (UnmapViewOfFile(iBase))
+				{
+				iBase = MapViewOfFile(iMapping, FILE_MAP_READ, 0, 0, sectionsSize);
+				}
+			else
+				{
+				iBase = NULL;
+				}
+			}
 
 		if (!iBase)
 			{
--- a/kernel/eka/euser/epoc/win32/uc_utl.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/euser/epoc/win32/uc_utl.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -114,6 +114,21 @@
 		RSemaphore::Wait();
 	}
 
+EXPORT_C __NAKED__ TInt RFastLock::Poll()
+	{
+	_asm xor eax, eax
+	_asm xor edx, edx
+	_asm dec edx
+
+	/* if ([ecx+4]==0) { [ecx+4]=-1; ZF=1;} else {eax=[ecx+4]; ZF=0;} */
+	_asm lock cmpxchg [ecx+4], edx
+	_asm jz short fastlock_poll_done
+	_asm mov eax, -33
+
+	fastlock_poll_done:
+	_asm ret
+	}
+
 EXPORT_C void RFastLock::Signal()
 	{
 	if (InterlockedIncrement((LPLONG)&iCount) < 0)
--- a/kernel/eka/euser/epoc/x86/uc_utl.cia	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/euser/epoc/x86/uc_utl.cia	Thu Jul 22 16:46:39 2010 +0100
@@ -42,6 +42,22 @@
 	THISCALL_EPILOG0()
 	}
 
+EXPORT_C __NAKED__ TInt RFastLock::Poll()
+	{
+	THISCALL_PROLOG0()
+	asm("xor eax, eax ");
+	asm("xor edx, edx ");
+	asm("dec edx ");
+
+	/* if ([ecx+4]==0) { [ecx+4]=-1; ZF=1;} else {eax=[ecx+4]; ZF=0;} */
+	asm("lock cmpxchg [ecx+4], edx ");
+	asm("jz short fastlock_poll_done ");
+	asm("mov eax, %0": : "i"(KErrTimedOut));
+
+	asm("fastlock_poll_done: ");
+	THISCALL_EPILOG0()
+	}
+
 EXPORT_C __NAKED__ void RFastLock::Signal()
 	{
 	THISCALL_PROLOG0()
--- a/kernel/eka/euser/us_exec.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/euser/us_exec.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -3768,8 +3768,59 @@
 */
 EXPORT_C void RMutex::Wait()
 	{
-
-	Exec::MutexWait(iHandle);
+	Exec::MutexWait(iHandle, 0);
+	}
+
+
+
+
+/**
+Acquire the mutex if it is currently free, but don't wait for it.
+
+This function checks if the mutex is currently held. If not the mutex is marked
+as held by the current thread and the call returns immediately indicating
+success. If the mutex is held by another thread the call returns immediately
+indicating failure. If the mutex is already held by the current thread a count
+is maintained of how many times the thread has acquired the mutex.
+
+@return	KErrNone if the mutex was acquired
+		KErrTimedOut if the mutex could not be acquired
+        KErrGeneral if the semaphore is being reset, i.e the semaphore
+        is about to  be deleted.
+*/
+EXPORT_C TInt RMutex::Poll()
+	{
+	return Exec::MutexWait(iHandle, -1);
+	}
+
+
+
+
+/**
+Acquire the mutex, if necessary waiting up to a specified maximum amount of time
+for it to become free.
+
+This function checks if the mutex is currently held. If not the mutex is marked
+as held by the current thread and the call returns immediately. If the mutex is
+held by another thread the current thread will suspend until the mutex becomes
+free or until the specified timeout period has elapsed. If the mutex is already
+held by the current thread a count is maintained of how many times the thread
+has acquired the mutex.
+
+@param aTimeout The timeout value in microseconds
+
+@return KErrNone if the mutex was acquired successfully.
+        KErrTimedOut if the timeout has expired.
+        KErrGeneral if the mutex is being reset, i.e the mutex
+        is about to  be deleted.
+        KErrArgument if aTimeout is negative;
+        otherwise one of the other system wide error codes.
+*/
+EXPORT_C TInt RMutex::Wait(TInt aTimeout)
+	{
+	if (aTimeout>=0)
+		return Exec::MutexWait(iHandle, aTimeout);
+	return KErrArgument;
 	}
 
 
@@ -4308,7 +4359,6 @@
 
 
 
-EXPORT_C void RSemaphore::Wait()
 /**
 Waits for a signal on the semaphore.
 
@@ -4324,19 +4374,16 @@
 
 If the semaphore is deleted, all threads waiting on that semaphore are released.
 */
-	{
-
+EXPORT_C void RSemaphore::Wait()
+	{
 	Exec::SemaphoreWait(iHandle, 0);
 	}
 
 
-
-
-EXPORT_C TInt RSemaphore::Wait(TInt aTimeout)
 /**
 Waits for a signal on the semaphore, or a timeout.
 
-@param aTimeout The timeout value in micoseconds
+@param aTimeout The timeout value in microseconds
 
 @return KErrNone if the wait has completed normally.
         KErrTimedOut if the timeout has expired.
@@ -4345,12 +4392,26 @@
         KErrArgument if aTimeout is negative;
         otherwise one of the other system wide error codes.
 */
-	{
-
-	return Exec::SemaphoreWait(iHandle, aTimeout);
-	}
-
-
+EXPORT_C TInt RSemaphore::Wait(TInt aTimeout)
+	{
+	if (aTimeout>=0)
+		return Exec::SemaphoreWait(iHandle, aTimeout);
+	return KErrArgument;
+	}
+
+
+/**
+Acquires the semaphore if that is possible without waiting.
+
+@return KErrNone if the semaphore was acquired successfully
+        KErrTimedOut if the semaphore could not be acquired
+        KErrGeneral if the semaphore is being reset, i.e the semaphore
+        is about to  be deleted.
+*/
+EXPORT_C TInt RSemaphore::Poll()
+	{
+	return Exec::SemaphoreWait(iHandle, -1);
+	}
 
 
 EXPORT_C void RSemaphore::Signal()
@@ -4389,6 +4450,54 @@
 
 
 
+#ifndef __CPU_ARM
+/**
+Acquire the lock, if necessary waiting up to a specified maximum amount of time
+for it to become free.
+
+This function checks if the lock is currently held. If not the lock is marked
+as held by the current thread and the call returns immediately. If the lock is
+held by another thread the current thread will suspend until the lock becomes
+free or until the specified timeout period has elapsed.
+
+@param aTimeout The timeout value in microseconds
+
+@return KErrNone if the lock was acquired successfully.
+        KErrTimedOut if the timeout has expired.
+        KErrGeneral if the lock is being reset, i.e the lock
+        is about to  be deleted.
+        KErrArgument if aTimeout is negative;
+        otherwise one of the other system wide error codes.
+*/
+EXPORT_C TInt RFastLock::Wait(TInt aTimeout)
+	{
+	if (aTimeout<=0)
+		return KErrArgument;
+	TInt orig = __e32_atomic_add_acq32(&iCount, TUint32(-1));
+	if (orig == 0)
+		return KErrNone;
+	FOREVER
+		{
+		TInt r = Exec::SemaphoreWait(iHandle, aTimeout);
+		if (r != KErrTimedOut)	// got lock OK or lock deleted
+			return r;
+		// Before we can return KErrTimedOut we must increment iCount (since we
+		// previously decremented it in anticipation of acquiring the lock.
+		// However we must not increment iCount if it would become zero, since
+		// the semaphore will have been signalled (to counterbalance the Wait()
+		// which timed out and thus never happened). This would result in two
+		// threads being able to acquire the lock simultaneously - one by
+		// decrementing iCount from 0 to -1 without looking at the semaphore,
+		// and the other by decrementing iCount from -1 to -2 and then absorbing
+		// the spurious semaphore signal.
+		orig = __e32_atomic_tas_ord32(&iCount, -1, 0, 1);	// don't release lock completely
+		if (orig < -1)
+			return KErrTimedOut;	// count corrected - don't need to touch semaphore
+		// lock is actually free at this point, try again to claim it
+		aTimeout = 1;
+		}
+	}
+#endif
 
 EXPORT_C RCriticalSection::RCriticalSection()
 	: iBlocked(1)
--- a/kernel/eka/euser/v7_0/euser-7_0.cia	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/euser/v7_0/euser-7_0.cia	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,18 @@
-//
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32/euser/v7_0/euser-7_0.cia
+// 
 // EUSER-7_0.CIA - generated by GENSHIMSRC.BAT
 //
 
--- a/kernel/eka/ewsrv/base_e32_ewsrv.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/ewsrv/base_e32_ewsrv.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Text Window Server"
 
 component	base_e32_ewsrv
--- a/kernel/eka/include/d32comm.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/d32comm.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -30,64 +30,6 @@
 #include <d32public.h>
 
 /**
- Enumeration of number of data bits for serial port configuration.
- Typically, these values are used to initialize the iDataBits of 
- TCommConfigV01 before calling DComm::Configure() or any other serial
- comm API to configure the serial port's databits size.
- */
-enum TDataBits {EData5,EData6,EData7,EData8};
-/**
- Enumeration of number of stop bits for serial port configuration.
- Typically, these values are used to initialize the iStopBits of 
- TCommConfigV01 before calling DComm::Configure() or any other serial
- comm API to configure the serial port's stopbits.
- */
-enum TStopBits {EStop1,EStop2};
-/**
- Enumeration of types of parity for serial port configuration.
- Typically, these values are used to initialize the iParity of 
- TCommConfigV01 before calling DComm::Configure() or any other serial
- comm API to configure the serial port's parity setting.
- */
-enum TParity {EParityNone,EParityEven,EParityOdd,EParityMark,EParitySpace};
-/**
- Enumeration of baud rates in bits per second for serial port configuration.
- * e.g EBps115200 is for 115200Bps data rate  
- Typically, these values are used to initialize the iRate of TCommConfigV01 
- before calling DComm::Configure() or any other serial comm API to configure
- the serial port's baud rate.
- */
-enum TBps
-	{
-	EBps50,
-	EBps75,
-	EBps110,
-	EBps134,
-	EBps150,
-	EBps300,
-	EBps600,
-	EBps1200,
-	EBps1800,
-	EBps2000,
-	EBps2400,
-	EBps3600,
-	EBps4800,
-	EBps7200,
-	EBps9600,
-	EBps19200,
-	EBps38400,
-	EBps57600,
-	EBps115200,
-	EBps230400,
-	EBps460800,
-	EBps576000,
-	EBps1152000,
-	EBps4000000,
-	EBps921600,
-	EBpsAutobaud=0x40000000,
-	EBpsSpecial=0x80000000,
-	};
-/**
  Enumeration of Fifo status (enable and disable) for serial port configuration.
  Typically, these values are used to initialize the iFifo of TCommConfigV01 
  before calling DComm::Configure() or any other serial comm API to configure
--- a/kernel/eka/include/d32locd.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/d32locd.h	Thu Jul 22 16:46:39 2010 +0100
@@ -565,7 +565,8 @@
 	enum TReadWriteFlags
 		{
 		ELocDrvMetaData					= 0x80000000,	/**< Set if read/write request is for metadata */
-		ELocDrvWholeMedia				= 0x40000000	/**< Set to access whole media, rather than partition */
+		ELocDrvWholeMedia				= 0x40000000,	/**< Set to access whole media, rather than partition */
+		ELocDrvDirectIO					= 0x20000000
 		};
 
 	// @see TBusLocalDrive::QueryDevice()
--- a/kernel/eka/include/d32public.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/d32public.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -26,6 +26,67 @@
 #ifndef __D32PUBLIC_H__
 #define __D32PUBLIC_H__
 
+/**
+ Enumeration of number of data bits for serial port configuration.
+ Typically, these values are used to initialize the iDataBits of 
+ TCommConfigV01 before calling DComm::Configure() or any other serial
+ comm API to configure the serial port's databits size.
+ */
+enum TDataBits {EData5,EData6,EData7,EData8};
+
+/**
+ Enumeration of number of stop bits for serial port configuration.
+ Typically, these values are used to initialize the iStopBits of 
+ TCommConfigV01 before calling DComm::Configure() or any other serial
+ comm API to configure the serial port's stopbits.
+ */
+enum TStopBits {EStop1,EStop2};
+
+/**
+ Enumeration of types of parity for serial port configuration.
+ Typically, these values are used to initialize the iParity of 
+ TCommConfigV01 before calling DComm::Configure() or any other serial
+ comm API to configure the serial port's parity setting.
+ */
+enum TParity {EParityNone,EParityEven,EParityOdd,EParityMark,EParitySpace};
+
+/**
+ Enumeration of baud rates in bits per second for serial port configuration.
+ * e.g EBps115200 is for 115200Bps data rate  
+ Typically, these values are used to initialize the iRate of TCommConfigV01 
+ before calling DComm::Configure() or any other serial comm API to configure
+ the serial port's baud rate.
+ */
+enum TBps
+	{
+	EBps50,
+	EBps75,
+	EBps110,
+	EBps134,
+	EBps150,
+	EBps300,
+	EBps600,
+	EBps1200,
+	EBps1800,
+	EBps2000,
+	EBps2400,
+	EBps3600,
+	EBps4800,
+	EBps7200,
+	EBps9600,
+	EBps19200,
+	EBps38400,
+	EBps57600,
+	EBps115200,
+	EBps230400,
+	EBps460800,
+	EBps576000,
+	EBps1152000,
+	EBps4000000,
+	EBps921600,
+	EBpsAutobaud=0x40000000,
+	EBpsSpecial=0x80000000,
+	};
 
 enum TFlowControl
 	{
--- a/kernel/eka/include/d32usbdi_errors.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/d32usbdi_errors.h	Thu Jul 22 16:46:39 2010 +0100
@@ -201,6 +201,7 @@
 		EUsbDevMonDeviceAttachDenied					= 41,
 		EUsbHubDriverZeroInterfaceTokenProduced			= 42,
 		EUsbInterfaceSuccessfulPipeOpenWithNoPipe		= 43,
+		EFailedToLockHostStackInWaitDeviceStateMutex    = 44,
 		};
 
 	_LIT(KUsbDescFaultCat, "USBDesc-Fault");
--- a/kernel/eka/include/drivers/dma_compat.inl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/drivers/dma_compat.inl	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -34,6 +34,8 @@
 	{
 	TUint32 flags = (aFlags & KDmaMemSrc) ? KDmaMemAddr : 0;
 	flags |= (aFlags & KDmaPhysAddrSrc) ? KDmaPhysAddr : 0;
+	if ((flags & KDmaMemAddr) && (flags & KDmaPhysAddr))
+		flags |= KDmaMemIsContiguous;
 	return flags;
 	}
 
@@ -41,6 +43,8 @@
 	{
 	TUint32 flags = (aFlags & KDmaMemDest) ? KDmaMemAddr : 0;
 	flags |= (aFlags & KDmaPhysAddrDest) ? KDmaPhysAddr : 0;
+	if ((flags & KDmaMemAddr) && (flags & KDmaPhysAddr))
+		flags |= KDmaMemIsContiguous;
 	return flags;
 	}
 
--- a/kernel/eka/include/drivers/dma_hai.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/drivers/dma_hai.h	Thu Jul 22 16:46:39 2010 +0100
@@ -16,6 +16,11 @@
 //
 //
 
+/** @file
+	@publishedPartner
+	@released
+*/
+
 #ifndef __DMA_HAI_H__
 #define __DMA_HAI_H__
 
@@ -29,12 +34,10 @@
 /** Interface used by PIL to open and close DMA channels.
 
 	Must be implemented by the PSL.
-
-	@publishedPartner
-	@released
 */
 class DmaChannelMgr
 	{
+
 public:
 	/** Opens a channel using a client-provided identifier.
 
@@ -94,6 +97,7 @@
 	*/
 	static TDmaChannel* Open(TUint32 aOpenId, TBool aDynChannel, TUint aPriority);
 
+
 	/** Performs platform-specific operations when a channel is closed.
 
 		If aChannel was opened as a dynamic channel then this call is a sign
@@ -110,6 +114,7 @@
 	*/
 	static void Close(TDmaChannel* aChannel);
 
+
 	/** Function allowing PSL to extend DMA API with new channel-independent
 		operations.
 
@@ -122,14 +127,16 @@
 
 		@return KErrNotSupported if aCmd is not supported. PSL-specific value
 		otherwise.
-	 */
+	*/
 	static TInt StaticExtension(TInt aCmd, TAny* aArg);
 
+
 	/** Acquires the channel manager lock. Called by the PIL before opening and
 		closing a channel.
 	*/
 	static void Wait();
 
+
 	/** Releases the channel manager lock. Called by the PIL after opening and
 		closing a channel.
 	*/
@@ -139,7 +146,7 @@
 	/** Declared, defined, and called by PSL's DECLARE_STANDARD_EXTENSION(). */
 	friend TInt InitExtension();
 
-	/** Must be called in the DMA DLL entry point. */
+	/** Must be called in the PSL's DECLARE_STANDARD_EXTENSION(). */
 	static TInt Initialise();
 
 	static NFastMutex Lock;
@@ -160,22 +167,26 @@
 
 	These functions are the main interfaces between the PIL
 	(platform-independent layer) and PSL.
-
-	@publishedPartner
-	@released
 */
 class TDmac
 	{
-	friend class DmaChannelMgr;
+friend class DmaChannelMgr;
+
+// The following two friend declarations will become obsolete once that
+// functionality is owned and provided by the controller class instead of the
+// request class. (TDmac::iFreeHdr could then also be made private.)
+friend TInt DDmaRequest::ExpandDesList(TInt, TInt&, SDmaDesHdr*&, SDmaDesHdr*&);
+friend void DDmaRequest::FreeDesList(TInt&, SDmaDesHdr*&, SDmaDesHdr*&);
 
 protected:
-	/** Data required for creating a new instance */
+	/** Data required for creating a new instance. */
 	struct SCreateInfo
 		{
 		/** True if DMAC uses hardware descriptors (i.e. supports
 			scatter/gather mode).
 		*/
 		TBool iCapsHwDes;
+
 		/** Initial maximum number of descriptors and headers (shared by all
 			channels) to be allocated by the PIL. If at run time more
 			descriptors are needed then they will be dynamically allocated and
@@ -186,14 +197,22 @@
 			the maximum transfer size per descriptor and also likely usage
 			scenarios for the platform or device (number of drivers using DMA,
 			their traffic patterns, simultaneity of operations, etc.).
+
+			(NB: Dynamic growing of the descriptor pool is not yet implemented
+			in the PIL, so this value is currently also the final maximum
+			number of descriptors.)
 		*/
 		TInt iDesCount;
-		/** Size of individual descriptors. Use sizeof(TDmaTransferArgs) for
-		 	single-buffer and double-buffer (i.e. non-s/g) controllers.
+
+		/** Size of an individual descriptor.
+
+			Use sizeof(TDmaTransferArgs) for single-buffer and double-buffer
+		 	(i.e. non-s/g) controllers.
 		*/
 		TInt iDesSize;
+
 		/** Bitmask used when creating the memory chunk storing the descriptor
-			pool. Used only for hardware descriptors.
+			pool in the PIL. Used only for hardware descriptors.
 
 			The access part must be EMapAttrSupRw. If the chunk is cached
 			and/or buffered, the PSL must flush the data cache and/or drain the
@@ -207,65 +226,65 @@
 		TUint iDesChunkAttribs;
 		};
 
-	/** Base class constructor. */
+	/** Base class constructor.
+	 */
 	TDmac(const SCreateInfo& aInfo);
 
-	/** Base class 2nd-phase constructor. */
+	/** Base class 2nd-phase constructor.
+	 */
 	TInt Create(const SCreateInfo& aInfo);
 
 public:
-	/** Base class virtual destructor. */
+	/** Base class virtual destructor.
+	 */
 	virtual ~TDmac();
 
+
 	/** Allocates a number of headers (and hence also descriptors) from the
 		header/descriptor pools. Called by the PIL but may also be used by the
 		PSL.
 	*/
 	TInt ReserveSetOfDes(TInt aCount);
 
+
 	/** Returns previously allocated headers (and hence also descriptors) to
 		the header/descriptor pools. Called by the PIL but may also be used by
 		the PSL.
 	*/
 	void ReleaseSetOfDes(TInt aCount);
 
+
 	/** Called by the PIL during request fragmentation to fill a descriptor or
 		pseudo descriptor with transfer arguments.
 	*/
 	TInt InitDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs);
 
+
 	/** Called by the PIL in TDmaChannel::IsrRedoRequest() if any of the
 		latter's arguments is non-zero.
 	*/
 	TInt UpdateDes(const SDmaDesHdr& aHdr, TUint32 aSrcAddr, TUint32 aDstAddr,
 				   TUint aTransferCount, TUint32 aPslRequestInfo);
 
+
 	/** Returns a reference to the associated pseudo descriptor for a given
 		descriptor header. For use by PIL and PSL.
 	*/
 	inline TDmaTransferArgs& HdrToDes(const SDmaDesHdr& aHdr) const;
 
+
 	/** Returns a reference to the associated hardware descriptor for a given
 		descriptor header. For use by PIL and PSL.
 	*/
 	inline TAny* HdrToHwDes(const SDmaDesHdr& aHdr) const;
 
+
 	/** Returns the physical address of the hardware descriptor
 		pointed to by aDes. For use by PIL and PSL.
 	*/
 	inline TUint32 HwDesLinToPhys(TAny* aDes) const;
 
-	/** Called by the PIL to acquire the controller lock which protects the
-		header and descriptor pools.
-	*/
-	inline void Wait();
 
-	/** Called by the PIL to release the controller lock which protects the
-		header and descriptor pools.
-	*/
-	inline void Signal();
-
-public:
 	/** Called by PIL when one fragment (single-buffer and double-buffer DMACs)
 		or list of fragments (scatter/gather DMAC) is to be transferred.
 
@@ -283,6 +302,7 @@
 	*/
 	virtual void Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aHdr);
 
+
 	/** Called by PIL when two lists of fragments (scatter/gather DMAC with
 		asymmetrical linked-list capability) are to be transferred.
 
@@ -302,6 +322,7 @@
 	virtual void Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aSrcHdr,
 						  const SDmaDesHdr& aDstHdr);
 
+
 	/** Called by PIL to stop a transfer on a given channel.
 
 		The stopping must occur synchronously as the PIL assumes the channel
@@ -316,6 +337,7 @@
 	*/
 	virtual void StopTransfer(const TDmaChannel& aChannel) = 0;
 
+
 	/** Called by PIL to pause (suspend) a transfer on a given channel.
 
 		A paused channel transfer must be able to be resumed by calling
@@ -330,9 +352,10 @@
 
 		@post No interrupt will occur from this channel until it is
 		resumed.
-	 */
+	*/
 	virtual TInt PauseTransfer(const TDmaChannel& aChannel);
 
+
 	/** Called by PIL to resume a paused (suspended) transfer on a given
 		channel.
 
@@ -341,14 +364,16 @@
 		Pause bit in a H/W descriptor.
 
 		The function must be implemented by the PSL if
-		SDmacCaps::iChannelPauseAndResume is reported as true.
+		SDmacCaps::iChannelPauseAndResume or
+		SDmacCaps::iLinkedListPausedInterrupt is reported as true.
 
 		@return KErrNone if the transfer has been resumed successfully,
 		KErrCompletion if there was no paused transfer, KErrGeneral
 		if a general error occurred preventing a successful outcome.
-	 */
+	*/
 	virtual TInt ResumeTransfer(const TDmaChannel& aChannel);
 
+
 	/** Called by PIL to check whether a DMA channel is idle.
 
 		'Idle' here means that the channel is ultimately stopped, for example
@@ -363,6 +388,7 @@
 	*/
 	virtual TBool IsIdle(const TDmaChannel& aChannel) = 0;
 
+
 	/** Called by PIL to retrieve from the PSL the maximum transfer length
 		based on the parameters passed.
 
@@ -380,6 +406,7 @@
 	virtual TUint MaxTransferLength(TDmaChannel& aChannel, TUint aSrcFlags,
 									TUint aDstFlags, TUint32 aPslInfo) = 0;
 
+
 	/** Called by PIL to retrieve from the PSL the memory alignment mask based
 		on the parameters passed. Some DMA controllers impose alignment
 		constraints on the base address of memory buffers. This mask is AND'ed
@@ -412,6 +439,7 @@
 	virtual TUint AddressAlignMask(TDmaChannel& aChannel, TUint aTargetFlags,
 								   TUint aElementSize, TUint32 aPslInfo) = 0;
 
+
 	/** Called by PIL during fragmentation to initialise a hardware descriptor.
 
 		The PSL must assume the descriptor is the last in the chain and so set
@@ -433,6 +461,7 @@
 	*/
 	virtual TInt InitHwDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs);
 
+
 	/** Called by PIL during fragmentation to initialise a hardware descriptor
 		on the source side of an asymmetric linked list.
 
@@ -452,6 +481,7 @@
 	*/
 	virtual TInt InitSrcHwDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs);
 
+
 	/** Called by PIL during fragmentation to initialise a hardware descriptor
 		on the destination side of an asymmetric linked list.
 
@@ -471,6 +501,7 @@
 	*/
 	virtual TInt InitDstHwDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs);
 
+
 	/** Called by the PIL in ISR context to change specific fields in a
 		hardware descriptor.
 
@@ -497,6 +528,7 @@
 	virtual TInt UpdateHwDes(const SDmaDesHdr& aHdr, TUint32 aSrcAddr, TUint32 aDstAddr,
 							 TUint aTransferCount, TUint32 aPslRequestInfo);
 
+
 	/** Called by the PIL in ISR context to change specific fields in a
 		hardware descriptor.
 
@@ -521,6 +553,7 @@
 	virtual TInt UpdateSrcHwDes(const SDmaDesHdr& aHdr, TUint32 aSrcAddr,
 								TUint aTransferCount, TUint32 aPslRequestInfo);
 
+
 	/** Called by the PIL in ISR context to change specific fields in a
 		hardware descriptor.
 
@@ -545,6 +578,7 @@
 	virtual TInt UpdateDstHwDes(const SDmaDesHdr& aHdr, TUint32 aDstAddr,
 								TUint aTransferCount, TUint32 aPslRequestInfo);
 
+
 	/** Called by PIL, when fragmenting a request, to append a new hardware
 		descriptor to an existing descriptor chain. May also be called by
 		clients who wish to create their own descriptor chains.
@@ -559,6 +593,7 @@
 	*/
 	virtual void ChainHwDes(const SDmaDesHdr& aHdr, const SDmaDesHdr& aNextHdr);
 
+
 	/** Called by PIL when queuing a new request while the channel is running.
 
 		Must append the first hardware descriptor of the new request to the
@@ -576,6 +611,7 @@
 	virtual void AppendHwDes(const TDmaChannel& aChannel, const SDmaDesHdr& aLastHdr,
 							 const SDmaDesHdr& aNewHdr);
 
+
 	/** Called by PIL when queuing a new request while the channel is running.
 
 		Must append the first hardware descriptor of the new request to the
@@ -598,6 +634,7 @@
 							 const SDmaDesHdr& aSrcLastHdr, const SDmaDesHdr& aSrcNewHdr,
 							 const SDmaDesHdr& aDstLastHdr, const SDmaDesHdr& aDstNewHdr);
 
+
 	/** Called by PIL when completing or cancelling a request to cause the PSL
 		to unlink the last item in the h/w descriptor chain from a subsequent
 		chain that it was possibly linked to.
@@ -612,6 +649,7 @@
 	*/
 	virtual void UnlinkHwDes(const TDmaChannel& aChannel, SDmaDesHdr& aHdr);
 
+
 	/** Called by PIL when freeing descriptors back to the shared pool in
 		FreeDesList(). The PSL inside ClearHwDes() can clear the contents of
 		the h/w descriptor.
@@ -624,9 +662,10 @@
 		hardware descriptors.
 
 		@param aHdr Header associated with the h/w descriptor being freed.
-	 */
+	*/
 	virtual void ClearHwDes(const SDmaDesHdr& aHdr);
 
+
 	/** Called by PIL to logically link two physical channels.
 
 		The function must be implemented by the PSL if the DMAC supports
@@ -642,9 +681,10 @@
 		KErrArgument if a1stChannel was already linked to a different channel,
 		KErrGeneral if a general error occurred preventing a successful
 		outcome. The default PIL implementation returns KErrNotSupported.
-	 */
+	*/
 	virtual TInt LinkChannels(TDmaChannel& a1stChannel, TDmaChannel& a2ndChannel);
 
+
 	/** Called by PIL to logically unlink a physical channel from its linked-to
 		successor.
 
@@ -659,9 +699,10 @@
 		KErrCompletion if the channel was not linked to another channel,
 		KErrGeneral if a general error occurred preventing a successful
 		outcome. The default PIL implementation returns KErrNotSupported.
-	 */
+	*/
 	virtual TInt UnlinkChannel(TDmaChannel& aChannel);
 
+
 	/** Called by a test harness to force an error when the next fragment is
 		transferred.
 
@@ -674,6 +715,7 @@
 	*/
 	virtual TInt FailNext(const TDmaChannel& aChannel);
 
+
 	/** Called by a test harness to force the DMA controller to miss one or
 		more interrupts.
 
@@ -687,6 +729,7 @@
 	*/
 	virtual TInt MissNextInterrupts(const TDmaChannel& aChannel, TInt aInterruptCount);
 
+
 	/** Function allowing platform-specific layer to extend channel API with
 		new channel-specific operations.
 
@@ -702,6 +745,7 @@
 	*/
 	virtual TInt Extension(TDmaChannel& aChannel, TInt aCmd, TAny* aArg);
 
+
 	/** Called by the PIL to query the number of elements that have so far been
 		transferred by the hardware descriptor associated with aHdr at the
 		source port.
@@ -721,6 +765,7 @@
 	*/
 	virtual TUint32 HwDesNumSrcElementsTransferred(const SDmaDesHdr& aHdr);
 
+
 	/** Called by the PIL to query the number of elements that have so far been
 		transferred by the hardware descriptor associated with aHdr at the
 		destination port.
@@ -746,7 +791,7 @@
 		@param aChannel The channel the ISR relates to
 		@param aEventMask Bitmask of one or more TDmaCallbackType values
 		@param aIsComplete Set to ETrue if no error was encountered
-	 */
+	*/
 	static void HandleIsr(TDmaChannel& aChannel, TUint aEventMask, TBool aIsComplete);
 
 private:
@@ -756,6 +801,16 @@
 	/** Called in ~TDmac() */
 	void FreeDesPool();
 
+	/** Called by the PIL to acquire the controller lock which protects the
+		header and descriptor pools.
+	*/
+	inline void Wait();
+
+	/** Called by the PIL to release the controller lock which protects the
+		header and descriptor pools.
+	*/
+	inline void Signal();
+
 private:
 	NFastMutex iLock;			 // protect descriptor reservation and allocation
 	const TInt iMaxDesCount;	 // initial number of descriptors and headers
@@ -785,9 +840,6 @@
 /** Single-buffer DMA channel.
 
 	Can be instantiated or further derived by the PSL.
-
-	@publishedPartner
-	@released
 */
 class TDmaSbChannel : public TDmaChannel
 	{
@@ -795,6 +847,7 @@
 	virtual void DoQueue(const DDmaRequest& aReq);
 	virtual void DoCancelAll();
 	virtual void DoDfc(const DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr);
+
 private:
 	enum {EIdle = 0, ETransferring} iState;
 	};
@@ -803,9 +856,6 @@
 /** Double-buffer DMA channel.
 
 	Can be instantiated or further derived by the PSL.
-
-	@publishedPartner
-	@released
 */
 class TDmaDbChannel : public TDmaChannel
 	{
@@ -813,6 +863,7 @@
 	virtual void DoQueue(const DDmaRequest& aReq);
 	virtual void DoCancelAll();
 	virtual void DoDfc(const DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr);
+
 private:
 	enum {EIdle = 0, ETransferring, ETransferringLast} iState;
 	};
@@ -821,9 +872,6 @@
 /** Scatter-gather DMA channel.
 
 	Can be instantiated or further derived by the PSL.
-
-	@publishedPartner
-	@released
 */
 class TDmaSgChannel : public TDmaChannel
 	{
@@ -832,6 +880,7 @@
 	virtual void DoCancelAll();
 	virtual void DoUnlink(SDmaDesHdr& aHdr);
 	virtual void DoDfc(const DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr);
+
 private:
 	enum {EIdle = 0, ETransferring} iState;
 	};
@@ -841,8 +890,7 @@
 
 	Can be instantiated or further derived by the PSL.
 
-	@publishedPartner
-	@released
+	@prototype
 */
 class TDmaAsymSgChannel : public TDmaChannel
 	{
@@ -852,8 +900,9 @@
 	virtual void DoUnlink(SDmaDesHdr& aHdr);
 	virtual void DoDfc(const DDmaRequest& aCurReq, SDmaDesHdr*& aSrcCompletedHdr,
 					   SDmaDesHdr*& aDstCompletedHdr);
+
 private:
-	SDmaDesHdr* iSrcCurHdr;		   // source fragment being transferred or NULL
+	SDmaDesHdr* iSrcCurHdr;	  // source fragment being transferred or NULL
 	SDmaDesHdr** iSrcNullPtr; // Pointer to NULL pointer following last source fragment
 	SDmaDesHdr* iDstCurHdr;	  // destination fragment being transferred or NULL
 	SDmaDesHdr** iDstNullPtr; // Pointer to NULL pointer following last destination fragment
--- a/kernel/eka/include/drivers/dma_v1.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/drivers/dma_v1.h	Thu Jul 22 16:46:39 2010 +0100
@@ -158,6 +158,15 @@
     The request can be uninitialised or may have been fragmented previously.  The
     previous configuration if any is lost whether or not the function succeeds.
 
+    The client must ensure that any memory buffers involved in the transfer
+    have been suitably prepared for DMA. For memory allocated on the kernel
+    side or in a shared chunk this amounts to ensuring cache consistency
+    before Queue() is called. However for memory that was allocated on the
+    user side the client must also ensure that the memory is protected from
+    both data paging and RAM defragmentation before Fragment() is called
+    @see Kern::MapAndPinMemory(). Note however, that this function is only
+    available if the flexible memory model (FMM) is in use.
+
     @param aSrc     Source memory buffer linear address or peripheral magic cookie.
     @param aDest    Destination memory buffer linear address or peripheral magic cookie.
     @param aCount   Number of bytes to transfer.
@@ -340,27 +349,66 @@
 	virtual void DoUnlink(SDmaDesHdr& aHdr);
 	virtual void DoDfc(DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr) = 0;
 	/**
-	   This function allows the Platform Specific Layer (PSL) to control the
-	   power management of the channel or its controller by overriding the
-	   PIL's default implementation (which does nothing) and making appropriate
-	   use of the Power Resource Manager (PRM).
+		This function allows the Platform Specific Layer (PSL) to control the
+		power management of the channel or its controller by overriding the
+		PIL's default implementation (which does nothing) and making
+		appropriate use of the Power Resource Manager (PRM).
+
+		The function gets called by the PIL whenever the channel's queued
+		requests count has changed in a significant way, either before the
+		channel's Transfer() method is invoked for a request on a previously
+		empty request queue, or immediately after the request count has become
+		zero because of request cancellation or completion.
+
+		Depending on the current and previous observed values of
+		iQueuedRequests, the PSL may power down or power up the channel.
 
-	   The function gets called by the PIL whenever the channel's queued
-	   requests count has changed in a significant way, either before the
-	   channel's Transfer() method is invoked for a request on a previously
-	   empty request queue, or immediately after the request count has become
-	   zero because of request cancellation or completion.
+		Note that iQueuedRequests gets accessed and changed by different
+		threads, so the PSL needs to take the usual precautions when evaluating
+		the variable's value. Also, due to the multithreaded framework
+		architecture, there is no guarantee that the function calls always
+		arrive at the PSL level in the strict chronological order of
+		iQueuedRequests being incremented/decremented in the PIL, i.e. it might
+		happen that the PSL finds iQueuedRequests to have the same value in two
+		or more consecutive calls (that's why the previous observed value needs
+		to be locally available and taken into account). It is however promised
+		that before any actual transfer commences the PSL will find the request
+		count to be greater than zero and that after the last request has
+		finished it will be found to be zero.
+
+		None of the internal DMA framework mutexes is being held by the PIL
+		when calling this function.
 
-	   Depending on the current value of iQueuedRequests, the PSL may power
-	   down or power up the channel. Note that iQueuedRequests gets accessed
-	   and changed by different threads, so the PSL needs to take the usual
-	   precautions when evaluating the variable's value.
+		Here is an example implementation for a derived channel class:
+
+		@code
+
+		class TFooDmaChannel : public TDmaSgChannel
+			{
+			DMutex* iDmaMutex;
+			TInt iPrevQueuedRequests;
+			virtual void QueuedRequestCountChanged();
+			};
 
-	   None of the internal DMA framework mutexes is being held by the PIL when
-	   calling this function.
+		void TFooDmaChannel::QueuedRequestCountChanged()
+			{
+			Kern::MutexWait(*iDmaMutex);
+			if ((iQueuedRequests > 0) && (iPrevQueuedRequests == 0))
+				{
+				IncreasePowerCount(); // Base port specific
+				}
+			else if ((iQueuedRequests == 0) && (iPrevQueuedRequests > 0))
+				{
+				DecreasePowerCount(); // Base port specific
+				}
+			iPrevQueuedRequests = iQueuedRequests;
+			Kern::MutexSignal(*iDmaMutex);
+			}
 
-	   @see iQueuedRequests
-	 */
+		@endcode
+
+		@see iQueuedRequests
+	*/
 	virtual void QueuedRequestCountChanged();
 #if defined(__CPU_ARM) && !defined(__EABI__)
 	inline virtual ~TDmaChannel() {}	// kill really annoying warning
--- a/kernel/eka/include/drivers/dma_v2.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/drivers/dma_v2.h	Thu Jul 22 16:46:39 2010 +0100
@@ -18,6 +18,10 @@
 // generic header file <drivers/dma.h>.
 //
 
+/** @file
+	@publishedPartner
+*/
+
 #ifndef __DMA_H__
 #error "dma_v2.h must'n be included directly - use <drivers/dma.h> instead"
 #endif	// #ifndef __DMA_H__
@@ -66,15 +70,15 @@
 
 	Some peripherals may require a post-increment address mode.
 
-	@see DDmaRequest::Fragment
-	@publishedPartner
-	@released
+	@see DDmaRequest::Fragment()
+
+	Note: This enum is only required for backwards compatibility with the old
+	DMA framework, it can be removed once this is no longer needed.
+
+	@deprecated
 */
 enum TDmaRequestFlags
 	{
-	// Note: This enum is only required for backwards compatibility with the
-	// old DMA framework, it can be removed once this is no longer needed.
-
 	/** Source is address of memory buffer */
 	KDmaMemSrc       = 0x01,
 	/** Destination is address of memory buffer */
@@ -96,7 +100,6 @@
 	are needed because hardware descriptors can not easily be extended to store
 	additional information.
 
-	@publishedPartner
 	@released
 */
 struct SDmaDesHdr
@@ -104,18 +107,23 @@
 	SDmaDesHdr* iNext;
 	};
 
+
 /** Pointer to signature of the new extended callback function.
 
-	TUint - bitmask of one or more TDmaCallbackType values
-	TDmaResult - just that
-	TAny* - was provided by client in DDmaRequest constructor
+	TUint       - bitmask of one or more TDmaCallbackType values
+	TDmaResult  - just that
+	TAny*       - was provided by client in DDmaRequest constructor
 	SDmaDesHdr* - points to header (and thus descriptor) which caused a
-	'descriptor completed' or 'descriptor paused' event.
+	'descriptor completed' or 'descriptor paused' event
+
+	@released
  */
 typedef void (*TDmaCallback)(TUint, TDmaResult, TAny*, SDmaDesHdr*);
 
+
 class TDmaChannel;
 
+
 /** A DMA request is a list of fragments small enough to be transferred in one go
 	by the DMAC.
 
@@ -132,10 +140,7 @@
 	Mutexes are used internally to protect data structures accessed both by the
 	client thread and the DFC thread. Therefore no fast mutex can be held when
 	calling a request function.
-
-	@publishedPartner
-	@released
- */
+*/
 class DDmaRequest : public DBase
 	{
 	friend class TDmaChannel;
@@ -143,14 +148,17 @@
 public:
 	/** The outcome of the transfer
 
+		@see TDmaResult
+
 		@deprecated
-		@see TDmaResult
 	*/
 	enum TResult {EBadResult=0, EOk, EError};
+
 	/** The signature of the completion/failure callback function
 
+		@see TDmaCallback
+
 		@deprecated
-		@see TDmaCallback
 	*/
 	typedef void (*TCallback)(TResult, TAny*);
 
@@ -183,15 +191,19 @@
 		@param aMaxTransferSize Maximum fragment size. If not specified,
 		defaults to the maximum size supported by the DMA controller for the
 		type of transfer that is later scheduled.
+
+		@released
 	*/
-	IMPORT_C DDmaRequest(TDmaChannel& aChannel, TDmaCallback aDmaCb, TAny* aCbArg=NULL,
-						 TUint aMaxTransferSize=0);
+	IMPORT_C DDmaRequest(TDmaChannel& aChannel, TDmaCallback aDmaCb,
+						 TAny* aCbArg=NULL, TUint aMaxTransferSize=0);
 
 
 	/** Destructor.
 
 		Assume the request is not being transferred or pending.
-    */
+
+		@released
+	*/
 	IMPORT_C ~DDmaRequest();
 
 
@@ -212,6 +224,15 @@
 		previously. The previous configuration if any is lost whether or not
 		the function succeeds.
 
+		The client must ensure that any memory buffers involved in the transfer
+		have been suitably prepared for DMA. For memory allocated on the kernel
+		side or in a shared chunk this amounts to ensuring cache consistency
+		before Queue() is called. However for memory that was allocated on the
+		user side the client must also ensure that the memory is protected from
+		both data paging and RAM defragmentation before Fragment() is called
+		@see Kern::MapAndPinMemory(). Note however, that this function is only
+		available if the flexible memory model (FMM) is in use.
+
 		@param aSrc Source memory buffer linear address or peripheral magic
 		cookie.
 		@param aDest Destination memory buffer linear address or peripheral
@@ -237,6 +258,38 @@
 
 	/** New version of the DMA request fragment function, to be used with the
 		TDmaTransferArgs structure.
+
+		Split request into a list of fragments small enough to be fed to the
+		DMAC.
+
+		The size of each fragment is smaller than or equal to the maximum
+		transfer size supported by the DMAC. If the source and/or destination
+		is memory, each fragment points to memory which is physically
+		contiguous.
+
+		The request can be uninitialised or may have been fragmented
+		previously. Any previous configuration is lost whether or not the
+		function succeeds.
+
+		The client must ensure that any memory buffers involved in the transfer
+		have been suitably prepared for DMA. For memory allocated on the kernel
+		side or in a shared chunk this amounts to ensuring cache consistency
+		before Queue() is called. However for memory that was allocated on the
+		user side the client must also ensure that the memory is protected from
+		both data paging and RAM defragmentation before Fragment() is called
+		@see Kern::MapAndPinMemory(). Note however, that this function is only
+		available if the flexible memory model (FMM) is in use.
+
+		@param aTransferArgs Describes the transfer to be performed.
+
+		@return KErrNone if success. KErrArgument if certain arguments are
+		invalid. May also fail if running out of descriptors.
+
+		@pre The request is not being transferred or pending.
+		@pre The various parameters must be valid. The PIL or PSL will fault
+		the kernel if not.
+
+		@released
 	*/
 	IMPORT_C TInt Fragment(const TDmaTransferArgs& aTransferArgs);
 
@@ -250,11 +303,13 @@
 		after the transfer if necessary.
 
 		@return KErrNone if success, KErrGeneral otherwise.
-    */
+
+		@released
+	*/
 	IMPORT_C TInt Queue();
 
 
-    /** Append new descriptor(s) to existing list.
+	/** Append new descriptor(s) to existing list.
 
 		Clients needing to build a custom descriptor list should call this
 		function to allocate the list and access the resulting list through
@@ -270,72 +325,86 @@
 		@param aCount Number of descriptors to append.
 
 		@return KErrNone or standard error code.
-    */
+
+		@released
+	*/
 	IMPORT_C TInt ExpandDesList(TInt aCount=1);
 
 
-    /** Append new descriptor(s) to existing list. This function variant
+	/** Append new descriptor(s) to existing list. This function variant
 		operates on the source port descriptor chain.
 
 		Works like ExpandDesList except that it uses the iSrcFirstHdr and
 		iSrcLastHdr fields.
 
-		@see ExpandDesList
+		@see ExpandDesList()
 
-		This function can only be used if SDmacCaps::iAsymHwDescriptors is
-		true, otherwise it will just return KErrGeneral.
+		This function should only be used if SDmacCaps::iAsymHwDescriptors is
+		reported as true, as only then the framework will actually use the
+		allocated descriptors.
 
 		@param aCount Number of descriptors to append.
 
 		@return KErrNone or standard error code.
-    */
+
+		@prototype
+	*/
 	IMPORT_C TInt ExpandSrcDesList(TInt aCount=1);
 
 
-    /** Append new descriptor(s) to existing list. This function variant
+	/** Append new descriptor(s) to existing list. This function variant
 		operates on the destination port descriptor chain.
 
 		Works like ExpandDesList except that it uses the iDstFirstHdr and
 		iDstLastHdr fields.
 
-		@see ExpandDesList
+		@see ExpandDesList()
 
-		This function can only be used if SDmacCaps::iAsymHwDescriptors is
-		true, otherwise it will just return KErrGeneral.
+		This function should only be used if SDmacCaps::iAsymHwDescriptors is
+		reported as true, as only then the framework will actually use the
+		allocated descriptors.
 
 		@param aCount Number of descriptors to append.
 
 		@return KErrNone or standard error code.
-    */
+
+		@prototype
+	*/
 	IMPORT_C TInt ExpandDstDesList(TInt aCount=1);
 
 
 	/** Free resources associated with this request.
 
-		Assume the request is not being transferred or pending.
-    */
+		Assumes the request is not being transferred or pending.
+
+		@see ExpandDesList()
+
+		@released
+	*/
 	IMPORT_C void FreeDesList();
 
 
 	/** Free resources associated with this request. This function variant
 		operates on the source port descriptor chain.
 
-		@see FreeDesList
+		Assumes the request is not being transferred or pending.
 
-		This function can only be used if SDmacCaps::iAsymHwDescriptors is
-		true, otherwise it will do nothing.
-    */
+		@see ExpandSrcDesList()
+
+		@prototype
+	*/
 	IMPORT_C void FreeSrcDesList();
 
 
 	/** Free resources associated with this request. This function variant
 		operates on the destination port descriptor chain.
 
-		@see FreeDesList
+		Assumes the request is not being transferred or pending.
 
-		This function can only be used if SDmacCaps::iAsymHwDescriptors is
-		true, otherwise it will do nothing.
-    */
+		@see ExpandDstDesList()
+
+		@prototype
+	*/
 	IMPORT_C void FreeDstDesList();
 
 
@@ -367,6 +436,8 @@
 
 		@see Queue()
 		@see TotalNumSrcElementsTransferred()
+
+		@prototype
 	*/
 	IMPORT_C void EnableSrcElementCounting(TBool aResetElementCount=ETrue);
 
@@ -399,6 +470,8 @@
 
 		@see Queue()
 		@see TotalNumDstElementsTransferred()
+
+		@prototype
 	*/
 	IMPORT_C void EnableDstElementCounting(TBool aResetElementCount=ETrue);
 
@@ -427,6 +500,8 @@
 
 		@see Queue()
 		@see TotalNumSrcElementsTransferred()
+
+		@prototype
 	*/
 	IMPORT_C void DisableSrcElementCounting();
 
@@ -455,6 +530,8 @@
 
 		@see Queue()
 		@see TotalNumDstElementsTransferred()
+
+		@prototype
 	*/
 	IMPORT_C void DisableDstElementCounting();
 
@@ -475,6 +552,8 @@
 
 		@return The number of elements that have been transferred by this
 		transfer request at the source port.
+
+		@prototype
 	*/
 	IMPORT_C TUint32 TotalNumSrcElementsTransferred();
 
@@ -495,6 +574,8 @@
 
 		@return The number of elements that have been transferred by this
 		transfer request at the destination port.
+
+		@prototype
 	*/
 	IMPORT_C TUint32 TotalNumDstElementsTransferred();
 
@@ -512,9 +593,12 @@
 
 		@return The number of fragments (descriptors / pseudo descriptors) that
 		this transfer request has been split into.
-	 */
+
+		@released
+	*/
 	IMPORT_C TInt FragmentCount();
 
+
 	/** Returns the number of source port fragments that this transfer request
 		has been split into.
 
@@ -527,7 +611,9 @@
 
 		@return The number of source port fragments (descriptors) that this
 		transfer request has been split into.
-	 */
+
+		@prototype
+	*/
 	IMPORT_C TInt SrcFragmentCount();
 
 
@@ -543,17 +629,24 @@
 
 		@return The number of destination port fragments (descriptors) that
 		this transfer request has been split into.
-	 */
+
+		@prototype
+	*/
 	IMPORT_C TInt DstFragmentCount();
 
 private:
 	inline void OnDeque();
-	TUint GetTransferCount(const TDmaTransferArgs& aTransferArgs);
+	TInt CheckTransferConfig(const TDmaTransferConfig& aTarget, TUint aCount) const;
+	TInt CheckMemFlags(const TDmaTransferConfig& aTarget, TUint aCount) const;
+	TInt AdjustFragmentSize(TUint& aFragSize, TUint aElementSize, TUint aFrameSize);
+	TUint GetTransferCount(const TDmaTransferArgs& aTransferArgs) const;
+	TUint GetMaxTransferlength(const TDmaTransferArgs& aTransferArgs, TUint aCount) const;
 	TInt Frag(TDmaTransferArgs& aTransferArgs);
 	TInt FragSym(TDmaTransferArgs& aTransferArgs, TUint aCount, TUint aMaxTransferLen);
 	TInt FragAsym(TDmaTransferArgs& aTransferArgs, TUint aCount, TUint aMaxTransferLen);
 	TInt FragAsymSrc(TDmaTransferArgs& aTransferArgs, TUint aCount, TUint aMaxTransferLen);
 	TInt FragAsymDst(TDmaTransferArgs& aTransferArgs, TUint aCount, TUint aMaxTransferLen);
+	TInt FragBalancedAsym(TDmaTransferArgs& aTransferArgs, TUint aCount, TUint aMaxTransferLen);
 	TInt ExpandDesList(TInt aCount, TInt& aDesCount, SDmaDesHdr*& aFirstHdr,
 					   SDmaDesHdr*& aLastHdr);
 	void FreeDesList(TInt& aDesCount, SDmaDesHdr*& aFirstHdr, SDmaDesHdr*& aLastHdr);
@@ -561,7 +654,7 @@
 
 public:
 	// WARNING: The following attributes are accessed both in client and DFC
-	// context and so accesses must be protected with the channel lock.
+	// thread context, so accesses must be protected with the channel lock.
 	TDmaChannel& iChannel;		/**< The channel this request is bound to */
 	TCallback iCb;			 /**< Called on completion/failure (can be NULL) */
 	TAny* iCbArg;			 /**< Callback argument */
@@ -608,18 +701,15 @@
 	Mutexes are used internally to protect data structures accessed both by the
 	client thread and the DFC one. Therefore no fast mutex can be held when
 	calling a channel function.
-
-	@publishedPartner
-	@released
- */
+*/
 class TDmaChannel
 	{
 	friend class DDmaRequest;
 	friend class TDmac;
 	friend class DmaChannelMgr;
+
 public:
-
-	/** Information passed by client when opening a channel */
+	/** Information passed by client when opening a channel. */
 	struct SCreateInfo
 		{
 		/** Default constructor. Initializes all fields with meaningful default
@@ -628,20 +718,23 @@
 			Must be inline (for now) because exporting it would break existing
 			custom DMA libs as their clients would need the export which would
 			be missing from the custom .def files.
+
+			@released
 		*/
 		SCreateInfo() : iPriority(KDmaPriorityNone), iDynChannel(EFalse) {};
 
-		/** Identifier used by PSL to select channel to open */
-		TUint32 iCookie;
-		/** Number of descriptors this channel can use.
+		/** Identifier used by PSL to select channel to open.
 
-			This number is not used in the upgraded version of the DMA
-			framework and is kept there only for source compatibility. If the
-			client is certain that it will only ever use that version, then the
-			value passed here doesn't matter - the framework will ignore it.
+			@released
+		*/
+		TUint32 iCookie;
+		/** Number of descriptors this channel can maximally use.
 
-			@deprecated
-		 */
+			This value will not be used in the fully implemented new version of
+			the DMA framework. Until then it is still required.
+
+			@released
+		*/
 		TInt iDesCount;
 		/** DFC queue used to service DMA interrupts.
 
@@ -649,15 +742,22 @@
 			priority to avoid a situation where a transfer completes while
 			being cancelled and another transfer is started before the DFC
 			thread gets a chance to run. This would lead to a stray DFC.
+
+			@released
 		*/
 		TDfcQue* iDfcQ;
-		/** DFC priority */
+		/** DFC priority.
+
+			@released
+		*/
 		TUint8 iDfcPriority;
 		/** Used by PSL to configure a channel priority (if possible).
 
 			The default is KDmaPriorityNone (the don't care value).
 
-		    @see TDmaPriority
+			@see TDmaPriority
+
+			@prototype
 		*/
 		TUint iPriority;
 		/** Request a dynamic DMA channel.
@@ -668,12 +768,14 @@
 			that case.
 
 			The default value is EFalse.
+
+			@prototype
 		 */
 		TBool iDynChannel;
 		};
 
 public:
-    /** Opens the DMA channel.
+	/** Opens the DMA channel.
 
 		Channel selection is done by the hardware-specific layer using a cookie
 		passed in via aInfo.
@@ -689,7 +791,9 @@
 		otherwise.
 
 		@return KErrNone or standard error code.
- 	*/
+
+		@released
+	*/
 	IMPORT_C static TInt Open(const SCreateInfo& aInfo, TDmaChannel*& aChannel);
 
 
@@ -701,6 +805,8 @@
 		released, and the pointer/reference to it mustn't therefore be accessed
 		any longer after the function has returned. The channel pointer should
 		be set to NULL by the client.
+
+		@released
  	*/
 	IMPORT_C void Close();
 
@@ -733,9 +839,12 @@
 		support channel linking, KErrArgument if this channel was already
 		linked to a different channel, KErrGeneral if a general error occurred
 		preventing a successful outcome.
-	 */
+
+		@prototype
+	*/
 	IMPORT_C TInt LinkToChannel(TDmaChannel* aChannel);
 
+
 	/** Pauses an active transfer on this channel.
 
 		A paused channel transfer can be resumed by calling Resume() or it can
@@ -751,7 +860,9 @@
 		KErrCompletion if a transfer was already paused, KErrNotSupported if
 		the DMAC doesn't support channel transfer pausing/resuming, KErrGeneral
 		if a general error occurred preventing a successful outcome.
-	 */
+
+		@released
+	*/
 	IMPORT_C TInt Pause();
 
 
@@ -767,17 +878,22 @@
 		Function can only be used if the DMAC supports this functionality.
 
 		@see SDmacCaps::iChannelPauseAndResume
+		@see SDmacCaps::iLinkedListPausedInterrupt
 
 		@return KErrNone if a paused transfer has been resumed successfully,
 		KErrCompletion if there was no paused transfer, KErrNotSupported if the
 		DMAC doesn't support channel transfer pausing/resuming, KErrGeneral if
 		a general error occurred preventing a successful outcome.
-	 */
+
+		@released
+	*/
 	IMPORT_C TInt Resume();
 
 
 	/** Cancels the current request and all the pending ones.
-	 */
+
+		@released
+	*/
 	IMPORT_C void CancelAll();
 
 
@@ -795,6 +911,8 @@
 
 		@return 0 if transfer length is not limited, the maximum transfer
 		length in bytes otherwise.
+
+		@released
  	*/
 	IMPORT_C TUint MaxTransferLength(TUint aSrcFlags, TUint aDstFlags, TUint32 aPslInfo);
 
@@ -819,7 +937,9 @@
 
 		@return A value representing the alignment mask (e.g. 3 if buffer must
 		be 4-byte aligned)
-	 */
+
+		@released
+	*/
 	IMPORT_C TUint AddressAlignMask(TUint aTargetFlags, TUint aElementSize,
 									TUint32 aPslInfo);
 
@@ -829,7 +949,9 @@
 
 		@return A reference to a structure containing the capabilities and
 		features of the DMA controller associated with this channel.
-	 */
+
+		@released
+	*/
 	IMPORT_C const SDmacCaps& DmacCaps();
 
 
@@ -876,7 +998,9 @@
 		@see TDmaPILFlags::KDmaRequestCallbackFromIsr
 
 		@return KErrGeneral if there was an error, KErrNone otherwise.
-	 */
+
+		@released
+	*/
 	IMPORT_C TInt IsrRedoRequest(TUint32 aSrcAddr=KPhysAddrInvalid,
 								 TUint32 aDstAddr=KPhysAddrInvalid,
 								 TUint aTransferCount=0,
@@ -891,18 +1015,20 @@
 		NB: This API should not be used any longer.
 
 		After calling TDmaChannel::Open() successfully the channel is
-		guaranteed to be open. Therefore there seems no good reason for this
-		API to exist.
+		guaranteed to be open, hence there seems no good reason for this API to
+		exist.
 
 		@deprecated
-	 */
+	*/
 	inline TBool IsOpened() const;
 
 
 	/** Tests whether the channel's request queue is currently empty.
 
 		@return ETrue if request queue is currently empty, EFalse otherwise.
-	 */
+
+		@released
+	*/
 	inline TBool IsQueueEmpty() const;
 
 
@@ -910,7 +1036,9 @@
 		it is used for debug tracing by the PIL.
 
 		@return PSL-specific value which uniquely identifies this channel.
-	 */
+
+		@released
+	*/
 	inline TUint32 PslId() const;
 
 
@@ -918,7 +1046,9 @@
 		transferred.
 
 		@param aFragmentCount The number of consecutive fragments to fail
-	 */
+
+		@released
+	*/
 	IMPORT_C TInt FailNext(TInt aFragmentCount);
 
 
@@ -926,53 +1056,65 @@
 		more interrupts.
 
 		@param aInterruptCount The number of consecutive interrupts to miss
-	 */
+
+		@released
+	*/
 	IMPORT_C TInt MissNextInterrupts(TInt aInterruptCount);
 
 
 	/** Function allowing platform-specific layer to extend channel API with
 		new channel-specific operations.
 
-		@param aCmd Command identifier. Negative values are reserved for use by
-		Nokia.
+		@param aCmd Command identifier.
 		@param aArg PSL-specific argument
 
 		@return KErrNotSupported if aCmd is not supported. PSL-specific value
 		otherwise.
-	 */
+
+		@released
+	*/
 	IMPORT_C TInt Extension(TInt aCmd, TAny* aArg);
 
 
 	/** This is a function that allows the Platform Specific Layer (PSL) to
 		extend the DMA API with new channel-independent operations.
 
-		@param aCmd Command identifier. Negative values are reserved for
-		Symbian use.
+		@param aCmd Command identifier.
 		@param aArg PSL-specific.
 
 		@return KErrNotSupported if aCmd is not supported; a PSL specific value
 		otherwise.
+
+		@released
  	*/
 	IMPORT_C TInt StaticExtension(TInt aCmd, TAny* aArg);
 
 
-	/** @deprecated
-		@see DmacCaps()
-	 */
+	/** @see DmacCaps()
+
+		@deprecated
+	*/
 	inline const TDmac* Controller() const;
 
-	/** @deprecated
-		@see MaxTransferLength()
-	 */
+	/** @see MaxTransferLength()
+
+		@deprecated
+	*/
 	inline TInt MaxTransferSize(TUint aFlags, TUint32 aPslInfo);
 
-	/** @deprecated
-		@see AddressAlignMask()
-	 */
+	/** @see AddressAlignMask()
+
+		@deprecated
+	*/
 	inline TUint MemAlignMask(TUint aFlags, TUint32 aPslInfo);
 
 protected:
 	// Interface with state machines
+
+	/** Constructor.
+
+		@released
+	*/
 	TDmaChannel();
 
 	/** Called by the PIL when adding a new request to the channel's queue.
@@ -980,11 +1122,15 @@
 		and begin transfer of aReq if possible.
 
 		@param aReq The request which has been added to the queue
+
+		@released
 	*/
 	virtual void DoQueue(const DDmaRequest& aReq);
 
 	/** Called by the PIL in response to a CancelAll call. It should update
 		the channel state appropriately.
+
+		@released
 	*/
 	virtual void DoCancelAll() = 0;
 
@@ -999,6 +1145,8 @@
 
 		@param aHdr The header for a descriptor, which must be unlinked
 		from its next descriptor (if there is one)
+
+		@released
 	*/
 	virtual void DoUnlink(SDmaDesHdr& aHdr);
 
@@ -1012,6 +1160,8 @@
 		@param aCurReq The current request.
 		@param aCompletedHdr Must be set by the implementation to the header
 		of the last transfer to complete.
+
+		@released
 	*/
 	virtual void DoDfc(const DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr);
 
@@ -1032,6 +1182,8 @@
 
 		@param aDstCompletedHdr Must be set by the implementation to
 		the header of the last destination descriptor to complete.
+
+		@prototype
 	*/
 	virtual void DoDfc(const DDmaRequest& aCurReq, SDmaDesHdr*& aSrcCompletedHdr,
 					   SDmaDesHdr*& aDstCompletedHdr);
@@ -1047,14 +1199,53 @@
 		empty request queue, or immediately after the request count has become
 		zero because of request cancellation or completion.
 
-		Depending on the current value of iQueuedRequests, the PSL may power
-		down or power up the channel. Note that iQueuedRequests gets accessed
-		and changed by different threads, so the PSL needs to take the usual
-		precautions when evaluating the variable's value.
+		Depending on the current and previous observed values of
+		iQueuedRequests, the PSL may power down or power up the channel.
+
+		Note that iQueuedRequests gets accessed and changed by different
+		threads, so the PSL needs to take the usual precautions when evaluating
+		the variable's value. Also, due to the multithreaded framework
+		architecture, there is no guarantee that the function calls always
+		arrive at the PSL level in the strict chronological order of
+		iQueuedRequests being incremented/decremented in the PIL, i.e. it might
+		happen that the PSL finds iQueuedRequests to have the same value in two
+		or more consecutive calls (that's why the previous observed value needs
+		to be locally available and taken into account). It is however promised
+		that before any actual transfer commences the PSL will find the request
+		count to be greater than zero and that after the last request has
+		finished it will be found to be zero.
 
 		None of the internal DMA framework mutexes is being held by the PIL
 		when calling this function.
 
+		Here is an example implementation for a derived channel class:
+
+		@code
+
+		class TFooDmaChannel : public TDmaSgChannel
+			{
+			DMutex* iDmaMutex;
+			TInt iPrevQueuedRequests;
+			virtual void QueuedRequestCountChanged();
+			};
+
+		void TFooDmaChannel::QueuedRequestCountChanged()
+			{
+			Kern::MutexWait(*iDmaMutex);
+			if ((iQueuedRequests > 0) && (iPrevQueuedRequests == 0))
+				{
+				IncreasePowerCount(); // Base port specific
+				}
+			else if ((iQueuedRequests == 0) && (iPrevQueuedRequests > 0))
+				{
+				DecreasePowerCount(); // Base port specific
+				}
+			iPrevQueuedRequests = iQueuedRequests;
+			Kern::MutexSignal(*iDmaMutex);
+			}
+
+		@endcode
+
 		@see iQueuedRequests
 	*/
 	virtual void QueuedRequestCountChanged();
@@ -1080,20 +1271,21 @@
 	NFastMutex iLock;		 // for data accessed in both client & DFC context
 	SDmaDesHdr* iCurHdr;	 // fragment being transferred or NULL
 	SDmaDesHdr** iNullPtr;	 // Pointer to NULL pointer following last fragment
-	TDfc iDfc;				  // transfer completion/failure DFC
-	TInt iMaxDesCount;		  // maximum number of allocable descriptors
-	TInt iAvailDesCount;	  // available number of descriptors
+	TDfc iDfc;				 // transfer completion/failure DFC
+	TInt iMaxDesCount;		 // maximum number of allocable descriptors
+	TInt iAvailDesCount;	 // available number of descriptors
 	volatile TUint32 iIsrDfc; // Interface between ISR and DFC:
 	enum {KErrorFlagMask = 0x80000000};	   // bit 31 - error flag
 	enum {KCancelFlagMask = 0x40000000};   // bit 30 - cancel flag
 	enum {KDfcCountMask = 0x3FFFFFFF};	   // bits 0-29 - number of queued DFCs
-	SDblQue iReqQ;				 // being/about to be transferred request queue
-	TInt iReqCount;				 // number of requests attached to this channel
-	TInt iQueuedRequests; // number of requests currently queued on this channel
+	SDblQue iReqQ;			// being/about to be transferred request queue
+	TInt iReqCount;			// number of requests attached to this channel
+	TInt iQueuedRequests; 	// number of requests currently queued on this channel
+
 private:
 	TDmaCancelInfo* iCancelInfo; // ...
-	TBool iRedoRequest;			 // client ISR callback wants a redo of request
-	TBool iIsrCbRequest;		 // request on queue using ISR callback
+	TBool iRedoRequest;		// client ISR callback wants a redo of request
+	TBool iIsrCbRequest;	// request on queue using ISR callback
 
 	__DMA_DECLARE_INVARIANT
 	};
@@ -1103,54 +1295,24 @@
 // INTERFACE WITH TEST HARNESS
 //////////////////////////////////////////////////////////////////////////////
 
-/** Set of information used by test harness.
+/** Provides access to test information structure stored in the PSL.
 
-	@publishedPartner
-	@released
+	Must be implemented by the PSL (v1).
+
+	@deprecated
 */
-struct TDmaTestInfo
-	{
-	/** Maximum transfer size in bytes for all channels (ie. the minimum of all channels' maximum size)*/
-	TUint iMaxTransferSize;
-	/** 3->Memory buffers must be 4-byte aligned, 7->8-byte aligned, ... */
-	TUint iMemAlignMask;
-	/** Cookie to pass to DDmaRequest::Fragment for memory-memory transfer*/
-	TUint32 iMemMemPslInfo;
-	/** Number of test single-buffer channels */
-	TInt iMaxSbChannels;
-	/** Pointer to array containing single-buffer test channel ids */
-	TUint32* iSbChannels;
-	/** Number of test double-buffer channels */
-	TInt iMaxDbChannels;
-	/** Pointer to array containing double-buffer test channel ids */
-	TUint32* iDbChannels;
-	/** Number of test scatter-gather channels */
-	TInt iMaxSgChannels;
-	/** Pointer to array containing scatter-gather test channel ids */
-	TUint32* iSgChannels;
-	};
+IMPORT_C const TDmaTestInfo& DmaTestInfo();
 
 
 /** Provides access to test information structure stored in the PSL.
 
-	Must be implemented by the PSL.
+	Must be implemented by the PSL (v2).
 
-	@publishedPartner
-	@released
-*/
-IMPORT_C const TDmaTestInfo& DmaTestInfo();
-
-/** Provides access to test information structure stored in the PSL.
-
-	Must be implemented by the PSL.
-
-	@publishedPartner
 	@released
 */
 IMPORT_C const TDmaV2TestInfo& DmaTestInfoV2();
 
 
-
 //////////////////////////////////////////////////////////////////////////////
 
 
--- a/kernel/eka/include/drivers/dma_v2.inl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/drivers/dma_v2.inl	Thu Jul 22 16:46:39 2010 +0100
@@ -26,28 +26,17 @@
 
 inline void TDmaChannel::Wait()
 	{
-	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::Wait thread %O channel - %d",
-									&Kern::CurrentThread(), iPslId));
 	NKern::FMWait(&iLock);
-	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::Wait thread %O channel - %d Acq",
-									&Kern::CurrentThread(), iPslId));
 	}
 
 inline void TDmaChannel::Signal()
 	{
-	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::Signal thread %O channel - %d",
-									&Kern::CurrentThread(), iPslId));
 	NKern::FMSignal(&iLock);
 	}
 
 inline TBool TDmaChannel::Flash()
 	{
-	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::Flash thread %O channel - %d",
-									&Kern::CurrentThread(), iPslId));
-	const TBool r = NKern::FMFlash(&iLock);
-	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::Flash thread %O channel - %d Acq (%d)",
-									&Kern::CurrentThread(), iPslId, r));
-	return r;
+	return NKern::FMFlash(&iLock);
 	}
 
 inline TBool TDmaChannel::IsOpened() const
--- a/kernel/eka/include/drivers/dmadefs.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/drivers/dmadefs.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -16,6 +16,10 @@
 //
 //
 
+/** @file
+	@publishedPartner
+*/
+
 #ifndef __DMADEFS_H__
 #define __DMADEFS_H__
 
@@ -23,40 +27,81 @@
 #include <e32def.h>
 
 
-/** The client request callback type */
+/** The client request callback type.
+
+*/
 enum TDmaCallbackType
 	{
-	/** Transfer request completion callback */
+	/** Transfer request completion callback
+
+		@released
+	*/
 	EDmaCallbackRequestCompletion        = 0x01,
-	/** Transfer request completion callback - source side */
+	/** Transfer request completion callback - source side
+
+		@prototype
+	*/
 	EDmaCallbackRequestCompletion_Src    = 0x02,
-	/** Transfer request completion callback - destination side */
+	/** Transfer request completion callback - destination side
+
+		@prototype
+	*/
 	EDmaCallbackRequestCompletion_Dst    = 0x04,
 
-	/** Descriptor completion callback */
+	/** Descriptor completion callback
+
+		@prototype
+	*/
 	EDmaCallbackDescriptorCompletion     = 0x08,
-	/** Descriptor completion callback - source side */
+	/** Descriptor completion callback - source side
+
+		@prototype
+	*/
 	EDmaCallbackDescriptorCompletion_Src = 0x10,
-	/** Descriptor completion callback - destination side */
+	/** Descriptor completion callback - destination side
+
+		@prototype
+	*/
 	EDmaCallbackDescriptorCompletion_Dst = 0x20,
 
-	/** Frame completion callback */
+	/** Frame completion callback
+
+		@prototype
+	*/
 	EDmaCallbackFrameCompletion          = 0x40,
-	/** Frame completion callback - source side */
+	/** Frame completion callback - source side
+
+		@prototype
+	*/
 	EDmaCallbackFrameCompletion_Src      = 0x80,
-	/** Frame completion callback - destination side */
+	/** Frame completion callback - destination side
+
+		@prototype
+	*/
 	EDmaCallbackFrameCompletion_Dst      = 0x100,
 
-	/** H/W descriptor pause event callback */
+	/** H/W descriptor pause event callback
+
+		@prototype
+	*/
 	EDmaCallbackLinkedListPaused        = 0x200,
-	/** H/W descriptor pause event callback - source side */
+	/** H/W descriptor pause event callback - source side
+
+		@prototype
+	*/
 	EDmaCallbackLinkedListPaused_Src    = 0x400,
-	/** H/W descriptor pause event callback - destination side */
+	/** H/W descriptor pause event callback - destination side
+
+		@prototype
+	*/
 	EDmaCallbackLinkedListPaused_Dst    = 0x800
 	};
 
 
-/** The outcome of the transfer request */
+/** The outcome of the transfer request.
+
+	@released
+*/
 enum TDmaResult
 	{
 	/** Completed without error */
@@ -66,7 +111,6 @@
 	};
 
 
-
 /** To be used with address mode field of the DMA transfer config struct.
 
 	@see TDmaTransferConfig::iAddrMode
@@ -75,24 +119,34 @@
 	{
 	/** Constant addressing. The address remains the same for consecutive
 		accesses.
+
+		@released
 	*/
 	KDmaAddrModeConstant,
 	/** Post-increment addressing. The address increases by the element size
 		after each access.
+
+		@released
 	*/
 	KDmaAddrModePostIncrement,
 	/** Post-decrement addressing. The address decreases by the element size
 		after each access.
+
+		@prototype
 	*/
 	KDmaAddrModePostDecrement,
 	/** 1D-index addressing. The address always increases by the element size
 		plus the element skip value after each access.
+
+		@prototype
 	*/
 	KDmaAddrMode1DIndex,
 	/** 2D-index addressing. The address increases by the element size plus the
 		element skip value - but only within a frame. Once a full frame has been
 		transferred, the address increases by the element size plus the element
 		skip value plus the frame skip value.
+
+		@prototype
 	*/
 	KDmaAddrMode2DIndex
 	};
@@ -102,6 +156,8 @@
 
 	@see SDmacCaps::iBurstTransactions
 	@see TDmaTransferConfig::iBurstSize
+
+	@prototype
 */
 enum TDmaBurstSize
 	{
@@ -132,18 +188,28 @@
 	{
 	/** Location is address of a memory buffer (as opposed to a peripheral or a
 		register).
+
+		@released
 	*/
 	KDmaMemAddr                      = 0x01,
 	/** Address is a physical address (as opposed to a linear one).
+
 		If it is a memory address then KDmaMemIsContiguous will need to be set
 		as well.
+
+		@released
 	 */
 	KDmaPhysAddr                     = 0x02,
 	/** Target memory is known to be physically contiguous, hence there is
 		no need for the framework to check for memory fragmentation.
+
+		@released
 	*/
 	KDmaMemIsContiguous              = 0x04,
-	/** Don't use packed access (if possible) */
+	/** Don't use packed access (if possible)
+
+		@released
+	*/
 	KDmaDontUsePacked                = 0x08,
 	/** Location is big endian (little endian if not set).
 
@@ -151,6 +217,8 @@
 		conversion.
 
 		@see SDmacCaps::iEndiannessConversion
+
+		@prototype
 	*/
 	KDmaBigEndian                    = 0x10,
 	/** Don't do endianness conversion even if applicable.
@@ -159,6 +227,8 @@
 		conversion.
 
 		@see SDmacCaps::iEndiannessConversion
+
+		@prototype
 	*/
 	KDmaLockEndian                   = 0x20,
 	/** Execute client request callback after each subtransfer (streaming /
@@ -172,6 +242,8 @@
 		destination are different), unless the flag
 		TDmaPILFlags::KDmaAsymCompletionCallback is set too, in which case what
 		is described there applies.
+
+		@prototype
 	*/
 	KDmaCallbackAfterEveryTransfer   = 0x40,
 	/** Execute client request callback after each completed hardware
@@ -183,6 +255,8 @@
 
 		@see SDmacCaps::iDescriptorInterrupt
 		@see SDmacCaps::iAsymDescriptorInterrupt
+
+		@prototype
 	*/
 	KDmaCallbackAfterEveryDescriptor = 0x80,
 	/** Execute client request callback after each completed frame.
@@ -193,6 +267,8 @@
 
 		@see SDmacCaps::iFrameInterrupt
 		@see SDmacCaps::iAsymFrameInterrupt
+
+		@prototype
 	*/
 	KDmaCallbackAfterEveryFrame      = 0x100
 	};
@@ -203,11 +279,13 @@
 
 	@see SDmacCaps::iSynchronizationTypes
 	@see TDmaTransferConfig::iSyncFlags
+
+	@released
 */
 enum TDmaTransferSyncFlags
 	{
 	/** Leave the decision on whether the transfer is hardware synchronized at
-		this end (either source or destination) to the Framework. This is the
+		this end (either source or destination) to the framework. This is the
 		default.
 	*/
 	KDmaSyncAuto        = 0x00,
@@ -245,6 +323,8 @@
 /** To be used with the Graphics operation field of a DMA transfer request.
 
 	@see TDmaTransferArgs::iGraphicsOps
+
+	@prototype
 */
 enum TDmaGraphicsOps
 	{
@@ -265,20 +345,28 @@
 	{
 	/** Request a different max transfer size (for instance for test
 		purposes).
+
+		@released
 	*/
 	KDmaAltTransferLength         = 0x01,
 	/** Execute client request callback in ISR context instead of from a
 		DFC.
+
+		@released
 	*/
 	KDmaRequestCallbackFromIsr    = 0x02,
 	/** Execute descriptor completion callback in ISR context instead of
 		from a DFC. This option is to be used in conjunction with the
 		TDmaTransferFlags::KDmaCallbackAfterEveryDescriptor flag.
+
+		@prototype
 	*/
 	KDmaDescriptorCallbackFromIsr = 0x04,
 	/** Execute frame completion callback in ISR context instead of
 		from a DFC. This option is to be used in conjunction with the
 		TDmaTransferFlags::KDmaCallbackAfterEveryFrame flag.
+
+		@prototype
 	*/
 	KDmaFrameCallbackFromIsr      = 0x08,
 	/** Execute the client request callback separately for source and
@@ -292,6 +380,8 @@
 		Requires the DMAC to support this feature.
 
 		@see SDmacCaps::iAsymCompletionInterrupt
+
+		@prototype
 	*/
 	KDmaAsymCompletionCallback    = 0x10,
 	/** Execute the descriptor completion callback separately for source
@@ -307,6 +397,8 @@
 		Requires the DMAC to support this feature.
 
 		@see SDmacCaps::iAsymDescriptorInterrupt
+
+		@prototype
 	*/
 	KDmaAsymDescriptorCallback    = 0x20,
 	/** Execute the frame completion callback separately for source and
@@ -321,10 +413,14 @@
 		Requires the DMAC to support this feature.
 
 		@see SDmacCaps::iAsymFrameInterrupt
+
+		@prototype
 	*/
 	KDmaAsymFrameCallback         = 0x40,
 	/** This transfer (only) should use the channel priority indicated by
 		TDmaTransferArgs::iChannelPriority.
+
+		@prototype
 	*/
 	KDmaRequestChannelPriority    = 0x80
 	};
@@ -335,6 +431,8 @@
 
 	@see TDmaChannel::SCreateInfo::iPriority
 	@see TDmaTransferArgs::iChannelPriority
+
+	@prototype
 */
 enum TDmaPriority
 	{
@@ -369,21 +467,26 @@
 	@see SDmacCaps::iSrcDstAsymmetry
 	@see TDmaTransferArgs::iSrcConfig
 	@see TDmaTransferArgs::iDstConfig
+
+	@released
 */
 struct TDmaTransferConfig
 	{
 friend struct TDmaTransferArgs;
 
-	/** Default constructor. Initializes all fields with meaningful default
-		values.
+	/** Default constructor.
+
+		Initializes all fields with meaningful default values.
 	*/
 #ifdef DMA_APIV2
 	KIMPORT_C
 #endif
 	TDmaTransferConfig();
 
-	/**	Intended for general use ie. not 2D or 1D transfers
-	 */
+	/**	Alternate constructor.
+
+		Intended for general use ie. not 1D or 2D transfers
+	*/
 #ifdef DMA_APIV2
 	KIMPORT_C
 #endif
@@ -399,8 +502,10 @@
 		TInt aRepeatCount = 0
 		);
 
-	/**	Intended for 1D and 2D transfers
-	 */
+	/**	Alternate constructor.
+
+		Intended for 1D and 2D transfers.
+	*/
 #ifdef DMA_APIV2
 	KIMPORT_C
 #endif
@@ -441,7 +546,7 @@
 	TInt iBurstSize;
 	/** PIL src/dst config flags.
 		@see TDmaTransferFlags
-	 */
+	*/
 	TUint32 iFlags;
 	/** Transfer synchronization flags.
 		@see TDmaTransferSyncFlags
@@ -450,19 +555,28 @@
 	/** Information passed to the PSL */
 	TUint iPslTargetInfo;
 	/** How often to repeat this (sub-)transfer:
-		0     no repeat (the default)
-		1..n  once / n times
+		 0     no repeat (the default)
+		 1..n  once / n times
 		-1     endlessly.
+
+		@prototype
 	*/
 	TInt iRepeatCount;
-	/** Structure contents delta vector (usage tbd) */
+	/** Structure contents delta vector.
+
+		(usage tbd)
+
+		@prototype
+	 */
 	TUint32 iDelta;
 	/** Reserved for future use */
 	TUint32 iReserved;
 
 private:
-	/** Private constructor. Initializes fields with the values passed in by
-		the legacy version of the DDmaRequest::Fragment() call.
+	/** Private constructor.
+
+		Initializes fields with the values passed in by the legacy version of
+		the DDmaRequest::Fragment() call.
 	*/
 	TDmaTransferConfig(TUint32 aAddr, TUint aFlags, TBool aAddrInc);
 	};
@@ -475,6 +589,8 @@
 	controller doesn't support hardware descriptors (scatter/gather LLI).
 
 	@see DDmaRequest::Fragment
+
+	@released
 */
 struct TDmaTransferArgs
 	{
@@ -483,17 +599,20 @@
 	friend class TDmac;
 	friend class DmaChannelMgr;
 
-	/** Default constructor. Initializes all fields with meaningful default
-		values.
+	/** Default constructor.
+
+		Initializes all fields with meaningful default values.
 	*/
 #ifdef DMA_APIV2
 	KIMPORT_C
 #endif
 	TDmaTransferArgs();
 
-	/**	For transfers where src and dst TDmaTransferConfig structs share some
-		of the same options ie. iDmaTransferFlags, iAddrMode, iSyncFlags,
-		iBurstSize, and iElementSize.
+	/**	Alternate constructor.
+
+		Intended for transfers where src and dst TDmaTransferConfig structs
+		share some of the same options, i.e. iDmaTransferFlags, iAddrMode,
+		iSyncFlags, iBurstSize, and iElementSize.
 
 		@param aSrcAddr
 		@param aDstAddr
@@ -513,17 +632,25 @@
 	KIMPORT_C
 #endif
 	TDmaTransferArgs (
-		TUint aSrcAddr, TUint aDstAddr, TUint aCount,
-		TUint aDmaTransferFlags, TUint aDmaSyncFlags = KDmaSyncAuto,
+		TUint aSrcAddr,
+		TUint aDstAddr,
+		TUint aCount,
+		TUint aDmaTransferFlags,
+		TUint aDmaSyncFlags = KDmaSyncAuto,
 		TUint aDmaPILFlags = 0,
-		TDmaAddrMode aMode = KDmaAddrModePostIncrement, TUint aElementSize = 0,
+		TDmaAddrMode aMode = KDmaAddrModePostIncrement,
+		TUint aElementSize = 0,
 		TUint aChannelPriority = KDmaPriorityNone,
-		TDmaBurstSize aBurstSize = KDmaBurstSizeAny, TUint aPslRequestInfo = 0,
-		TDmaGraphicsOps aGraphicOp = KDmaGraphicsOpNone, TUint32 aColour = 0
+		TDmaBurstSize aBurstSize = KDmaBurstSizeAny,
+		TUint aPslRequestInfo = 0,
+		TDmaGraphicsOps aGraphicOp = KDmaGraphicsOpNone,
+		TUint32 aColour = 0
 		);
 
-	/** For transfers needing specific options for source and destination
-		TDmaTransferConfig structs.
+	/** Alternate constructor.
+
+		Intended for transfers needing specific options for source and
+		destination TDmaTransferConfig structs.
 
 		@param aSrc Configuration values for the source
 		@param aDst Configuration values for the destination
@@ -531,7 +658,6 @@
 		@param aChannelPriority Use for this request (only) the indicated
 		channel priority. Requires KDmaRequestChannelPriority to be set in
 		iFlags as well. @see TDmaPriority
-
 		@param aPslRequestInfo Info word passed to the PSL
 		@param aGraphicOp Graphics operation to be executed
 		@param aColour Colour value for graphics operation
@@ -545,7 +671,8 @@
 		TUint32 aFlags = 0,
 		TUint aChannelPriority = KDmaPriorityNone,
 		TUint aPslRequestInfo = 0,
-		TDmaGraphicsOps aGraphicOp = KDmaGraphicsOpNone, TUint32 aColour = 0
+		TDmaGraphicsOps aGraphicOp = KDmaGraphicsOpNone,
+		TUint32 aColour = 0
 		);
 
 	/** Configuration values for the source */
@@ -580,25 +707,32 @@
 	TUint iChannelPriority;
 	/** Info word passed to the PSL */
 	TUint iPslRequestInfo;
+	/** Stores the PSL cookie returned by TDmaChannel::PslId() at request
+		fragmentation time.
 
-	/** Structure contents delta vector (usage tbd) */
+		The value PslId() is often (but not necessarily) identical with the
+		client's TDmaChannel::SCreateInfo::iCookie, which gets passed by the
+		PIL into DmaChannelMgr::Open() as 'aOpenId'.
+	*/
+	TUint32 iChannelCookie;
+	/** Structure contents delta vector.
+
+		(usage tbd)
+
+		@prototype
+	 */
 	TUint32 iDelta;
 	/** Reserved for future use */
 	TUint32 iReserved1;
 
 private:
-	/** Private constructor. Initializes fields with the values passed in by
-		the legacy version of the DDmaRequest::Fragment() call.
+	/** Private constructor.
+
+		Initializes fields with the values passed in by the legacy version of
+		the DDmaRequest::Fragment() call.
 	*/
 	TDmaTransferArgs(TUint32 aSrcAddr, TUint32 aDstAddr, TInt aCount,
 					 TUint aFlags, TUint32 aPslInfo);
-	/** Stores the PSL cookie returned by TDmaChannel::PslId() at request
-		fragmentation time.
-		The value PslId() is often (but not necessarily) identical with the
-		client's TDmaChannel::SCreateInfo::iCookie, which gets passed by the
-		PIL into DmaChannelMgr::Open() as 'aOpenId'.
-	*/
-	TUint32 iChannelCookie;
 	/** Reserved for future use */
 	TUint32 iReserved2;
 	};
@@ -609,24 +743,31 @@
 	Instances are to be filled in by the PSL and then linked to via TDmaChannel
 	objects after they have been opened.
 
-	The contents may vary even between channels on the same DMAC (but will
+	The contents may vary even between channels on the same DMAC (but should
 	remain constant for a given channel for the duration that it is open),
 	depending on static or dynamic factors which only the PSL knows about.
 
 	@see TDmaChannel::Open
 	@see TDmaChannel::DmacCaps
+
+	@released
 */
 struct SDmacCaps
 	{
-	/** DMAC supports n + 1 different channel priorities. */
+	/** DMAC supports n + 1 different channel priorities.
+	 */
 	TUint iChannelPriorities;
-	/** DMAC supports the pausing and resuming of channels. */
+	/** DMAC supports the pausing and resuming of channels.
+	 */
 	TBool iChannelPauseAndResume;
-	/** DMA addresses must be aligned on an element size boundary. */
+	/** DMA addresses must be aligned on an element size boundary.
+	 */
 	TBool iAddrAlignedToElementSize;
-	/** DMAC supports 1D (element) index addressing in hardware. */
+	/** DMAC supports 1D (element) index addressing in hardware.
+	 */
 	TBool i1DIndexAddressing;
-	/** DMAC supports 2D (frame) index addressing in hardware. */
+	/** DMAC supports 2D (frame) index addressing in hardware.
+	 */
 	TBool i2DIndexAddressing;
 	/** DMAC supports these transfer synchronization types (bitmap of values).
 
@@ -638,24 +779,31 @@
 		@see TDmaBurstSize
 	*/
 	TUint iBurstTransactions;
-	/** DMAC supports a 'h/w descriptor complete' interrupt. */
+	/** DMAC supports a 'h/w descriptor complete' interrupt.
+	 */
 	TBool iDescriptorInterrupt;
-	/** DMAC supports a 'frame transfer complete' interrupt. */
+	/** DMAC supports a 'frame transfer complete' interrupt.
+	 */
 	TBool iFrameInterrupt;
-	/** DMAC supports a 'linked-list pause event' interrupt. */
+	/** DMAC supports a 'linked-list pause event' interrupt.
+	 */
 	TBool iLinkedListPausedInterrupt;
-	/** DMAC supports endianness conversion. */
+	/** DMAC supports endianness conversion.
+	 */
 	TBool iEndiannessConversion;
 	/** DMAC supports these graphics operations (bitmap of values).
 
 		@see TDmaGraphicsOps
 	*/
 	TUint iGraphicsOps;
-	/** DMAC supports repeated transfers (loops). */
+	/** DMAC supports repeated transfers (loops).
+	 */
 	TBool iRepeatingTransfers;
-	/** DMAC supports logical channel linking (chaining). */
+	/** DMAC supports logical channel linking (chaining).
+	 */
 	TBool iChannelLinking;
-	/** DMAC supports scatter/gather mode (linked list items). */
+	/** DMAC supports scatter/gather mode (linked list items).
+	 */
 	TBool iHwDescriptors;
 	/** DMAC supports asymmetric source and destination transfer
 		parameters (such as element size).
@@ -712,10 +860,51 @@
 	};
 
 
+//////////////////////////////////////////////////////////////////////////////
+// INTERFACE WITH TEST HARNESS
+//////////////////////////////////////////////////////////////////////////////
+
+/** Set of information used by test harness.
+
+	@deprecated
+*/
+#ifdef DMA_APIV2
+struct TDmaTestInfo
+	{
+	/** Maximum transfer size in bytes for all channels (ie. the minimum of all
+		channels' maximum size)
+	*/
+	TUint iMaxTransferSize;
+	/** 3->Memory buffers must be 4-byte aligned, 7->8-byte aligned, ... */
+	TUint iMemAlignMask;
+	/** Cookie to pass to DDmaRequest::Fragment for memory-memory transfer */
+	TUint32 iMemMemPslInfo;
+	/** Number of test single-buffer channels */
+	TInt iMaxSbChannels;
+	/** Pointer to array containing single-buffer test channel ids */
+	TUint32* iSbChannels;
+	/** Number of test double-buffer channels */
+	TInt iMaxDbChannels;
+	/** Pointer to array containing double-buffer test channel ids */
+	TUint32* iDbChannels;
+	/** Number of test scatter-gather channels */
+	TInt iMaxSgChannels;
+	/** Pointer to array containing scatter-gather test channel ids */
+	TUint32* iSgChannels;
+	};
+#endif
+
+
+/** Set of information used by test harness.
+
+	@released
+*/
 struct TDmaV2TestInfo
 	{
 	enum {KMaxChannels=32};
-	/** Maximum transfer size in bytes for all channels (ie. the minimum of all channels' maximum size)*/
+	/** Maximum transfer size in bytes for all channels (ie. the minimum of all
+		channels' maximum size)
+	*/
 	TUint iMaxTransferSize;
 	/** 3->Memory buffers must be 4-byte aligned, 7->8-byte aligned, ... */
 	TUint iMemAlignMask;
--- a/kernel/eka/include/drivers/locmedia.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/drivers/locmedia.h	Thu Jul 22 16:46:39 2010 +0100
@@ -385,6 +385,7 @@
 		EDataPaging=0x40,			// a data paging request
 		ETClientBuffer=0x80,		// RemoteDes() points to a TClientBuffer
 		EKernelBuffer=0x100,		// RemoteDes() points to a kernel-side buffer : set for all paging requests and media extension requests
+		EPhysAddrOnly=0x200,        // No virtual address is available. Data Paging requests Only. 
 		};
 public:
     
@@ -1039,6 +1040,12 @@
 	inline static TBool PageInRequest(TLocDrvRequest& aReq);
 	inline static TBool PageOutRequest(TLocDrvRequest& aReq);
 	inline static TBool PagingRequest(TLocDrvRequest& aReq);
+		
+	virtual TInt WritePhysical(TThreadMessage* aReq, TPhysAddr* aPageArray, TUint aPageCount, TUint aOffset, TBool aBackground);
+	virtual TInt ReadPhysical(TThreadMessage* aReq, TPhysAddr* aPageArray, TUint aPageCount, TUint aOffset, TInt aDrvNumber);
+private:    
+    virtual TInt BaseRead(TThreadMessage* aReq,TUint32 aBuffer,TUint aOffset,TUint aSize,TInt aDrvNumber,TBool aPhysAddr);
+    virtual TInt BaseWrite(TThreadMessage* aReq,TUint32 aBuffer,TUint aOffset,TUint aSize, TBool aBackground,TBool aPhysAddr); 
 public:
 	TMessageQue iMainQ;
 	TMessageQue iDeferredQ;
--- a/kernel/eka/include/drivers/mmc.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/drivers/mmc.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1540,7 +1540,8 @@
 	enum TCardTypes
 		{
 		EHighSpeedCard26Mhz = 0x01,
-		EHighSpeedCard52Mhz = 0x02
+		EHighSpeedCard52Mhz = 0x02,
+		ECardTypeMsk        = 0x03 
 		};
 	
 	/**
@@ -1714,6 +1715,9 @@
 	
 	/** returns the contents of the S_A_TIMEOUT field */
 	inline TUint SleepAwakeTimeout() const;
+	
+	/** returns True if the CARD_TYPE field conatains a valid value **/
+	inline TBool IsSupportedCardType() const;
 
 private:
 	/** 
--- a/kernel/eka/include/drivers/mmc.inl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/drivers/mmc.inl	Thu Jul 22 16:46:39 2010 +0100
@@ -190,6 +190,19 @@
 inline TUint TExtendedCSD::BootBusWidth() const {return iData[EBootBusWidthIndex];}
 inline TUint TExtendedCSD::EraseGroupDef() const {return iData[EEraseGroupDefIndex];}
 
+/*
+ * MMC v4.3 specification states the only valid values for CardType are 0x01 or 0x03
+ */
+inline TBool TExtendedCSD::IsSupportedCardType() const        
+        {
+        switch (CardType()&ECardTypeMsk)
+            {
+            case 0x01:
+            case 0x03: return ETrue;
+            default: return EFalse;
+            }
+        }
+
 //	--------  class TMMCStatus  --------
  /**
  * Constructor for TMMCStatus.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/include/drivers/resourcecontrol_clientsettings.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,109 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32\include\drivers\resourcecontrol_clientsettings.h
+//
+//
+
+#ifndef __RESOURCECONTROL_CLIENTSETTINGS_H__
+#define __RESOURCECONTROL_CLIENTSETTINGS_H__
+
+#include <drivers/hcr.h>
+
+const TUint KBitPerClientSettings = 5; // 0 - 31, Max of 32 elements defined for use per client
+const TUint KClientElementIdBase = 0x10;	// Max of 16 elements defined for use by resman
+const TUint8 KStaticResourceTableSize = 5;
+
+inline TUint ElementId_ClientSettingBase(TUint aClientToken)
+	{
+	return	((aClientToken << KBitPerClientSettings) + KClientElementIdBase);
+	}
+
+inline HCR::TElementId ElementId_ClientName(TUint aClientToken)
+	{
+	return ((HCR::TElementId) ElementId_ClientSettingBase(aClientToken));
+	}
+
+inline HCR::TElementId ElementId_ClientPropertyFlag(TUint aClientToken)
+	{
+	return ((HCR::TElementId) (ElementId_ClientSettingBase(aClientToken) + 1));
+	}
+
+inline HCR::TElementId ElementId_ClientPreallocation(TUint aClientToken)
+	{
+	return ((HCR::TElementId) (ElementId_ClientSettingBase(aClientToken) + 2));
+	}
+
+inline HCR::TElementId ElementId_ClientStaticResource(TUint aClientToken, TUint aResource)
+	{
+	return ((HCR::TElementId) (ElementId_ClientSettingBase(aClientToken) + 3 + aResource));
+	}
+
+inline HCR::TElementId ElementId_ClientDynamicResource(TUint aClientToken, TUint aResource)
+	{
+	return ((HCR::TElementId) (ElementId_ClientSettingBase(aClientToken) + 3 + KStaticResourceTableSize + aResource));
+	}
+
+
+// Dynamic Resource Settings
+
+const TUint KDynamicResourceElementIdBase = 0x20000;
+const TUint KBitPerDynamicResourceSettings = 5; // 0 - 31, Max of 32 elements defined for use per dynamic resource
+
+inline TUint ElementId_DynamicResourceBase(TUint aDynamicResource)
+	{
+	return ((aDynamicResource << KBitPerDynamicResourceSettings) + KDynamicResourceElementIdBase);
+	}
+
+inline HCR::TElementId ElementId_DynamicResourceName(TUint aDynamicResource)
+	{
+	return ((HCR::TElementId) (ElementId_DynamicResourceBase(aDynamicResource)));
+	}
+
+inline HCR::TElementId ElementId_DynamicResourcePropertyFlag(TUint aDynamicResource)
+	{
+	return ((HCR::TElementId) (ElementId_DynamicResourceBase(aDynamicResource) + 1));
+	}
+
+inline HCR::TElementId ElementId_DynamicResourceMaxLevel(TUint aDynamicResource)
+	{
+	return ((HCR::TElementId) (ElementId_DynamicResourceBase(aDynamicResource) + 2));
+	}
+
+inline HCR::TElementId ElementId_DynamicResourceMinLevel(TUint aDynamicResource)
+	{
+	return ((HCR::TElementId) (ElementId_DynamicResourceBase(aDynamicResource) + 3));
+	}
+
+inline HCR::TElementId ElementId_DynamicResourceDefaultLevel(TUint aDynamicResource)
+	{
+	return ((HCR::TElementId) (ElementId_DynamicResourceBase(aDynamicResource) + 4));
+	}
+
+inline HCR::TElementId ElementId_DynamicResourceDependencyMask1(TUint aDynamicResource)
+	{
+	return ((HCR::TElementId) (ElementId_DynamicResourceBase(aDynamicResource) + 5));
+	}
+
+inline HCR::TElementId ElementId_DynamicResourceDependencyMask2(TUint aDynamicResource)
+	{
+	return ((HCR::TElementId) (ElementId_DynamicResourceBase(aDynamicResource) + 6));
+	}
+
+inline HCR::TElementId ElementId_DynamicResourceDependencyMask3(TUint aDynamicResource)
+	{
+	return ((HCR::TElementId) (ElementId_DynamicResourceBase(aDynamicResource) + 7));
+	}
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/include/drivers/resourcecontrol_settings.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,29 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32\include\drivers\resourcecontrol_settings.h
+//
+//
+
+#ifndef __RESOURCECONTROL_SETTINGS_H__
+#define __RESOURCECONTROL_SETTINGS_H__
+
+#include <drivers/hcr.h>
+
+const HCR::TElementId KPRMPoolSizeKernelClient = 0;
+const HCR::TElementId KPRMPoolSizeUserClient = 1;
+const HCR::TElementId KPRMPoolSizeClientLevel = 2;
+const HCR::TElementId KPRMPoolSizeClientRequest = 3;
+
+#endif
+
--- a/kernel/eka/include/drivers/sdcard.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/drivers/sdcard.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -82,12 +82,16 @@
 	inline TUint32 PARootDirEnd() const;
 	inline void SetPARootDirEnd(TUint32 aPARootDirEnd);
 	virtual TUint MaxTranSpeedInKilohertz() const;
+	inline void RegisterClient();
+	inline void DeregisterClient();
+	inline TBool ClientsRegistered();
 private:
 	TUint32 iProtectedAreaSize;
 	TUint32 iPARootDirEnd;
 	TUint8	iAUSize;
 	TUint8 iPad[3];
-	TUint32 iSpare[4];
+	TUint32 iClientCountSD;
+	TUint32 iSpare[3];
 	};
 
 class TSDCardArray : public TMMCardArray
--- a/kernel/eka/include/drivers/sdcard.inl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/drivers/sdcard.inl	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -44,6 +44,34 @@
 inline TUint32 TSDCard::PARootDirEnd() const			{return iPARootDirEnd;}
 inline void TSDCard::SetPARootDirEnd(TUint32 aPARootDirEnd)	{iPARootDirEnd=aPARootDirEnd;}
 
+/**
+Called when a client registers with the SD card.
+*/
+inline void TSDCard::RegisterClient()
+	{
+	__e32_atomic_add_ord32(&iClientCountSD, 1);
+	}
+
+/**
+Called when a client de-registers with the SD card.
+*/	
+inline void TSDCard::DeregisterClient()
+
+	{ 
+	__e32_atomic_add_ord32(&iClientCountSD, TUint32(-1));
+	}
+
+/**
+Returned value indicates whether or not clients have registered with the SD card.
+*/
+inline TBool TSDCard::ClientsRegistered()
+	{
+	if(iClientCountSD)
+		return ETrue;
+
+	return EFalse;
+	}
+
 // ======== TSDCardArray ========
 
 inline TSDCardArray::TSDCardArray(DSDStack* aOwningStack) : TMMCardArray(aOwningStack)
--- a/kernel/eka/include/drivers/smppower/idlehelper.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/drivers/smppower/idlehelper.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,22 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  
-* os\kernelhwsrv\kernel\eka\include\drivers\smpidlehelper.h
-* Helper classes required to implement CPU idle
-* functionality in a SMP BSP.
-*
-*/
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL " http://www.eclipse.org/legal/epl-v10.html ".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// os\kernelhwsrv\kernel\eka\include\drivers\smppower\idlehelper.h
+// Helper classes required to implement CPU idle
+// functionality in a SMP BSP.
 
 
 /**
--- a/kernel/eka/include/drivers/smppower/sample_idlehandler/smpidlehandler.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/drivers/smppower/sample_idlehandler/smpidlehandler.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,22 +1,18 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  
-* os/kernelhwsrv/kernel/eka/include/drivers/smppower/sample_idlehandler/smpidlehandler.h
-* Example of a generic idle handler layer
-*
-*/
-
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL " http://www.eclipse.org/legal/epl-v10.html ".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// eka/drivers/smppower/sample_idlehandler/smpidlehandler.h
+// Example of a generic idle handler layer
 
 
 #ifndef __SMPIDLEHANDLER_H__
@@ -41,6 +37,8 @@
     
 
     DSMPIdleHandler();
+	virtual ~DSMPIdleHandler();
+
     /*
       called to init and bind the idle handler. After this call idle will be directed to idle handler
       @pre thread context, no locks no fast mutexes, interrupt on
--- a/kernel/eka/include/drivers/xyin.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/drivers/xyin.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -27,6 +27,7 @@
 #include <platform.h>
 #include <e32hal.h>
 
+
 #ifdef _DEBUG
 //#define __DIGITISER_DEBUG1__
 //#define __DIGITISER_DEBUG2__
@@ -180,6 +181,7 @@
 	TState iState;
 	TInt iCount;
 	TUint8 iPointerOn;
+	TInt iOrientation;	 			// HALData::TDigitizerOrientation
 	};
 
 
--- a/kernel/eka/include/e32cia.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/e32cia.h	Thu Jul 22 16:46:39 2010 +0100
@@ -39,6 +39,7 @@
 #define CSM_Z15PanicStrayEventv " PanicStrayEvent__Fv"
 #define CSM_ZN8CServer210BadMessageERK9RMessage2 " BadMessage__8CServer2RC9RMessage2"
 #define CSM_ZN10RSemaphore4WaitEv " Wait__10RSemaphore"
+#define CSM_ZN10RSemaphore4WaitEi " Wait__10RSemaphorei"
 #define CSM_Z34PanicCObjectConFindIndexOutOfRangev " PanicCObjectConFindIndexOutOfRange__Fv"
 #define CSM_ZN7TRegion5ClearEv " Clear__7TRegion"
 #define CSM_ZN4User5AllocEi " Alloc__4Useri"
@@ -73,6 +74,7 @@
 #define CSM_Z15PanicStrayEventv " __cpp(PanicStrayEvent)"
 #define CSM_ZN8CServer210BadMessageERK9RMessage2 " __cpp(CServer2::BadMessage)"
 #define CSM_ZN10RSemaphore4WaitEv " __cpp(static_cast<void (RSemaphore::*) ()>(&RSemaphore::Wait))"
+#define CSM_ZN10RSemaphore4WaitEi " __cpp(static_cast<TInt (RSemaphore::*) (TInt)>(&RSemaphore::Wait))"
 #define CSM_Z34PanicCObjectConFindIndexOutOfRangev " __cpp(PanicCObjectConFindIndexOutOfRange)"
 #define CSM_ZN7TRegion5ClearEv " __cpp(TRegion::Clear)"
 #define CSM_ZN4User5AllocEi " __cpp(User::Alloc)"
@@ -106,6 +108,7 @@
 #define CSM_Z15PanicStrayEventv " _Z15PanicStrayEventv"
 #define CSM_ZN8CServer210BadMessageERK9RMessage2 " _ZN8CServer210BadMessageERK9RMessage2"
 #define CSM_ZN10RSemaphore4WaitEv " _ZN10RSemaphore4WaitEv"
+#define CSM_ZN10RSemaphore4WaitEi " _ZN10RSemaphore4WaitEi"
 #define CSM_Z34PanicCObjectConFindIndexOutOfRangev " _Z34PanicCObjectConFindIndexOutOfRangev"
 #define CSM_ZN7TRegion5ClearEv " _ZN7TRegion5ClearEv"
 #define CSM_ZN4User5AllocEi " _ZN4User5AllocEi"
--- a/kernel/eka/include/e32cmn.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/e32cmn.h	Thu Jul 22 16:46:39 2010 +0100
@@ -2488,6 +2488,7 @@
 	IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess);
 	IMPORT_C void Wait();
 	IMPORT_C TInt Wait(TInt aTimeout);	// timeout in microseconds
+	IMPORT_C TInt Poll();		// acquire the semaphore if possible, but don't block
 	IMPORT_C void Signal();
 	IMPORT_C void Signal(TInt aCount);
 #endif
@@ -2511,6 +2512,8 @@
 	inline RFastLock();
 	IMPORT_C TInt CreateLocal(TOwnerType aType=EOwnerProcess);
 	IMPORT_C void Wait();
+	IMPORT_C TInt Wait(TInt aTimeout);	// timeout in microseconds
+	IMPORT_C TInt Poll();		// acquire the lock if possible, but don't block
 	IMPORT_C void Signal();
 private:
 	TInt iCount;
@@ -5398,6 +5401,7 @@
 	IMPORT_C RArrayBase(TInt anEntrySize, TInt aMinGrowBy, TInt aKeyOffset, TInt aFactor);
 	IMPORT_C RArrayBase(TInt aEntrySize,TAny* aEntries, TInt aCount);
 	IMPORT_C void Close();
+	IMPORT_C void SetKeyOffset(TInt aKeyOffset);
 	IMPORT_C TInt Count() const;
 	IMPORT_C TAny* At(TInt anIndex) const;
 	IMPORT_C TInt Append(const TAny* anEntry);
@@ -5496,6 +5500,7 @@
 	inline RArray(TInt aMinGrowBy, TInt aKeyOffset, TInt aFactor);
 	inline RArray(TInt aEntrySize,T* aEntries, TInt aCount);
 	inline void Close();
+	inline void SetKeyOffset(TInt aKeyOffset);
 	inline TInt Count() const;
 	inline const T& operator[](TInt anIndex) const;
 	inline T& operator[](TInt anIndex);
--- a/kernel/eka/include/e32cmn.inl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/e32cmn.inl	Thu Jul 22 16:46:39 2010 +0100
@@ -4866,6 +4866,21 @@
 
 
 template <class T>
+inline void RArray<T>::SetKeyOffset(TInt aOffset)
+/**
+Sets the offset of the ordering key within each array entry.
+
+@param aKeyOffset   The key offset.
+
+@panic USER 128, if aKeyOffset is not positive, or is not less than the 
+       size of class T, or is not a multiple of 4.
+*/
+	{RArrayBase::SetKeyOffset(aOffset);}
+
+
+
+
+template <class T>
 inline TInt RArray<T>::Count() const
 /**
 Gets the number of objects in the array.
--- a/kernel/eka/include/e32math.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/e32math.h	Thu Jul 22 16:46:39 2010 +0100
@@ -456,11 +456,6 @@
 	IMPORT_C static TInt ATan(TReal &aTrg,const TReal &aSrc);
 	IMPORT_C static TInt ATan(TReal &aTrg,const TReal &aSrcY,const TReal &aSrcX);
 	IMPORT_C static TInt Cos(TReal &aTrg,const TReal &aSrc);
-	
-	/**
-	This function is not implemented by Symbian OS.
-	*/
-	IMPORT_C static TInt DtoR(TReal &aTrg,const TDesC &aSrc,TInt &aPos,const TChar aPoint);
 	IMPORT_C static TInt Exp(TReal &aTrg,const TReal &aSrc);
 	IMPORT_C static TInt Frac(TReal &aTrg,const TReal &aSrc);
 	IMPORT_C static TInt Int(TReal &aTrg,const TReal &aSrc);
--- a/kernel/eka/include/e32std.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/e32std.h	Thu Jul 22 16:46:39 2010 +0100
@@ -3314,6 +3314,8 @@
 	IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,TOwnerType aType=EOwnerProcess);
 	IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess);
 	IMPORT_C void Wait();
+	IMPORT_C TInt Poll();		// acquire the lock if possible, but don't block
+	IMPORT_C TInt Wait(TInt aTimeout);	// timeout in microseconds
 	IMPORT_C void Signal();
 	IMPORT_C TBool IsHeld();
 	};
--- a/kernel/eka/include/e32ver.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/e32ver.h	Thu Jul 22 16:46:39 2010 +0100
@@ -28,7 +28,7 @@
 
 const TInt KE32MajorVersionNumber=2;
 const TInt KE32MinorVersionNumber=0;
-const TInt KE32BuildVersionNumber=3072;
+const TInt KE32BuildVersionNumber=3098;
 
 const TInt KMachineConfigurationMajorVersionNumber=1;
 const TInt KMachineConfigurationMinorVersionNumber=0;
--- a/kernel/eka/include/emulator.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/emulator.h	Thu Jul 22 16:46:39 2010 +0100
@@ -33,6 +33,10 @@
 class TUidType;
 class TProcessCreateInfo;
 
+// Names of sections that we are interested in looking at.  These are used by the GetSectionsSize()
+// routine to determine the minimum number of bytes of a DLL to map into memory in order to examine
+// its sections.  If a new section is added here then it must also be added to the list of sections
+// held in the sectionNames array in GetSectionsSize()
 static const BYTE KWin32SectionName_Symbian[IMAGE_SIZEOF_SHORT_NAME]	= {'.','S','Y','M','B','I','A','N'};
 static const BYTE KWin32SectionName_Import[IMAGE_SIZEOF_SHORT_NAME]		= {'.','i','d','a','t','a','\0','\0'};
 static const BYTE KWin32SectionName_EpocData[IMAGE_SIZEOF_SHORT_NAME]	= {'.','d','a','t','a','\0','\0','\0'};
--- a/kernel/eka/include/kernel/cache.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/kernel/cache.h	Thu Jul 22 16:46:39 2010 +0100
@@ -126,10 +126,40 @@
 	On SMP platforms, it only maintains internal cache of the CPU that executes the call.
 	Cache memory common to the all cores (like external cache controllers) are also synchronised.
 	@pre Interrupts must be disabled.
+	@deprecated in TB 10.1 Use Cache::CpuRetires and Cache::KernelRetires
 	*/
 	IMPORT_C static void AtomicSyncMemory();
 
 	/**
+	Synchronises cache(s) of the current CPU with the next memory level (which may also be cache)
+	prior to power off or reboot. Caches in other CPUs and those that are shared among them are not affected.
+
+	Shut down or reboot sequence should ensure that the context of cache memories is copied down to the main
+	memory prior CPU/cache power off. In order to achieve this goal, the following should be obeyed:
+	 - On SMP H/W, any CPU that is about to shut down or reboot should call this method. The very last
+	   running CPU should call both this method and Cache::KernelRetires method.
+	 - On non-SMP H/W. CPU that is about to shut down or reboot should call this method. Call to
+	   Cache::KernelRetires is not required.
+
+	Both Cache::CpuRetires and Cache::KernelRetires assume that Kernel may not be in stable state (as reboot may
+	be caused by crash), so no attampt will be made to acquire spin lock or call any other Kernel interface.
+
+	@see Cache::KernelRetires
+	@pre Interrupts must be disabled.
+	@pre Kernel may not be in stable state.
+	*/
+	IMPORT_C static void CpuRetires();
+
+	/*
+	Synchronises cache(s) that are shared among CPUs with the main memory prior to power off or reboot.
+	@see Cache::CpuRetires
+	@pre Interrupts must be disabled.
+	@pre Kernel may not be in stable state.
+	@pre All CPUs other than the current CPU are powered down or their reboot sequence is completed.
+	*/
+	IMPORT_C static void KernelRetires();
+	
+	/**
 	Synchronises cache(s) prior to a DMA write (memory to HW DMA transfer) operation.
 
 	The purpose of SyncMemoryBeforeDmaWrite is to make sure that the main memory is synchronised 
--- a/kernel/eka/include/kernel/cache_maintenance.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/kernel/cache_maintenance.h	Thu Jul 22 16:46:39 2010 +0100
@@ -301,7 +301,9 @@
 /*
  * Cleans and invalidates the entire content of data and unified cache(s) and drains
  * write buffers (DSB barrier)..
- * On SMP, only the running core is maintained. 
+ * On SMP, only the running core is maintained.
+ * This methos is called during reboot or power down sequence and therefore is not allowed
+ * to do Kernel calls that may hold spin lock - such as Kern::Print or precondition checkings.
  */
 	static void CleanAndInvalidate_DCache_All();
 
--- a/kernel/eka/include/kernel/kbma.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/kernel/kbma.h	Thu Jul 22 16:46:39 2010 +0100
@@ -39,6 +39,7 @@
 	IMPORT_C void Free(TInt aPos);
 	IMPORT_C void Alloc(TInt aStart, TInt aLength);
 	IMPORT_C void Free(TInt aStart, TInt aLength);
+	IMPORT_C TUint SelectiveAlloc(TInt aStart, TInt aLength);
 	IMPORT_C void SelectiveFree(TInt aStart, TInt aLength);
 	IMPORT_C TBool NotFree(TInt aStart, TInt aLength) const;
 	IMPORT_C TBool NotAllocated(TInt aStart, TInt aLength) const;
--- a/kernel/eka/include/kernel/kern_priv.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/kernel/kern_priv.h	Thu Jul 22 16:46:39 2010 +0100
@@ -745,7 +745,7 @@
 	void ChangePendingThreadPriority(DThread* aThread, TInt aNewPriority);
 	void WakeUpNextThread();
 public:
-	TInt Wait();
+	TInt Wait(TInt aTimeout=0);	// 0 means wait forever, -1 means poll, n>0 means n nanokernel ticks
 	void Signal();
 	void Reset();
 public:
@@ -2740,6 +2740,22 @@
 class M
 	{
 public:
+	/**
+	Flags to control the moving or discarding of a page via the methods M::DiscardPage(),
+	M::MovePage()and M::MoveAndAllocPage().
+	*/
+	enum TMoveDiscardFlags
+		{
+		/** Set this flag so dirty discardable page are moved rather than 
+			written to swap.
+		*/
+		EMoveDisMoveDirty = 0x1,
+		/** Set this so the attempt to allocate the location to move the page to 
+			will fail if the blocked RAM zone is reached.
+		*/
+		EMoveDisBlockRest = 0x2,
+		};
+
 	static void Init1();
 	static void Init2();
 #ifdef __SMP__
@@ -2786,8 +2802,10 @@
 	static void RamAllocIsLocked();
 	static TUint NumberOfFreeDpPages();
 	static TUint NumberOfDirtyDpPages();
-	static TInt MovePage(TPhysAddr aOld, TPhysAddr& aNew, TUint aBlockZoneId, TBool aBlockRest);
-	static TInt DiscardPage(TPhysAddr aAddr, TUint aBlockZoneId, TBool aBlockRest);
+	static TInt MovePage(TPhysAddr aOld, TPhysAddr& aNew, TUint aBlockZoneId, TUint aMoveDisFlags);
+	static TInt MoveAndAllocPage(TPhysAddr aAddr, TZonePageType aPageType);
+	static TInt DiscardPage(TPhysAddr aAddr, TUint aBlockZoneId, TUint aMoveDisFlags);
+	static TBool GetFreePages(TUint aNumPages);
 	static void RamZoneClaimed(SZone* aZone);
 	static TInt RamDefragFault(TAny* aExceptionInfo);
 	};
--- a/kernel/eka/include/kernel/kerncorestats.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/kernel/kerncorestats.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,7 +1,7 @@
 // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
+// under the terms of the License "Eclipse Public License v1.0"
 // which accompanies this distribution, and is available
 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 //
--- a/kernel/eka/include/kernel/kernel.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/kernel/kernel.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1994-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -229,7 +229,6 @@
 
 
 const TUint8 KMutexOrdRamDrive			= KMutexOrdGeneral7; /**< @internalComponent */
-const TUint8 KMutexOrdDmaChannel		= 0x70; /**< @internalComponent */
 const TUint8 KMutexOrdShPool			= 0x68; /**< @internalComponent */
 const TUint8 KMutexOrdCodeSegLock		= 0x60; /**< @internalComponent */
 const TUint8 KMutexOrdPubSub2			= 0x5e; /**< @internalComponent */
@@ -2794,6 +2793,12 @@
 		EDriveDataPaging = -2,	/**< Special drive number to indicate data paging. */
 		};
 
+	/** Additional flags. */
+	enum TFlags
+		{
+		ESupportsPhysicalAccess = 1<<0,  /**< Supports ReadPhysical and WritePhysical methods. */
+		};
+
 	/**
 	Called by the paging system to read data from the media represented by this
 	device.
@@ -2845,6 +2850,55 @@
 	IMPORT_C NFastMutex* NotificationLock();
 	
 	/**
+	Called by the paging system to read data from the media represented by this device using
+	physical addresses, if the device supports it.
+	
+	This is intended to allow reading pages from swap without needing to map them first, and should
+	be implemented by media drivers that support DMA access.
+
+	If this method is implemented, the ESupportsPhysicalAccess flag in iFlags must be set as well.
+
+	The default implementation of this method just returns KErrNotSupported.
+
+	@param aPageArray   Pointer to array of physical address to write to.
+	@param aPageCount   Number of physical pages to read.
+	@param aOffset      The offset from the media start, in read units, from where data should be read.
+	
+	@param aDrvNumber The drive number for code paging or a member of TSpecialDrives for rom or data
+	paging.
+
+	@return KErrNone or standard error code.
+	*/
+	inline virtual TInt ReadPhysical(TThreadMessage* aReq, TPhysAddr* aPageArray, TUint aPageCount, TUint aOffset, TInt aDrvNumber);
+
+	/**
+	Called by the paging system to write data to the media represented by this device using physical
+	addresses, if the device supports it.
+
+	This is only used in the implementation of data paging to write to the swap partition.
+
+	This method takes a pointer to an array of physical addresses and the number of pages to write,
+	in contrast to #Write which takes a logical address and a number of read units.
+
+	This is intended to allow writing pages to swap without needing to map them first, and should be
+	implelemented by media drivers that support DMA access.
+
+	If this method is implemented, the ESupportsPhysicalAccess flag in iFlags must be set as well.
+
+	The default implementation of this method just returns KErrNotSupported.
+
+	@param aPageArray   Pointer to array of physical address to read from.
+	@param aPageCount   Number of physical pages to write.
+	@param aOffset      The offset from the media start, in read units, to where data should be
+		   			    written.
+	@param aBackground  If set, this indicates that the request should not count as making the 
+		   				device busy.
+
+	@return KErrNone or standard error code.
+	*/
+	inline virtual TInt WritePhysical(TThreadMessage* aReq, TPhysAddr* aPageArray, TUint aPageCount, TUint aOffset, TBool aBackground);
+	
+	/**
 	Called by the paging device to notify the kernel that the device has just become idle and is not
 	currently processing any requests.
 
@@ -2868,7 +2922,10 @@
 	
 public:
 	/** The type of device this represents. */
-	TUint32 iType;
+	TUint16 iType;
+
+	/** Flags bitfield made up of members of TFlags. */
+	TUint16 iFlags;
 
 	/** The local drives supported for code paging.
 	    This is a bitmask containing one bit set for each local drive supported, where the bit set
@@ -2903,20 +2960,48 @@
 	*/
 	DPagingRequestPool* iRequestPool;
 
+	/** Log2 of the media's preferred write size in bytes.
+
+		E.g. if the preferred write size is 16KB, this should be set 14.
+		
+		Some media may exhibit poor performance unless writes happen in multiples of the superpage
+		size.  In this case the media driver would set this field to indicate the write size, and
+		the kernel will attempt to:
+		
+		 - write in multiples of the preferred size
+		 - align writes to multiples of the preferred size
+
+		Note that this value cannot be less the size of a page (eg 12) and there may be a maximum
+		limit to what the kernel will write as well.
+	*/
+	TUint32 iPreferredWriteShift;
+
 	/** Reserved for future use.
 	*/
-	TInt iSpare[4];
+	TInt iSpare[3];
 	};
 
-inline TInt DPagingDevice::Write(TThreadMessage*,TLinAddr,TUint,TUint,TBool)
+inline TInt DPagingDevice::Write(TThreadMessage*, TLinAddr, TUint, TUint, TBool)
+	{
+	// Default implementation, may be overriden by derived classes
+	return KErrNotSupported;
+	}
+
+inline TInt DPagingDevice::ReadPhysical(TThreadMessage*, TPhysAddr*, TUint, TUint, TInt)
 	{
-	// Default implementation, may be overriden by dervied classes
+	// Default implementation, may be overriden by derived classes
+	return KErrNotSupported;
+	}
+	
+inline TInt DPagingDevice::WritePhysical(TThreadMessage*, TPhysAddr*, TUint, TUint, TBool)
+	{
+	// Default implementation, may be overriden by derived classes
 	return KErrNotSupported;
 	}
 
 inline TInt DPagingDevice::DeleteNotify(TThreadMessage*,TUint,TUint)
 	{
-	// Default implementation, may be overriden by dervied classes
+	// Default implementation, may be overriden by derived classes
 	return KErrNotSupported;
 	}
 
--- a/kernel/eka/include/kernel/sproperty.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/kernel/sproperty.h	Thu Jul 22 16:46:39 2010 +0100
@@ -95,7 +95,19 @@
 
 private:
 	friend class TProperty;
-	DProcess*	iProcess;
+
+	/**
+    Defines the context of iProcess.
+    @internalComponent
+    */
+	enum {KScheduledForCompletion = 1, KProcessPtrMask = 0xfffffffe};
+
+    /**
+    The process that has required notification.
+    LSB is set if the request is scheduled for completition.
+    */
+    DProcess*   iProcess;
+
 	};
 
 
--- a/kernel/eka/include/memmodel/epoc/mmubase/mmubase.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/memmodel/epoc/mmubase/mmubase.h	Thu Jul 22 16:46:39 2010 +0100
@@ -526,8 +526,8 @@
 public:
 	TInt AllocRamPages(TPhysAddr* aPageList, TInt aNumPages, TZonePageType aPageType, TUint aBlockedZoneId=KRamZoneInvalidId, TBool aBlockRest=EFalse);
 	TInt ZoneAllocRamPages(TUint* aZoneIdList, TUint aZoneIdCount, TPhysAddr* aPageList, TInt aNumPages, TZonePageType aPageType);
-	TInt AllocContiguousRam(TInt aSize, TPhysAddr& aPhysAddr, TZonePageType aPageType, TInt aAlign, TUint aBlockedZoneId=KRamZoneInvalidId, TBool aBlockRest=EFalse);
-	TInt ZoneAllocContiguousRam(TUint* aZoneIdList, TUint aZoneIdCount, TInt aSize, TPhysAddr& aPhysAddr, TZonePageType aPageType, TInt aAlign);
+	TInt AllocContiguousRam(TInt aSize, TPhysAddr& aPhysAddr, TInt aAlign);
+	TInt ZoneAllocContiguousRam(TUint* aZoneIdList, TUint aZoneIdCount, TInt aSize, TPhysAddr& aPhysAddr, TInt aAlign);
 
 public:
 	TInt iPageSize;				// page size in bytes
--- a/kernel/eka/include/memmodel/epoc/mmubase/mmubase.inl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/memmodel/epoc/mmubase/mmubase.inl	Thu Jul 22 16:46:39 2010 +0100
@@ -81,15 +81,17 @@
 	}
 
 
-inline TInt M::MovePage(TPhysAddr aOld, TPhysAddr& aNew, TUint aBlockZoneId, TBool aBlockRest)
+inline TInt M::MovePage(TPhysAddr aOld, TPhysAddr& aNew, TUint aBlockZoneId, TUint aMoveDisFlags)
 	{
-	return Mmu::Get().MovePage(aOld, aNew, aBlockZoneId, aBlockRest);
+	return Mmu::Get().MovePage(	aOld, aNew, aBlockZoneId, 
+								(aMoveDisFlags & M::EMoveDisBlockRest)!=0);
 	}
 
 
-inline TInt M::DiscardPage(TPhysAddr aAddr, TUint aBlockZoneId, TBool aBlockRest)
+inline TInt M::DiscardPage(TPhysAddr aAddr, TUint aBlockZoneId, TUint aMoveDisFlags)
 	{
-	return Mmu::Get().DiscardPage(aAddr, aBlockZoneId, aBlockRest);
+	return Mmu::Get().DiscardPage(	aAddr, aBlockZoneId, 
+									(aMoveDisFlags & M::EMoveDisBlockRest)!=0);
 	}
 #endif
 
--- a/kernel/eka/include/memmodel/epoc/mmubase/ramalloc.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/memmodel/epoc/mmubase/ramalloc.h	Thu Jul 22 16:46:39 2010 +0100
@@ -142,8 +142,15 @@
 	void FreeRamPages(TPhysAddr* aPageList, TInt aNumPages, TZonePageType aType);
 	TInt AllocRamPages(TPhysAddr* aPageList, TInt aNumPages, TZonePageType aType, TUint aBlockedZoneId=KRamZoneInvalidId, TBool aBlockRest=EFalse);
 	TInt ZoneAllocRamPages(TUint* aZoneIdList, TUint aZoneIdCount, TPhysAddr* aPageList, TInt aNumPages, TZonePageType aType);
-	TInt AllocContiguousRam(TUint aNumPages, TPhysAddr& aPhysAddr, TZonePageType aType, TInt aAlign=0, TUint aBlockZoneId=KRamZoneInvalidId, TBool aBlockRest=EFalse);
-	TInt ZoneAllocContiguousRam(TUint* aZoneIdList, TUint aZoneIdCount, TInt aSize, TPhysAddr& aPhysAddr, TZonePageType aType, TInt aAlign);
+	TInt AllocContiguousRam(TUint aNumPages, TPhysAddr& aPhysAddr, TInt aAlign=0);
+#if !defined(__MEMMODEL_MULTIPLE__) && !defined(__MEMMODEL_MOVING__)
+	TUint BlockContiguousRegion(TPhysAddr aAddrBase, TUint aNumPages);
+	void UnblockSetAllocRuns(TUint& aOffset1, TUint& aOffset2, TUint aRunLength1, TUint aRunLength2, TUint& aAllocLength, TUint& aAllocStart);
+	void UnblockContiguousRegion(TPhysAddr aAddrBase, TUint aNumPages);
+	TBool ClearContiguousRegion(TPhysAddr aAddrBase, TPhysAddr aZoneBase, TUint aNumPages, TInt& aOffsetm, TUint aUnreservedPages);
+	TUint CountPagesInRun(TPhysAddr aAddrBase, TPhysAddr aAddrEndPage, TZonePageType aType);
+#endif
+	TInt ZoneAllocContiguousRam(TUint* aZoneIdList, TUint aZoneIdCount, TInt aSize, TPhysAddr& aPhysAddr, TInt aAlign);
 #ifdef _DEBUG
 	void DebugDump();
 #endif
@@ -158,6 +165,7 @@
 	TInt GetZoneAddress(TUint aZoneId, TPhysAddr& aPhysBase, TUint& aNumPages);
 	TInt HalFunction(TInt aFunction, TAny* a1, TAny* a2);
 	TInt NextAllocatedPage(SZone* aZone, TUint& aOffset, TZonePageType aType) const;
+	TInt NextAllocatedRun(SZone* aZone, TUint& aOffset, TUint aEndOffset, TZonePageType aType) const;
 	TUint GenDefragFreePages(TZonePageType aType) const;
 	SZone* GeneralDefragStart0(TGenDefragStage& aStage, TUint& aRequiredToBeDiscarded);
 	SZone* GeneralDefragNextZone0();
@@ -205,9 +213,7 @@
 	SDblQueLink* iZoneGeneralPrefLink;	/**< Link to the current RAM zone being defragged*/
 	SDblQueLink* iZoneGeneralTmpLink;	/**< Link to the current RAM zone being defragged*/
 	TUint iZoneGeneralStage;			/**< The current stage of any general defrag operation*/
-#ifdef _DEBUG
-	TBool iAllowBmaVerify;
-#endif
+	TUint iContiguousReserved;			/**< The count of the number of separate contiguous allocations that have reserved pages*/
 	};
 
 #endif
--- a/kernel/eka/include/nkern/nk_cpu.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/nkern/nk_cpu.h	Thu Jul 22 16:46:39 2010 +0100
@@ -688,6 +688,8 @@
 #error SMP not allowed without thread ID registers
 #endif
 
+#define	__SRATIO_MACHINE_CODED__
+
 #endif	//	end of __CPU_ARM
 
 #if defined(__CPU_X86) && defined(__EPOC32__)
--- a/kernel/eka/include/nkern/nklib.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/nkern/nklib.h	Thu Jul 22 16:46:39 2010 +0100
@@ -85,6 +85,39 @@
 	};
 
 
+/**
+@internalComponent
+
+Ratio represented = iM*2^iX
+e.g. 1.0 has iM=0x80000000, iX=-31
+*/
+struct SRatio
+	{
+	void Set(TUint32 aInt, TInt aDivisorExp=0);		// set this ratio to aInt/2^aDivisorExp
+	TInt Reciprocal();								// this = 1/this
+	TInt Mult(TUint32& aInt32);						// Multiply aInt32 by this ratio
+//	TInt Mult(TUint64& aInt64);						// Multiply aInt64 by this ratio
+
+	TUint32		iM;		// mantissa, normalised so bit 31=1
+	TInt16		iX;		// -exponent.
+	TUint8		iSpare1;
+	TUint8		iSpare2;
+	};
+
+/**
+@internalComponent
+
+Ratio and inverse ratio
+*/
+struct SRatioInv
+	{
+	void Set(const SRatio* aR);
+
+	SRatio		iR;
+	SRatio		iI;
+	};
+
+
 #if defined(__VC32__) || defined(__CW32__)
 extern "C"
 /** @internalComponent */
--- a/kernel/eka/include/nkernsmp/arm/ncern.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/nkernsmp/arm/ncern.h	Thu Jul 22 16:46:39 2010 +0100
@@ -97,20 +97,6 @@
 
 __ASSERT_COMPILE(sizeof(SPerCpuUncached) <= 8*sizeof(TUint64));
 
-/** Timer frequency specification
-
-Stores a frequency as a fraction of a (separately stored) maximum.
-The frequency must be at least 1/256 of the maximum.
-
-@internalTechnology
-@prototype
-*/
-struct STimerMult
-	{
-	TUint32		iFreq;						// frequency as a fraction of maximum possible, multiplied by 2^32
-	TUint32		iInverse;					// 2^24/(iFreq/2^32) = 2^56/iFreq
-	};
-
 /** Function to power up a CPU
 @publishedPartner
 @prototype
@@ -123,6 +109,12 @@
 */
 typedef void (*TCpuPowerDownFn)(TInt aCpu, SPerCpuUncached* aU);
 
+/** Function to notify changes to system clock frequencies
+@publishedPartner
+@prototype
+*/
+typedef TInt (*TFrequencyChangeFn)();
+
 /** Variant interface block
 @internalTechnology
 @prototype
@@ -138,11 +130,13 @@
 	TLinAddr	iGicCpuIfcAddr;				// address of GIC CPU interface (must be same for all CPUs)
 	TLinAddr	iLocalTimerAddr;			// address of per-CPU timer (must be same for all CPUs)
 	TLinAddr	iGlobalTimerAddr;			// address of global timer if it exists
-	volatile STimerMult*	iTimerMult[KMaxCpus];	// timer[i] frequency / iMaxTimerClock * 2^32
-	volatile TUint32*		iCpuMult[KMaxCpus];		// CPU[i] frequency / iMaxCpuClock * 2^32
+	SRatio*		iTimerFreqR[KMaxCpus];		// timer[i] frequency as a fraction of iMaxTimerClock
+	SRatio*		iCpuFreqR[KMaxCpus];		// CPU[i] frequency as a fraction of iMaxCpuClock
 	UPerCpuUncached*		iUncached[KMaxCpus];	// Pointer to uncached memory for each CPU
 	TCpuPowerUpFn			iCpuPowerUpFn;			// function used to power up a retired CPU (NULL if core control not supported)
 	TCpuPowerDownFn			iCpuPowerDownFn;		// function used to power down a CPU (NULL if power down done within idle handler itself)
+	SRatio*		iGTimerFreqR;				// global timer frequency as a fraction of iMaxTimerClock
+	TFrequencyChangeFn		iFrqChgFn;		// function to notify frequency changes
 	};
 
 // End of file
--- a/kernel/eka/include/nkernsmp/arm/nk_plat.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/nkernsmp/arm/nk_plat.h	Thu Jul 22 16:46:39 2010 +0100
@@ -66,35 +66,12 @@
 	TLinAddr			iUndStackTop;			// Top of UND stack for this CPU
 	TLinAddr			iFiqStackTop;			// Top of FIQ stack for this CPU
 	TLinAddr			iIrqStackTop;			// Top of IRQ stack for this CPU
-	volatile TUint32	iCpuFreqM;				// CPU frequency / Max CPU frequency (mantissa, bit 31=1) f/fmax=mantissa/2^shift
-	volatile TInt		iCpuFreqS;				// CPU frequency / Max CPU frequency (shift)
-	volatile TUint32	iCpuPeriodM;			// Max CPU frequency / CPU frequency (mantissa, bit 31=1) fmax/f=mantissa/2^shift
-	volatile TInt		iCpuPeriodS;			// Max CPU frequency / CPU frequency (shift)
-	volatile TUint32	iNTimerFreqM;			// Nominal Timer frequency / Max Timer frequency (mantissa, bit 31=1) f/fmax=mantissa/2^shift
-	volatile TInt		iNTimerFreqS;			// Nominal Timer frequency / Max Timer frequency (shift)
-	volatile TUint32	iNTimerPeriodM;			// Nominal Max Timer frequency / Timer frequency (mantissa, bit 31=1) fmax/f=mantissa/2^shift
-	volatile TInt		iNTimerPeriodS;			// Nominal Max Timer frequency / Timer frequency (shift)
-	volatile TUint32	iTimerFreqM;			// Timer frequency / Max Timer frequency (mantissa, bit 31=1) f/fmax=mantissa/2^shift
-	volatile TInt		iTimerFreqS;			// Timer frequency / Max Timer frequency (shift)
-	volatile TUint32	iTimerPeriodM;			// Max Timer frequency / Timer frequency (mantissa, bit 31=1) fmax/f=mantissa/2^shift
-	volatile TInt		iTimerPeriodS;			// Max Timer frequency / Timer frequency (shift)
-	volatile TUint64	iLastSyncTime;			// Timestamp at which last reference check occurred
-	volatile TUint32	iTicksSinceLastSync;	// Local timer ticks between last ref. check and next zero crossing
-	volatile TUint32	iLastTimerSet;			// Value last written to local timer counter
-	volatile TUint32	iGapEstimate;			// 2^16 * estimated gap in ticks whenever local timer counter is read then written
-	volatile TUint32	iGapCount;				// count of local timer counter RMW ops
-	volatile TUint32	iTotalTicks;			// programmed ticks since last sync
-	volatile TUint32	iDitherer;				// PRNG state for dither generation
-	volatile TInt		iFreqErrorEstimate;		// Current frequency offset between local timer and reference
-	volatile TInt		iFreqErrorLimit;		// Saturation level for frequency offset
-	volatile TInt64		iErrorIntegrator;		// Accumulator to integrate time error measurements
-	volatile TUint64	iRefAtLastCorrection;	// Value of reference timer at last correction
-	volatile TUint8		iM;						// Value controlling loop bandwidth (larger->lower loop bandwidth)
-	volatile TUint8		iN;						// Number of timer ticks between corrections = 2^iN
-	volatile TUint8		iD;						// Value controlling loop damping
-	volatile TUint8		iSSXP1;
+	SRatioInv* volatile	iNewCpuFreqRI;			// set when CPU frequency has been changed
+	SRatioInv* volatile	iNewTimerFreqRI;		// set when CPU local timer frequency has been changed
+	SRatioInv			iCpuFreqRI;				// Ratio of CPU frequency to maximum possible CPU frequency
+	SRatioInv			iTimerFreqRI;			// Ratio of CPU local timer frequency to maximum possible
 
-	TUint32				iSSXP2[19];
+	TUint32				iSSXP2[36];
 	TUint64				iSSXP3;					// one 64 bit value to guarantee alignment
 	};
 
@@ -108,7 +85,12 @@
 	GicDistributor*		iGicDistAddr;			// Address of GIC Distributor (also in TSubScheduler)
 	GicCpuIfc*			iGicCpuIfcAddr;			// Address of GIC CPU Interface (also in TSubScheduler)
 	ArmLocalTimer*		iLocalTimerAddr;		// Address of local timer registers (also in TSubScheduler)
-	TUint32				iSXP2[8];
+
+	SRatioInv			iGTimerFreqRI;			// ratio of global timer frequency to maximum possible
+	TUint64				iCount0;				// global timer count at last frequency change
+	TUint64				iTimestamp0;			// timestamp at last frequency change
+
+	TUint32				iSXP2[16];
 	};
 
 
--- a/kernel/eka/include/nkernsmp/nk_priv.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/nkernsmp/nk_priv.h	Thu Jul 22 16:46:39 2010 +0100
@@ -629,6 +629,7 @@
 __ASSERT_COMPILE(sizeof(TSubScheduler)==(1<<KSubSchedulerShift));	// make it a nice power of 2 size for easy indexing
 
 struct SCoreControlAction;
+struct SVariantInterfaceBlock;
 
 /**
 @internalComponent
@@ -669,6 +670,7 @@
 	static TBool CoreControlSupported();
 	static void CCInitiatePowerUp(TUint32 aCores);
 	static void CCIndirectPowerDown(TAny*);
+	static void DoFrequencyChanged(TAny*);
 public:
 	TLinAddr		iMonitorExceptionHandler;
 	TLinAddr		iProcessHandler;
@@ -727,11 +729,13 @@
 	TDfc			iCCRequestDfc;				// runs when a request is made to change the number of active cores
 	TDfc			iCCPowerDownDfc;			// runs when indirect power down of core(s) is required
 	TDfc			iCCIpiReactIDFC;			// runs when an IPI needs to wake up a core
+	TDfc			iFreqChgDfc;				// runs when frequency changes required
 
 	TSubScheduler*	iPoweringOff;				// CPU last to power off
 	TUint32			iDetachCount;				// detach count before power off
 
-	TUint32			i_Scheduler_Padding[54];
+	SVariantInterfaceBlock* iVIB;
+	TUint32			i_Scheduler_Padding[29];
 	};
 
 __ASSERT_COMPILE(!(_FOFF(TScheduler,iGenIPILock)&7));
@@ -739,7 +743,7 @@
 __ASSERT_COMPILE(!(_FOFF(TScheduler,iIdleBalanceLock)&7));
 __ASSERT_COMPILE(!(_FOFF(TScheduler,iEnumerateLock)&7));
 __ASSERT_COMPILE(!(_FOFF(TScheduler,iBalanceListLock)&7));
-__ASSERT_COMPILE(sizeof(TSchedulerX)==16*4);
+__ASSERT_COMPILE(sizeof(TSchedulerX)==32*4);
 __ASSERT_COMPILE(sizeof(TScheduler)==1024);
 
 extern TScheduler TheScheduler;
--- a/kernel/eka/include/nkernsmp/nkern.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/nkernsmp/nkern.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1243,7 +1243,7 @@
 class TStopIPI : public TGenericIPI
 	{
 public:
-	void StopCPUs();
+	TUint32 StopCPUs();
 	void ReleaseCPUs();
 	static void Isr(TGenericIPI*);
 public:
--- a/kernel/eka/include/nkernsmp/x86/ncern.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/nkernsmp/x86/ncern.h	Thu Jul 22 16:46:39 2010 +0100
@@ -36,20 +36,6 @@
 	{
 	};
 
-/** Timer frequency specification
-
-Stores a frequency as a fraction of a (separately stored) maximum.
-The frequency must be at least 1/256 of the maximum.
-
-@internalTechnology
-@prototype
-*/
-struct STimerMult
-	{
-	TUint32		iFreq;						// frequency as a fraction of maximum possible, multiplied by 2^32
-	TUint32		iInverse;					// 2^24/(iFreq/2^32) = 2^56/iFreq
-	};
-
 /** Variant interface block
 @internalTechnology
 @prototype
@@ -59,8 +45,9 @@
 	TUint64		iMaxCpuClock;				// maximum possible CPU clock frequency on this system
 	TUint32		iTimestampFreq;				// rate at which timestamp increments
 	TUint32		iMaxTimerClock;				// maximum possible local timer clock frequency
-	volatile STimerMult* iTimerMult[KMaxCpus];	// timer[i] frequency as a fraction of iMaxTimerClock
-	volatile TUint32* iCpuMult[KMaxCpus];	// CPU[i] frequency / iMaxCpuClock * 2^32
+	SRatio*		iTimerFreqR[KMaxCpus];		// timer[i] frequency as a fraction of iMaxTimerClock
+	SRatio*		iCpuFreqR[KMaxCpus];		// CPU[i] frequency as a fraction of iMaxCpuClock
+	SRatio*		iTimestampFreqR;			// timestamp counter frequency as a fraction of
 	};
 
 // End of file
--- a/kernel/eka/include/nkernsmp/x86/nk_plat.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/nkernsmp/x86/nk_plat.h	Thu Jul 22 16:46:39 2010 +0100
@@ -42,21 +42,12 @@
 	volatile TInt		iIrqNestCount;			// IRQ nest count for this CPU (starts at -1)
 	TLinAddr			iIrqStackTop;			// Top of IRQ stack for this CPU
 	TX86Tss*			iTss;					// Address of TSS for this CPU
-	volatile TUint32	iCpuFreqM;				// CPU frequency / Max CPU frequency (mantissa, bit 31=1) f/fmax=M/2^(S+32) <=1
-	volatile TInt		iCpuFreqS;				// CPU frequency / Max CPU frequency (shift)
-	volatile TUint32	iCpuPeriodM;			// Max CPU frequency / CPU frequency (mantissa, bit 31=1) fmax/f=M/2^S >=1
-	volatile TInt		iCpuPeriodS;			// Max CPU frequency / CPU frequency (shift)
-	volatile TUint32	iNTimerFreqM;			// Nominal Timer frequency / Max Timer frequency (mantissa, bit 31=1) f/fmax=M/2^(S+32) <=1
-	volatile TInt		iNTimerFreqS;			// Nominal Timer frequency / Max Timer frequency (shift)
-	volatile TUint32	iNTimerPeriodM;			// Nominal Max Timer frequency / Timer frequency (mantissa, bit 31=1) fmax/f=M/2^S >=1
-	volatile TInt		iNTimerPeriodS;			// Nominal Max Timer frequency / Timer frequency (shift)
-	volatile TUint32	iTimerFreqM;			// Timer frequency / Max Timer frequency (mantissa, bit 31=1) f/fmax=M/2^(S+32) <=1
-	volatile TInt		iTimerFreqS;			// Timer frequency / Max Timer frequency (shift)
-	volatile TUint32	iTimerPeriodM;			// Max Timer frequency / Timer frequency (mantissa, bit 31=1) fmax/f=M/2^S >=1
-	volatile TInt		iTimerPeriodS;			// Max Timer frequency / Timer frequency (shift)
+	SRatioInv			iCpuFreqRI;				// Ratio of CPU frequency to maximum possible CPU frequency
+	SRatioInv			iTimerFreqRI;			// Ratio of CPU local timer frequency to maximum possible
+
 	volatile TUint64HL	iTimestampOffset;		// 64 bit value to add to CPU TSC to give NKern::Timestamp()
 
-	TUint32				iSSXP2[32];
+	TUint32				iSSXP2[36];
 	TUint64				iSSXP3;					// one 64 bit value to guarantee alignment
 	};
 
@@ -64,7 +55,7 @@
 struct TSchedulerX
 	{
 	TUint64				iTimerMax;				// Maximum per-CPU timer frequency (after prescaling)
-	TUint32				iSXP[14];
+	TUint32				iSXP[30];
 	};
 
 
--- a/kernel/eka/include/u32hal.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/u32hal.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -2015,7 +2015,23 @@
     @see TPckgBuf
     @see TDigitiserInfoV02
     */
-	EDigitiserHal3DInfo
+	EDigitiserHal3DInfo,
+
+	/**
+	Get or sets the digitiser driver's current orientation property.
+	Requirements of the HAL function handler's 2nd, 3rd and 4th parameters:
+	
+	- TInt aFunction : This enum value.
+    - TAny* a1 : if Set, a TDigitiserOrientation value the driver should now use	
+			   : If Get, a pointer to a TDigitiserOrientation. The HAL function 
+			   : needs to set its value to the current value used in the driver.	
+	- TAny* a2 : Cast to a TInt. Should be assigned the value 
+			   : EFalse - Get property; ETrue - Set property 
+	
+	@see HALData::TDigitiserOrientation
+	@capability WriteDeviceData To set the property, None to read
+	*/
+	EDigitiserOrientation
 
 	};
 
@@ -2774,6 +2790,59 @@
 	@see TChanges
 	*/ 
 	EVMHalSetThrashThresholds,
+
+	/**
+	Indicate whether the data paging media driver supports access by physical address.
+
+	@return 1 if it does, 0 if it does not and KErrNotSupported if data paging is not enabled.
+	*/
+	EVMHalGetPhysicalAccessSupported,
+
+	/**
+	Indicate whether the data paging media driver currently uses physical access for writing out
+	dirty data pages to swap.
+
+	@return 1 if it does, 0 if it does not and KErrNotSupported if data paging is not enabled.
+	*/
+	EVMHalGetUsePhysicalAccess,
+
+	/**
+	Set whether physical access is used for writing out dirty data pages to swap.
+
+	The first argument (a1) should contain zero or one to indicate whether to disable or enable
+	physical access respectively.
+	
+	@return KErrNone if successful, KErrNotSupported if data paging is not enabled.
+	*/
+	EVMHalSetUsePhysicalAccess,
+
+	/**
+	Get the data paging media driver's preferred write size.
+
+	@return Log2 of the preferred write size in pages, or KErrNotSupported if data paging is not
+	enabled.
+	*/
+	EVMHalGetPreferredDataWriteSize,
+
+	/**
+	Get the number of pages that the pager attempts to write at a time when paging out dirty pages
+	to swap.
+
+	@return Log2 of the current write size in pages, or KErrNotSupported if data paging is not
+	enabled.
+	*/
+	EVMHalGetDataWriteSize,
+
+	/**
+	Set the number of pages that the pager attempts to write at a time when paging out dirty pages
+	to swap.
+	
+	The first argument (a1) should contain log2 of the write size in pages.
+
+	@return KErrArgument if the value is out of range, or KErrNotSupported if data paging is not
+	enabled.
+	*/
+	EVMHalSetDataWriteSize,
 	};
 
 
--- a/kernel/eka/include/u32std.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/include/u32std.h	Thu Jul 22 16:46:39 2010 +0100
@@ -508,6 +508,8 @@
 	EKernelConfigSMPUnsafeCPU0   = 1<<13,				// Slow compatibility mode: all SMP-unsafe processes run on CPU 0 only
 	EKernelConfigSMPCrazyInterrupts = 1<<14,			// Enables CPU target rotation for HW Interrupts.
 
+	EKernelConfigSMPLockKernelThreadsCore0 = 1<< 15,    // locks all kernel side threads to CPU 0
+
 	EKernelConfigDisableAPs = 1u<<30,
 
 	EKernelConfigTest = 1u<<31,							// Only used by test code for __PLATSEC_UNLOCKED__
--- a/kernel/eka/kernel/arm/cache.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/arm/cache.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -70,8 +70,10 @@
 
 EXPORT_C void Cache::AtomicSyncMemory()
 	{
-	CHECK_PRECONDITIONS(MASK_INTERRUPTS_DISABLED,"Cache::AtomicSyncMemory");				
-	__KTRACE_OPT(KMMU,Kern::Printf("Cache::AtomicSyncMemory"));
+	// This methos is called during reboot or power down sequence and therefore is not allowed
+	// to do Kernel calls that may hold spin lock - such as Kern::Print or precondition checkings.
+	// CHECK_PRECONDITIONS(MASK_INTERRUPTS_DISABLED,"Cache::AtomicSyncMemory");				
+	// __KTRACE_OPT(KMMU,Kern::Printf("Cache::AtomicSyncMemory"));
 
 	InternalCache::CleanAndInvalidate_DCache_All();
 
@@ -80,6 +82,29 @@
 #endif //__HAS_EXTERNAL_CACHE__
 	}
 
+EXPORT_C void Cache::CpuRetires()
+	{
+	// This methos is called during reboot or power down sequence and therefore is not allowed
+	// to do Kernel calls that may hold spin lock - such as Kern::Print or precondition checkings.
+	// CHECK_PRECONDITIONS(MASK_INTERRUPTS_DISABLED,"Cache::CpuRetires");				
+
+	InternalCache::CleanAndInvalidate_DCache_All();
+
+#if  !defined(__SMP__) & defined(__HAS_EXTERNAL_CACHE__)
+	ExternalCache::AtomicSync();
+#endif	
+	}
+
+EXPORT_C void Cache::KernelRetires()
+	{
+	// This methos is called during reboot or power down sequence and therefore is not allowed
+	// to do Kernel calls that may hold spin lock - such as Kern::Print or precondition checkings.
+	// CHECK_PRECONDITIONS(MASK_INTERRUPTS_DISABLED,"Cache::KernelRetires");				
+
+#if  defined(__SMP__) & defined(__HAS_EXTERNAL_CACHE__)
+	ExternalCache::AtomicSync();
+#endif
+	}
 
 EXPORT_C TInt Cache::GetThresholds(TCacheThresholds& aThresholds, TUint aCacheType)
 	{
--- a/kernel/eka/kernel/arm/cache_external.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/arm/cache_external.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -313,21 +313,24 @@
 
 void ExternalCache::AtomicSync()
 	{
-	CHECK_PRECONDITIONS(MASK_INTERRUPTS_DISABLED,"ExternalCache::AtomicSync");
-	__KTRACE_OPT(KMMU,Kern::Printf("ExternalCache::AtomicSync"));
-
+	// This methos is called during reboot or power down sequence and therefore is not allowed
+	// to do Kernel calls that may hold spin lock - such as Kern::Print or precondition checkings.
+	// CHECK_PRECONDITIONS(MASK_INTERRUPTS_DISABLED,"ExternalCache::AtomicSync");
+	// __KTRACE_OPT(KMMU,Kern::Printf("ExternalCache::AtomicSync"));
 #if defined(__ARM_PL310_CACHE__)
-	// On Pl310, we hold the lock while maintaining cache. Therefore, we cannot
-	// do that on a way basis as it takes too long to complete.
-	// This will also ensure that PL310 erratum 727915 is sorted out.
-
-#if defined(__ARM_PL310_ERRATUM_588369_FIXED)
-	Maintain_All((TInt*)(Base+ARML2C_CleanInvalidateByIndexWay));
-#else //defined(__ARM_PL310_ERRATUM_588369_FIXED)
-	//CleanAndInvalidate is broken. Just clean it.
-	Maintain_All((TInt*)(Base+ARML2C_CleanByIndexWay));
-#endif //else defined(__ARM_PL310_ERRATUM_588369_FIXED)
-	
+    // Do not use maintain-by-way operations on PL310 (due to erratum 727915 for example)
+    // Also, do not use ARML2C_CleanInvalidateByIndexWay (erratum 588369)
+    // Do not hold spin lock as it is assumed this is the only running CPU.
+    TInt indexNo = Info.iSize>>3; // This is the number of cache lines in each way. Assoc is always 8 in this cache
+    volatile TInt* ctrlReg = (volatile TInt*)(Base+ARML2C_CleanByIndexWay);
+    TInt way,index;
+    for (way = 0 ; way <Info.iAssoc ; way++)
+        {
+        for (index = 0 ; index <indexNo ; index++)
+            {
+            *ctrlReg = (way<<ARML2C_WayShift) | (index<<ARML2C_IndexShift); //This will maintain a single cache line
+            }
+        }
 #else //defined(__ARM_PL310_CACHE__)
 
 	#if defined (__ARM_L210_CACHE__)
--- a/kernel/eka/kernel/arm/cutils.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/arm/cutils.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -153,9 +153,10 @@
 	{
 	if (aPhase==0)
 		{
-		Cache::AtomicSyncMemory();
+		Cache::CpuRetires();
 		return;
 		}
+	Cache::KernelRetires();
 #ifdef __SMP__
 	SFullArmRegSet* regs = SubScheduler().iSSX.iRegs;
 #else
--- a/kernel/eka/kernel/device.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/device.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -629,9 +629,9 @@
 			r=pdev.FindByFullName(h,n,fn);
 			if (r!=KErrNone)
 				break;
-			__KTRACE_OPT(KDEVICE,Kern::Printf("Found PDD %lS",&fn));
+			__KTRACE_OPT(KDEVICE,Kern::Printf("Found PDD %S",&fn));
 			pP=(DPhysicalDevice *)pdev.At(h);
-			__KTRACE_OPT(KDEVICE,{TBuf<16> verBuf(iVersion.Name()); Kern::Printf("unit=%d, info=%08x, ver=%lS",aInfo.iUnit,aInfo.iInfo,&verBuf);});
+			__KTRACE_OPT(KDEVICE,{TBuf<16> verBuf(iVersion.Name()); Kern::Printf("unit=%d, info=%08x, ver=%S",aInfo.iUnit,aInfo.iInfo,&verBuf);});
 			r=pP->Validate(aInfo.iUnit,aInfo.iInfo,iVersion);
 			__KTRACE_OPT(KDEVICE,Kern::Printf("DPhysicalDevice::Validate returns %d",r));
 			if (r!=KErrNotSupported)
@@ -692,7 +692,7 @@
 		info.iPhysicalDevice=&pddName;
 		}
 
-	__KTRACE_OPT(KDEVICE,Kern::Printf("Exec::ChannelCreate LDD %lS PDD %lS Unit %d",&lddName,info.iPhysicalDevice,info.iUnit));
+	__KTRACE_OPT(KDEVICE,Kern::Printf("Exec::ChannelCreate LDD %S PDD %S Unit %d",&lddName,info.iPhysicalDevice,info.iUnit));
 
 	TInt r=Kern::ValidateName(lddName);
 	if (r<0)
--- a/kernel/eka/kernel/execs.txt	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/execs.txt	Thu Jul 22 16:46:39 2010 +0100
@@ -680,6 +680,8 @@
 
 slow {
 	name = MutexWait
+	return = TInt
+	arg2 = TInt
 	handle = mutex
 }
 
--- a/kernel/eka/kernel/kerncorestats.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/kerncorestats.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,7 +1,7 @@
 // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
+// under the terms of the License "Eclipse Public License v1.0"
 // which accompanies this distribution, and is available
 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 //
--- a/kernel/eka/kernel/object.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/object.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -441,7 +441,7 @@
 EXPORT_C TInt DObject::SetName(const TDesC* aName)
 	{
 	CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL,"DObject::SetName");		
-	__KTRACE_OPT(KOBJECT,Kern::Printf("SetName %O (%lS)",this,aName));
+	__KTRACE_OPT(KOBJECT,Kern::Printf("SetName %O (%S)",this,aName));
 	TAny* pN=NULL;
 	if (aName)
 		{
@@ -456,7 +456,7 @@
 	pN = __e32_atomic_swp_ord_ptr(&iName, pN);
 	if (iName)
 		{
-		__KTRACE_OPT(KOBJECT,Kern::Printf("Name is now %lS",iName));
+		__KTRACE_OPT(KOBJECT,Kern::Printf("Name is now %S",iName));
 		}
 	else
 		{
@@ -1164,7 +1164,7 @@
 			__KTRACE_OPT(KOBJECT,Kern::Printf("Container %d created OK",pC->UniqueID()));
 			return pC;
 			}
-		__KTRACE_OPT(KOBJECT,Kern::Printf("Error %d creating mutex %lS",r,&n));
+		__KTRACE_OPT(KOBJECT,Kern::Printf("Error %d creating mutex %S",r,&n));
 		}
 	return NULL;
 	}
--- a/kernel/eka/kernel/power.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/power.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -194,7 +194,7 @@
 // Called in CS
 void DPowerManager::AppendHandler(DPowerHandler* aPh)
 	{ // called by drivers (power handler)
-	__KTRACE_OPT(KPOWER,Kern::Printf("PowerManger::AppendHandler('%lS')", &aPh->iName));
+	__KTRACE_OPT(KPOWER,Kern::Printf("PowerManger::AppendHandler('%S')", &aPh->iName));
 	__ASSERT_CRITICAL;
 	//Check to ensure that handler is not added multiple times and not part of any other list
 	__PM_ASSERT(!(aPh->iPrev) && !(aPh->iNext));
@@ -220,7 +220,7 @@
 // Called in CS
 void DPowerManager::RemoveHandler(DPowerHandler* aPh)
 	{ // called by drivers (power handler)
-	__KTRACE_OPT(KPOWER,Kern::Printf("PowerManger::RemoveHandler('%lS')", &aPh->iName));
+	__KTRACE_OPT(KPOWER,Kern::Printf("PowerManger::RemoveHandler('%S')", &aPh->iName));
 	__ASSERT_CRITICAL;
 	Lock();
 	__PM_ASSERT(aPh);
@@ -529,7 +529,7 @@
 	iStatus |= EDone;
 #endif
 	NKern::Lock();
-	__KTRACE_OPT(KPOWER,Kern::Printf("DPowerHandler::Done('%lS') sem=0x%x", &iName, iSem));
+	__KTRACE_OPT(KPOWER,Kern::Printf("DPowerHandler::Done('%S') sem=0x%x", &iName, iSem));
 	NFastSemaphore* sem = (NFastSemaphore*)__e32_atomic_swp_ord_ptr(&iSem, 0);
 	if (sem)
 		sem->Signal();
--- a/kernel/eka/kernel/scodeseg.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/scodeseg.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -671,7 +671,7 @@
 	const TInt KValidAttrMask =
 		ECodeSegAttKernel | ECodeSegAttGlobal | ECodeSegAttFixed | ECodeSegAttABIMask | ECodeSegAttHDll | ECodeSegAttExpVer | ECodeSegAttNmdExpData | ECodeSegAttSMPSafe;
 	
-	__KTRACE_OPT(KDLL,Kern::Printf("DCodeSeg::Create %08x file %lS ver %08x process %O",this,&aInfo.iFileName,aInfo.iModuleVersion,aProcess));
+	__KTRACE_OPT(KDLL,Kern::Printf("DCodeSeg::Create %08x file %S ver %08x process %O",this,&aInfo.iFileName,aInfo.iModuleVersion,aProcess));
 	TInt32 uid1=aInfo.iUids.iUid[0].iUid;
 	if (uid1!=KDynamicLibraryUidValue && uid1!=KExecutableImageUidValue)
 		return KErrNotSupported;
@@ -1420,7 +1420,7 @@
 	{
 	TCodeSegCreateInfo info;
 	kumemget32(&info, &aInfo, sizeof(info));
-	__KTRACE_OPT2(KEXEC,KDLL,Kern::Printf("Exec::CodeSegCreate %lS ver %08x", &info.iFileName, info.iModuleVersion));
+	__KTRACE_OPT2(KEXEC,KDLL,Kern::Printf("Exec::CodeSegCreate %S ver %08x", &info.iFileName, info.iModuleVersion));
 	__KTRACE_OPT(KDLL,DumpCodeSegCreateInfo(info));
 	K::CheckFileServerAccess();			// only F32 can use this exec function
 	info.iHandle=NULL;
@@ -1448,7 +1448,7 @@
 	{
 	TCodeSegCreateInfo info;
 	kumemget32(&info, &aInfo, sizeof(info));
-	__KTRACE_OPT2(KEXEC,KDLL,Kern::Printf("Exec::CodeSegLoaded %lS ver %08x", &info.iFileName, info.iModuleVersion));
+	__KTRACE_OPT2(KEXEC,KDLL,Kern::Printf("Exec::CodeSegLoaded %S ver %08x", &info.iFileName, info.iModuleVersion));
 	__KTRACE_OPT(KDLL,DumpCodeSegCreateInfo(info));
 	DCodeSeg* pS=DCodeSeg::VerifyCallerAndHandle(info.iHandle);
 	Kern::AccessCode();
@@ -1667,7 +1667,7 @@
 	{
 	TProcessCreateInfo info;
 	kumemget32(&info, &aInfo, sizeof(info));
-	__KTRACE_OPT2(KEXEC,KDLL,Kern::Printf("Exec::ProcessCreate %lS ver %08x", &info.iFileName, info.iModuleVersion));
+	__KTRACE_OPT2(KEXEC,KDLL,Kern::Printf("Exec::ProcessCreate %S ver %08x", &info.iFileName, info.iModuleVersion));
 	__KTRACE_OPT(KDLL,DumpProcessCreateInfo(info));
 	K::CheckFileServerAccess();			// only F32 can use this exec function
 	if (info.iHandle)
@@ -1794,7 +1794,7 @@
 	{
 	TProcessCreateInfo info;
 	kumemget32(&info, &aInfo, sizeof(info));
-	__KTRACE_OPT2(KEXEC,KDLL,Kern::Printf("Exec::ProcessLoaded %lS ver %08x", &info.iFileName, info.iModuleVersion));
+	__KTRACE_OPT2(KEXEC,KDLL,Kern::Printf("Exec::ProcessLoaded %S ver %08x", &info.iFileName, info.iModuleVersion));
 	__KTRACE_OPT(KDLL,DumpProcessCreateInfo(info));
 	K::CheckFileServerAccess();			// only F32 can use this exec function
 	NKern::LockSystem();
--- a/kernel/eka/kernel/server.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/server.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -840,7 +840,7 @@
 	TBuf<KMaxExitCategoryName> cat;
 	if (aType==EExitPanic && aCategory)
 		GetCategory(cat,*aCategory);
-	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::ThreadKill %d,%d,%lS",aType,aReason,&cat));
+	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::ThreadKill %d,%d,%S",aType,aReason,&cat));
 	K::CheckKernelUnlocked();
 	NKern::LockSystem();
 	DThread* pT=(DThread*)K::ObjectFromHandle(aHandle,EThread);
@@ -856,7 +856,7 @@
 	TBuf<KMaxExitCategoryName> cat;
 	if (aType==EExitPanic && aCategory)
 		GetCategory(cat,*aCategory);
-	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::ProcessKill %d,%d,%lS",aType,aReason,&cat));
+	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::ProcessKill %d,%d,%S",aType,aReason,&cat));
 	K::CheckKernelUnlocked();
 	NKern::LockSystem();
 	DProcess* pP=(DProcess*)K::ThreadEnterCS(aHandle,EProcess);
@@ -932,7 +932,7 @@
 	{
 	CHECK_PRECONDITIONS(MASK_THREAD_STANDARD,"Kern::PanicCurrentThread");			
 	// enter with system unlocked
-	__KTRACE_OPT(KEXEC,Kern::Printf("Kern::PanicCurrentThread %lS %d",&aCategory,aReason));
+	__KTRACE_OPT(KEXEC,Kern::Printf("Kern::PanicCurrentThread %S %d",&aCategory,aReason));
 	K::CheckKernelUnlocked();
 	NKern::LockSystem();
 	TheCurrentThread->Die(EExitPanic,aReason,aCategory);	// doesn't return
--- a/kernel/eka/kernel/sexec.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/sexec.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -36,7 +36,7 @@
 	TFindHandle h;
 	Kern::KUDesGet(match,aName);
 	kumemget32(&h,&aFindHandle,sizeof(h));
-	__KTRACE_OPT(KEXEC,Kern::Printf("ObjN: %lS %08x", &match, h.Handle()));
+	__KTRACE_OPT(KEXEC,Kern::Printf("ObjN: %S %08x", &match, h.Handle()));
 	NKern::ThreadEnterCS();
 	TInt r=pC->FindByFullName(h, match, fn);
 	NKern::ThreadLeaveCS();
@@ -96,14 +96,26 @@
 	return aChunk->Top();
 	}
 
-void ExecHandler::MutexWait(DMutex* aMutex)
+TInt ExecHandler::MutexWait(DMutex* aMutex, TInt aTimeout)
 //
 // Wait for the mutex.
 //
 	{
-
-//	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::MutexWait"));
-	aMutex->Wait();
+	if (aTimeout)	// 0 means wait forever, -1 means poll
+		{
+		if (aTimeout<-1)
+			{
+			return KErrArgument;
+			}
+		if (aTimeout>0)
+			{
+			// Convert microseconds to NTimer ticks, rounding up
+			TInt ntp = NKern::TickPeriod();
+			aTimeout += ntp-1;
+			aTimeout /= ntp;
+			}
+		}
+	return aMutex->Wait(aTimeout);
 	}
 
 void ExecHandler::MutexSignal(DMutex* aMutex)
@@ -555,20 +567,21 @@
 // Wait for a signal.
 //
 	{
-
 	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::SemaphoreWait"));
-	if (aTimeout)
+	if (aTimeout)	// 0 means wait forever, -1 means poll
 		{
-		if (aTimeout<0)
+		if (aTimeout<-1)
 			{
 			NKern::UnlockSystem();
 			return KErrArgument;
 			}
-
-		// Convert microseconds to NTimer ticks, rounding up
-		TInt ntp = NKern::TickPeriod();
-		aTimeout += ntp-1;
-		aTimeout /= ntp;
+		if (aTimeout>0)
+			{
+			// Convert microseconds to NTimer ticks, rounding up
+			TInt ntp = NKern::TickPeriod();
+			aTimeout += ntp-1;
+			aTimeout /= ntp;
+			}
 		}
 	return aSemaphore->Wait(aTimeout);
 	}
@@ -812,7 +825,7 @@
 	TKName n;
 	if (aName)
 		Kern::KUDesGet(n,*aName);
-	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::ChunkCreate %lS",&n));
+	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::ChunkCreate %S",&n));
 	TChunkCreate uinfo;
 	SChunkCreateInfo info;
 	kumemget32(&uinfo,&anInfo,sizeof(uinfo));
@@ -938,9 +951,9 @@
 
 TInt ExecHandler::OpenObject(TObjectType aObjType, const TDesC8& aName, TOwnerType aType)
 	{
-	__KTRACE_OPT(KTHREAD,Kern::Printf("Exec::OpenObject %lS",&aName));
 	TFullName n;
 	Kern::KUDesGet(n,aName);
+	__KTRACE_OPT(KTHREAD,Kern::Printf("Exec::OpenObject %S",&n));
 	if (Kern::ValidateFullName(n)!=KErrNone)
 		K::PanicKernExec(EBadName);
 	if ((TUint)aObjType>=(TUint)ENumObjectTypes)
@@ -1012,12 +1025,12 @@
 		{
 		Kern::KUDesGet(n,*aName);
 		pN=&n;
+		__KTRACE_OPT(KSEMAPHORE,Kern::Printf("Exec::MutexCreate %S",pN));
 		}
 	else if (aType==EOwnerThread)
 		pO=TheCurrentThread;
 	else
 		pO=TheCurrentThread->iOwningProcess;
-	__KTRACE_OPT(KSEMAPHORE,Kern::Printf("Exec::MutexCreate %lS",aName));
 	NKern::ThreadEnterCS();
 	DMutex* pM;
 	TInt r=K::MutexCreate(pM, *pN, pO, ETrue, KMutexOrdUser);
@@ -1036,7 +1049,6 @@
 
 TInt ExecHandler::SemaphoreCreate(const TDesC8* aName, TInt aCount, TOwnerType aType)
 	{
-	__KTRACE_OPT(KSEMAPHORE,Kern::Printf("Exec::SemaphoreCreate %lS",aName));
 	TKName n;
 	DObject* pO=NULL;
 	const TDesC* pN=NULL;
@@ -1044,6 +1056,7 @@
 		{
 		Kern::KUDesGet(n,*aName);
 		pN=&n;
+		__KTRACE_OPT(KSEMAPHORE,Kern::Printf("Exec::SemaphoreCreate %S",pN));
 		}
 	else if (aType==EOwnerThread)
 		pO=TheCurrentThread;
@@ -1230,7 +1243,7 @@
 	{
 	TKName n;
 	Kern::KUDesGet(n,aName);
-	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::ThreadRename %lS",&n));
+	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::ThreadRename %S",&n));
 	NKern::LockSystem();
 	DThread* pT=(DThread*)K::ThreadEnterCS(aHandle,EThread);
 	if (pT!=TheCurrentThread &&
@@ -1255,7 +1268,7 @@
 	{
 	TKName n;
 	Kern::KUDesGet(n,aName);
-	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::ProcessRename %lS",&n));
+	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::ProcessRename %S",&n));
 	NKern::LockSystem();
 	DProcess* pP=(DProcess*)K::ThreadEnterCS(aHandle,EProcess);
 	if (pP->iSecurityZone!=TheCurrentThread->iOwningProcess->iSecurityZone)
@@ -1907,7 +1920,7 @@
 	{
 	TKName n;
 	Kern::KUDesGet(n,aName);
-	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::ThreadCreate %lS",&n));
+	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::ThreadCreate %S",&n));
 	TUint32 infoBuf[KMaxThreadCreateInfo/sizeof(TUint32)];
 	SThreadCreateInfo& info = *(SThreadCreateInfo*)infoBuf;
 	kumemget32(&info, &aInfo, sizeof(SThreadCreateInfo));
@@ -1942,7 +1955,7 @@
 
 TInt K::MutexCreate(DMutex*& aMutex, const TDesC& aName, DObject* anOwner, TBool aVisible, TUint aOrder)
 	{
-	__KTRACE_OPT(KSEMAPHORE,Kern::Printf("K::MutexCreate %lS owner %O visible=%d order=%02x",&aName,anOwner,aVisible,aOrder));
+	__KTRACE_OPT(KSEMAPHORE,Kern::Printf("K::MutexCreate %S owner %O visible=%d order=%02x",&aName,anOwner,aVisible,aOrder));
 	DMutex* pM=new DMutex;
 	TInt r=KErrNoMemory;
 	if (pM)
@@ -2009,7 +2022,7 @@
 EXPORT_C TInt Kern::ThreadCreate(SThreadCreateInfo& aInfo)
 	{
 	CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL,"Kern::ThreadCreate");		
-	__KTRACE_OPT(KEXEC,Kern::Printf("Kern::ThreadCreate %lS",&aInfo.iName));
+	__KTRACE_OPT(KEXEC,Kern::Printf("Kern::ThreadCreate %S",&aInfo.iName));
 	aInfo.iHandle=NULL;
 	DThread* pT=NULL;
 	TBool svc = aInfo.iType!=EThreadUser;
--- a/kernel/eka/kernel/sinit.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/sinit.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -377,6 +377,7 @@
 
 	pN->iFlags |= KThreadFlagSystemPermanent; // supervisor thread can't exit for any reason
 
+	K::SvThread=pN;
 	K::TheKernelThread=pN;
 	K::SvMsgQ->iThread=&pN->iNThread;
 	K::SvBarrierQ.SetDfcQ(K::SvMsgQ);
--- a/kernel/eka/kernel/sipc.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/sipc.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -2044,7 +2044,7 @@
 	TBuf<KMaxExitCategoryName> cat;
 	if (aType==EExitPanic && aCategory)
 		GetCategory(cat,*aCategory);
-	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::MessageKill %d,%d,%lS",aType,aReason,&cat));
+	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::MessageKill %d,%d,%S",aType,aReason,&cat));
 	K::CheckKernelUnlocked();
 	NKern::LockSystem();
 	RMessageK* pM = RMessageK::MessageK(aHandle);
--- a/kernel/eka/kernel/skernel.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/skernel.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -53,7 +53,7 @@
 // Enter and return with system unlocked.
 TInt DSemaphore::Create(DObject* aOwner, const TDesC* aName, TInt aInitialCount, TBool aVisible)
 	{
-	__KTRACE_OPT(KSEMAPHORE,Kern::Printf("DSemaphore::Create owner %O, name %lS, init count=%d, visible=%d",aOwner,aName,aInitialCount,aVisible));
+	__KTRACE_OPT(KSEMAPHORE,Kern::Printf("DSemaphore::Create owner %O, name %S, init count=%d, visible=%d",aOwner,aName,aInitialCount,aVisible));
 	if (aInitialCount<0)
 		return KErrArgument;
 	SetOwner(aOwner);
@@ -74,6 +74,9 @@
 
 // Wait for semaphore with timeout
 // Enter with system locked, return with system unlocked.
+// If aNTicks==0, wait forever
+// If aNTicks==-1, poll (don't block)
+// If aNTicks>0, timeout is aNTicks nanokernel ticks
 TInt DSemaphore::Wait(TInt aNTicks)
 	{
 	__KTRACE_OPT(KSEMAPHORE,Kern::Printf("Semaphore %O Wait %d Timeout %d",this,iCount,aNTicks));
@@ -84,14 +87,23 @@
 		r=KErrGeneral;
 	else if (--iCount<0)
 		{
-		DThread* pC=TheCurrentThread;
-		pC->iMState=DThread::EWaitSemaphore;
-		pC->iWaitObj=this;
-		iWaitQ.Add(pC);
-		BTRACE_KS(BTrace::ESemaphoreBlock, this);
-		r=NKern::Block(aNTicks,NKern::ERelease,SYSTEM_LOCK);
-		__ASSERT_DEBUG(pC->iMState==DThread::EReady,K::Fault(K::ESemWaitBadState));
-		COND_BTRACE_KS(r==KErrNone, BTrace::ESemaphoreAcquire, this);
+		if (aNTicks >= 0)
+			{
+			DThread* pC=TheCurrentThread;
+			pC->iMState=DThread::EWaitSemaphore;
+			pC->iWaitObj=this;
+			iWaitQ.Add(pC);
+			BTRACE_KS(BTrace::ESemaphoreBlock, this);
+			r=NKern::Block(aNTicks,NKern::ERelease,SYSTEM_LOCK);
+			__ASSERT_DEBUG(pC->iMState==DThread::EReady,K::Fault(K::ESemWaitBadState));
+			COND_BTRACE_KS(r==KErrNone, BTrace::ESemaphoreAcquire, this);
+			}
+		else
+			{
+			++iCount;
+			NKern::UnlockSystem();
+			r = KErrTimedOut;	// couldn't acquire semaphore immediately, so fail
+			}
 		return r;
 		}
 #ifdef BTRACE_SYMBIAN_KERNEL_SYNC
@@ -306,7 +318,7 @@
 // Enter and return with system unlocked.
 TInt DMutex::Create(DObject* aOwner, const TDesC* aName, TBool aVisible, TUint aOrder)
 	{
-	__KTRACE_OPT(KSEMAPHORE,Kern::Printf("DMutex::Create owner %O, name %lS, visible=%d, order=%02x",aOwner,aName,aVisible,aOrder));
+	__KTRACE_OPT(KSEMAPHORE,Kern::Printf("DMutex::Create owner %O, name %S, visible=%d, order=%02x",aOwner,aName,aVisible,aOrder));
 	iOrder = (TUint8)aOrder;
 	SetOwner(aOwner);
 	TInt r=KErrNone;
@@ -326,10 +338,14 @@
 extern const SNThreadHandlers EpocThreadHandlers;
 #endif
 
-// Enter and return with system locked.
-TInt DMutex::Wait()
+// Wait for mutex with timeout
+// Enter with system locked, return with system unlocked.
+// If aNTicks==0, wait forever
+// If aNTicks==-1, poll (don't block)
+// If aNTicks>0, timeout is aNTicks nanokernel ticks
+TInt DMutex::Wait(TInt aNTicks)
 	{
-	__KTRACE_OPT(KSEMAPHORE,Kern::Printf("Mutex %O Wait hold %O hldc=%d wtc=%d",this,iCleanup.iThread,iHoldCount,iWaitCount));
+	__KTRACE_OPT(KSEMAPHORE,Kern::Printf("Mutex %O Wait(%d) hold %O hldc=%d wtc=%d",this,aNTicks,iCleanup.iThread,iHoldCount,iWaitCount));
 	__ASSERT_SYSTEM_LOCK;
 	__ASSERT_DEBUG(NCurrentThread()->iHandlers==&EpocThreadHandlers, K::Fault(K::EMutexWaitNotDThread));
 	DThread* pC=TheCurrentThread;
@@ -353,6 +369,8 @@
 			BTRACE_KS(BTrace::EMutexAcquire, this);
 			return KErrNone;
 			}
+		if (aNTicks<0)
+			return KErrTimedOut;	// poll mode - can't get mutex immediately so fail
 		K::PINestLevel=0;
 		pC->iMState=DThread::EWaitMutex;
 		pC->iWaitObj=this;
@@ -375,7 +393,7 @@
 		// return value is set at the point where the thread is released from its wait
 		// condition). However we can still detect this situation since the thread will
 		// have been placed into the EReady state when the mutex was reset.
-		TInt r=NKern::Block(0, NKern::ERelease|NKern::EClaim|NKern::EObstruct, SYSTEM_LOCK);
+		TInt r=NKern::Block(aNTicks, NKern::ERelease|NKern::EClaim|NKern::EObstruct, SYSTEM_LOCK);
 		if (r==KErrNone && pC->iMState==DThread::EReady)
 			r = KErrGeneral;	// mutex has been reset
 		if (r!=KErrNone)		// if we get an error here...
@@ -654,7 +672,7 @@
 // Enter and return with system unlocked.
 TInt DCondVar::Create(DObject* aOwner, const TDesC* aName, TBool aVisible)
 	{
-	__KTRACE_OPT(KSEMAPHORE,Kern::Printf("DCondVar::Create owner %O, name %lS, visible=%d",aOwner,aName,aVisible));
+	__KTRACE_OPT(KSEMAPHORE,Kern::Printf("DCondVar::Create owner %O, name %S, visible=%d",aOwner,aName,aVisible));
 	SetOwner(aOwner);
 	TInt r=KErrNone;
 	if (aName && aName->Length())
@@ -1080,12 +1098,12 @@
 		{
 		Kern::KUDesGet(n,*aName);
 		pN=&n;
+		__KTRACE_OPT(KSEMAPHORE,Kern::Printf("Exec::CondVarCreate %S", pN));
 		}
 	else if (aType==EOwnerThread)
 		pO=TheCurrentThread;
 	else
 		pO=TheCurrentThread->iOwningProcess;
-	__KTRACE_OPT(KSEMAPHORE,Kern::Printf("Exec::CondVarCreate %lS", aName));
 	NKern::ThreadEnterCS();
 	TInt r=KErrNoMemory;
 	DCondVar* pV = new DCondVar;
--- a/kernel/eka/kernel/smonitor.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/smonitor.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -322,7 +322,7 @@
 		}
 	PrintLine(buf);
 	Printf("Default priority %d WaitLink Priority %d\r\n",pT->iDefaultPriority,pT->iWaitLink.iPriority);
-	Printf("ExitInfo %d,%d,%lS\r\n",pT->iExitType,pT->iExitReason,&pT->iExitCategory);
+	Printf("ExitInfo %d,%d,%S\r\n",pT->iExitType,pT->iExitReason,&pT->iExitCategory);
 	Printf("Flags %08x, Handles %08x\r\n",pT->iFlags,&pT->iHandles);
 	Printf("Supervisor stack base %08x size %x\r\n", pT->iSupervisorStack, pT->iSupervisorStackSize);
 	Printf("User stack base %08x size %x\r\n", pT->iUserStackRunAddress, pT->iUserStackSize);
@@ -493,7 +493,7 @@
  
 void Monitor::DumpProcessData(DProcess* pP)
 	{
-	Printf("ExitInfo %d,%d,%lS\r\n",pP->iExitType,pP->iExitReason,&pP->iExitCategory);
+	Printf("ExitInfo %d,%d,%S\r\n",pP->iExitType,pP->iExitReason,&pP->iExitCategory);
 	Printf("Flags %08x, Handles %08x, Attributes %08x\r\n",pP->iFlags,&pP->iHandles,pP->iAttributes);
 	Printf("DataBssChunk %08x, CodeSeg %08x\r\n",pP->iDataBssStackChunk,pP->iCodeSeg);
 	Printf("DllLock %08x, Process Lock %08x SID %08x\r\n",pP->iDllLock,pP->iProcessLock,pP->iS.iSecureId);
--- a/kernel/eka/kernel/sprocess.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/sprocess.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -324,7 +324,7 @@
 
 	iGeneration = NextGeneration(aName, iUids.iUid[2]);
 
-	__KTRACE_OPT(KTHREAD,Kern::Printf("DProcess::Rename %O to %lS",this,&aName));
+	__KTRACE_OPT(KTHREAD,Kern::Printf("DProcess::Rename %O to %S",this,&aName));
 	TInt r = SetName(&aName);
 #ifdef BTRACE_THREAD_IDENTIFICATION
 	Name(n);
@@ -530,7 +530,7 @@
 // Kill a process. Enter and return with system unlocked and calling thread in critical section.
 //
 	{
-	__KTRACE_OPT(KPROC,Kern::Printf("Process %O Die: %d %d %lS",this,aType,aReason,&aCategory));
+	__KTRACE_OPT(KPROC,Kern::Printf("Process %O Die: %d %d %S",this,aType,aReason,&aCategory));
 
 	TInt r=WaitProcessLock();
 	if (r!=KErrNone)
@@ -612,7 +612,7 @@
 TInt DProcess::NewThread(DThread*& aThread, SThreadCreateInfo& anInfo, TInt* aHandle, TOwnerType aType)
 	{
 	__KTRACE_OPT(KTHREAD,Kern::Printf("NewThread proc %O, func %08x ptr %08x",this,anInfo.iFunction,anInfo.iPtr));
-	__KTRACE_OPT(KTHREAD,Kern::Printf("type %d name %lS pri %d",anInfo.iType,&anInfo.iName,anInfo.iInitialThreadPriority));
+	__KTRACE_OPT(KTHREAD,Kern::Printf("type %d name %S pri %d",anInfo.iType,&anInfo.iName,anInfo.iInitialThreadPriority));
 	if (aHandle)
 		*aHandle=0;
 	TInt r=GetNewThread(aThread,anInfo);
--- a/kernel/eka/kernel/sproperty.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/sproperty.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -29,6 +29,14 @@
 	return TheCurrentThread->iOwningProcess;
 	}
 
+// Used by a thread to schedule cancelation of Subscribe request in Supervisor thread.
+class TCancelQ: public SDblQueLink
+{
+public:
+    TPropertySubsRequest* iPropSubRequest;//The request to be cancelled, can be NULL
+    NFastSemaphore iFSemaphore;//Semafore to be signalled by Supervisor thread after the request is cancelled.
+};
+
 class TProperty 
 	{
 public:
@@ -112,7 +120,10 @@
 	static void CompleteRequest(TPropertySubsRequest*, TInt aReason);	
 	static void CompleteQue(SDblQue* aQue, TInt aReason);	
 	static void CompleteDfc(TAny* aQue);
-
+	static void CompleteDfcByKErrPermissionDenied(TAny* aQue);
+	static void CompleteDfcByKErrNotFound(TAny* aQue);
+	static void CompleteCancellationQDfc(TAny* aQue);
+	
 	static TUint Hash(TUint aCategory, TUint aKey);
 	static TProperty** Lookup(TUint aCategory, TUint aKey);
 	static TInt LookupOrCreate(TUint aCategory, TUint aKey, TProperty**);
@@ -186,10 +197,17 @@
 
 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
 
-	enum { KCompletionDfcPriority = 2 };
+	enum { KCancellationDfcPriority = 1, KCompletionDfcPriority = 2  };
 	static TDfc		CompletionDfc;
-	// subscriptions to be completed by the DFC
-	static SDblQue	CompletionQue;		// protected by the system lock
+	static TDfc		CompletionDfcPermissionDenied;
+	static TDfc		CompletionDfcNotFound;
+	static TDfc		CancellationDfc;
+	
+	// subscriptions to be completed by the DFCs, protected by system lock
+	static SDblQue	CompletionQue; // to be completed by KerrNone
+	static SDblQue	CompletionQuePermissionDenied;
+	static SDblQue	CompletionQueNotFound;
+	static SDblQue	CancellationQue;		
 
 	static DMutex*	FeatureLock;			///< Order KMutexOrdPubSub
 
@@ -266,8 +284,20 @@
 	};
 
 
+// Completion/Cancelation DFCs and their corresponding queues.
+// All subscribe requests are completed in Supervisor thread.
 TDfc		TProperty::CompletionDfc(TProperty::CompleteDfc, &TProperty::CompletionQue, KCompletionDfcPriority);
 SDblQue		TProperty::CompletionQue;
+
+TDfc		TProperty::CompletionDfcPermissionDenied(TProperty::CompleteDfcByKErrPermissionDenied, &TProperty::CompletionQuePermissionDenied, KCompletionDfcPriority);
+SDblQue		TProperty::CompletionQuePermissionDenied;
+
+TDfc		TProperty::CompletionDfcNotFound(TProperty::CompleteDfcByKErrNotFound, &TProperty::CompletionQueNotFound, KCompletionDfcPriority);
+SDblQue		TProperty::CompletionQueNotFound;
+
+TDfc		TProperty::CancellationDfc(TProperty::CompleteCancellationQDfc, &TProperty::CancellationQue, KCancellationDfcPriority);
+SDblQue		TProperty::CancellationQue;
+
 DMutex*		TProperty::FeatureLock;	
 TProperty*	TProperty::Table[KHashTableLimit];
 
@@ -288,6 +318,9 @@
 	if (r != KErrNone)
 		return r;
 	CompletionDfc.SetDfcQ(K::SvMsgQ);
+	CompletionDfcPermissionDenied.SetDfcQ(K::SvMsgQ);
+	CompletionDfcNotFound.SetDfcQ(K::SvMsgQ);
+	CancellationDfc.SetDfcQ(K::SvMsgQ);
 	
 #ifdef __DEMAND_PAGING__	
 	r = Kern::MutexCreate(PagingLockMutex, KPubSubMutexName2, KMutexOrdPubSub2);
@@ -512,8 +545,9 @@
 	// iteration; we get (move) always the first 'iPendingQue' entry until the 
 	// queue becomes empty.
 	//
-	SDblQue localPendingQue;	// protected by the system lock
-	SDblQue localCompletionQue;	// protected by the system lock
+
+	SDblQue localPendingQue;    // Will hold requests with sufficient capabilities. 
+	TInt accessDeniedCounter = 0;// Will count requests with no sufficient capabilities.
 	NKern::LockSystem();
 	while (!iPendingQue.IsEmpty())
 		{
@@ -522,7 +556,8 @@
 		subs->iProcess = NULL;
 		if (process && !CheckGetRights(process, __PLATSEC_DIAGNOSTIC_STRING("Checked whilst trying to Subscribe to a Publish and Subscribe Property")))
 			{ // Check fails - will complete the subscription with an error
-			localCompletionQue.Add(subs);
+			CompletionQuePermissionDenied.Add(subs);
+			accessDeniedCounter++;
 			}
 		else
 			{ // Check OK - will leave in the pending queue 
@@ -536,8 +571,10 @@
 	// Now the property can be accessed by other threads.
 	Use();
 	Unlock();
-	// Now we can complete requests.
-	CompleteQue(&localCompletionQue, KErrPermissionDenied);
+
+	// Schedule DFC to complete requests of those with insufficient capabilities.
+	if (accessDeniedCounter)
+		CompletionDfcPermissionDenied.Enque();
 	return KErrNone;
 	}
 
@@ -604,9 +641,10 @@
 	SetNotDefined();
 	// Down from here nobody can access the property value
 
-	// We don't want to complete requests holding the feature lock. 
-	SDblQue localQue;
-	localQue.MoveFrom(&iPendingQue);
+	// Move all pending requests to completion queue (to be completed by KErrNotFound).
+	TBool pendingQueEmpty = iPendingQue.IsEmpty();
+	if(!pendingQueEmpty)
+		CompletionQueNotFound.MoveFrom(&iPendingQue);
 
 	NKern::UnlockSystem();
 
@@ -616,8 +654,10 @@
 	Release();
 	// '*this' may do not exist any more
 	Unlock();
-	 // Now we can complete.
-	CompleteQue(&localQue, KErrNotFound);
+
+	 // Schedule Svc Dfc to complete all requests from CompletionQueNotFound.
+	if (!pendingQueEmpty)
+		CompletionDfcNotFound.Enque();
 	return KErrNone;
 	}
 
@@ -661,9 +701,8 @@
 		aSubs->iProcess = NULL;	
 		if (aProcess && !CheckGetRights(aProcess,__PLATSEC_DIAGNOSTIC_STRING("Checked whilst trying to Subscribe to a Publish and Subscribe Property")))
 			{
-			NKern::ThreadEnterCS();
-			CompleteRequest(aSubs, KErrPermissionDenied);
-			NKern::ThreadLeaveCS();
+			CompletionQuePermissionDenied.Add(aSubs);
+			CompletionDfcPermissionDenied.Enque(SYSTEM_LOCK);
 			return KErrNone;
 			}
 		}	
@@ -681,36 +720,70 @@
 void TProperty::Cancel(TPropertySubsRequest* aSubs)
 	{
 	__ASSERT_SYSTEM_LOCK;
-	if (!aSubs->iNext)
-		{ // not pending - silently return
-		NKern::UnlockSystem();	
+
+	// This is set if the request is about to be completed (in SVC thread). In that case, a 'dummy' CancelationDFC
+	// will be scheduled here. This will just ensure that we don't return from Cancel before ongoing completion has finished.  
+	TBool scheduledForCompletition = (TInt)(aSubs->iProcess) & TPropertySubsRequest::KScheduledForCompletion;
+
+	if (!aSubs->iNext && !scheduledForCompletition)
+		{ // Neither in any queue nor scheduled for completion.
+		  // The request is not active - silently return.
+		NKern::UnlockSystem();
 		return;
 		}
-	aSubs->Deque();
-	aSubs->iNext = NULL;
-	aSubs->iProcess = NULL;
-	NKern::ThreadEnterCS();
-	CompleteRequest(aSubs, KErrCancel);
-	NKern::ThreadLeaveCS();
+
+	if (aSubs->iNext)
+		{
+		// Take it out from the current queue. It is usually pending queue of a property but could
+		// also be one of the completion queues.
+		aSubs->Deque();
+		aSubs->iNext = NULL;
+		}
+	
+	// Set process to NULL (leave KScheduledForCompletion bit as it is)
+	aSubs->iProcess = (DProcess*)((TInt)aSubs->iProcess & ~TPropertySubsRequest::KProcessPtrMask);
+	
+	if (&Kern::CurrentThread() == K::SvThread)
+		{   // Complete the request immediatelly if already running in supervisor thread...
+		if (!scheduledForCompletition)
+			CompleteRequest(aSubs, KErrCancel); //This will also release system lock.
+		else
+			NKern::UnlockSystem();              // Nothing to be done here. Just release system lock.
+		}
+	else
+		{   //... or schedule DFC in supervisor thread to complete the request.
+		TCancelQ linkQ;
+		if (!scheduledForCompletition)
+			linkQ.iPropSubRequest = aSubs;      // CancelationDFC will complete this request with KErrCancel.
+		else
+			linkQ.iPropSubRequest = NULL;       // Schedule 'dummy' CancelationDFC (no request will be completed).
+		linkQ.iFSemaphore.iOwningThread = NKern::CurrentThread();
+		CancellationQue.Add(&linkQ);
+		CancellationDfc.Enque(SYSTEM_LOCK);     // This will also release system lock.
+
+		NKern::FSWait(&linkQ.iFSemaphore);      // Wait for CancellationDfc to finish.
+		}
 	}
 
 // Enter system locked.
 // Return system unlocked.
-// Called in CS or a DFC context
+// Executed in supervisor thread.
 void TProperty::CompleteRequest(TPropertySubsRequest* aSubs, TInt aResult)
 	{ // static
 	__ASSERT_SYSTEM_LOCK;
-	__ASSERT_CRITICAL;
+	__PS_ASSERT(&Kern::CurrentThread() == K::SvThread);
 	TPropertyCompleteFn	fn = aSubs->iCompleteFn;
 	TAny* ptr = aSubs->iPtr;
+	// Mark that this request is about to be completed.
+	aSubs->iProcess = (DProcess*)((TInt)aSubs->iProcess | TPropertySubsRequest::KScheduledForCompletion);
 	NKern::UnlockSystem();
 	(*fn)(ptr, aResult);
 	}
 
-// Called in CS or a DFC context
+// Executed in supervisor thread.
 void TProperty::CompleteQue(SDblQue* aQue, TInt aReason)
 	{ // static
-	__ASSERT_CRITICAL;
+	__PS_ASSERT(&Kern::CurrentThread() == K::SvThread);
 	NKern::LockSystem();
 	while (!aQue->IsEmpty())
 		{ 
@@ -723,12 +796,53 @@
 	NKern::UnlockSystem();
 	}
 
-// Executed in DFC context
+// Executed in supervisor thread. Completes requests with KErrNone.
 void TProperty::CompleteDfc(TAny* aQue)
 	{ // static
 	CompleteQue((SDblQue*) aQue, KErrNone);
 	}
 
+// Executed in supervisor thread.
+void TProperty::CompleteDfcByKErrPermissionDenied(TAny* aQue)
+	{ // static
+	CompleteQue((SDblQue*) aQue, KErrPermissionDenied);
+	}
+
+// Executed in supervisor thread.
+void TProperty::CompleteDfcByKErrNotFound(TAny* aQue)
+	{ // static
+	CompleteQue((SDblQue*) aQue, KErrNotFound);
+	}
+
+// Executed in supervisor thread.
+void TProperty::CompleteCancellationQDfc(TAny* aAny)
+	{ // static
+	SDblQue* aQue = (SDblQue*)aAny;
+	NKern::LockSystem();
+	while (!aQue->IsEmpty() )
+		{
+        TCancelQ* first = static_cast<TCancelQ*>(aQue->First());
+        first->Deque();
+        first->iNext = NULL;
+
+        if( first->iPropSubRequest)
+        	{
+            CompleteRequest(first->iPropSubRequest, KErrCancel); // This will also release system lock.
+            NKern::LockSystem();
+        	}
+        else
+        	{
+        	// Do not complete the request.
+        	// It was already just about to be completed when Cancel request was issued.
+			// As all complitions (this method included) run is Svc thread, we can here be sure that
+			// the request is now completed.
+			NKern::FlashSystem();	// Preemption point
+        	}
+        NKern::FSSignal( &first->iFSemaphore ); // Issue the signal that the request is now completed.
+        }
+    NKern::UnlockSystem();
+	}
+
 // Enter system locked.
 // Return system unlocked.
 void TProperty::CompleteByDfc()
@@ -900,7 +1014,7 @@
 		return KErrArgument;
 		}
 	iValue = aValue;
-	CompleteByDfc();
+	CompleteByDfc(); //This will also release system lock.
 	return KErrNone;
 	}
 
--- a/kernel/eka/kernel/sthread.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/sthread.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -589,29 +589,28 @@
 	ni.iStackSize=iSupervisorStackSize;
 #ifdef __SMP__
 	TUint32 config = TheSuperPage().KernelConfigFlags();
+	ni.iGroup = 0;
+	ni.iCpuAffinity = KCpuAffinityAny;
 	if (iThreadType==EThreadUser)
 		{
 		// user thread
 		if ((config & EKernelConfigSMPUnsafeCPU0) && iOwningProcess->iSMPUnsafeCount)
 			{
 			ni.iCpuAffinity = 0; // compatibility mode
-			ni.iGroup = 0;
 			}
 		else
 			{
-			ni.iCpuAffinity = KCpuAffinityAny;
 			if ((config & EKernelConfigSMPUnsafeCompat) && iOwningProcess->iSMPUnsafeCount)
 				ni.iGroup = iOwningProcess->iSMPUnsafeGroup;
-			else
-				ni.iGroup = 0;
 			}
-		
 		}
 	else
 		{
-		// kernel thread
-		ni.iCpuAffinity = 0;
-		ni.iGroup = 0;
+		if (config & EKernelConfigSMPLockKernelThreadsCore0) 
+			{
+			// kernel thread
+			ni.iCpuAffinity = 0;
+			}
 		}
 #endif
 	if (iThreadType!=EThreadInitial)
@@ -699,7 +698,7 @@
 #ifdef KPANIC
 	if (iExitType==EExitPanic)
 		{
-		__KTRACE_OPT2(KPANIC,KSCHED,Kern::Printf("Thread %O Panic %lS %d",this,&iExitCategory,iExitReason));
+		__KTRACE_OPT2(KPANIC,KSCHED,Kern::Printf("Thread %O Panic %S %d",this,&iExitCategory,iExitReason));
 		}
 	else if (iExitType==EExitTerminate)
 		{
@@ -830,7 +829,7 @@
 void DThread::Die(TExitType aType, TInt aReason, const TDesC& aCategory)
 	{
 	CHECK_PRECONDITIONS(MASK_SYSTEM_LOCKED,"DThread::Die");				
-	__KTRACE_OPT(KTHREAD,Kern::Printf("Thread %O Die: %d,%d,%lS",this,aType,aReason,&aCategory));
+	__KTRACE_OPT(KTHREAD,Kern::Printf("Thread %O Die: %d,%d,%S",this,aType,aReason,&aCategory));
 	SetExitInfo(aType,aReason,aCategory);
 
 	// If necessary, decrement count of running user threads in this process.  We get here if the
@@ -923,7 +922,7 @@
 
 TInt DThread::Create(SThreadCreateInfo& aInfo)
 	{
-	__KTRACE_OPT(KTHREAD,Kern::Printf("DThread::Create %lS owner %O size %03x", &aInfo.iName,
+	__KTRACE_OPT(KTHREAD,Kern::Printf("DThread::Create %S owner %O size %03x", &aInfo.iName,
 																iOwningProcess, aInfo.iTotalSize));
 
 	if (aInfo.iTotalSize < (TInt)sizeof(SThreadCreateInfo))
@@ -1268,7 +1267,7 @@
 	TInt r=K::Containers[EThread]->CheckUniqueFullName(this,aName);
 	if (r==KErrNone)
 		{
-		__KTRACE_OPT(KTHREAD,Kern::Printf("DThread::Rename %O to %lS",this,&aName));
+		__KTRACE_OPT(KTHREAD,Kern::Printf("DThread::Rename %O to %S",this,&aName));
 		r=SetName(&aName);
 #ifdef BTRACE_THREAD_IDENTIFICATION
 		Name(n);
--- a/kernel/eka/kernel/sutils.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/sutils.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1580,7 +1580,7 @@
 
 TInt DThread::OpenObject(TOwnerType aType, const TDesC& aName, TInt& aHandle, DObject*& anObj, TInt aObjType)
 	{
-	__KTRACE_OPT(KEXEC,Kern::Printf("DThread::OpenObject %lS",&aName));
+	__KTRACE_OPT(KEXEC,Kern::Printf("DThread::OpenObject %S",&aName));
 	anObj=NULL;
 	TInt r=Kern::ValidateFullName(aName);
 	if (r!=KErrNone)
@@ -2373,7 +2373,7 @@
 EXPORT_C TInt Kern::SemaphoreCreate(DSemaphore*& aSem, const TDesC& aName, TInt aInitialCount)
 	{
 	CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL,"Kern::SemaphoreCreate");				
-	__KTRACE_OPT(KSEMAPHORE,Kern::Printf("Kern::SemaphoreCreate %lS init %d", &aName, aInitialCount));
+	__KTRACE_OPT(KSEMAPHORE,Kern::Printf("Kern::SemaphoreCreate %S init %d", &aName, aInitialCount));
 	TInt r = KErrNoMemory;
 	DSemaphore* pS = new DSemaphore;
 	if (pS)
--- a/kernel/eka/kernel/win32/cache.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/win32/cache.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -38,6 +38,14 @@
 	{
 	}
 
+EXPORT_C void Cache::CpuRetires()
+	{
+	}
+
+EXPORT_C void Cache::KernelRetires()
+	{
+	}
+
 EXPORT_C void Cache::SyncMemoryBeforeDmaWrite(TLinAddr, TUint, TUint32)
 	{
 	}
--- a/kernel/eka/kernel/x86/cache.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/x86/cache.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -48,6 +48,14 @@
 	{
 	}
 
+EXPORT_C void Cache::CpuRetires()
+	{
+	}
+
+EXPORT_C void Cache::KernelRetires()
+	{
+	}
+
 EXPORT_C void Cache::SyncMemoryBeforeDmaWrite(TLinAddr, TUint, TUint32)
 	{
 	}
--- a/kernel/eka/kernel/x86/cutils.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/kernel/x86/cutils.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -102,9 +102,10 @@
 	{
 	if (aPhase==0)
 		{
-		Cache::AtomicSyncMemory();
+		Cache::CpuRetires();
 		return;
 		}
+	Cache::KernelRetires();
 #ifdef __SMP__
 	SFullX86RegSet* regs = &(((SCpuData*)SubScheduler().iSSX.iTss)->iRegs);
 #else
--- a/kernel/eka/klib/arm/cbma.cia	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/klib/arm/cbma.cia	Thu Jul 22 16:46:39 2010 +0100
@@ -336,6 +336,81 @@
 	}
 
 
+/**	Allocates a specific range of bit positions.
+	
+	The specified range must lie within the total range for this allocator but it is
+	not necessary that all the positions are currently free.
+
+	@param	aStart	First position to allocate.
+	@param	aLength	Number of consecutive positions to allocate, must be >0.
+	@return The number of previously free positions that were allocated.
+ */
+EXPORT_C __NAKED__ TUint TBitMapAllocator::SelectiveAlloc(TInt /*aStart*/, TInt /*aLength*/)
+	{
+	asm("ldr r3, [r0, #%a0] " : : "i" _FOFF(TBitMapAllocator, iSize));	// r3->iSize
+	asm("stmfd sp!, {r4-r8,lr} ");
+	asm("adds r4, r1, r2 ");			// r4 = aStart + aLength
+	asm("bcs 0f ");						// if (aStart + aLength < aStart)
+	asm("cmp r4, r3 ");					// if (aStart + aLength > iSize)
+	asm("bhi 0f ");
+	asm("mov r7, r0 ");					// r7 = this
+	asm("mov r4, r1, lsr #5 ");			// r4 = wix = aStart >> 5
+	asm("and r1, r1, #0x1f ");			// r1 = sbit = aStart & 31
+	asm("ldr r6, [r7, #%a0] " : : "i" _FOFF(TBitMapAllocator, iAvail));	// r6 = iAvail
+	asm("add r4, r7, r4, lsl #2 ");	
+	asm("add r4, r4, #%a0 " : : "i" _FOFF(TBitMapAllocator, iMap));		// r4 = iMap + wix
+	asm("sub r6, r6, r2 ");				// r6 = iAvail -= aLength
+	asm("add r5, r2, r1 ");				// r5 = ebit =  sbit + aLength
+	asm("mvn r0, #0 ");
+	asm("mvn r0, r0, lsr r1 ");			// r0 = b = ~(0xffffffff >> sbit)
+	asm("cmp r5, #32 ");
+	asm("mov r8, r2");					// r8 = aLength
+	asm("bhi salloc_cross_bdry ");		// branch if (ebit >=32)
+
+	asm("mvn r5, #0 ");					// r5 = 0xffffffff
+	asm("mov r5, r5, lsr r8 ");			// r5 >> aLength
+	asm("mov r5, r5, lsr r1 ");			// r5 >> sbit
+	asm("orr r5, r5, r0 ");				// r5 = b = r0 | r5
+	asm("ldr r0, [r4] ");				// r0 = w = *pW
+	asm("and r1, r0, r5 ");				// r1 = w & b, clear the positions to be allocated
+	asm("str r1, [r4] ");				// *pW = r1, store new bit map word.
+	asm("mvn r0, r0");					// r0 = ~w
+	asm("mvn r5, r5");					// r5 = ~b
+	asm("and r0, r0, r5");				// r0 = ~w & ~b
+	asm("bl " CSM_CFUNC(__e32_bit_count_32));
+	asm("add r6, r6, r0 ");				// r6 = iAvail + allocated
+	asm("sub r0, r8, r0 ");				// return aLength - allocated
+	asm("str r6, [r7] ");				// iAvail += allocated, store free count
+	asm("ldmfd sp!, {r4-r8,pc} ");		// return
+	
+	asm("salloc_cross_bdry: ");			// r0 = b, r8 = aLength, r7 = this, r5 = ebit
+	asm("ldr r2, [r4] ");				// r2 = w = *pW
+	asm("and r1, r2, r0 ");				// r1 = w & b
+	asm("str r1, [r4], #4 ");			// *pW++ = r1, store new bit mask
+	asm("mvn r2, r2");					// r2 = ~w
+	asm("mvn r0, r0");					// r0 = ~b
+	asm("and r0, r0, r2");				// r0 = ~w & ~b
+	asm("bl " CSM_CFUNC(__e32_bit_count_32));
+	asm("add r6, r6, r0 ");				// r6 = iAvail += allocated
+	asm("sub r8, r8, r0 ");				// r8 = aLength -= allocated
+	asm("subs r5, r5, #32 ");			// r5 = ebit -= 32
+	asm("bls salloc_return ");			// ebit < 0 so return.
+	asm("cmp r5, #32 ");				// if (ebit < 32) {
+	asm("mvnlt r0, #0 ");
+	asm("movlt r0, r0, lsr r5 ");		// r0 = 0xffffffff >> ebit }
+	asm("movge r0, #0 ");				// if (ebit >= 32) r0 = b = 0
+	asm("b salloc_cross_bdry ");
+
+	asm("salloc_return: ");
+	asm("str r6, [r7] ");				// iAvail += allocated, store free count
+	asm("mov r0, r8 ");					// return aLength
+	asm("ldmfd sp!, {r4-r8,pc} ");		// return
+
+	asm("0: ");
+	ASM_FAULT();
+	}
+
+
 /**	Tests if a specific range of bit positions are all free
 	Specified range must lie within the total range for this allocator.
 
--- a/kernel/eka/klib/bma.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/klib/bma.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -433,6 +433,49 @@
 	}
 
 
+/**	Allocates a specific range of bit positions.
+	
+	The specified range must lie within the total range for this allocator but it is
+	not necessary that all the positions are currently free.
+
+	@param	aStart	First position to allocate.
+	@param	aLength	Number of consecutive positions to allocate, must be >0.
+	@return The number of previously free positions that were allocated.
+ */
+EXPORT_C TUint TBitMapAllocator::SelectiveAlloc(TInt aStart, TInt aLength)
+	{
+	__ASSERT_ALWAYS(TUint(aStart) < TUint(iSize), TBMA_FAULT());
+	__ASSERT_ALWAYS(TUint(aStart + aLength) >= TUint(aStart), TBMA_FAULT());
+	__ASSERT_ALWAYS(TUint(aStart + aLength) <= TUint(iSize), TBMA_FAULT());
+	TInt wix = aStart >> 5;
+	TInt sbit = aStart & 31;
+	TUint32* pW = iMap + wix;
+	iAvail -= aLength;	// update free count assuming no positions already allocated
+	TInt ebit = sbit + aLength;
+	if (ebit < 32)
+		{
+		TUint32 b = ((0xffffffffu >> aLength) >> sbit) | ~(0xffffffffu >> sbit);
+		TUint32 w = *pW;
+		*pW = w & b;	// mark all positions allocated
+		TUint allocated = __e32_bit_count_32(~w & ~b);
+		iAvail += allocated;	// increase free count by number of positions already allocated
+		return aLength - allocated;
+		}
+	TUint32 b = ~(0xffffffffu >> sbit);
+	while (ebit > 0)
+		{
+		TUint32 w = *pW;
+		*pW++ = w & b;		// mark all positions allocated
+		TUint allocated = __e32_bit_count_32(~w & ~b);
+		iAvail += allocated;	// increase free count by number of positions already allocated
+		aLength -= allocated;
+		ebit -= 32;
+		b = (ebit >= 32)? 0 : 0xffffffff >> ebit;
+		}
+	return aLength;
+	}
+
+
 /**	Tests whether a specific range of bit positions are all free.
 
 	The specified range must lie within the total range for this allocator.
--- a/kernel/eka/memmodel/emul/win32/mcodeseg.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/emul/win32/mcodeseg.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -66,8 +66,8 @@
 	Kern::Printf("iAccessCount = %d", a.iAccessCount);
 	Kern::Printf("iEntryPtVeneer = %08x", a.iEntryPtVeneer);
 	Kern::Printf("iFileEntryPoint = %08x", a.iFileEntryPoint);
-	Kern::Printf("iFileName = %lS", a.iFileName);
-	Kern::Printf("iRootName = %lS", &a.iRootName);
+	Kern::Printf("iFileName = %S", a.iFileName);
+	Kern::Printf("iRootName = %S", &a.iRootName);
 	Kern::Printf("iExtOffset = %d", a.iExtOffset);
 	Kern::Printf("iModuleVersion = %08x", a.iModuleVersion);
 	Kern::Printf("iUids = %08x %08x %08x", uid[0], uid[1], uid[2]);
@@ -1111,7 +1111,7 @@
 // in order to make them appear to be in z:\system\libs
 void P::NormalizeExecutableFileName(TDes& a)
 	{
-	__KTRACE_OPT(KDLL, Kern::Printf("NormalizeExecutableFileName %lS", &a));
+	__KTRACE_OPT(KDLL, Kern::Printf("NormalizeExecutableFileName %S", &a));
 	if (a.Length()<3 || a[1]!=':' || a[2]!='\\')
 		{
 		// don't have a drive so assume in 'ROM'
@@ -1120,7 +1120,7 @@
 		if (initial.Length()==0 || initial[0]!='\\')
 			a.Append('\\');
 		a+=initial;
-		__KTRACE_OPT(KDLL, Kern::Printf("NormalizeExecutableFileName -> %lS", &a));
+		__KTRACE_OPT(KDLL, Kern::Printf("NormalizeExecutableFileName -> %S", &a));
 		}
 	}
 
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mcodepaging.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mcodepaging.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -290,7 +290,7 @@
 			__KTRACE_OPT(KPAGING,Kern::Printf("  uncompressed, file offset == %x, size == %d", dataOffset, dataSize));
 			}
 
-		TInt bufferStart = info.iBlockMap.Read(aRequest->iBuffer,
+		TInt bufferStart = info.iBlockMap.Read(aRequest->Buffer(),
 												dataOffset,
 												dataSize,
 												device.iReadUnitShift,
@@ -305,7 +305,7 @@
 			break;
 			}
 
-		TLinAddr data = aRequest->iBuffer + bufferStart;
+		TLinAddr data = aRequest->Buffer() + bufferStart;
 		r = Decompress(info.iCompressionType, linAddr, decompressedSize, data, dataSize);
 		if(r>=0)
 			{
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mdatapaging.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mdatapaging.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -14,6 +14,7 @@
 //
 
 #include <plat_priv.h>
+#include <kernel/cache.h>
 #include "mm.h"
 #include "mmu.h"
 
@@ -25,6 +26,34 @@
 
 
 /**
+Log2 of minimum number of pages to attempt to write at a time.
+
+The value of 2 gives a minimum write size of 16KB.
+*/
+const TUint KMinPreferredWriteShift = 2;
+
+/**
+Log2 of maximum number of pages to attempt to write at a time.
+
+The value of 4 gives a maximum write size of 64KB.
+*/
+const TUint KMaxPreferredWriteShift = 4;
+
+__ASSERT_COMPILE((1 << KMaxPreferredWriteShift) <= KMaxPagesToClean);
+
+
+/**
+Whether the CPU has the page colouring restriction, where pages must be mapped in sequential colour
+order.
+*/
+#ifdef __CPU_CACHE_HAS_COLOUR	
+const TBool KPageColouringRestriction = ETrue;
+#else
+const TBool KPageColouringRestriction = EFalse;
+#endif
+
+
+/**
 Manages the swap via the data paging device.
 */
 class DSwapManager
@@ -57,23 +86,24 @@
 	TInt UnreserveSwap(DMemoryObject* aMemory, TUint aStartIndex, TUint aPageCount);
 	TBool IsReserved(DMemoryObject* aMemory, TUint aStartIndex, TUint aPageCount);
 
-	TInt ReadSwapPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TLinAddr aLinAddr, DPageReadRequest* aRequest, TPhysAddr* aPhysAddrs);
-	TInt WriteSwapPages(DMemoryObject** aMemory, TUint* aIndex, TUint aCount, TLinAddr aLinAddr, TBool aBackground);
+	TInt ReadSwapPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TLinAddr aLinAddr, TPhysAddr* aPhysAddrs);
+	TInt WriteSwapPages(DMemoryObject** aMemory, TUint* aIndex, TUint aCount, TLinAddr aLinAddr, TPhysAddr* aPhysAddrs, TBool aBackground);
 
 	void GetSwapInfo(SVMSwapInfo& aInfoOut);
 	TInt SetSwapThresholds(const SVMSwapThresholds& aThresholds);
+	void SetSwapAlign(TUint aSwapAlign);
 
 private:
 	inline TSwapState SwapState(TUint aSwapData);
 	inline TInt SwapIndex(TUint aSwapData);
 	inline TUint SwapData(TSwapState aSwapState, TInt aSwapIndex);
 	
-	TInt AllocSwapIndex(TInt aCount);
+	TInt AllocSwapIndex(TUint aCount);
 	void FreeSwapIndex(TInt aSwapIndex);
 	void CheckSwapThresholdsAndUnlock(TUint aInitial);
 	
 	void DoDeleteNotify(TUint aSwapIndex);
-	TInt DoWriteSwapPages(DMemoryObject** aMemory, TUint* aIndex, TUint aCount, TLinAddr aLinAddr, TInt aSwapIndex, TBool aBackground);
+	TInt DoWriteSwapPages(DMemoryObject** aMemory, TUint* aIndex, TUint aCount, TLinAddr aLinAddr, TInt aPageIndex, TPhysAddr* aPhysAddrs, TInt aSwapIndex, TBool aBackground);
 	
 private:
 	DPagingDevice* iDevice;			///< Paging device used to read and write swap pages
@@ -81,6 +111,7 @@
 	NFastMutex iSwapLock;			///< Fast mutex protecting access to all members below
 	TUint iFreePageCount;			///< Number of swap pages that have not been reserved
 	TBitMapAllocator* iBitMap;		///< Bitmap of swap pages that have been allocated
+	TUint iSwapAlign;				///< Log2 number of pages to align swap writes to
 	TUint iAllocOffset;				///< Next offset to try when allocating a swap page
  	TUint iSwapThesholdLow;
  	TUint iSwapThesholdGood;
@@ -88,11 +119,11 @@
 
 
 /**
-Manager for demand paged memory objects which contain writeable data.
-The contents of the memory are written to a backing store whenever its
-pages are 'paged out'.
+   Manager for demand paged memory objects which contain writeable data.
+   The contents of the memory are written to a backing store whenever its
+   pages are 'paged out'.
 
-@see DSwapManager
+   @see DSwapManager
 */
 class DDataPagedMemoryManager : public DPagedMemoryManager
 	{
@@ -114,6 +145,12 @@
 public:
 	void GetSwapInfo(SVMSwapInfo& aInfoOut);
 	TInt SetSwapThresholds(const SVMSwapThresholds& aThresholds);
+	TBool PhysicalAccessSupported();
+	TBool UsePhysicalAccess();
+	void SetUsePhysicalAccess(TBool aUsePhysicalAccess);
+	TUint PreferredWriteSize();
+	TUint PreferredSwapAlignment();
+	TInt SetWriteSize(TUint aWriteShift);
 
 private:
 	TInt WritePages(DMemoryObject** aMemory, TUint* aIndex, TPhysAddr* aPages, TUint aCount, DPageWriteRequest *aRequest, TBool aAnyExecutable, TBool aBackground);
@@ -130,6 +167,13 @@
 	*/
 	DSwapManager* iSwapManager;
 
+	/**
+	Whether to read and write pages by physical address without mapping them first.
+
+	Set if the paging media driver supports it.
+	*/
+	TBool iUsePhysicalAccess;
+
 public:
 	/**
 	The single instance of this manager class.
@@ -175,6 +219,15 @@
 	}
 
 
+void DSwapManager::SetSwapAlign(TUint aSwapAlign)
+	{
+	TRACE(("WDP: Set swap alignment to %d (%d KB)", aSwapAlign, 4 << aSwapAlign));
+	NKern::FMWait(&iSwapLock);
+	iSwapAlign = aSwapAlign;
+	NKern::FMSignal(&iSwapLock);
+	}
+
+
 inline DSwapManager::TSwapState DSwapManager::SwapState(TUint aSwapData)
 	{
 	TSwapState state = (TSwapState)(aSwapData & ESwapStateMask);
@@ -204,34 +257,57 @@
 
 @return The swap index of the first location allocated.
 */
-TInt DSwapManager::AllocSwapIndex(TInt aCount)
+TInt DSwapManager::AllocSwapIndex(TUint aCount)
 	{
-	__NK_ASSERT_DEBUG(aCount > 0 && aCount <= KMaxPagesToClean);
+	TRACE2(("DSwapManager::AllocSwapIndex %d", aCount));
+		
+	__NK_ASSERT_DEBUG(aCount <= KMaxPagesToClean);
 	NKern::FMWait(&iSwapLock);
 
-	// search for run of aCount from iAllocOffset to end
-	TInt carry = 0;
+	TInt carry;
 	TInt l = KMaxTInt;
-	TInt swapIndex = iBitMap->AllocAligned(aCount, 0, 0, EFalse, carry, l, iAllocOffset);
+	TInt swapIndex = -1;
 
-	// if search failed, retry from beginning
+	// if size suitable for alignment, search for aligned run of aCount from iAllocOffset to end,
+	// then from beginning
+	// 
+	// note that this aligns writes that at least as large as the alignment size - an alternative
+	// policy might be to align writes that are an exact multiple of the alignment size
+	if (iSwapAlign && aCount >= (1u << iSwapAlign))
+		{
+		carry = 0;
+		swapIndex = iBitMap->AllocAligned(aCount, iSwapAlign, 0, EFalse, carry, l, iAllocOffset);
+		if (swapIndex < 0)
+			{
+			carry = 0;
+			swapIndex = iBitMap->AllocAligned(aCount, iSwapAlign, 0, EFalse, carry, l, 0);
+			}
+		}
+	
+	// if not doing aligned search, or aligned search failed, retry without alignment
 	if (swapIndex < 0)
 		{
-		iAllocOffset = 0;
 		carry = 0;
 		swapIndex = iBitMap->AllocAligned(aCount, 0, 0, EFalse, carry, l, iAllocOffset);
+		if (swapIndex < 0)
+			{
+			carry = 0;
+			swapIndex = iBitMap->AllocAligned(aCount, 0, 0, EFalse, carry, l, 0);
+			}
 		}
 
 	// if we found one then mark it as allocated and update iAllocOffset
 	if (swapIndex >= 0)
 		{
-		__NK_ASSERT_DEBUG(swapIndex <= (iBitMap->iSize - aCount));
+		__NK_ASSERT_DEBUG(swapIndex <= (TInt)(iBitMap->iSize - aCount));
 		iBitMap->Alloc(swapIndex, aCount);
 		iAllocOffset = (swapIndex + aCount) % iBitMap->iSize;
 		}
 	
 	NKern::FMSignal(&iSwapLock);
 	__NK_ASSERT_DEBUG(swapIndex >= 0 || aCount > 1); // can't fail to allocate single page
+
+	TRACE2(("DSwapManager::AllocSwapIndex returns %d", swapIndex));	
 	return swapIndex;
 	}
 
@@ -384,7 +460,7 @@
 @param aRequest	The request to use for the read.
 @param aPhysAddrs	An array of the physical addresses for each page to read in.
 */
-TInt DSwapManager::ReadSwapPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TLinAddr aLinAddr, DPageReadRequest* aRequest, TPhysAddr* aPhysAddrs)
+TInt DSwapManager::ReadSwapPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TLinAddr aLinAddr, TPhysAddr* aPhysAddrs)
 	{
 	__ASSERT_CRITICAL;
 	
@@ -458,8 +534,10 @@
 
 @pre Called with page cleaning lock held
 */
-TInt DSwapManager::WriteSwapPages(DMemoryObject** aMemory, TUint* aIndex, TUint aCount, TLinAddr aLinAddr, TBool aBackground)
+TInt DSwapManager::WriteSwapPages(DMemoryObject** aMemory, TUint* aIndex, TUint aCount, TLinAddr aLinAddr, TPhysAddr* aPhysAddrs, TBool aBackground)
 	{
+	TRACE(("DSwapManager::WriteSwapPages %d pages", aCount));
+	
 	__ASSERT_CRITICAL;  // so we can pass the paging device a stack-allocated TThreadMessage
 	__NK_ASSERT_DEBUG(PageCleaningLock::IsHeld());
 
@@ -503,13 +581,13 @@
 			if (startIndex != -1)
 				{
 				// write pages from startIndex to i exclusive
-				TInt count = i - startIndex;
+				TUint count = i - startIndex;
 				__NK_ASSERT_DEBUG(count > 0 && count <= KMaxPagesToClean);
 
 				// Get a new swap location for these pages, writing them all together if possible
 				TInt swapIndex = AllocSwapIndex(count);
 				if (swapIndex >= 0)
-					r = DoWriteSwapPages(&aMemory[startIndex], &aIndex[startIndex], count, aLinAddr + (startIndex << KPageShift), swapIndex, aBackground);
+					r = DoWriteSwapPages(&aMemory[startIndex], &aIndex[startIndex], count, aLinAddr, startIndex, aPhysAddrs, swapIndex, aBackground);
 				else
 					{
 					// Otherwise, write them individually
@@ -517,7 +595,7 @@
 						{
 						swapIndex = AllocSwapIndex(1);
 						__NK_ASSERT_DEBUG(swapIndex >= 0);
-						r = DoWriteSwapPages(&aMemory[j], &aIndex[j], 1, aLinAddr + (j << KPageShift), swapIndex, aBackground);
+						r = DoWriteSwapPages(&aMemory[j], &aIndex[j], 1, aLinAddr, j, &aPhysAddrs[j], swapIndex, aBackground);
 						if (r != KErrNone)
 							break;
 						}
@@ -533,16 +611,22 @@
 	return r;
 	}
 
-TInt DSwapManager::DoWriteSwapPages(DMemoryObject** aMemory, TUint* aIndex, TUint aCount, TLinAddr aLinAddr, TInt aSwapIndex, TBool aBackground)
+TInt DSwapManager::DoWriteSwapPages(DMemoryObject** aMemory, TUint* aIndex, TUint aCount, TLinAddr aLinAddr, TInt aPageIndex, TPhysAddr* aPhysAddrs, TInt aSwapIndex, TBool aBackground)
 	{	
+	TRACE2(("DSwapManager::DoWriteSwapPages %d pages to %d", aCount, aSwapIndex));
 		
 	const TUint readUnitShift = iDevice->iReadUnitShift;
 	const TUint writeSize = aCount << (KPageShift - readUnitShift);
 	const TUint writeOffset = aSwapIndex << (KPageShift - readUnitShift);
-		
+
 	TThreadMessage msg;
 	START_PAGING_BENCHMARK;
-	TInt r = iDevice->Write(&msg, aLinAddr, writeOffset, writeSize, aBackground);
+	TInt r;
+	if (aLinAddr == 0)
+		r = iDevice->WritePhysical(&msg, aPhysAddrs, aCount, writeOffset, aBackground);
+	else
+		r = iDevice->Write(&msg, aLinAddr + (aPageIndex << KPageShift), writeOffset, writeSize, aBackground);
+		
 	if (r != KErrNone)
 		{
 		__KTRACE_OPT(KPANIC, Kern::Printf("DSwapManager::WriteSwapPages: error writing media from %08x to %08x + %x: %d", aLinAddr, writeOffset << readUnitShift, writeSize << readUnitShift, r));
@@ -643,6 +727,63 @@
 	}
 
 
+TBool DDataPagedMemoryManager::PhysicalAccessSupported()
+	{
+	return (iDevice->iFlags & DPagingDevice::ESupportsPhysicalAccess) != 0;
+	}
+
+
+TBool DDataPagedMemoryManager::UsePhysicalAccess()
+	{
+	return iUsePhysicalAccess;
+	}
+
+
+void DDataPagedMemoryManager::SetUsePhysicalAccess(TBool aUsePhysicalAccess)
+	{
+	TRACE(("WDP: Use physical access set to %d", aUsePhysicalAccess));
+	NKern::ThreadEnterCS();
+	PageCleaningLock::Lock();
+	iUsePhysicalAccess = aUsePhysicalAccess;
+	ThePager.SetCleanInSequence(!iUsePhysicalAccess && KPageColouringRestriction);
+	PageCleaningLock::Unlock();
+	NKern::ThreadLeaveCS();
+	}
+
+
+TUint DDataPagedMemoryManager::PreferredWriteSize()
+	{
+	return MaxU(iDevice->iPreferredWriteShift, KMinPreferredWriteShift + KPageShift) - KPageShift;
+	}
+
+
+TUint DDataPagedMemoryManager::PreferredSwapAlignment()
+	{
+	return MaxU(iDevice->iPreferredWriteShift, KPageShift) - KPageShift;
+	}
+
+
+TInt DDataPagedMemoryManager::SetWriteSize(TUint aWriteShift)
+	{
+	TRACE(("WDP: Set write size to %d (%d KB)", aWriteShift, 4 << aWriteShift));
+	// Check value is sensible
+	if (aWriteShift > 31)
+		return KErrArgument;
+	if (aWriteShift > KMaxPreferredWriteShift)
+		{
+		aWriteShift = KMaxPreferredWriteShift;
+		TRACE(("WDP: Reduced write size to %d (%d KB)",
+			   aWriteShift, 4 << aWriteShift));
+
+		}
+	NKern::ThreadEnterCS();
+	PageCleaningLock::Lock();
+	ThePager.SetPagesToClean(1 << aWriteShift);
+	PageCleaningLock::Unlock();
+	NKern::ThreadLeaveCS();
+	return KErrNone;
+	}
+
 
 TInt DDataPagedMemoryManager::InstallPagingDevice(DPagingDevice* aDevice)
 	{
@@ -673,9 +814,11 @@
 
 	// Now we can determine the size of the swap, create the swap manager.
 	iSwapManager = new DSwapManager;
-	__NK_ASSERT_ALWAYS(iSwapManager);
+	if (!iSwapManager)
+		return KErrNoMemory;
 
-	TInt r = iSwapManager->Create(iDevice);
+	// Create swap manager object
+	TInt r = iSwapManager->Create(aDevice);
 	if (r != KErrNone)
 		{// Couldn't create the swap manager.
 		delete iSwapManager;
@@ -683,6 +826,25 @@
 		NKern::SafeSwap(NULL, (TAny*&)iDevice);
 		return r;
 		}
+
+	// Enable physical access where supported
+	SetUsePhysicalAccess(PhysicalAccessSupported());
+	
+	// Determine swap alignment and number of pages to clean at once from device's preferred write
+	// size, if set
+	TRACE(("WDP: Preferred write shift is %d", iDevice->iPreferredWriteShift));
+	r = SetWriteSize(PreferredWriteSize());
+	if (r != KErrNone)
+		{
+		delete iSwapManager;
+		iSwapManager = NULL;
+		NKern::SafeSwap(NULL, (TAny*&)iDevice);
+		return r;
+		}
+
+	// Set swap alignment
+	iSwapManager->SetSwapAlign(PreferredSwapAlignment());
+	
  	NKern::LockedSetClear(K::MemModelAttributes, 0, EMemModelAttrDataPaging);
 
 	return r;
@@ -755,10 +917,15 @@
 	{
 	__NK_ASSERT_DEBUG(aRequest->CheckUseContiguous(aMemory,aIndex,aCount));
 
+	// todo: Possible to read using physical addresses here, but not sure it's worth it because it's
+	// not much saving and we may need to map the page anyway if it's blank to clear it
+	// 
+	// todo: Could move clearing pages up to here maybe?
+
 	// Map pages temporarily so that we can copy into them.
 	const TLinAddr linAddr = aRequest->MapPages(aIndex, aCount, aPages);
 
-	TInt r = iSwapManager->ReadSwapPages(aMemory, aIndex, aCount, linAddr, aRequest, aPages);
+	TInt r = iSwapManager->ReadSwapPages(aMemory, aIndex, aCount, linAddr, aPages);
 
 	// The memory object allows executable mappings then need IMB.
 	aRequest->UnmapPages(aMemory->IsExecutable());
@@ -769,13 +936,28 @@
 
 TInt DDataPagedMemoryManager::WritePages(DMemoryObject** aMemory, TUint* aIndex, TPhysAddr* aPages, TUint aCount, DPageWriteRequest* aRequest, TBool aAnyExecutable, TBool aBackground)
 	{
-	// Map pages temporarily so that we can copy into them.
-	const TLinAddr linAddr = aRequest->MapPages(aIndex[0], aCount, aPages);
+	// Note: this method used to do an IMB for executable pages (like ReadPages) but it was thought
+	// that this was uncessessary and so was removed
+
+	TLinAddr linAddr = 0;
 
-	TInt r = iSwapManager->WriteSwapPages(aMemory, aIndex, aCount, linAddr, aBackground);
+	if (iUsePhysicalAccess)
+		{
+		// must maps pages to perform cache maintenance but can map each page individually
+		for (TUint i = 0 ; i < aCount ; ++i)
+			{
+			TLinAddr addr = aRequest->MapPages(aIndex[i], 1, &aPages[i]);
+			Cache::SyncMemoryBeforeDmaWrite(addr, KPageSize);
+			aRequest->UnmapPages(EFalse);
+			}
+		}
+	else
+		linAddr = aRequest->MapPages(aIndex[0], aCount, aPages);
+	
+	TInt r = iSwapManager->WriteSwapPages(aMemory, aIndex, aCount, linAddr, aPages, aBackground);
 
-	// The memory object allows executable mappings then need IMB.
-	aRequest->UnmapPages(aAnyExecutable);
+	if (linAddr != 0)
+		aRequest->UnmapPages(EFalse);
 
 	return r;
 	}
@@ -783,6 +965,8 @@
 
 void DDataPagedMemoryManager::CleanPages(TUint aPageCount, SPageInfo** aPageInfos, TBool aBackground)
 	{
+	TRACE(("DDataPagedMemoryManager::CleanPages %d", aPageCount));
+	
 	__NK_ASSERT_DEBUG(PageCleaningLock::IsHeld());
 	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
 	__NK_ASSERT_DEBUG(aPageCount <= (TUint)KMaxPagesToClean);
@@ -792,7 +976,7 @@
 	TUint index[KMaxPagesToClean];
 	TPhysAddr physAddr[KMaxPagesToClean];
 	TBool anyExecutable = EFalse;
-	
+
 	for (i = 0 ; i < aPageCount ; ++i)
 		{
 		SPageInfo* pi = aPageInfos[i];
@@ -828,7 +1012,8 @@
 		{
 		SPageInfo* pi = aPageInfos[i];
 		// check if page is clean...
-		if(pi->CheckModified(&memory[0]) || pi->IsWritable())
+		if(pi->CheckModified(&memory[0]) ||
+		   pi->IsWritable())
 			{
 			// someone else modified the page, or it became writable, so mark as not cleaned
 			aPageInfos[i] = NULL;
@@ -875,4 +1060,34 @@
 	{
 	return ((DDataPagedMemoryManager*)TheDataPagedMemoryManager)->SetSwapThresholds(aThresholds);
 	}
-  
+
+
+TBool GetPhysicalAccessSupported()
+	{
+	return ((DDataPagedMemoryManager*)TheDataPagedMemoryManager)->PhysicalAccessSupported();
+	}
+
+
+TBool GetUsePhysicalAccess()
+	{
+	return ((DDataPagedMemoryManager*)TheDataPagedMemoryManager)->UsePhysicalAccess();
+	}
+
+
+void SetUsePhysicalAccess(TBool aUsePhysicalAccess)
+	{
+	((DDataPagedMemoryManager*)TheDataPagedMemoryManager)->SetUsePhysicalAccess(aUsePhysicalAccess);
+	}
+
+
+TUint GetPreferredDataWriteSize()
+	{
+	return ((DDataPagedMemoryManager*)TheDataPagedMemoryManager)->PreferredWriteSize();
+	}
+
+
+TInt SetDataWriteSize(TUint aWriteShift)
+	{
+	return	((DDataPagedMemoryManager*)TheDataPagedMemoryManager)->SetWriteSize(aWriteShift);
+	}
+
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mdefrag.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mdefrag.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -115,51 +115,89 @@
 	RamAllocLock::Lock();
 
 	// Move the page to any RAM zone.
-	r = M::MovePage(aOld, aNew, KRamZoneInvalidId, EFalse);
+	r = M::MovePage(aOld, aNew, KRamZoneInvalidId, 0);
 
 	RamAllocLock::Unlock();
 	return r;
 	}
 
 
-TInt M::MovePage(TPhysAddr aOld, TPhysAddr& aNew, TUint aBlockZoneId, TBool aBlockRest)
+TInt M::MovePage(TPhysAddr aOld, TPhysAddr& aNew, TUint aBlockZoneId, TUint aMoveDisFlags)
 	{
-	TInt r;
+	// Returns this when page is not paged or managed or free but is a real RAM page.
+	TInt r = KErrNotSupported;
 
 	// get memory object corresponding to the page...
 	DMemoryObject* memory = 0;
 	MmuLock::Lock();
-	SPageInfo* pi = SPageInfo::SafeFromPhysAddr(aOld&~KPageMask);
+	SPageInfo* pi = SPageInfo::SafeFromPhysAddr(aOld & ~KPageMask);
+	if (pi)
+		{
+		if (pi->PagedState() != SPageInfo::EUnpaged)
+			{// The page is paged so let the pager handle it.
+			return ThePager.DiscardPage(pi, aBlockZoneId, aMoveDisFlags);
+			}
+		switch (pi->Type())
+			{
+			case SPageInfo::EManaged:
+				memory = pi->Owner();
+				memory->Open();
+				// move page, this will release the mmu lock.
+				r = memory->iManager->MovePage(	memory, pi, aNew, aBlockZoneId, 
+												(aMoveDisFlags & M::EMoveDisBlockRest)!=0);
+				memory->AsyncClose();
+				break;
+			case SPageInfo::EUnused:
+				r = KErrNotFound;	// This page is free so nothing to do.
+				// Fall through..
+			default:
+				MmuLock::Unlock();
+			}
+		}
+	else
+		{// page info for aOld not found so aOld is not a RAM page...
+		MmuLock::Unlock();
+		r = KErrArgument;
+		}
+	return r;
+	}
+
+
+TInt M::MoveAndAllocPage(TPhysAddr aAddr, TZonePageType aPageType)
+	{
+	// Returns this when page is not paged or managed or free but is a real RAM page.
+	TInt r = KErrNotSupported;
+
+	// get memory object corresponding to the page...
+	DMemoryObject* memory = 0;
+	MmuLock::Lock();
+	SPageInfo* pi = SPageInfo::SafeFromPhysAddr(aAddr & ~KPageMask);
 	if(pi)
 		{
 		if (pi->PagedState() != SPageInfo::EUnpaged)
 			{// The page is paged so let the pager handle it.
-			return ThePager.DiscardPage(pi, aBlockZoneId, aBlockRest);
+			return ThePager.DiscardAndAllocPage(pi, aPageType);
 			}
-		if (pi->Type()==SPageInfo::EManaged)
-			memory = pi->Owner();
-		}
-	MmuLock::Unlock();
-
-	// Note, whilst we hold the RamAllocLock the page can't change it's use
-	// and we can safely assume that it still belongs to the memory object
-	// at a fixed page index.
-	// Also, as memory objects can't be destroyed whilst they still own pages
-	// we can safely access this object without taking an explicit referernce,
-	// i.e. we don't need to Open() the memory object.
-	if (!pi)
-		{// page info for aOld not found so aOld is not a RAM page...
-		r = KErrArgument;
-		}
-	else if(!memory)
-		{
-		// page does not have a memory manager, so we can't move it...
-		r = KErrNotSupported;
+		switch (pi->Type())
+			{
+			case SPageInfo::EManaged:
+				memory = pi->Owner();
+				memory->Open();
+				// move page, this will release the mmu lock.
+				r = memory->iManager->MoveAndAllocPage(memory, pi, aPageType);
+				memory->AsyncClose();
+				break;
+			case SPageInfo::EUnused:
+				r = KErrNone;	// This page is free so nothing to do.
+				// Fall through..
+			default:
+				MmuLock::Unlock();
+			}
 		}
 	else
-		{
-		// move page...
-		r = memory->iManager->MovePage(memory, pi, aNew, aBlockZoneId, aBlockRest);
+		{// page info for aAddr not found so aAddr is not a RAM page...
+		MmuLock::Unlock();
+		r = KErrArgument;
 		}
 	return r;
 	}
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mdefrag.inl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mdefrag.inl	Thu Jul 22 16:46:39 2010 +0100
@@ -50,10 +50,10 @@
 	}
 
 
-inline TInt M::DiscardPage(TPhysAddr aAddr, TUint aBlockZoneId, TBool aBlockRest)
+inline TInt M::DiscardPage(TPhysAddr aAddr, TUint aBlockZoneId, TUint aMoveDisFlags)
 	{
 	TPhysAddr newAddr;
-	return MovePage(aAddr, newAddr, aBlockZoneId, aBlockRest);
+	return MovePage(aAddr, newAddr, aBlockZoneId, aMoveDisFlags);
 	}
 
 
@@ -75,3 +75,9 @@
 								aZone->iPhysPages,
 								(Mmu::TRamAllocFlags)EMemAttStronglyOrdered);
 	}
+
+
+inline TBool M::GetFreePages(TUint aNumPages)
+	{
+	return ThePager.GetFreePages(aNumPages);
+	}
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mm.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mm.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1124,6 +1124,14 @@
 FORCE_INLINE void FlagClear(T& a,const T b,const T c,const T d)
 	{ a = (T)(a&~b&~c&~d); }
 
+/// Utility function to calculate the minimum of two unsigned integers
+FORCE_INLINE TUint MinU(TUint a, TUint b)
+	{ return a <= b ? a : b; }
+
+/// Utility function to calculate the maximum of two unsigned integers
+FORCE_INLINE TUint MaxU(TUint a, TUint b)
+	{ return a >= b ? a : b; }
+
 
 #include <memmodel/epoc/mmubase/kblockmap.h>
 
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mmanager.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mmanager.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -131,9 +131,18 @@
 TInt DMemoryManager::MovePage(	DMemoryObject* aMemory, SPageInfo* aOldPageInfo, 
 								TPhysAddr& aNewPage, TUint aBlockZoneId, TBool aBlockRest)
 	{
+	MmuLock::Unlock();
 	return KErrNotSupported;
 	}
 
+
+TInt DMemoryManager::MoveAndAllocPage(DMemoryObject*, SPageInfo*, TZonePageType)
+	{
+	__NK_ASSERT_DEBUG(0);	// This should only be invoked on managers that can move or discard pages.
+	return KErrNotSupported;
+	}
+
+
 TZonePageType DMemoryManager::PageType()
 	{// This should not be invoked on memory managers that do not use the methods
 	// AllocPages() and FreePages().
@@ -721,6 +730,7 @@
 public:
 	// from DMemoryManager...
 	virtual TInt MovePage(DMemoryObject* aMemory, SPageInfo* aOldPageInfo, TPhysAddr& aNewPage, TUint aBlockZoneId, TBool aBlockRest);
+	virtual TInt MoveAndAllocPage(DMemoryObject* aMemory, SPageInfo* aPageInfo, TZonePageType aPageType);
 	virtual TInt HandleFault(	DMemoryObject* aMemory, TUint aIndex, DMemoryMapping* aMapping, 
 								TUint aMapInstanceCount, TUint aAccessPermissions);
 	virtual TZonePageType PageType();
@@ -740,20 +750,8 @@
 										TPhysAddr& aNewPage, TUint aBlockZoneId, TBool aBlockRest)
 	{
 	__NK_ASSERT_DEBUG(RamAllocLock::IsHeld());
-
-	// Allocate the new page to move to, ensuring that we use the page type of the
-	// manager assigned to this page.
-	TPhysAddr newPage;
-	Mmu& m = TheMmu;
-	TInt r = m.AllocRam(&newPage, 1, aMemory->RamAllocFlags(), aMemory->iManager->PageType(), 
-						aBlockZoneId, aBlockRest);
-	if (r != KErrNone)
-		{// Failed to allocate a new page to move the page to so can't continue.
-		return r;
-		}
-	
-	r = KErrInUse;
-	MmuLock::Lock();
+	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
+	TInt r = KErrInUse;
 
 	TUint index = aOldPageInfo->Index();
 	TRACE(	("DMovableMemoryManager::MovePage(0x%08x,0x%08x,?,0x%08x,%d) index=0x%x",
@@ -766,7 +764,6 @@
 	if (!movingPageArrayPtr)
 		{// Can't move the page another operation is being performed on it.
 		MmuLock::Unlock();
-		TheMmu.FreeRam(&newPage, 1, aMemory->iManager->PageType());
 		return r;
 		}
 	__NK_ASSERT_DEBUG(RPageArray::IsPresent(*movingPageArrayPtr));
@@ -779,13 +776,41 @@
 		__NK_ASSERT_DEBUG(SPageInfo::FromPhysAddr(oldPage)->Type() == SPageInfo::EShadow);
 		}
 #endif
+	// Set the modifier so we can detect if the page state is updated.
+	aOldPageInfo->SetModifier(&pageIter);
+
+	MmuLock::Unlock();
+
+	// Allocate the new page to move to, ensuring that we use the page type of the
+	// manager assigned to this page.
+	TPhysAddr newPage;
+	Mmu& m = TheMmu;
+	TInt allocRet = m.AllocRam(&newPage, 1, aMemory->RamAllocFlags(), aMemory->iManager->PageType(), 
+						aBlockZoneId, aBlockRest);
+	if (allocRet != KErrNone)
+		{
+		MmuLock::Lock();
+		aMemory->iPages.MovePageEnd(*movingPageArrayPtr, index);
+		MmuLock::Unlock();
+		return allocRet;
+		}
+
 	__NK_ASSERT_DEBUG((newPage & KPageMask) == 0);
 	__NK_ASSERT_DEBUG(newPage != oldPage);
 
-	// Set the modifier so we can detect if the page state is updated.
-	aOldPageInfo->SetModifier(&pageIter);
+	MmuLock::Lock();
+	if (aOldPageInfo->CheckModified(&pageIter) ||
+		oldPageEntry != *movingPageArrayPtr)
+		{// The page was modified or freed.
+		aMemory->iPages.MovePageEnd(*movingPageArrayPtr, index);
+		MmuLock::Unlock();
+		m.FreeRam(&newPage, 1, aMemory->iManager->PageType());
+		return r;
+		}
+	MmuLock::Unlock();
 
-	// Restrict the page ready for moving.
+	// This page's contents may be changed so restrict the page to no access 
+	// so we can detect any access to it while we are moving it.
 	// Read only memory objects don't need to be restricted but we still need
 	// to discover any physically pinned mappings.
 	TBool pageRestrictedNA = !aMemory->IsReadOnly();
@@ -793,9 +818,6 @@
 										ERestrictPagesNoAccessForMoving :
 										ERestrictPagesForMovingFlag;
 
-	// This page's contents may be changed so restrict the page to no access 
-	// so we can detect any access to it while we are moving it.
-	MmuLock::Unlock();
 	// This will clear the memory objects mapping added flag so we can detect any new mappings.
 	aMemory->RestrictPages(pageIter, restrictType);
 
@@ -808,7 +830,8 @@
 	// If the page array entry (*movingPageArrayPtr) has been modified then a pinning 
 	// veto'd the preparation.
 	MmuLock::Lock();
-	if (aOldPageInfo->CheckModified(&pageIter) || oldPageEntry != *movingPageArrayPtr)
+	if (aOldPageInfo->CheckModified(&pageIter) ||
+		oldPageEntry != *movingPageArrayPtr)
 		{// Page is pinned or has been modified by another operation.
 		MmuLock::Unlock();
 		TheMmu.FreeRam(&newPage, 1, aMemory->iManager->PageType());
@@ -833,7 +856,8 @@
 #endif
 	
 	MmuLock::Lock();
-	if (!aOldPageInfo->CheckModified(&pageIter) && oldPageEntry == *movingPageArrayPtr &&
+	if (!aOldPageInfo->CheckModified(&pageIter) &&
+		oldPageEntry == *movingPageArrayPtr &&
 		!aMemory->MappingAddedFlag())
 		{
 		// The page has been copied without anyone modifying it so set the page 
@@ -880,13 +904,25 @@
 #endif
 	// indicate we've stopped moving memory now...
 	MmuLock::Lock();
-	RPageArray::MovePageEnd(*movingPageArrayPtr);
+	aMemory->iPages.MovePageEnd(*movingPageArrayPtr, index);
 	MmuLock::Unlock();
 
 	return r;
 	}
 
 
+TInt DMovableMemoryManager::MoveAndAllocPage(DMemoryObject* aMemory, SPageInfo* aPageInfo, TZonePageType aPageType)
+	{
+	TPhysAddr newPage;
+	TInt r = MovePage(aMemory, aPageInfo, newPage, KRamZoneInvalidId, EFalse);
+	if (r == KErrNone)
+		{
+		TheMmu.MarkPageAllocated(aPageInfo->PhysAddr(), aPageType);
+		}
+	return r;
+	}
+
+
 TInt DMovableMemoryManager::HandleFault(DMemoryObject* aMemory, TUint aIndex, DMemoryMapping* aMapping, 
 										TUint aMapInstanceCount, TUint aAccessPermissions)
 	{
@@ -1099,7 +1135,10 @@
 
 			// attempt to clean the page if it is dirty...
 			if (aPageInfo->IsDirty())
+				{
+				//Kern::Printf("WDP: Cleaning single page in StealPage");
 				aMemory->iManager->CleanPages(1, &aPageInfo, EFalse);
+				}
 
 			if(aPageInfo)
 				{
@@ -1515,10 +1554,7 @@
 
 	page = *p;
 	if(aPageInfo->CheckModified(&pageList) || page!=originalPage/*page state changed*/)
-		{
-		// page state was changed by someone else...
 		r = KErrInUse;
-		}
 	else
 		{
 		// nobody else has modified page state, so restrictions successfully applied...
@@ -1657,6 +1693,8 @@
 	TRACE(("DPagedMemoryManager::DoPin(0x%08x,0x%08x,0x%08x,0x%08x)",aMemory, aIndex, aCount, aMapping));
 	__ASSERT_CRITICAL;
 	__NK_ASSERT_DEBUG(aPinArgs.HaveSufficientPages(aCount));
+	__NK_ASSERT_DEBUG(aMapping->IsPinned());
+	__NK_ASSERT_DEBUG(!aMapping->PagesPinned());
 
 	// check and allocate page array entries...
 	RPageArray::TIter pageList;
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mmanager.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mmanager.h	Thu Jul 22 16:46:39 2010 +0100
@@ -359,11 +359,37 @@
 	virtual void Unpin(DMemoryObject* aMemory, DMemoryMappingBase* aMapping, TPinArgs& aPinArgs) =0;
 
 	/**
-	@todo
+	Attempt to move the page specified to a new physical location.  The new physical
+	location for the page to be moved to is allocated by this method.  However,
+	aBlockZoneId and aBlockRest can be used to control which RAM zone the new
+	location is in.
+
+	@param aMemory		The memory object that owns the page.
+	@param aOldPageInfo	The page info for the physical page to move.
+	@param aNewPage 	On success this will hold the physical address of the new 
+						location for the page.
+	@param aBlockZoneId The ID of a RAM zone not to allocate the new page into.
+	@param aBlockRest 	When set to ETrue the search for a new page will stop if it 
+						ever needs to look at aBlockZoneId.
+	@return KErrNone on success, KErrInUse if the page couldn't be moved, 
+			or KErrNoMemory if it wasn't possible to allocate a new page.
 	*/
 	virtual TInt MovePage(DMemoryObject* aMemory, SPageInfo* aOldPageInfo, TPhysAddr& aNewPage, TUint aBlockZoneId, TBool aBlockRest);
 
 	/**
+	Move the page specified to a new physical location and mark the page as 
+	allocated as type aPageType.
+	
+	@param aMemory		The memory object that owns the page.
+	@param aPageInfo	The page info for the physical page to move.
+	@param aPageType	The type of the page to allocate into the orignal physical 
+						location of the page to move.
+	@return KErrNone on success, KErrInUse if the page couldn't be moved, 
+			or KErrNoMemory if it wasn't possible to allocate a new page.
+	*/
+	virtual TInt MoveAndAllocPage(DMemoryObject* aMemory, SPageInfo* aPageInfo, TZonePageType aPageType);
+
+	/**
 	Return the TZonePageType of the pages that the memory manager can allocate and free.
 	*/
 	virtual TZonePageType PageType();
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mmapping.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mmapping.h	Thu Jul 22 16:46:39 2010 +0100
@@ -237,7 +237,7 @@
 	*/
 	FORCE_INLINE TBool IsPinned()
 		{ return Flags()&EPinned; }
-		
+
 	/**
 	Return true if this mapping physically pins the memory it maps.
 	*/
@@ -245,6 +245,12 @@
 		{ return Flags()&EPhysicalPinningMapping; }
 
 	/**
+	Return true if this mapping has beed successfully attached to a memory object, pinning its pages.
+	*/
+	FORCE_INLINE TBool PagesPinned()
+		{ return Flags()&EPagesPinned; }		
+		
+	/**
 	Return the access permissions which this mapping uses to maps memory.
 	*/
 	FORCE_INLINE TMappingPermissions Permissions()
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mmu.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mmu.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -622,7 +622,7 @@
 	__KTRACE_OPT(KMMU,Kern::Printf("Mmu::ZoneAllocPhysicalRam(?,%d,%d,?,%d)", aZoneIdCount, aBytes, aPhysAddr, aAlign));
 	__NK_ASSERT_DEBUG(RamAllocLock::IsHeld());
 
-	TInt r = iRamPageAllocator->ZoneAllocContiguousRam(aZoneIdList, aZoneIdCount, aBytes, aPhysAddr, EPageFixed, aAlign);
+	TInt r = iRamPageAllocator->ZoneAllocContiguousRam(aZoneIdList, aZoneIdCount, aBytes, aPhysAddr, aAlign);
 	if(r!=KErrNone)
 		iRamAllocFailed = ETrue;
 	else
@@ -859,8 +859,14 @@
 		}
 #endif
 	TInt missing = iRamPageAllocator->AllocRamPages(aPages, aCount, aZonePageType, aBlockZoneId, aBlockRest);
-	if(missing && !(aFlags&EAllocNoPagerReclaim) && ThePager.GetFreePages(missing))
-		missing = iRamPageAllocator->AllocRamPages(aPages, aCount, aZonePageType, aBlockZoneId, aBlockRest);
+	if(missing && !(aFlags&EAllocNoPagerReclaim))
+		{
+		// taking the page cleaning lock here prevents the pager releasing the ram alloc lock
+		PageCleaningLock::Lock();  
+		if (ThePager.GetFreePages(missing))
+			missing = iRamPageAllocator->AllocRamPages(aPages, aCount, aZonePageType, aBlockZoneId, aBlockRest);
+		PageCleaningLock::Unlock();  
+		}
 	TInt r = missing ? KErrNoMemory : KErrNone;
 	if(r!=KErrNone)
 		iRamAllocFailed = ETrue;
@@ -871,6 +877,22 @@
 	}
 
 
+/**
+Mark a page as being allocated to a particular page type.
+
+NOTE - This page should not be used until PagesAllocated() has been invoked on it.
+
+@param aPhysAddr		The physical address of the page to mark as allocated.
+@param aZonePageType	The type of the page to mark as allocated.
+*/
+void Mmu::MarkPageAllocated(TPhysAddr aPhysAddr, TZonePageType aZonePageType)
+	{
+	__KTRACE_OPT(KMMU,Kern::Printf("Mmu::MarkPageAllocated(0x%x, %d)", aPhysAddr, aZonePageType));
+	__NK_ASSERT_DEBUG(RamAllocLock::IsHeld());
+	iRamPageAllocator->MarkPageAllocated(aPhysAddr, aZonePageType);
+	}
+
+
 void Mmu::FreeRam(TPhysAddr* aPages, TUint aCount, TZonePageType aZonePageType)
 	{
 	__KTRACE_OPT(KMMU,Kern::Printf("Mmu::FreeRam(?,%d)",aCount));
@@ -890,20 +912,31 @@
 		SPageInfo* pi = SPageInfo::FromPhysAddr(pagePhys);
 		PageFreed(pi);
 
-		// If this is an old page of a page being moved that was previously pinned
-		// then make sure it is freed as discardable otherwise despite DPager::DonatePages()
-		// having marked it as discardable it would be freed as movable.
-		__NK_ASSERT_DEBUG(pi->PagedState() != SPageInfo::EPagedPinnedMoved || aCount == 1);
-		if (pi->PagedState() == SPageInfo::EPagedPinnedMoved)
-			aZonePageType = EPageDiscard;
-
-		if(ThePager.PageFreed(pi)==KErrNone)
-			--aCount; // pager has dealt with this page, so one less for us
-		else
+		switch (ThePager.PageFreed(pi))
 			{
-			// All paged pages should have been dealt with by the pager above.
-			__NK_ASSERT_DEBUG(pi->PagedState() == SPageInfo::EUnpaged);
-			*pagesOut++ = pagePhys; // store page address for freeing later
+			case KErrNone: 
+				--aCount; // pager has dealt with this page, so one less for us
+				break;
+			case KErrCompletion:
+				// This was a pager controlled page but it is no longer required.
+				__NK_ASSERT_DEBUG(aZonePageType == EPageMovable || aZonePageType == EPageDiscard);
+				__NK_ASSERT_DEBUG(pi->PagedState() == SPageInfo::EUnpaged);
+				if (aZonePageType == EPageMovable)
+					{// This page was donated to the pager so have to free it here
+					// as aZonePageType is incorrect for this page but aPages may 
+					// contain a mixture of movable and discardable pages.
+					MmuLock::Unlock();
+					iRamPageAllocator->FreeRamPages(&pagePhys, 1, EPageDiscard);
+					aCount--; // We've freed this page here so one less to free later
+					flash = 0;	// reset flash count as we released the mmulock.
+					MmuLock::Lock();
+					break;
+					}
+				// fall through..
+			default:
+				// Free this page..
+				__NK_ASSERT_DEBUG(pi->PagedState() == SPageInfo::EUnpaged);
+				*pagesOut++ = pagePhys; // store page address for freeing later
 			}
 		}
 	MmuLock::Unlock();
@@ -922,21 +955,15 @@
 		__KTRACE_OPT(KMMU,Kern::Printf("Mmu::AllocContiguousRam returns simulated OOM %d",KErrNoMemory));
 		return KErrNoMemory;
 		}
-	// Only the page sets EAllocNoPagerReclaim and it shouldn't allocate contiguous ram.
+	// Only the pager sets EAllocNoPagerReclaim and it shouldn't allocate contiguous ram.
 	__NK_ASSERT_DEBUG(!(aFlags&EAllocNoPagerReclaim));
 #endif
-	TInt r = iRamPageAllocator->AllocContiguousRam(aCount, aPhysAddr, EPageFixed, aAlign+KPageShift);
-	if(r==KErrNoMemory && aCount > KMaxFreeableContiguousPages)
-		{
-		// flush paging cache and retry...
-		ThePager.FlushAll();
-		r = iRamPageAllocator->AllocContiguousRam(aCount, aPhysAddr, EPageFixed, aAlign+KPageShift);
-		}
+	TInt r = iRamPageAllocator->AllocContiguousRam(aCount, aPhysAddr, aAlign+KPageShift);
 	if(r!=KErrNone)
 		iRamAllocFailed = ETrue;
 	else
 		PagesAllocated((TPhysAddr*)(aPhysAddr|1), aCount, aFlags);
-	__KTRACE_OPT(KMMU,Kern::Printf("AllocContiguouseRam returns %d and aPhysAddr=0x%08x",r,aPhysAddr));
+	__KTRACE_OPT(KMMU,Kern::Printf("AllocContiguousRam returns %d and aPhysAddr=0x%08x",r,aPhysAddr));
 	return r;
 	}
 
@@ -1623,48 +1650,65 @@
 
 	// get page to remap...
 	TPhysAddr pagePhys = aPage;
-	
+
 	// Only remap the page if it is committed or it is being moved and
 	// no other operation has been performed on the page.
 	if(!RPageArray::TargetStateIsCommitted(pagePhys))
 		return; // page no longer needs mapping
-	
+
 	// Only remap the page if it is currently mapped, i.e. doesn't have an unallocated pte.
 	// This will only be true if a new mapping is being added but it hasn't yet updated 
 	// all the ptes for the pages that it maps.
 	TPte pte = *aPtePtr;
 	if (pte == KPteUnallocatedEntry)
 		return;
-	
+
 	// clear type flags...
 	pagePhys &= ~KPageMask;
 
+	// Get the SPageInfo of the page to map.  Allow pages without SPageInfos to
+	// be mapped as when freeing a shadow page may need to remap an unpaged ROM 
+	// page which won't have an SPageInfo.
 	SPageInfo* pi = SPageInfo::SafeFromPhysAddr(pagePhys);
 	if (pi)
 		{
 		SPageInfo::TPagedState pagedState = pi->PagedState();
 		if (pagedState != SPageInfo::EUnpaged)
 			{
-			// The page is demand paged.  Only remap the page if it is pinned or is currently
-			// accessible but to the old physical page.
-			if (pagedState != SPageInfo::EPagedPinned &&
-				 (Mmu::IsPteInaccessible(pte) || (pte^pagePhys) < TPte(KPageSize)))
-				return;
-			if (!pi->IsDirty())
+			// For paged pages only update the pte if the pte points to the wrong physical
+			// address or the page is pinned.
+			if (pagedState != SPageInfo::EPagedPinned)
 				{
-				// Ensure that the page is mapped as read only to prevent pages being marked dirty
-				// by page moving despite not having been written to
-				Mmu::MakePteInaccessible(aBlankPte, EFalse);
+				if ((pte^pagePhys) < TPte(KPageSize))
+					return;
+				if (Mmu::IsPteInaccessible(pte))
+					{
+					// Updating this pte shouldn't be necessary but it stops random data 
+					// corruption in stressed cases???
+					Mmu::MakePteInaccessible(aBlankPte, EFalse);
+					}
+				else if (!pi->IsDirty())
+					{
+					// Ensure that the page is mapped as read only to prevent pages being writable 
+					// without having been marked dirty.
+					Mmu::MakePteInaccessible(aBlankPte, ETrue);
+					}
+				}
+			else if (!pi->IsDirty())
+				{
+				// Ensure that the page is mapped as read only to prevent pages being writable 
+				// without having been marked dirty.
+				Mmu::MakePteInaccessible(aBlankPte, ETrue);
 				}
 			}
 		}
-	
+
 	// Map the page in the page array entry as this is always the physical
 	// page that the memory object's page should be mapped to.
 	pte = pagePhys|aBlankPte;
 	TRACE2(("!PTE %x=%x",aPtePtr,pte));
 	*aPtePtr = pte;
-	
+
 	// clean cache...
 	CacheMaintenance::SinglePteUpdated((TLinAddr)aPtePtr);
 	}
@@ -1943,7 +1987,10 @@
 			}
 #endif
 		if(!Mmu::IsPteMoreAccessible(aBlankPte,pte))
+			{
+			__NK_ASSERT_DEBUG((pte^page) < (TUint)KPageSize); // Must be the same physical addr.
 			return true; // return true to keep page table (it already had at least page mapped)
+			}
 
 		// remap page with new increased permissions...
 		if(pte==KPteUnallocatedEntry)
@@ -1996,6 +2043,8 @@
 					TRACE2(("!PTE %x=%x",pPte-1,pte));
 					pPte[-1] = pte;
 					}
+				else
+					__NK_ASSERT_DEBUG((pte^page) < (TUint)KPageSize); // Must be the same physical addr.	
 				}
 			}
 		while(pPte!=pPteEnd);
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mmu.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mmu.h	Thu Jul 22 16:46:39 2010 +0100
@@ -571,6 +571,23 @@
 		}
 
 	/**
+	Mark this page as an oldest old page.
+
+	This does not mark the object as modified as conceptually it's still an oldest page.  This means
+	that if a page goes from young -> old -> oldest the second transition will not interrupt the
+	page restriction that happens on the first.
+
+	@pre #MmuLock held.
+	*/
+	FORCE_INLINE void SetOldestPage(TPagedState aPagedState)
+		{
+		CheckAccess("SetPagedState");
+		__NK_ASSERT_DEBUG(iPagedState==EPagedOld);
+		__NK_ASSERT_DEBUG(aPagedState==EPagedOldestClean || aPagedState==EPagedOldestDirty);
+		iPagedState = aPagedState;
+		}
+
+	/**
 	Set the page's #iModifier value.
 
 	#iModifier is cleared to zero whenever the usage or paging state of the page
@@ -1962,6 +1979,7 @@
 
 	TInt AllocRam(	TPhysAddr* aPages, TUint aCount, TRamAllocFlags aFlags, TZonePageType aZonePageType, 
 					TUint aBlockZoneId=KRamZoneInvalidId, TBool aBlockRest=EFalse);
+	void MarkPageAllocated(TPhysAddr aPhysAddr, TZonePageType aZonePageType);
 	void FreeRam(TPhysAddr* aPages, TUint aCount, TZonePageType aZonePageType);
 	TInt AllocContiguousRam(TPhysAddr& aPhysAddr, TUint aCount, TUint aAlign, TRamAllocFlags aFlags);
 	void FreeContiguousRam(TPhysAddr aPhysAddr, TUint aCount);
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mobject.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mobject.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -79,7 +79,10 @@
 		}
 
 	if(aCreateFlags&EMemoryCreateDemandPaged)
+		{
 		iFlags |= EDemandPaged;
+		iRamAllocFlags |= Mmu::EAllocNoPagerReclaim;
+		}
 	if(aCreateFlags&EMemoryCreateReserveAllResources)
 		iFlags |= EReserveResources;
 	if(aCreateFlags&EMemoryCreateDisallowPinning)
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mpagearray.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mpagearray.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1158,6 +1158,7 @@
 		return NULL;
 
 	*p = (page & ~EStateMask) | EMoving;
+	s->Lock();
 
 	aPageList.Set(iSegments, aIndex, aIndex+1);
 
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mpagearray.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mpagearray.h	Thu Jul 22 16:46:39 2010 +0100
@@ -165,18 +165,6 @@
 		}
 
 	/**
-	Page moving has ended so set the page back to committed if no other 
-	operation has occurred/is occurring.
-
-	@param aEntry		A reference to the entry to update.
-	*/
-	static FORCE_INLINE void MovePageEnd(TPhysAddr& aEntry)
-		{
-		if (State(aEntry) == EMoving)
-			aEntry = (aEntry & ~EStateMask) | ECommitted;
-		}
-
-	/**
 	Update the physical address in the array entry \a aEntry.
 	@param aEntry		A reference to the entry to update.
 	@param aPhysAddr	The new physical address.
@@ -416,6 +404,17 @@
 	*/
 	TPhysAddr* MovePageStart(TUint aIndex, TIter& aPageList);
 
+
+	/**
+	Page moving has ended so set the page back to committed if no other 
+	operation has occurred/is occurring.
+
+	@param aEntry		A reference to the entry to update.
+	@param aIndex		The index of the page that was moved.
+	*/
+	void MovePageEnd(TPhysAddr& aEntry, TUint aIndex);
+
+
 	/**
 	Return the array entry for index \a aIndex.
 	*/
@@ -861,4 +860,12 @@
 	MmuLock::Unlock();
 	}
 
+FORCE_INLINE void RPageArray::MovePageEnd(TPhysAddr& aEntry, TUint aIndex)
+	{
+	__NK_ASSERT_DEBUG(PageEntry(aIndex) == &aEntry);
+	if (State(aEntry) == EMoving)
+		aEntry = (aEntry & ~EStateMask) | ECommitted;
+	ReleasePage(aIndex, 0);
+	}
+
 #endif
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mpagecleaner.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mpagecleaner.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,7 +1,7 @@
 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
+// under the terms of the License "Eclipse Public License v1.0"
 // which accompanies this distribution, and is available
 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 //
@@ -30,8 +30,8 @@
 
 const TInt KThreadPriority = 25;
 
-// The length of time the paging device is idle before we decide to use it for cleaning dirty
-// pages, in milliseconds.
+/// The length of time the paging device is idle before we decide to use it for cleaning dirty
+/// pages, in milliseconds.
 const TInt KIdleDelayInMillis = 2;
 
 class DPageCleaner
@@ -63,13 +63,13 @@
 
 	// All state below is accessed with the MmuLock held.
 
-	// Whether the paging device is currently idle.
+	/// Whether the paging device is currently idle.
 	TBool iPagingDeviceIdle;
 
-	// Whether the paging device has been idle for longer than the wait period.
+	/// Whether the paging device has been idle for longer than the wait period.
 	TBool iIdleForAWhile;
 	
-	// Whether the page cleaner is currently running.
+	/// Whether the page cleaner is currently running.
 	TBool iCleaningInProgress;	
 	};
 
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mpagecleaner.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mpagecleaner.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,7 +1,7 @@
 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
+// under the terms of the License "Eclipse Public License v1.0"
 // which accompanies this distribution, and is available
 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 //
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mpager.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mpager.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -43,21 +43,34 @@
 */
 const TUint	KAbsoluteMaxPageCount = (1u<<(32-KPageShift))-1u;
 
-/*
-Limit the maximum number of oldest pages to bound the time taken by SelectPagesToClean(), which is
-called with the MmuLock held.
+/**
+Default limit for the maximum number of oldest pages.
+
+If the data paging device sets iPreferredWriteShift, then this is increased if necessary to allow
+that many pages to be present.
+
+This limit exists to make our live list implementation a closer approximation to LRU, and to bound
+the time taken by SelectSequentialPagesToClean(), which is called with the MmuLock held.
 */
-const TUint KMaxOldestPages = 32;
+const TUint KDefaultMaxOldestPages = 32;
 
 static DMutex* ThePageCleaningLock = NULL;
 
 DPager ThePager;
 
 
-DPager::DPager()
-	: iMinimumPageCount(0), iMaximumPageCount(0), iYoungOldRatio(0),
-	  iYoungCount(0), iOldCount(0), iOldestCleanCount(0),
-	  iNumberOfFreePages(0), iReservePageCount(0), iMinimumPageLimit(0)
+DPager::DPager() :
+	iMinimumPageCount(0),
+	iMaximumPageCount(0),
+	iYoungOldRatio(0),
+	iYoungCount(0),
+	iOldCount(0),
+	iOldestCleanCount(0),
+	iMaxOldestPages(KDefaultMaxOldestPages),
+	iNumberOfFreePages(0),
+	iReservePageCount(0),
+	iMinimumPageLimit(0),
+	iPagesToClean(1)
 #ifdef __DEMAND_PAGING_BENCHMARKS__
 	, iBenchmarkLock(TSpinLock::EOrderGenericIrqHigh3)
 #endif	  
@@ -307,6 +320,7 @@
 
 TInt DPager::PageFreed(SPageInfo* aPageInfo)
 	{
+	__NK_ASSERT_DEBUG(RamAllocLock::IsHeld());
 	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
 	__NK_ASSERT_DEBUG(CheckLists());
 
@@ -351,7 +365,7 @@
 		// This page was pinned when it was moved but it has not been returned 
 		// to the free pool yet so make sure it is...
 		aPageInfo->SetPagedState(SPageInfo::EUnpaged);	// Must be unpaged before returned to free pool.
-		return KErrNotFound;
+		return KErrCompletion;
 
 	default:
 		__NK_ASSERT_DEBUG(0);
@@ -365,6 +379,14 @@
 		SetClean(*aPageInfo);
 		}
 
+	if (iNumberOfFreePages > 0)
+		{// The paging cache is not at the minimum size so safe to let the 
+		// ram allocator free this page.
+		iNumberOfFreePages--;
+		aPageInfo->SetPagedState(SPageInfo::EUnpaged);
+		return KErrCompletion;
+		}
+	// Need to hold onto this page as have reached the page cache limit.
 	// add as oldest page...
 	aPageInfo->SetPagedState(SPageInfo::EPagedOldestClean);
 	iOldestCleanList.Add(&aPageInfo->iLink);
@@ -413,8 +435,8 @@
 #ifdef _DEBUG
 		if (!IsPageTableUnpagedRemoveAllowed(aPageInfo))
 			__NK_ASSERT_DEBUG(0);
+#endif
 		break;
-#endif
 	default:
 		__NK_ASSERT_DEBUG(0);
 		return;
@@ -436,8 +458,7 @@
 		case SPageInfo::EPagedOld:
 		case SPageInfo::EPagedOldestClean:
 		case SPageInfo::EPagedOldestDirty:
-			{// Update the list links point to the new page.
-			__NK_ASSERT_DEBUG(iYoungCount);
+			{// Update the list links to point to the new page.
 			SDblQueLink* prevLink = aOldPageInfo.iLink.iPrev;
 #ifdef _DEBUG
 			SDblQueLink* nextLink = aOldPageInfo.iLink.iNext;
@@ -476,19 +497,84 @@
 	}
 
 
-TInt DPager::TryStealOldestPage(SPageInfo*& aPageInfoOut)
+SPageInfo* DPager::StealOrAllocPage(TBool aAllowAlloc, Mmu::TRamAllocFlags aAllocFlags)
 	{
 	__NK_ASSERT_DEBUG(RamAllocLock::IsHeld());
 	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
 
-	// find oldest page in list...
+	// The PageCleaningLock may or may not be held to start with
+	TBool pageCleaningLockAcquired = EFalse;
+
 	SDblQueLink* link;
+	SPageInfo* pageInfo ;
+	
+restart:
+
+	// if there is a free page in the live list then use that (it will be at the end)...
+	if (iOldestCleanCount)
+		{
+		__NK_ASSERT_DEBUG(!iOldestCleanList.IsEmpty());
+		link = iOldestCleanList.Last();
+		pageInfo = SPageInfo::FromLink(link);
+		if(pageInfo->Type()==SPageInfo::EUnused)
+			goto try_steal_from_page_info;
+		}
+	
+	// maybe try getting a free page from the system pool...
+	if (aAllowAlloc && !HaveMaximumPages())
+		{
+		MmuLock::Unlock();
+		pageInfo = GetPageFromSystem(aAllocFlags);
+		MmuLock::Lock();
+		if (pageInfo)
+			goto exit;
+		}
+	
+	// try stealing the oldest clean page on the  live list if there is one...
 	if (iOldestCleanCount)
 		{
 		__NK_ASSERT_DEBUG(!iOldestCleanList.IsEmpty());
 		link = iOldestCleanList.Last();
+		goto try_steal_from_link;
 		}
-	else if (iOldestDirtyCount)
+
+	// no clean oldest pages, see if we can clean multiple dirty pages in one go...
+	if (iOldestDirtyCount > 1 && iPagesToClean > 1)
+		{
+		__NK_ASSERT_DEBUG(!iOldestDirtyList.IsEmpty());
+
+		// check if we hold page cleaning lock
+		TBool needPageCleaningLock = !PageCleaningLock::IsHeld();
+		if (needPageCleaningLock)
+			{
+			// temporarily release ram alloc mutex and acquire page cleaning mutex
+			MmuLock::Unlock();
+			RamAllocLock::Unlock();
+			PageCleaningLock::Lock();
+			MmuLock::Lock();
+			}
+
+		// there may be clean pages now if we've waited on the page cleaning mutex, if so don't
+		// bother cleaning but just restart
+		if (iOldestCleanCount == 0 && iOldestDirtyCount >= 1)
+			CleanSomePages(EFalse);
+
+		if (needPageCleaningLock)
+			{
+			// release page cleaning mutex and re-aquire ram alloc mutex
+			MmuLock::Unlock();
+			PageCleaningLock::Unlock();			
+			RamAllocLock::Lock();
+			MmuLock::Lock();
+			}
+
+		// if there are now some clean pages we restart so as to take one of them
+		if (iOldestCleanCount > 0)
+			goto restart;
+		}
+
+	// otherwise just try to steal the oldest page...
+	if (iOldestDirtyCount)
 		{
 		__NK_ASSERT_DEBUG(!iOldestDirtyList.IsEmpty());
 		link = iOldestDirtyList.Last();
@@ -504,85 +590,81 @@
 		__NK_ASSERT_ALWAYS(!iYoungList.IsEmpty());
 		link = iYoungList.Last();
 		}
-	SPageInfo* pageInfo = SPageInfo::FromLink(link);
-
+
+try_steal_from_link:
+
+	// lookup page info
+	__NK_ASSERT_DEBUG(link);
+	pageInfo = SPageInfo::FromLink(link);
+	
+try_steal_from_page_info:
+	
+	// if the page is dirty and we don't hold the page cleaning mutex then we have to wait on it,
+	// and restart - we clean with the ram alloc mutex held in this case
 	if (pageInfo->IsDirty() && !PageCleaningLock::IsHeld())
-		return 1;
-
-	// try to steal it from owning object...
-	TInt r = StealPage(pageInfo);	
-	if (r == KErrNone)
-		{
-		BalanceAges();
-		aPageInfoOut = pageInfo;
+		{		
+		MmuLock::Unlock();
+		PageCleaningLock::Lock();
+		MmuLock::Lock();
+		pageCleaningLockAcquired = ETrue;
+		goto restart;
 		}
 	
-	return r;
-	}
-
-
-SPageInfo* DPager::StealOldestPage()
-	{
+	// try to steal it from owning object...
+	if (StealPage(pageInfo) != KErrNone)
+		goto restart;
+	
+	BalanceAges();
+	
+exit:
+	if (pageCleaningLockAcquired)
+		{		
+		MmuLock::Unlock();
+		PageCleaningLock::Unlock();
+		MmuLock::Lock();
+		}
+
+	__NK_ASSERT_DEBUG(RamAllocLock::IsHeld());
 	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
-	TBool pageCleaningLockHeld = EFalse;
-	for(;;)
-		{
-		SPageInfo* pageInfo = NULL;
-		TInt r = TryStealOldestPage(pageInfo);
-		
-		if (r == KErrNone)
-			{
-			if (pageCleaningLockHeld)
-				{
-				MmuLock::Unlock();
-				PageCleaningLock::Unlock();
-				MmuLock::Lock();
-				}
-			return pageInfo;
-			}
-		else if (r == 1)
-			{
-			__NK_ASSERT_ALWAYS(!pageCleaningLockHeld);
-			MmuLock::Unlock();
-			PageCleaningLock::Lock();
-			MmuLock::Lock();
-			pageCleaningLockHeld = ETrue;
-			}
-		// else retry...
-		}
+	
+	return pageInfo;
 	}
 
-#ifdef __CPU_CACHE_HAS_COLOUR
-
-template <class T, TInt maxObjects> class TSequentialColourSelector
+
+template <class T, TUint maxObjects> class TSequentialColourSelector
 	{
 public:
-	static const TInt KMaxLength = maxObjects;
-	static const TInt KArrayLength = _ALIGN_UP(KMaxLength, KPageColourCount);
+	enum
+		{
+		KMaxSearchLength = _ALIGN_UP(maxObjects, KPageColourCount)
+		};
 	
-	FORCE_INLINE TSequentialColourSelector()
+	FORCE_INLINE TSequentialColourSelector(TUint aTargetLength)
 		{
 		memclr(this, sizeof(*this));
+		__NK_ASSERT_DEBUG(aTargetLength <= maxObjects);
+		iTargetLength = aTargetLength;
+		iSearchLength = _ALIGN_UP(aTargetLength, KPageColourCount);
 		}
 
 	FORCE_INLINE TBool FoundLongestSequence()
 		{
-		return iLongestLength >= KMaxLength;
+		return iLongestLength >= iTargetLength;
 		}
 
-	FORCE_INLINE void AddCandidate(T* aObject, TInt aColour)
+	FORCE_INLINE void AddCandidate(T* aObject, TUint aColour)
 		{
 		// allocate objects to slots based on colour
-		for (TInt i = aColour ; i < KArrayLength ; i += KPageColourCount)
+		for (TUint i = aColour ; i < iSearchLength ; i += KPageColourCount)
 			{
 			if (!iSlot[i])
 				{
 				iSlot[i] = aObject;
 				iSeqLength[i] = i == 0 ? 1 : iSeqLength[i - 1] + 1;
-				TInt j = i + 1;
-				while(j < KArrayLength && iSeqLength[j])
+				TUint j = i + 1;
+				while(j < iSearchLength && iSeqLength[j])
 					iSeqLength[j++] += iSeqLength[i];
-				TInt currentLength = iSeqLength[j - 1];
+				TUint currentLength = iSeqLength[j - 1];
 				if (currentLength > iLongestLength)
 					{
 					iLongestLength = currentLength;
@@ -593,31 +675,31 @@
 			}
 		}
 
-	FORCE_INLINE TInt FindLongestRun(T** aObjectsOut)
+	FORCE_INLINE TUint FindLongestRun(T** aObjectsOut)
 		{
 		if (iLongestLength == 0)
 			return 0;
 
-		if (iLongestLength < KMaxLength && iSlot[0] && iSlot[KArrayLength - 1])
+		if (iLongestLength < iTargetLength && iSlot[0] && iSlot[iSearchLength - 1])
 			{
 			// check possibility of wrapping
 
 			TInt i = 1;
 			while (iSlot[i]) ++i;  // find first hole
-			TInt wrappedLength = iSeqLength[KArrayLength - 1] + iSeqLength[i - 1];
+			TUint wrappedLength = iSeqLength[iSearchLength - 1] + iSeqLength[i - 1];
 			if (wrappedLength > iLongestLength)
 				{
 				iLongestLength = wrappedLength;
-				iLongestStart = KArrayLength - iSeqLength[KArrayLength - 1];
+				iLongestStart = iSearchLength - iSeqLength[iSearchLength - 1];
 				}
 			}		
 
-		iLongestLength = Min(iLongestLength, KMaxLength);
-
-		__NK_ASSERT_DEBUG(iLongestStart >= 0 && iLongestStart < KArrayLength);
-		__NK_ASSERT_DEBUG(iLongestStart + iLongestLength < 2 * KArrayLength);
-
-		TInt len = Min(iLongestLength, KArrayLength - iLongestStart);
+		iLongestLength = MinU(iLongestLength, iTargetLength);
+
+		__NK_ASSERT_DEBUG(iLongestStart < iSearchLength);
+		__NK_ASSERT_DEBUG(iLongestStart + iLongestLength < 2 * iSearchLength);
+
+		TUint len = MinU(iLongestLength, iSearchLength - iLongestStart);
 		wordmove(aObjectsOut, &iSlot[iLongestStart], len * sizeof(T*));
 		wordmove(aObjectsOut + len, &iSlot[0], (iLongestLength - len) * sizeof(T*));
 		
@@ -625,19 +707,22 @@
 		}
 
 private:
-	T* iSlot[KArrayLength];
-	TInt8 iSeqLength[KArrayLength];
-	TInt iLongestStart;
-	TInt iLongestLength;
+	TUint iTargetLength;
+	TUint iSearchLength;
+	TUint iLongestStart;
+	TUint iLongestLength;
+	T* iSlot[KMaxSearchLength];
+	TUint8 iSeqLength[KMaxSearchLength];
 	};
 
-TInt DPager::SelectPagesToClean(SPageInfo** aPageInfosOut)
+
+TInt DPager::SelectSequentialPagesToClean(SPageInfo** aPageInfosOut)
 	{
-	// select up to KMaxPagesToClean oldest dirty pages with sequential page colours
+	// select up to iPagesToClean oldest dirty pages with sequential page colours
 	
 	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
 
-	TSequentialColourSelector<SPageInfo, KMaxPagesToClean> selector;
+	TSequentialColourSelector<SPageInfo, KMaxPagesToClean> selector(iPagesToClean);
 
 	SDblQueLink* link = iOldestDirtyList.Last();
 	while (link != &iOldestDirtyList.iA)
@@ -659,15 +744,14 @@
 	return selector.FindLongestRun(aPageInfosOut);
 	}
 
-#else
-
-TInt DPager::SelectPagesToClean(SPageInfo** aPageInfosOut)
+
+TInt DPager::SelectOldestPagesToClean(SPageInfo** aPageInfosOut)
 	{
-	// no page colouring restrictions, so just take up to KMaxPagesToClean oldest dirty pages
+	// select up to iPagesToClean oldest dirty pages
 	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
-	TInt pageCount = 0;
+	TUint pageCount = 0;
 	SDblQueLink* link = iOldestDirtyList.Last();
-	while (link != &iOldestDirtyList.iA && pageCount < KMaxPagesToClean)
+	while (link != &iOldestDirtyList.iA && pageCount < iPagesToClean)
 		{
 		SPageInfo* pi = SPageInfo::FromLink(link);
 		if (!pi->IsWritable())
@@ -682,20 +766,29 @@
 	return pageCount;
 	}
 
-#endif
-
 
 TInt DPager::CleanSomePages(TBool aBackground)
 	{
+	TRACE(("DPager::CleanSomePages"));
+	
 	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
 	__NK_ASSERT_DEBUG(PageCleaningLock::IsHeld());
 	// ram alloc lock may or may not be held
 
 	SPageInfo* pageInfos[KMaxPagesToClean];
-	TInt pageCount = SelectPagesToClean(&pageInfos[0]);
+	TInt pageCount;
+	if (iCleanInSequence)
+		pageCount = SelectSequentialPagesToClean(&pageInfos[0]);
+	else
+		pageCount = SelectOldestPagesToClean(&pageInfos[0]);
 	
 	if (pageCount == 0)
+		{
+		TRACE2(("DPager::CleanSomePages no pages to clean", pageCount));
+		TRACE2(("  page counts %d, %d, %d, %d",
+				iYoungCount, iOldCount, iOldestCleanCount, iOldestDirtyCount));
 		return 0;
+		}
 	
 	TheDataPagedMemoryManager->CleanPages(pageCount, pageInfos, aBackground);
 
@@ -715,6 +808,8 @@
 			}
 		}
 
+	TRACE2(("DPager::CleanSomePages cleaned %d pages", pageCount));
+
 	return pageCount;
 	}
 
@@ -728,7 +823,6 @@
 
 TInt DPager::RestrictPage(SPageInfo* aPageInfo, TRestrictPagesType aRestriction)
 	{
-	TRACE(("DPager::RestrictPage(0x%08x,%d)",aPageInfo,aRestriction));
 	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
 
 	TInt r;
@@ -754,7 +848,6 @@
 		MmuLock::Lock();
 		}
 
-	TRACE(("DPager::RestrictPage returns %d",r));
 	return r;
 	}
 
@@ -803,16 +896,27 @@
 	}
 
 
-static TBool DiscardCanStealPage(SPageInfo* aOldPageInfo, TBool aBlockRest)
+TInt DPager::DiscardAndAllocPage(SPageInfo* aPageInfo, TZonePageType aPageType)
+	{
+	TInt r = DiscardPage(aPageInfo, KRamZoneInvalidId, M::EMoveDisMoveDirty);
+	if (r == KErrNone)
+		{
+		TheMmu.MarkPageAllocated(aPageInfo->PhysAddr(), aPageType);
+		}
+	return r;
+	}
+
+
+static TBool DiscardCanStealPage(SPageInfo* aOldPageInfo, TBool aMoveDirty)
 	{
  	// If the page is pinned or if the page is dirty and a general defrag is being performed then
 	// don't attempt to steal it
 	return aOldPageInfo->Type() == SPageInfo::EUnused ||
-		(aOldPageInfo->PagedState() != SPageInfo::EPagedPinned && (!aBlockRest || !aOldPageInfo->IsDirty()));	
+		(aOldPageInfo->PagedState() != SPageInfo::EPagedPinned && (!aMoveDirty || !aOldPageInfo->IsDirty()));	
 	}
 
 
-TInt DPager::DiscardPage(SPageInfo* aOldPageInfo, TUint aBlockZoneId, TBool aBlockRest)
+TInt DPager::DiscardPage(SPageInfo* aOldPageInfo, TUint aBlockZoneId, TUint aMoveDisFlags)
 	{
 	// todo: assert MmuLock not released
 	
@@ -820,19 +924,21 @@
 	
 	__NK_ASSERT_DEBUG(RamAllocLock::IsHeld());
 	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
-
-	if (!DiscardCanStealPage(aOldPageInfo, aBlockRest))
+	TBool moveDirty = (aMoveDisFlags & M::EMoveDisMoveDirty) != 0;
+	TBool blockRest = (aMoveDisFlags & M::EMoveDisBlockRest) != 0;
+
+	if (!DiscardCanStealPage(aOldPageInfo, moveDirty))
 		{
-		// The page is pinned or is dirty and this is a general defrag so move the page.
-		DMemoryObject* memory = aOldPageInfo->Owner();
 		// Page must be managed if it is pinned or dirty.
 		__NK_ASSERT_DEBUG(aOldPageInfo->Type()==SPageInfo::EManaged);
-		__NK_ASSERT_DEBUG(memory);
-		MmuLock::Unlock();
+		// The page is pinned or is dirty and this is a general defrag so move the page.
+		DMemoryObject* memory = aOldPageInfo->Owner();
+		memory->Open();
 		TPhysAddr newAddr;
 		TRACE2(("DPager::DiscardPage delegating pinned/dirty page to manager"));
-		TInt r = memory->iManager->MovePage(memory, aOldPageInfo, newAddr, aBlockZoneId, aBlockRest);
+		TInt r = memory->iManager->MovePage(memory, aOldPageInfo, newAddr, aBlockZoneId, blockRest);
 		TRACE(("< DPager::DiscardPage %d", r));
+		memory->AsyncClose();
 		return r;
 		}
 
@@ -852,7 +958,7 @@
 			{
 			// Allocate a new page for the live list as it has reached its minimum size.
 			TUint flags = EMemAttNormalCached | Mmu::EAllocNoWipe;
-			newPageInfo = GetPageFromSystem((Mmu::TRamAllocFlags)flags, aBlockZoneId, aBlockRest);
+			newPageInfo = GetPageFromSystem((Mmu::TRamAllocFlags)flags, aBlockZoneId, blockRest);
 			if (!newPageInfo)
 				{
 				TRACE(("< DPager::DiscardPage KErrNoMemory"));
@@ -871,7 +977,7 @@
 
 		// Re-acquire the mmulock and re-check that the page is not pinned or dirty.
 		MmuLock::Lock();
-		if (!DiscardCanStealPage(aOldPageInfo, aBlockRest))
+		if (!DiscardCanStealPage(aOldPageInfo, moveDirty))
 			{
 			// Page is now pinned or dirty so give up as it is in use.
 			r = KErrInUse;
@@ -929,17 +1035,15 @@
 			AddAsFreePage(newPageInfo);
 		else
 			ReturnPageToSystem(*newPageInfo);   // temporarily releases MmuLock
-		}
+		}	
+	MmuLock::Unlock();
 
 	if (havePageCleaningLock)
 		{
 		// Release the page cleaning mutex
-		MmuLock::Unlock();
 		PageCleaningLock::Unlock();
-		MmuLock::Lock();
-		}	
-	
-	MmuLock::Unlock();
+		}
+
 	TRACE(("< DPager::DiscardPage returns %d", r));
 	return r;	
 	}
@@ -982,12 +1086,61 @@
 	}
 
 
-void DPager::ReturnPageToSystem()
+TBool DPager::TryReturnOldestPageToSystem()
 	{
 	__NK_ASSERT_DEBUG(RamAllocLock::IsHeld());
 	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
-
-	ReturnPageToSystem(*StealOldestPage());
+	__NK_ASSERT_DEBUG(iNumberOfFreePages>0);
+
+	SPageInfo* pageInfo = StealOrAllocPage(EFalse, (Mmu::TRamAllocFlags)0);
+	
+	// StealOrAllocPage may have released the MmuLock, so check there are still enough pages
+	// to remove one from the live list
+	if (iNumberOfFreePages>0)
+		{
+		ReturnPageToSystem(*pageInfo);
+		return ETrue;
+		}
+	else
+		{
+		AddAsFreePage(pageInfo);
+		return EFalse;
+		}
+	}
+
+
+TUint DPager::AllowAddFreePages(SPageInfo*& aPageInfo, TUint aNumPages)
+	{
+	if (iMinimumPageCount + iNumberOfFreePages == iMaximumPageCount)
+		{// The paging cache is already at the maximum size so steal a page
+		// so it can be returned to the system if required.
+		aPageInfo = StealOrAllocPage(EFalse, (Mmu::TRamAllocFlags)0);
+		__NK_ASSERT_DEBUG(aPageInfo->PagedState() == SPageInfo::EUnpaged);
+		return 1;
+		}
+	// The paging cache is not at its maximum so determine how many can be added to
+	// the paging cache without it growing past its maximum.
+	aPageInfo = NULL;
+	__NK_ASSERT_DEBUG(iMinimumPageCount + iNumberOfFreePages < iMaximumPageCount);
+	if (iMinimumPageCount + iNumberOfFreePages + aNumPages > iMaximumPageCount)
+		{
+		return iMaximumPageCount - (iMinimumPageCount + iNumberOfFreePages);
+		}
+	else
+		return aNumPages;
+	}
+
+
+void DPager::AllowAddFreePage(SPageInfo*& aPageInfo)
+	{
+	if (iMinimumPageCount + iNumberOfFreePages == iMaximumPageCount)
+		{// The paging cache is already at the maximum size so steal a page
+		// so it can be returned to the system if required.
+		aPageInfo = StealOrAllocPage(EFalse, (Mmu::TRamAllocFlags)0);
+		__NK_ASSERT_DEBUG(aPageInfo->PagedState() == SPageInfo::EUnpaged);
+		return;
+		}
+	aPageInfo = NULL;
 	}
 
 
@@ -1002,6 +1155,9 @@
 	__NK_ASSERT_DEBUG(iNumberOfFreePages>0);
 	--iNumberOfFreePages;
 
+	// The page must be unpaged, otherwise it wasn't successfully removed 
+	// from the live list.
+	__NK_ASSERT_DEBUG(aPageInfo.PagedState() == SPageInfo::EUnpaged);
 	MmuLock::Unlock();
 
 	TPhysAddr pagePhys = aPageInfo.PhysAddr();
@@ -1013,98 +1169,23 @@
 
 SPageInfo* DPager::PageInAllocPage(Mmu::TRamAllocFlags aAllocFlags)
 	{
-	TBool pageCleaningLockHeld = EFalse;
-	SPageInfo* pageInfo;
-	TPhysAddr pagePhys;
-	TInt r = KErrGeneral;
+	// ram alloc mutex may or may not be held
+	__NK_ASSERT_DEBUG(!MmuLock::IsHeld());
 	
 	RamAllocLock::Lock();
-	MmuLock::Lock();
-
-find_a_page:
-	// try getting a free page from our live list...
-	if (iOldestCleanCount)
-		{
-		pageInfo = SPageInfo::FromLink(iOldestCleanList.Last());
-		if(pageInfo->Type()==SPageInfo::EUnused)
-			goto try_steal_oldest_page;
-		}
-
-	// try getting a free page from the system pool...
-	if(!HaveMaximumPages())
-		{
-		MmuLock::Unlock();
-		pageInfo = GetPageFromSystem(aAllocFlags);
-		if(pageInfo)
-			goto done;
-		MmuLock::Lock();
-		}
-
-	// try stealing a clean page...
-	if (iOldestCleanCount)
-		goto try_steal_oldest_page;
-
-	// see if we can clean multiple dirty pages in one go...
-	if (KMaxPagesToClean > 1 && iOldestDirtyCount > 1)
+	
+	MmuLock::Lock();	
+	SPageInfo* pageInfo = StealOrAllocPage(ETrue, aAllocFlags);
+	TBool wasAllocated = pageInfo->Type() == SPageInfo::EUnknown;
+	MmuLock::Unlock();
+
+	if (!wasAllocated)
 		{
-		// if we don't hold the page cleaning mutex then temporarily release ram alloc mutex and
-		// acquire page cleaning mutex; if we hold it already just proceed
-		if (!pageCleaningLockHeld)
-			{
-			MmuLock::Unlock();
-			RamAllocLock::Unlock();
-			PageCleaningLock::Lock();			
-			MmuLock::Lock();
-			}
-		
-		// there may be clean pages now if we've waited on the page cleaning mutex, if so don't
-		// bother cleaning but just restart
-		if (iOldestCleanCount == 0)
-			CleanSomePages(EFalse);
-		
-		if (!pageCleaningLockHeld)
-			{
-			MmuLock::Unlock();
-			PageCleaningLock::Unlock();			
-			RamAllocLock::Lock();
-			MmuLock::Lock();
-			}
-		
-		if (iOldestCleanCount > 0)
-			goto find_a_page;
+		// make page state same as a freshly allocated page...
+		TPhysAddr pagePhys = pageInfo->PhysAddr();
+		TheMmu.PagesAllocated(&pagePhys,1,aAllocFlags);
 		}
 
-	// as a last resort, steal a page from the live list...
-	
-try_steal_oldest_page:
-	__NK_ASSERT_ALWAYS(iOldestCleanCount|iOldestDirtyCount|iOldCount|iYoungCount);
-	r = TryStealOldestPage(pageInfo);
-	// if this fails we restart whole process
-	if (r < KErrNone)
-		goto find_a_page;
-
-	// if we need to clean, acquire page cleaning mutex for life of this function
-	if (r == 1)
-		{
-		__NK_ASSERT_ALWAYS(!pageCleaningLockHeld);
-		MmuLock::Unlock();
-		PageCleaningLock::Lock();
-		MmuLock::Lock();
-		pageCleaningLockHeld = ETrue;
-		goto find_a_page;		
-		}
-
-	// otherwise we're done!
-	__NK_ASSERT_DEBUG(r == KErrNone);
-	MmuLock::Unlock();
-
-	// make page state same as a freshly allocated page...
-	pagePhys = pageInfo->PhysAddr();
-	TheMmu.PagesAllocated(&pagePhys,1,aAllocFlags);
-
-done:
-	if (pageCleaningLockHeld)
-		PageCleaningLock::Unlock();
 	RamAllocLock::Unlock();
 
 	return pageInfo;
@@ -1120,8 +1201,8 @@
 	MmuLock::Lock();
 	while(aNumPages>0 && (TInt)NumberOfFreePages()>=aNumPages)
 		{
-		ReturnPageToSystem();
-		--aNumPages;
+		if (TryReturnOldestPageToSystem())
+			--aNumPages;
 		}
 	MmuLock::Unlock();
 
@@ -1140,9 +1221,18 @@
 	TPhysAddr* end = aPages+aCount;
 	while(aPages<end)
 		{
+		// Steal a page from the paging cache in case we need to return one to the system.
+		// This may release the ram alloc lock.
+		SPageInfo* pageInfo;
+		AllowAddFreePage(pageInfo);
+
 		TPhysAddr pagePhys = *aPages++;
 		if(RPageArray::State(pagePhys)!=RPageArray::ECommitted)
+			{
+			if (pageInfo)
+				AddAsFreePage(pageInfo);
 			continue; // page is not present
+			}
 
 #ifdef _DEBUG
 		SPageInfo* pi = SPageInfo::SafeFromPhysAddr(pagePhys&~KPageMask);
@@ -1165,26 +1255,31 @@
 		case SPageInfo::EPagedOld:
 		case SPageInfo::EPagedOldestDirty:
 		case SPageInfo::EPagedOldestClean:
+			if (pageInfo)
+				AddAsFreePage(pageInfo);
 			continue; // discard already been allowed
 
 		case SPageInfo::EPagedPinned:
 			__NK_ASSERT_DEBUG(0);
 		default:
 			__NK_ASSERT_DEBUG(0);
+			if (pageInfo)
+				AddAsFreePage(pageInfo);
 			continue;
 			}
 
-		// put page on live list...
+		// put page on live list and free the stolen page...
 		AddAsYoungestPage(pi);
 		++iNumberOfFreePages;
-
+		if (pageInfo)
+			ReturnPageToSystem(*pageInfo);
 		Event(EEventPageDonate,pi);
 
 		// re-balance live list...
-		RemoveExcessPages();
 		BalanceAges();
 		}
 
+	__NK_ASSERT_DEBUG((iMinimumPageCount + iNumberOfFreePages) <= iMaximumPageCount);
 	MmuLock::Unlock();
 	RamAllocLock::Unlock();
 	}
@@ -1236,7 +1331,7 @@
 			}
 
 		// check paging list has enough pages before we remove one...
-		if(iNumberOfFreePages<1)
+		if(!iNumberOfFreePages)
 			{
 			// need more pages so get a page from the system...
 			if(!TryGrowLiveList())
@@ -1272,8 +1367,15 @@
 
 	// we may have added a spare free page to the live list without removing one,
 	// this could cause us to have too many pages, so deal with this...
+
+	// If there are too many pages they should all be unused free pages otherwise 
+	// the ram alloc lock may be released by RemoveExcessPages().
+	__NK_ASSERT_DEBUG(	!HaveTooManyPages() ||
+						(iMinimumPageCount + iNumberOfFreePages - iMaximumPageCount
+						<= iOldestCleanCount));
 	RemoveExcessPages();
 
+	__NK_ASSERT_DEBUG((iMinimumPageCount + iNumberOfFreePages) <= iMaximumPageCount);
 	MmuLock::Unlock();
 	RamAllocLock::Unlock();
 	return r;
@@ -1307,61 +1409,89 @@
 void DPager::BalanceAges()
 	{
 	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
-	TBool restrictPage = EFalse;
-	SPageInfo* pageInfo = NULL;
-	TUint oldestCount = iOldestCleanCount + iOldestDirtyCount;
-	if((iOldCount + oldestCount) * iYoungOldRatio < iYoungCount)
+	TBool retry;
+	do
 		{
-		// Need more old pages so make one young page into an old page...
-		__NK_ASSERT_DEBUG(!iYoungList.IsEmpty());
-		__NK_ASSERT_DEBUG(iYoungCount);
-		SDblQueLink* link = iYoungList.Last()->Deque();
-		--iYoungCount;
-
-		pageInfo = SPageInfo::FromLink(link);
-		pageInfo->SetPagedState(SPageInfo::EPagedOld);
-
-		iOldList.AddHead(link);
-		++iOldCount;
-
-		Event(EEventPageAged,pageInfo);
-		// Delay restricting the page until it is safe to release the MmuLock.
-		restrictPage = ETrue;
-		}
-
-	// Check we have enough oldest pages.
-	if (oldestCount < KMaxOldestPages &&
-		oldestCount * iOldOldestRatio < iOldCount)
-		{
-		__NK_ASSERT_DEBUG(!iOldList.IsEmpty());
-		__NK_ASSERT_DEBUG(iOldCount);
-		SDblQueLink* link = iOldList.Last()->Deque();
-		--iOldCount;
-
-		SPageInfo* oldestPageInfo = SPageInfo::FromLink(link);
-		if (oldestPageInfo->IsDirty())
+		retry = EFalse;
+		TBool restrictPage = EFalse;
+		SPageInfo* pageInfo = NULL;
+		TUint oldestCount = iOldestCleanCount + iOldestDirtyCount;
+		if((iOldCount + oldestCount) * iYoungOldRatio < iYoungCount)
+			{
+			// Need more old pages so make one young page into an old page...
+			__NK_ASSERT_DEBUG(!iYoungList.IsEmpty());
+			__NK_ASSERT_DEBUG(iYoungCount);
+			SDblQueLink* link = iYoungList.Last()->Deque();
+			--iYoungCount;
+
+			pageInfo = SPageInfo::FromLink(link);
+			pageInfo->SetPagedState(SPageInfo::EPagedOld);
+
+			iOldList.AddHead(link);
+			++iOldCount;
+
+			Event(EEventPageAged,pageInfo);
+			// Delay restricting the page until it is safe to release the MmuLock.
+			restrictPage = ETrue;
+			}
+
+		// Check we have enough oldest pages.
+		if (oldestCount < iMaxOldestPages &&
+			oldestCount * iOldOldestRatio < iOldCount)
 			{
-			oldestPageInfo->SetPagedState(SPageInfo::EPagedOldestDirty);
-			iOldestDirtyList.AddHead(link);
-			++iOldestDirtyCount;
-			PageCleaner::NotifyPagesToClean();
-			Event(EEventPageAgedDirty,oldestPageInfo);
+			__NK_ASSERT_DEBUG(!iOldList.IsEmpty());
+			__NK_ASSERT_DEBUG(iOldCount);
+			SDblQueLink* link = iOldList.Last()->Deque();
+			--iOldCount;
+
+			SPageInfo* oldestPageInfo = SPageInfo::FromLink(link);
+			if (oldestPageInfo->IsDirty())
+				{
+				oldestPageInfo->SetOldestPage(SPageInfo::EPagedOldestDirty);
+				iOldestDirtyList.AddHead(link);
+				++iOldestDirtyCount;
+				PageCleaner::NotifyPagesToClean();
+				Event(EEventPageAgedDirty,oldestPageInfo);
+				}
+			else
+				{
+				oldestPageInfo->SetOldestPage(SPageInfo::EPagedOldestClean);
+				iOldestCleanList.AddHead(link);
+				++iOldestCleanCount;
+				Event(EEventPageAgedClean,oldestPageInfo);
+				}
 			}
-		else
+
+		if (restrictPage)
 			{
-			oldestPageInfo->SetPagedState(SPageInfo::EPagedOldestClean);
-			iOldestCleanList.AddHead(link);
-			++iOldestCleanCount;
-			Event(EEventPageAgedClean,oldestPageInfo);
+			// Make the recently aged old page inaccessible.  This is done last as it will release
+			// the MmuLock and therefore the page counts may otherwise change.
+			TInt r = RestrictPage(pageInfo,ERestrictPagesNoAccessForOldPage);
+
+			if (r == KErrInUse)
+				{
+				SPageInfo::TPagedState state = pageInfo->PagedState();
+				if (state == SPageInfo::EPagedOld ||
+					state == SPageInfo::EPagedOldestClean ||
+					state == SPageInfo::EPagedOldestDirty)
+					{
+					// The restrict operation failed, but the page was left in an old state.  This
+					// can happen when:
+					//  
+					//  - pages are in the process of being pinned - the mapping will veto the
+					//    restriction
+					//  - pages are rejuvenated and then become quickly become old again
+					//  
+					// In the second instance the page will be needlessly rejuvenated because we
+					// can't tell that it has actually been restricted by another thread
+					RemovePage(pageInfo);
+					AddAsYoungestPage(pageInfo);
+					retry = ETrue;
+					}
+				}
 			}
 		}
-
-	if (restrictPage)
-		{
-		// Make the recently aged old page inaccessible.  This is done last as it 
-		// will release the MmuLock and therefore the page counts may otherwise change.
-		RestrictPage(pageInfo,ERestrictPagesNoAccessForOldPage);
-		}
+	while (retry);
 	}
 
 
@@ -1370,7 +1500,7 @@
 	__NK_ASSERT_DEBUG(RamAllocLock::IsHeld());
 	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
 	while(HaveTooManyPages())
-		ReturnPageToSystem();
+		TryReturnOldestPageToSystem();
 	}
 
 
@@ -1662,6 +1792,8 @@
 
 void DPager::Pin(SPageInfo* aPageInfo, TPinArgs& aPinArgs)
 	{
+	TRACE(("DPager::Pin %08x", aPageInfo->PhysAddr()));
+	
 	__ASSERT_CRITICAL;
 	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
 	__NK_ASSERT_DEBUG(aPinArgs.HaveSufficientPages(1));
@@ -1811,6 +1943,17 @@
 		}
 	while(TryGrowLiveList());
 
+	if (!ok)
+		{// Failed to allocate enough pages so free any excess..
+
+		// If there are too many pages they should all be unused free pages otherwise 
+		// the ram alloc lock may be released by RemoveExcessPages().
+		__NK_ASSERT_DEBUG(	!HaveTooManyPages() ||
+							(iMinimumPageCount + iNumberOfFreePages - iMaximumPageCount
+							<= iOldestCleanCount));
+		RemoveExcessPages();
+		}
+	__NK_ASSERT_DEBUG((iMinimumPageCount + iNumberOfFreePages) <= iMaximumPageCount);
 	MmuLock::Unlock();
 	RamAllocLock::Unlock();
 	return ok;
@@ -1825,9 +1968,19 @@
 	RamAllocLock::Lock();
 	MmuLock::Lock();
 
-	iNumberOfFreePages += aNumPages;
-	RemoveExcessPages();
-
+	while (aNumPages)
+		{
+		SPageInfo* pageInfo;
+		// This may release the ram alloc lock but it will flash the mmulock
+		// if not all pages could be added in one go, i.e. freePages != aNumPages.
+		TUint freePages = AllowAddFreePages(pageInfo, aNumPages);
+		iNumberOfFreePages += freePages;
+		aNumPages -= freePages;
+		if (pageInfo)
+			ReturnPageToSystem(*pageInfo);
+		}
+
+	__NK_ASSERT_DEBUG((iMinimumPageCount + iNumberOfFreePages) <= iMaximumPageCount);
 	MmuLock::Unlock();
 	RamAllocLock::Unlock();
 	}
@@ -1967,7 +2120,10 @@
 
 TInt DPager::ResizeLiveList(TUint aMinimumPageCount, TUint aMaximumPageCount)
 	{
-	TRACE(("DPager::ResizeLiveList(%d,%d) current young=%d old=%d min=%d free=%d max=%d",aMinimumPageCount,aMaximumPageCount,iYoungCount,iOldCount,iMinimumPageCount,iNumberOfFreePages,iMaximumPageCount));
+	TRACE(("DPager::ResizeLiveList(%d,%d) current: %d %d %d %d, %d %d %d",
+		   aMinimumPageCount,aMaximumPageCount,
+		   iYoungCount,iOldCount,iOldestCleanCount,iOldestDirtyCount,
+		   iMinimumPageCount,iNumberOfFreePages,iMaximumPageCount));
 	__NK_ASSERT_DEBUG(CacheInitialised());
 
 	if(!aMaximumPageCount)
@@ -1979,12 +2135,17 @@
 		aMaximumPageCount = KAbsoluteMaxPageCount;
 
 	// Min must not be greater than max...
-	if(aMinimumPageCount>aMaximumPageCount)
+	if(aMinimumPageCount > aMaximumPageCount)
 		return KErrArgument;
-
+	
 	NKern::ThreadEnterCS();
 	RamAllocLock::Lock();
 
+	// We must hold this otherwise StealOrAllocPage will release the RamAllocLock while waiting for
+	// it.  Note this method is not used in producton, so it's ok to hold both locks for longer than
+	// would otherwise happen.
+	PageCleaningLock::Lock();  
+
 	MmuLock::Lock();
 
 	__NK_ASSERT_ALWAYS(iYoungOldRatio);
@@ -1992,68 +2153,67 @@
 	// Make sure aMinimumPageCount is not less than absolute minimum we can cope with...
 	iMinimumPageLimit = iMinYoungPages * (1 + iYoungOldRatio) / iYoungOldRatio
 						+ DPageReadRequest::ReservedPagesRequired();
-	if(iMinimumPageLimit<iAbsoluteMinPageCount)
+	if(iMinimumPageLimit < iAbsoluteMinPageCount)
 		iMinimumPageLimit = iAbsoluteMinPageCount;
-	if(aMinimumPageCount<iMinimumPageLimit+iReservePageCount)
-		aMinimumPageCount = iMinimumPageLimit+iReservePageCount;
-	if(aMaximumPageCount<aMinimumPageCount)
-		aMaximumPageCount=aMinimumPageCount;
+	if(aMinimumPageCount < iMinimumPageLimit + iReservePageCount)
+		aMinimumPageCount = iMinimumPageLimit + iReservePageCount;
+	if(aMaximumPageCount < aMinimumPageCount)
+		aMaximumPageCount = aMinimumPageCount;
 
 	// Increase iMaximumPageCount?
 	if(aMaximumPageCount > iMaximumPageCount)
 		iMaximumPageCount = aMaximumPageCount;
 
 	// Reduce iMinimumPageCount?
-	TInt spare = iMinimumPageCount-aMinimumPageCount;
-	if(spare>0)
+	if(aMinimumPageCount < iMinimumPageCount)
 		{
-		iMinimumPageCount -= spare;
-		iNumberOfFreePages += spare;
+		iNumberOfFreePages += iMinimumPageCount - aMinimumPageCount;
+		iMinimumPageCount = aMinimumPageCount;
 		}
 
 	// Increase iMinimumPageCount?
-	TInt r=KErrNone;
-	while(iMinimumPageCount<aMinimumPageCount)
+	TInt r = KErrNone;
+	while(aMinimumPageCount > iMinimumPageCount)
 		{
-		TUint newMin = aMinimumPageCount;
-		TUint maxMin = iMinimumPageCount+iNumberOfFreePages;
-		if(newMin>maxMin)
-			newMin = maxMin;
-
-		TUint delta = newMin-iMinimumPageCount;
-		if(delta)
+		TUint newMin = MinU(aMinimumPageCount, iMinimumPageCount + iNumberOfFreePages);
+		
+		if (newMin == iMinimumPageCount)
 			{
+			// have to add pages before we can increase minimum page count
+			if(!TryGrowLiveList())
+				{
+				r = KErrNoMemory;
+				break;
+				}
+			}
+		else
+			{
+			iNumberOfFreePages -= newMin - iMinimumPageCount;
 			iMinimumPageCount = newMin;
-			iNumberOfFreePages -= delta;
-			continue;
-			}
-
-		if(!TryGrowLiveList())
-			{
-			r=KErrNoMemory;
-			break;
 			}
 		}
 
 	// Reduce iMaximumPageCount?
-	while(iMaximumPageCount>aMaximumPageCount)
+	while(aMaximumPageCount < iMaximumPageCount)
 		{
-		TUint newMax = aMaximumPageCount;
-		TUint minMax = iMinimumPageCount+iNumberOfFreePages;
-		if(newMax<minMax)
-			newMax = minMax;
-
-		TUint delta = iMaximumPageCount-newMax;
-		if(delta)
+		TUint newMax = MaxU(aMaximumPageCount, iMinimumPageCount + iNumberOfFreePages);
+
+		if (newMax == iMaximumPageCount)
+			{
+			// have to remove pages before we can reduce maximum page count
+			TryReturnOldestPageToSystem();
+			}
+		else
 			{
 			iMaximumPageCount = newMax;
-			continue;
 			}
-
-		ReturnPageToSystem();
 		}
-
-	TRACE(("DPager::ResizeLiveList end with young=%d old=%d min=%d free=%d max=%d",iYoungCount,iOldCount,iMinimumPageCount,iNumberOfFreePages,iMaximumPageCount));
+	
+	TRACE(("DPager::ResizeLiveList end: %d %d %d %d, %d %d %d",
+		   iYoungCount,iOldCount,iOldestCleanCount,iOldestDirtyCount,
+		   iMinimumPageCount,iNumberOfFreePages,iMaximumPageCount));
+	
+	__NK_ASSERT_DEBUG((iMinimumPageCount + iNumberOfFreePages) <= iMaximumPageCount);
 
 #ifdef BTRACE_KERNEL_MEMORY
 	BTrace4(BTrace::EKernelMemory,BTrace::EKernelMemoryDemandPagingCache,iMinimumPageCount << KPageShift);
@@ -2061,6 +2221,7 @@
 
 	MmuLock::Unlock();
 
+	PageCleaningLock::Unlock();
 	RamAllocLock::Unlock();
 	NKern::ThreadLeaveCS();
 
@@ -2068,6 +2229,44 @@
 	}
 
 
+TUint RequiredOldestPages(TUint aPagesToClean, TBool aCleanInSequence)
+	{
+	return aCleanInSequence ? aPagesToClean * 8 : aPagesToClean;
+	}
+
+
+void DPager::SetPagesToClean(TUint aPagesToClean)
+	{
+	TRACE(("WDP: Pager will attempt to clean %d pages", aPagesToClean));
+	__NK_ASSERT_ALWAYS(aPagesToClean > 0 && aPagesToClean <= KMaxPagesToClean);
+	MmuLock::Lock();
+	iPagesToClean = aPagesToClean;
+	iMaxOldestPages = MaxU(KDefaultMaxOldestPages,
+						   RequiredOldestPages(iPagesToClean, iCleanInSequence));
+	MmuLock::Unlock();
+	TRACE(("WDP: Maximum %d oldest pages", iMaxOldestPages));	
+	}
+
+
+TUint DPager::PagesToClean()
+	{
+	return iPagesToClean;
+	}
+
+
+void DPager::SetCleanInSequence(TBool aCleanInSequence)
+	{
+	TRACE(("WDP: Sequential page colour set to %d", aCleanInSequence));
+	MmuLock::Lock();
+	iCleanInSequence = aCleanInSequence;
+	iMaxOldestPages = MaxU(KDefaultMaxOldestPages,
+						   RequiredOldestPages(iPagesToClean, iCleanInSequence));
+	MmuLock::Unlock();	
+	TRACE(("WDP: Maximum %d oldest pages", iMaxOldestPages));
+	}
+
+
+// WARNING THIS METHOD MAY HOLD THE RAM ALLOC LOCK FOR EXCESSIVE PERIODS.  DON'T USE THIS IN ANY PRODUCTION CODE.
 void DPager::FlushAll()
 	{
 	NKern::ThreadEnterCS();
@@ -2108,7 +2307,9 @@
 					}
 				++pi;
 				if(((TUint)pi&(0xf<<KPageInfoShift))==0)
+					{
 					MmuLock::Flash(); // every 16 page infos
+					}
 				}
 			while(pi<piEnd);
 			}
@@ -2116,13 +2317,13 @@
 		}
 	while(piMap<piMapEnd);
 	MmuLock::Unlock();
+	PageCleaningLock::Unlock();
 
 	// reduce live page list to a minimum
 	while(GetFreePages(1)) {}; 
 
 	TRACE(("DPager::FlushAll() end with young=%d old=%d min=%d free=%d max=%d",iYoungCount,iOldCount,iMinimumPageCount,iNumberOfFreePages,iMaximumPageCount));
 
-	PageCleaningLock::Unlock();
 	RamAllocLock::Unlock();
 	NKern::ThreadLeaveCS();
 	}
@@ -2407,6 +2608,43 @@
 		return KErrNone;
 #endif
 
+	case EVMHalGetPhysicalAccessSupported:
+		if ((K::MemModelAttributes & EMemModelAttrDataPaging) == 0)
+			return KErrNotSupported;
+		return GetPhysicalAccessSupported();
+		
+	case EVMHalGetUsePhysicalAccess:
+		if ((K::MemModelAttributes & EMemModelAttrDataPaging) == 0)
+			return KErrNotSupported;
+		return GetUsePhysicalAccess();
+
+	case EVMHalSetUsePhysicalAccess:
+		if(!TheCurrentThread->HasCapability(ECapabilityWriteDeviceData,__PLATSEC_DIAGNOSTIC_STRING("Checked by VMHalFunction(EVMHalSetUsePhysicalAccess)")))
+			K::UnlockedPlatformSecurityPanic();
+		if ((K::MemModelAttributes & EMemModelAttrDataPaging) == 0)
+			return KErrNotSupported;
+		if ((TUint)a1 > 1)
+			return KErrArgument;
+		SetUsePhysicalAccess((TBool)a1);
+		return KErrNone;
+		
+	case EVMHalGetPreferredDataWriteSize:
+		if ((K::MemModelAttributes & EMemModelAttrDataPaging) == 0)
+			return KErrNotSupported;
+		return GetPreferredDataWriteSize();
+		
+	case EVMHalGetDataWriteSize:
+		if ((K::MemModelAttributes & EMemModelAttrDataPaging) == 0)
+			return KErrNotSupported;
+		return __e32_find_ms1_32(ThePager.PagesToClean());
+		
+	case EVMHalSetDataWriteSize:
+		if(!TheCurrentThread->HasCapability(ECapabilityWriteDeviceData,__PLATSEC_DIAGNOSTIC_STRING("Checked by VMHalFunction(EVMHalSetDataWriteSize)")))
+			K::UnlockedPlatformSecurityPanic();
+		if ((K::MemModelAttributes & EMemModelAttrDataPaging) == 0)
+			return KErrNotSupported;
+		return SetDataWriteSize((TUint)a1);
+	
 	default:
 		return KErrNotSupported;
 		}
@@ -2459,151 +2697,45 @@
 //
 
 //
-// DPagingRequest
+// DPagingRequestBase
 //
 
-DPagingRequest::DPagingRequest()
-	: iMutex(NULL), iUseRegionCount(0)
-	{
-	}
-
-
-void DPagingRequest::SetUseContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount)
-	{
-	__ASSERT_SYSTEM_LOCK;
-	__NK_ASSERT_DEBUG(iUseRegionCount == 0);
-	__NK_ASSERT_DEBUG(aCount > 0 && aCount <= EMaxPages);
-	for (TUint i = 0 ; i < aCount ; ++i)
-		{
-		iUseRegionMemory[i] = aMemory;
-		iUseRegionIndex[i] = aIndex + i;		
-		}
-	iUseRegionCount = aCount;
-	}
-
-
-void DPagingRequest::SetUseDiscontiguous(DMemoryObject** aMemory, TUint* aIndex, TUint aCount)
-	{
-	__ASSERT_SYSTEM_LOCK;
-	__NK_ASSERT_DEBUG(iUseRegionCount == 0);
-	__NK_ASSERT_DEBUG(aCount > 0 && aCount <= EMaxPages);
-	for (TUint i = 0 ; i < aCount ; ++i)
-		{
-		iUseRegionMemory[i] = aMemory[i];
-		iUseRegionIndex[i] = aIndex[i];
-		}
-	iUseRegionCount = aCount;
-	}
-
-
-void DPagingRequest::ResetUse()
-	{
-	__ASSERT_SYSTEM_LOCK;
-	__NK_ASSERT_DEBUG(iUseRegionCount > 0);
-	iUseRegionCount = 0;
-	}
-
-
-TBool DPagingRequest::CheckUseContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount)
-	{
-	if (iUseRegionCount != aCount)
-		return EFalse;
-	for (TUint i = 0 ; i < iUseRegionCount ; ++i)
-		{
-		if (iUseRegionMemory[i] != aMemory || iUseRegionIndex[i] != aIndex + i)
-			return EFalse;
-		}
-	return ETrue;
-	}
-
-
-TBool DPagingRequest::CheckUseDiscontiguous(DMemoryObject** aMemory, TUint* aIndex, TUint aCount)
-	{
-	if (iUseRegionCount != aCount)
-		return EFalse;
-	for (TUint i = 0 ; i < iUseRegionCount ; ++i)
-		{
-		if (iUseRegionMemory[i] != aMemory[i] || iUseRegionIndex[i] != aIndex[i])
-			return EFalse;
-		}
-	return ETrue;
-	}
-
-
- TBool DPagingRequest::IsCollisionContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount)
-	{
-	// note this could be optimised as most of the time we will be checking read/read collusions,
-	// both of which will be contiguous
-	__ASSERT_SYSTEM_LOCK;
-	for (TUint i = 0 ; i < iUseRegionCount ; ++i)
-		{
-		if (iUseRegionMemory[i] == aMemory &&
-			TUint(iUseRegionIndex[i] - aIndex) < aCount)
-			return ETrue;
-		}
-	return EFalse;
-	}
-
-
-TLinAddr DPagingRequest::MapPages(TUint aColour, TUint aCount, TPhysAddr* aPages)
+
+TLinAddr DPagingRequestBase::MapPages(TUint aColour, TUint aCount, TPhysAddr* aPages)
 	{
 	__NK_ASSERT_DEBUG(iMutex->iCleanup.iThread == &Kern::CurrentThread());
 	return iTempMapping.Map(aPages,aCount,aColour);
 	}
 
 
-void DPagingRequest::UnmapPages(TBool aIMBRequired)
+void DPagingRequestBase::UnmapPages(TBool aIMBRequired)
 	{
 	__NK_ASSERT_DEBUG(iMutex->iCleanup.iThread == &Kern::CurrentThread());
 	iTempMapping.Unmap(aIMBRequired);
 	}
 
-//
-// DPoolPagingRequest
-//
-
-DPoolPagingRequest::DPoolPagingRequest(DPagingRequestPool::TGroup& aPoolGroup) :
-	iPoolGroup(aPoolGroup)
-	{
-	}
-
-
-void DPoolPagingRequest::Release()
-	{
-	NKern::LockSystem();
-	ResetUse();
-	Signal();
-	}
-
-
-void DPoolPagingRequest::Wait()
-	{
-	__ASSERT_SYSTEM_LOCK;
-	++iUsageCount;
-	TInt r = iMutex->Wait();
-	__NK_ASSERT_ALWAYS(r == KErrNone);
-	}
-
-
-void DPoolPagingRequest::Signal()
-	{
-	__ASSERT_SYSTEM_LOCK;
-	iPoolGroup.Signal(this);
-	}
 
 //
 // DPageReadRequest
 //
 
+
 TInt DPageReadRequest::iAllocNext = 0;
 
+
+TUint DPageReadRequest::ReservedPagesRequired()
+	{
+	return iAllocNext*EMaxPages;
+	}
+
+
 DPageReadRequest::DPageReadRequest(DPagingRequestPool::TGroup& aPoolGroup) :
-	DPoolPagingRequest(aPoolGroup)
+	iPoolGroup(aPoolGroup)
 	{
-	// allocate space for mapping pages whilst they're being loaded...
 	iTempMapping.Alloc(EMaxPages);
 	}
 
+
 TInt DPageReadRequest::Construct()
 	{
 	// allocate id and mutex...
@@ -2637,6 +2769,65 @@
 	}
 
 
+void DPageReadRequest::Release()
+	{
+	NKern::LockSystem();
+	ResetUse();
+	Signal();
+	}
+
+
+void DPageReadRequest::Wait()
+	{
+	__ASSERT_SYSTEM_LOCK;
+	++iUsageCount;
+	TInt r = iMutex->Wait();
+	__NK_ASSERT_ALWAYS(r == KErrNone);
+	}
+
+
+void DPageReadRequest::Signal()
+	{
+	__ASSERT_SYSTEM_LOCK;
+	__NK_ASSERT_DEBUG(iUsageCount > 0);
+	if (--iUsageCount == 0)
+		iPoolGroup.iFreeList.AddHead(&iLink);
+	iMutex->Signal();
+	}
+
+
+void DPageReadRequest::SetUseContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount)
+	{
+	__ASSERT_SYSTEM_LOCK;
+	__NK_ASSERT_DEBUG(aMemory != NULL && aCount <= EMaxPages);
+	__NK_ASSERT_DEBUG(iMemory == NULL);
+	iMemory = aMemory;
+	iIndex = aIndex;
+	iCount = aCount;
+	}
+
+
+void DPageReadRequest::ResetUse()
+	{
+	__ASSERT_SYSTEM_LOCK;
+	__NK_ASSERT_DEBUG(iMemory != NULL);
+	iMemory = NULL;
+	}
+
+
+ TBool DPageReadRequest::IsCollisionContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount)
+	{
+	__ASSERT_SYSTEM_LOCK;
+	return iMemory == aMemory && aIndex < iIndex + iCount && aIndex + aCount > iIndex;
+	}
+
+
+TBool DPageReadRequest::CheckUseContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount)
+	{
+	return iMemory == aMemory && iIndex == aIndex && iCount == aCount;
+	}
+
+
 //
 // DPageWriteRequest
 //
@@ -2645,8 +2836,7 @@
 DPageWriteRequest::DPageWriteRequest()
 	{
 	iMutex = ThePageCleaningLock;
-	// allocate space for mapping pages whilst they're being loaded...
-	iTempMapping.Alloc(KMaxPagesToClean);
+	iTempMapping.Alloc(EMaxPages);
 	}
 
 
@@ -2658,6 +2848,55 @@
 	}
 
 
+void DPageWriteRequest::SetUseDiscontiguous(DMemoryObject** aMemory, TUint* aIndex, TUint aCount)
+	{
+	__ASSERT_SYSTEM_LOCK;
+	__NK_ASSERT_DEBUG(iUseRegionCount == 0);
+	__NK_ASSERT_DEBUG(aCount > 0 && aCount <= EMaxPages);
+	for (TUint i = 0 ; i < aCount ; ++i)
+		{
+		iUseRegionMemory[i] = aMemory[i];
+		iUseRegionIndex[i] = aIndex[i];
+		}
+	iUseRegionCount = aCount;
+	}
+
+
+void DPageWriteRequest::ResetUse()
+	{
+	__ASSERT_SYSTEM_LOCK;
+	__NK_ASSERT_DEBUG(iUseRegionCount > 0);
+	iUseRegionCount = 0;
+	}
+
+
+TBool DPageWriteRequest::CheckUseContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount)
+	{
+	if (iUseRegionCount != aCount)
+		return EFalse;
+	for (TUint i = 0 ; i < iUseRegionCount ; ++i)
+		{
+		if (iUseRegionMemory[i] != aMemory || iUseRegionIndex[i] != aIndex + i)
+			return EFalse;
+		}
+	return ETrue;
+	}
+
+
+ TBool DPageWriteRequest::IsCollisionContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount)
+	{
+	// note this could be optimised as most of the time we will be checking read/read collusions,
+	// both of which will be contiguous
+	__ASSERT_SYSTEM_LOCK;
+	for (TUint i = 0 ; i < iUseRegionCount ; ++i)
+		{
+		if (iUseRegionMemory[i] == aMemory &&
+			TUint(iUseRegionIndex[i] - aIndex) < aCount)
+			return ETrue;
+		}
+	return EFalse;
+	}
+
 //
 // DPagingRequestPool
 //
@@ -2673,7 +2912,7 @@
 		TInt r = req->Construct();
 		__NK_ASSERT_ALWAYS(r==KErrNone);
 		iPageReadRequests.iRequests[i] = req;
-		iPageReadRequests.iFreeList.Add(req);
+		iPageReadRequests.iFreeList.Add(&req->iLink);
 		}
 
 	if (aWriteRequest)
@@ -2694,7 +2933,7 @@
 	{
 	NKern::LockSystem();
 
-	DPoolPagingRequest* req;
+	DPageReadRequest* req;
 	
 	// check for collision with existing write
 	if(iPageWriteRequest && iPageWriteRequest->IsCollisionContiguous(aMemory,aIndex,aCount))
@@ -2755,19 +2994,19 @@
 DPagingRequestPool::TGroup::TGroup(TUint aNumRequests)
 	{
 	iNumRequests = aNumRequests;
-	iRequests = new DPoolPagingRequest*[aNumRequests];
+	iRequests = new DPageReadRequest*[aNumRequests];
 	__NK_ASSERT_ALWAYS(iRequests);
 	}
 
 
-DPoolPagingRequest* DPagingRequestPool::TGroup::FindCollisionContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount)
+DPageReadRequest* DPagingRequestPool::TGroup::FindCollisionContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount)
 	{
 	__ASSERT_SYSTEM_LOCK;
-	DPoolPagingRequest** ptr = iRequests;
-	DPoolPagingRequest** ptrEnd = ptr+iNumRequests;
+	DPageReadRequest** ptr = iRequests;
+	DPageReadRequest** ptrEnd = ptr+iNumRequests;
 	while(ptr<ptrEnd)
 		{
-		DPoolPagingRequest* req = *ptr++;
+		DPageReadRequest* req = *ptr++;
 		if(req->IsCollisionContiguous(aMemory,aIndex,aCount))
 			return req;
 		}
@@ -2777,20 +3016,21 @@
 
 static TUint32 RandomSeed = 33333;
 
-DPoolPagingRequest* DPagingRequestPool::TGroup::GetRequest(DMemoryObject* aMemory, TUint aIndex, TUint aCount)
+DPageReadRequest* DPagingRequestPool::TGroup::GetRequest(DMemoryObject* aMemory, TUint aIndex, TUint aCount)
 	{
 	__NK_ASSERT_DEBUG(iNumRequests > 0);
 
 	// try using an existing request which collides with this region...
-	DPoolPagingRequest* req  = FindCollisionContiguous(aMemory,aIndex,aCount);
+	DPageReadRequest* req  = FindCollisionContiguous(aMemory,aIndex,aCount);
 	if(!req)
 		{
 		// use a free request...
-		req = (DPoolPagingRequest*)iFreeList.GetFirst();
-		if(req)
+		SDblQueLink* first = iFreeList.GetFirst();
+		if(first)
 			{
 			// free requests aren't being used...
-			__NK_ASSERT_DEBUG(req->iUsageCount == 0);
+			req = _LOFF(first, DPageReadRequest, iLink);
+			__NK_ASSERT_DEBUG(req->ThreadsWaiting() == 0);
 			}
 		else
 			{
@@ -2798,7 +3038,7 @@
 			RandomSeed = RandomSeed*69069+1; // next 'random' number
 			TUint index = (TUint64(RandomSeed) * TUint64(iNumRequests)) >> 32;
 			req = iRequests[index];
-			__NK_ASSERT_DEBUG(req->iUsageCount > 0); // we only pick random when none are free
+			__NK_ASSERT_DEBUG(req->ThreadsWaiting() > 0); // we only pick random when none are free
 			}
 		}
 
@@ -2809,17 +3049,6 @@
 	}
 
 
-void DPagingRequestPool::TGroup::Signal(DPoolPagingRequest* aRequest)
-	{
-	// if there are no threads waiting on the mutex then return it to the free pool...
-	__NK_ASSERT_DEBUG(aRequest->iUsageCount > 0);
-	if (--aRequest->iUsageCount==0)
-		iFreeList.AddHead(aRequest);
-
-	aRequest->iMutex->Signal();
-	}
-
-
 /**
 Register the specified paging device with the kernel.
 
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mpager.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mpager.h	Thu Jul 22 16:46:39 2010 +0100
@@ -26,8 +26,11 @@
 
 /**
 Maximum number of pages to attempt to clean in one go.
+
+If a paging device sets a preferred write size greater than this then it will fail to install with
+KErrArgument.
 */
-const TInt KMaxPagesToClean = 4;
+const TUint KMaxPagesToClean = 16;
 
 struct SVMCacheInfo;
 class DMemModelThread;
@@ -348,10 +351,21 @@
 	
 	@param aOldPageInfo	The page info of the page to discard.
 	@param aBlockZoneId	The ID of the RAM zone not to allocate any required new page into.
-	@param aBlockRest	Set to ETrue when we don't want the allocator to search for new pages if the RAM 
-						zone with ID==aBlockZoneId is encountered, i.e. a general RAM defrag operation.
+	@param aMoveDisFlags 	Flags that control the discarding of the page, should be a mask of 
+							values from M::TMoveDiscardFlags
 	*/
-	TInt DiscardPage(SPageInfo* aOldPageInfo, TUint aBlockZoneId, TBool aBlockRest);
+	TInt DiscardPage(SPageInfo* aOldPageInfo, TUint aBlockZoneId, TUint aMoveDisFlags);
+
+	/**
+	Attempt to discard the specified page and then allocate a page of type aPageType
+	in its place.
+	
+	Note - This will always attempt to move dirty pages rather than write them to swap.
+	
+	@param aPageInfo	The page info of the page to discard.
+	@param aPageType 	The new page type to allocate into aPageInfo's physical address.
+	*/
+	TInt DiscardAndAllocPage(SPageInfo* aPageInfo, TZonePageType aPageType);
 
 
 	/**
@@ -376,6 +390,34 @@
 	*/
 	void FreePinReplacementPages(TUint aNumPages);
 
+	//
+	// following public members for use by DDataPagedMemoryManager...
+	//
+	
+	/**
+	Called by the data paged memory manager to set the number of pages the pager should attempt to
+	clean at once.
+
+	This also adjusts the maximum size of the oldest list if it is too small to contain the
+	specified number of pages.
+
+	@param aPagesToClean     Number of pages the pager should attempt to clean in one go
+	*/
+	void SetPagesToClean(TUint aPagesToClean);
+
+	/**
+	Get the number of pages the pager attempts to clean at once.
+	*/
+	TUint PagesToClean();
+
+	/**
+	Called by the data paged memory manager to set whether pages cleaned must have sequential page
+	colour.
+
+	@param aCleanInSequence  Whether pages must have sequential page colour
+	*/
+	void SetCleanInSequence(TBool aCleanInSequence);
+
 private:
 	/**
 	Add a page to the head of the live page list. I.e. make it the 'youngest' page.
@@ -404,9 +446,20 @@
 	void RemovePage(SPageInfo* aPageInfo);
 
 	/**
-	Try to remove the oldest page from the live page list and perform #StealPage.
+	Get a page, either by stealing one from the live list or allocating one from the system.
+
+	
+	
+	If the oldest page is an oldest dirty page, this may attempt to clean multiple pages by calling
+	#CleanSomePages.
 
-	@param aPageInfoOut Set to the SPageInfo pointer for the stolen page if any.
+	If the oldest page is on any other list (i.e. is an old or young page) this will steal it,
+	aquiring the page cleaning mutex first if it is dirty.
+
+	Called from #PageInAllocPage, #TryReturnOldestPageToSystem, #AllowAddFreePage and 
+	#AllowAddFreePages.
+	
+	@param aAllowAlloc Indicates whether the method should try to allocate a page from the system
 	
 	@return KErrNone on success, KErrInUse if stealing failed or 1 to indicate the the oldest page
 	was dirty and the PageCleaning mutex was not held.
@@ -414,15 +467,7 @@
 	@pre MmuLock held
 	@post MmuLock left unchanged.
 	*/
-	TInt TryStealOldestPage(SPageInfo*& aPageInfoOut);
-
-	/**
-	Remove the oldest page from the live page list and perform #StealPage.
-
-	@pre MmuLock held
-	@post MmuLock held (but may have been released by this function)
-	*/
-	SPageInfo* StealOldestPage();
+	SPageInfo* StealOrAllocPage(TBool aAllowAlloc, Mmu::TRamAllocFlags aAllocFlags);
 
 	/**
 	Steal a page from the memory object (if any) which is using the page.
@@ -470,9 +515,32 @@
 
 	@pre RamAllocLock held.
 	*/
-	void ReturnPageToSystem();
+	TBool TryReturnOldestPageToSystem();
+
+	/**
+	Ensure adding a page to the paging cache will be within the maximum size.
+	
+	@param aPageInfo	On return this is set to the SPageInfo of a page that must be returned
+						to the system before a page can be added to the paging cache, or
+						NULL if no page must be returned to the system.
+	*/
+	void AllowAddFreePage(SPageInfo*& aPageInfo);
 
 	/**
+	Ensure adding aNumPages pages to the paging cache will be within the maximum size.
+	
+	@param aPageInfo	On return this is set to the SPageInfo of a page that must be returned
+						to the system before any more pages can be added to the paging cache, or
+						NULL if no page must be returned to the system.
+	@param aNumPages	The number of pages the caller wishes to add to the paging cache.
+	
+	@return If aPageInfo == NULL on return, this is the number of pages it is possible to
+			add to the paging cache or 1 if aPageInfo != NULL, i.e. a page will need 
+			to be returned to the system.
+	*/
+	TUint AllowAddFreePages(SPageInfo*& aPageInfo, TUint aNumPages);
+	
+	/**
 	Put a specific page back on the system's free pool.
 
 	@pre RamAllocLock held.
@@ -489,11 +557,11 @@
 	SPageInfo* PageInAllocPage(Mmu::TRamAllocFlags aAllocFlags);
 
 	/**
-	Called by CleanSomePages() to determine which pages should be cleaned.
+	Called by CleanSomePages() to select the pages be cleaned.
 
-	This deals with the complexity of page colouring, which means that pages can only be mapped at
-	certain locations.  When cleaning multiple pages at once we need to find a set of pages that we
-	can map in memory sequentially.
+	This function finds a set of pages that can be mapped sequentially in memory when page colouring
+	restrictions are in effect.  It is only called on systems with page colouring restrictions where
+	the paging media driver does not support writing by phyiscal address.
 
 	@pre MmuLock held
 	
@@ -502,7 +570,22 @@
 	
 	@return The numnber of pages to clean.
 	*/
-	TInt SelectPagesToClean(SPageInfo** aPageInfosOut);
+	TInt SelectSequentialPagesToClean(SPageInfo** aPageInfosOut);
+
+	/**
+	Called by CleanSomePages() to select the pages be cleaned.
+
+	This funciton selects the oldest dirty pages.  It is called on systems without page colouring
+	restrictions or where the paging media driver supports writing by phyiscal address.
+
+	@pre MmuLock held
+	
+	@param aPageInfosOut Pointer to an array of SPageInfo pointers, which must be at least
+	KMaxPagesToClean long.  This will be filled in to indicate the pages to clean.
+	
+	@return The numnber of pages to clean.
+	*/
+	TInt SelectOldestPagesToClean(SPageInfo** aPageInfosOut);
 
 	/**
 	If the number of young pages exceeds that specified by iYoungOldRatio then a
@@ -578,6 +661,7 @@
 	*/
 	TInt PteAndInfoFromLinAddr(	TInt aOsAsid, TLinAddr aAddress, DMemoryMappingBase* aMapping, 
 								TUint aMapInstanceCount, TPte*& aPte, SPageInfo*& aPageInfo);
+	
 #ifdef _DEBUG
 	/**
 	Check consistency of live list.
@@ -603,6 +687,7 @@
 	SDblQue iOldestDirtyList;	/**< Head of 'oldestDirty' page list. */
 	TUint iOldestDirtyCount;	/**< Number of 'oldestDirty' pages */
 	TUint16 iOldOldestRatio;	/**< Ratio of old pages to oldest to clean and dirty in the live page list*/
+	TUint iMaxOldestPages;      /**< Maximum number of oldest pages. */
 	TUint iNumberOfFreePages;
 	TUint iNumberOfDirtyPages;	/**< The total number of dirty pages in the paging cache. Protected by MmuLock */
 	TUint iInitMinimumPageCount;/**< Initial value for iMinimumPageCount */
@@ -610,6 +695,9 @@
 	TUint iReservePageCount;	/**< Number of pages reserved for locking */
 	TUint iMinimumPageLimit;	/**< Minimum size for iMinimumPageCount, not including locked pages.
 								     iMinimumPageCount >= iMinimumPageLimit + iReservePageCount */
+	TUint iPagesToClean;        /**< Preferred number of pages to attempt to clean in one go. */
+	TBool iCleanInSequence;     /**< Pages to be cleaned must have sequential page colour. */
+
 	SVMEventInfo iEventInfo;
 
 #ifdef __DEMAND_PAGING_BENCHMARKS__
@@ -777,7 +865,6 @@
 const TInt KPagingRequestsPerDevice = 2;
 
 
-class DPoolPagingRequest;
 class DPageReadRequest;
 class DPageWriteRequest;
 
@@ -797,110 +884,98 @@
 		{
 	public:
 		TGroup(TUint aNumRequests);
-		DPoolPagingRequest* FindCollisionContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
-		DPoolPagingRequest* GetRequest(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
-		void Signal(DPoolPagingRequest* aRequest);
+		DPageReadRequest* FindCollisionContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
+		DPageReadRequest* GetRequest(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
 	public:
 		TUint iNumRequests;
-		DPoolPagingRequest** iRequests;
+		DPageReadRequest** iRequests;
 		SDblQue iFreeList;
 		};
 	TGroup iPageReadRequests;
 	DPageWriteRequest* iPageWriteRequest;
 
-	friend class DPoolPagingRequest;
 	friend class DPageReadRequest;
-	friend class DPageWriteRequest;
 	};
 
 
 /**
-Resources needed to service a paging request.
+Common resources needed to service a paging request.
 */
-class DPagingRequest : public SDblQueLink
+class DPagingRequestBase : public DBase
 	{
 public:
+	TLinAddr MapPages(TUint aColour, TUint aCount, TPhysAddr* aPages);
+	void UnmapPages(TBool aIMBRequired);
+public:  // for DPagingRequestPool
+	DMutex*			iMutex;		/**< A mutex for synchronisation and priority inheritance. */
+protected:
+	Mmu::TTempMapping	iTempMapping;
+	};
+
+
+/**
+Resources needed to service a page in request.
+*/
+class DPageReadRequest : public DPagingRequestBase
+	{
+public:
+	static TUint ReservedPagesRequired();
+private:
+	static TInt iAllocNext;
+
+public:
 	enum
 		{
 		EMaxPages = 4
 		};
-	DPagingRequest();
-	TLinAddr MapPages(TUint aColour, TUint aCount, TPhysAddr* aPages);
-	void UnmapPages(TBool aIMBRequired);
-	void SetUseContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
-	void SetUseDiscontiguous(DMemoryObject** aMemory, TUint* aIndex, TUint aCount);
-	void ResetUse();
-	TBool CheckUseContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
-	TBool CheckUseDiscontiguous(DMemoryObject** aMemory, TUint* aIndex, TUint aCount);
-	TBool IsCollisionContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
-public:
-	DMutex*			iMutex;		/**< A mutex for synchronisation and priority inheritance. */
-protected:
-	Mmu::TTempMapping	iTempMapping;
-private:
-	// used to identify memory request is used for...
-	TUint			iUseRegionCount;
-	DMemoryObject*	iUseRegionMemory[EMaxPages];
-	TUint			iUseRegionIndex[EMaxPages];
-	};
-
-
-__ASSERT_COMPILE(DPagingRequest::EMaxPages >= KMaxPagesToClean);
-
-
-/**
-A paging request that is part of a pool of similar request objects.
-*/
-class DPoolPagingRequest : public DPagingRequest
-	{
-public:
-	DPoolPagingRequest(DPagingRequestPool::TGroup& aPoolGroup);
+	DPageReadRequest(DPagingRequestPool::TGroup& aPoolGroup);
+	TInt Construct();
  	void Release();
 	void Wait();
 	void Signal();
-public:
-	TInt			iUsageCount;	/**< How many threads are using or waiting for this object. */	
+	void SetUseContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
+	void ResetUse();
+	TBool CheckUseContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
+	TBool IsCollisionContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
+	TLinAddr Buffer() { return iBuffer; }
+	TUint ThreadsWaiting() { return iUsageCount; }
 private:
+	~DPageReadRequest() { }  // can't delete
+public:  // for DPagingRequestPool
+	SDblQueLink iLink;  /**< Link into list of free requests. */
+private:
+	TInt iUsageCount;	/**< How many threads are using or waiting for this object. */	
+	TLinAddr iBuffer;	/**< A buffer of size EMaxPages+1 pages to read compressed data into. */
 	DPagingRequestPool::TGroup& iPoolGroup;
+	DMemoryObject* iMemory;
+	TUint iIndex;
+	TUint iCount;
 	};
 
-	
-/**
-Resources needed to service a page in request.
-*/
-class DPageReadRequest : public DPoolPagingRequest
-	{
-public:
-	DPageReadRequest(DPagingRequestPool::TGroup& aPoolGroup);
-	TInt Construct();
-	static TUint ReservedPagesRequired();
-private:
-	~DPageReadRequest(); // can't delete
-public:
-	TLinAddr		iBuffer;	/**< A buffer to read compressed data into. Size is EMaxPages+1 pages.*/
-private:
-	DMemoryObject*	iMemory;
-private:
-	static TInt iAllocNext;
-	};
-
-
-FORCE_INLINE TUint DPageReadRequest::ReservedPagesRequired()
-	{
-	return iAllocNext*EMaxPages;
-	}
-
 
 /**
 Resources needed to service a page out request.
 */
-class DPageWriteRequest : public DPagingRequest
+class DPageWriteRequest : public DPagingRequestBase
 	{
 public:
+	enum
+		{
+		EMaxPages = KMaxPagesToClean
+		};
 	DPageWriteRequest();
  	void Release();
+	void SetUseDiscontiguous(DMemoryObject** aMemory, TUint* aIndex, TUint aCount);
+	void ResetUse();
+	TBool CheckUseContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
+	TBool IsCollisionContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
 private:
-	~DPageWriteRequest(); // can't delete
+	~DPageWriteRequest() { }  // can't delete	
+private:
+	// used to identify the memory the request is used for...
+	TUint			iUseRegionCount;
+	DMemoryObject*	iUseRegionMemory[EMaxPages];
+	TUint			iUseRegionIndex[EMaxPages];
 	};
 
 
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mptalloc.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mptalloc.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -54,10 +54,6 @@
 uses memory from #ThePager which will reclaim paged memory if necessary.
 Providing the live list always has #DPager::iMinYoungPages, this guarantees that
 handling page faults can never fail by running out of memory.
-
-TODO: In really pathological situations page table allocation can fail due to
-being out of virtual address space to map the table, this needs to be prevented
-from happening when handling demand paging faults.
 */
 
 
@@ -122,6 +118,8 @@
 
 	virtual TInt MovePage(	DMemoryObject* aMemory, SPageInfo* aOldPageInfo, 
 							TPhysAddr& aNewPage, TUint aBlockZoneId, TBool aBlockRest);
+
+	virtual TInt MoveAndAllocPage(DMemoryObject* aMemory, SPageInfo* aPageInfo, TZonePageType aType);
 public:
 	/**
 	Allocate a page of RAM for storing page tables in.
@@ -267,13 +265,22 @@
 	return r;
 	}
 
+
 TInt DPageTableMemoryManager::MovePage(	DMemoryObject* aMemory, SPageInfo* aOldPageInfo, 
 										TPhysAddr& aNewPage, TUint aBlockZoneId, TBool aBlockRest)
-		{
-		// This could be a demand paged page table info which can be discarded 
-		// but let the PageTableAllocator handle that.
-		return ::PageTables.MovePage(aMemory, aOldPageInfo, aBlockZoneId, aBlockRest);
-		}
+	{
+	// This could be a demand paged page table info which can be discarded 
+	// but let the PageTableAllocator handle that.
+	return ::PageTables.MovePage(aMemory, aOldPageInfo, aBlockZoneId, aBlockRest);
+	}
+
+
+TInt DPageTableMemoryManager::MoveAndAllocPage(DMemoryObject* aMemory, SPageInfo* aPageInfo, TZonePageType aPageType)
+	{
+	// This could be a demand paged page table info which can be discarded 
+	// but let the PageTableAllocator handle that.
+	return ::PageTables.MoveAndAllocPage(aMemory, aPageInfo, aPageType);
+	}
 
 
 //
@@ -1181,9 +1188,9 @@
 TInt PageTableAllocator::MovePage(DMemoryObject* aMemory, SPageInfo* aOldPageInfo, 
 									TUint aBlockZoneId, TBool aBlockRest)
 	{
+	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
 	// We don't move page table or page table info pages, however, if this page 
 	// is demand paged then we may be able to discard it.
-	MmuLock::Lock();
 	if (aOldPageInfo->Owner() == iPageTableInfoMemory)
 		{
 		if (!(iPtPageAllocator.IsDemandPagedPtInfo(aOldPageInfo)))
@@ -1210,7 +1217,19 @@
 	// Let the pager discard the page as it controls the size of the live list.
 	// If the size of the live list allows then eventually 
 	// PageTableAllocator::StealPage() will be invoked on this page.
-	return ThePager.DiscardPage(aOldPageInfo, aBlockZoneId, aBlockRest);
+	TUint moveDisFlags = (aBlockRest)? M::EMoveDisBlockRest : 0;
+	return ThePager.DiscardPage(aOldPageInfo, aBlockZoneId, moveDisFlags);
+	}
+
+
+TInt PageTableAllocator::MoveAndAllocPage(DMemoryObject* aMemory, SPageInfo* aPageInfo, TZonePageType aPageType)
+	{
+	TInt r = MovePage(aMemory, aPageInfo, KRamZoneInvalidId, EFalse);
+	if (r == KErrNone)
+		{
+		TheMmu.MarkPageAllocated(aPageInfo->PhysAddr(), aPageType);
+		}
+	return r;
 	}
 
 
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mptalloc.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mptalloc.h	Thu Jul 22 16:46:39 2010 +0100
@@ -137,6 +137,17 @@
 	TInt MovePage(	DMemoryObject* aMemory, SPageInfo* aOldPageInfo, 
 						TUint aBlockZoneId, TBool aBlockRest);
 
+	/**
+	Attempts to discard a page of page tables using #MovePage.  If the discard was 
+	succesful it then allocates the page with type aPageType.
+	
+	@param aMemory		This should always be the page table info memory object.
+	@param aPageInfo	The page info of the page to discard.
+
+	@return KErrNone if the page could be successfully discarded and its RAM page allocated.
+	*/
+	TInt MoveAndAllocPage(DMemoryObject* aMemory, SPageInfo* aPageInfo, TZonePageType aPageType);
+
 #ifdef _DEBUG
 	/**
 	Debug function for use by DPager::RemovePage() to allow it to remove
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mrom.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mrom.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -576,7 +576,7 @@
 				__NK_ASSERT_ALWAYS(romPageInfo->iPagingAttributes & SRomPageInfo::EPageable);
 
 				// Read data for page...
-				const TLinAddr buffer = aRequest->iBuffer;
+				const TLinAddr buffer = aRequest->Buffer();
 				const TUint readStart = dataOffset >> readUnitShift;
 				const TUint readSize = ((dataOffset + dataSize - 1) >> readUnitShift) - readStart + 1;
 				__NK_ASSERT_DEBUG((readSize << readUnitShift) <= (DPageReadRequest::EMaxPages << KPageShift));
@@ -958,7 +958,11 @@
 	RamAllocLock::Lock();
 
 	Mmu& m = TheMmu;
-	r = m.AllocRam(&iNewPage, 1, aMemory->RamAllocFlags(), EPageFixed);
+	// Allocate a page to shadow to allowing the allocation to steal pages from the paging cache.
+	r = m.AllocRam(	&iNewPage, 
+					1, 
+					(Mmu::TRamAllocFlags)(aMemory->RamAllocFlags() & ~Mmu::EAllocNoPagerReclaim), 
+					EPageFixed);
 	if(r==KErrNone)
 		{
 		TLinAddr dst = m.MapTemp(iNewPage,aIndex,0);
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mswap.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mswap.h	Thu Jul 22 16:46:39 2010 +0100
@@ -23,5 +23,10 @@
 
 extern void GetSwapInfo(SVMSwapInfo& aInfoOut);
 extern TInt SetSwapThresholds(const SVMSwapThresholds& aThresholds);
+extern TBool GetPhysicalAccessSupported();
+extern TBool GetUsePhysicalAccess();
+extern void SetUsePhysicalAccess(TBool aUsePhysicalAccess);
+extern TUint GetPreferredDataWriteSize();
+extern TInt SetDataWriteSize(TUint aWriteShift);
 
 #endif
--- a/kernel/eka/memmodel/epoc/mmubase/defragbase.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/mmubase/defragbase.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -78,6 +78,7 @@
 	TUint offset = 0;
 	TPhysAddr newAddr;
 	TBool zoneActive = EFalse;
+	const TUint moveDisFlags = (aBestEffort)? 0 : M::EMoveDisBlockRest | M::EMoveDisMoveDirty;
 	TInt ret = iRamAllocator->NextAllocatedPage(&aZone, offset, EPageMovable);
 
 	// if not best effort mode keep moving pages unless someone allocates into 
@@ -101,7 +102,7 @@
 			__KTRACE_OPT(KMMU, Kern::Printf("ClearMovableFromZone: memory too low or zone active addr %x", addr));
 			return KErrNoMemory;
 			}
-		TInt moved = M::MovePage(addr, newAddr, aZone.iId, !aBestEffort);
+		TInt moved = M::MovePage(addr, newAddr, aZone.iId, moveDisFlags);
 		if (moved != KErrNone)
 			{// Couldn't move the page so stop as we can't clear the zone
 			if (!aBestEffort)
@@ -144,6 +145,7 @@
 	TUint offset = 0;
 	TBool zoneActive = EFalse;
 	TInt ret = iRamAllocator->NextAllocatedPage(&aZone, offset, EPageDiscard);
+	const TUint moveDisFlags = (aBestEffort)? 0 : M::EMoveDisBlockRest | M::EMoveDisMoveDirty;
 
 
 	while (	aZone.iAllocPages[EPageDiscard] != 0 && ret == KErrNone && 
@@ -169,7 +171,7 @@
 			return KErrNoMemory;
 			}
 
-		TInt discardRet = M::DiscardPage(addr, aZone.iId, !aBestEffort);
+		TInt discardRet = M::DiscardPage(addr, aZone.iId, moveDisFlags);
 		if (discardRet == KErrNone)
 			{// Page was discarded successfully.
 			if (aMaxDiscard)
--- a/kernel/eka/memmodel/epoc/mmubase/mmubase.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/mmubase/mmubase.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -483,7 +483,7 @@
 TInt MmuBase::AllocPhysicalRam(TInt aSize, TPhysAddr& aPhysAddr, TInt aAlign)
 	{
 	__KTRACE_OPT(KMMU,Kern::Printf("Mmu::AllocPhysicalRam() size=%x align=%d",aSize,aAlign));
-	TInt r=AllocContiguousRam(aSize, aPhysAddr, EPageFixed, aAlign);
+	TInt r=AllocContiguousRam(aSize, aPhysAddr, aAlign);
 	if (r!=KErrNone)
 		{
 		iAllocFailed=ETrue;
@@ -516,7 +516,7 @@
 TInt MmuBase::ZoneAllocPhysicalRam(TUint* aZoneIdList, TUint aZoneIdCount, TInt aSize, TPhysAddr& aPhysAddr, TInt aAlign)
 	{
 	__KTRACE_OPT(KMMU,Kern::Printf("Mmu::ZoneAllocPhysicalRam() size=0x%x align=%d", aSize, aAlign));
-	TInt r = ZoneAllocContiguousRam(aZoneIdList, aZoneIdCount, aSize, aPhysAddr, EPageFixed, aAlign);
+	TInt r = ZoneAllocContiguousRam(aZoneIdList, aZoneIdCount, aSize, aPhysAddr, aAlign);
 	if (r!=KErrNone)
 		{
 		iAllocFailed=ETrue;
@@ -725,20 +725,19 @@
 	}
 
 
-TInt MmuBase::AllocContiguousRam(TInt aSize, TPhysAddr& aPhysAddr, TZonePageType aPageType, TInt aAlign, TUint aBlockedZoneId, TBool aBlockRest)
+TInt MmuBase::AllocContiguousRam(TInt aSize, TPhysAddr& aPhysAddr, TInt aAlign)
 	{
 #ifdef _DEBUG
 	if(K::CheckForSimulatedAllocFail())
 		return KErrNoMemory;
 #endif
-	__NK_ASSERT_DEBUG(aPageType == EPageFixed);
 	TUint contigPages = (aSize + KPageSize - 1) >> KPageShift;
-	TInt r = iRamPageAllocator->AllocContiguousRam(contigPages, aPhysAddr, aPageType, aAlign, aBlockedZoneId, aBlockRest);
+	TInt r = iRamPageAllocator->AllocContiguousRam(contigPages, aPhysAddr, aAlign);
 	if (r == KErrNoMemory && contigPages > KMaxFreeableContiguousPages)
 		{// Allocation failed but as this is a large allocation flush the RAM cache 
 		// and reattempt the allocation as large allocation wouldn't discard pages.
 		iRamCache->FlushAll();
-		r = iRamPageAllocator->AllocContiguousRam(contigPages, aPhysAddr, aPageType, aAlign, aBlockedZoneId, aBlockRest);
+		r = iRamPageAllocator->AllocContiguousRam(contigPages, aPhysAddr, aAlign);
 		}
 	return r;
 	}
@@ -750,16 +749,15 @@
 @param aZoneIdCount	The number of IDs listed in aZoneIdList
 @param aSize		The number of bytes to allocate
 @param aPhysAddr 	Will receive the physical base address of the allocated RAM
-@param aPageType 	The type of the pages being allocated
 @param aAlign 		The log base 2 alginment required
 */
-TInt MmuBase::ZoneAllocContiguousRam(TUint* aZoneIdList, TUint aZoneIdCount, TInt aSize, TPhysAddr& aPhysAddr, TZonePageType aPageType, TInt aAlign)
+TInt MmuBase::ZoneAllocContiguousRam(TUint* aZoneIdList, TUint aZoneIdCount, TInt aSize, TPhysAddr& aPhysAddr, TInt aAlign)
 	{
 #ifdef _DEBUG
 	if(K::CheckForSimulatedAllocFail())
 		return KErrNoMemory;
 #endif
-	return iRamPageAllocator->ZoneAllocContiguousRam(aZoneIdList, aZoneIdCount, aSize, aPhysAddr, aPageType, aAlign);
+	return iRamPageAllocator->ZoneAllocContiguousRam(aZoneIdList, aZoneIdCount, aSize, aPhysAddr, aAlign);
 	}
 
 SPageInfo* SPageInfo::SafeFromPhysAddr(TPhysAddr aAddress)
@@ -5525,7 +5523,7 @@
 		}
 
 	MmuBase::Wait();
-	TInt r=M::MovePage(aOld,aNew,KRamZoneInvalidId,EFalse);
+	TInt r=M::MovePage(aOld,aNew,KRamZoneInvalidId,0);
 	if (r!=KErrNone)
 		aNew = KPhysAddrInvalid;
 	MmuBase::Signal();
--- a/kernel/eka/memmodel/epoc/mmubase/ramalloc.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/mmubase/ramalloc.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -354,13 +354,13 @@
 					aZone->iAllocPages[EPageFixed],	aZone->iAllocPages[EPageMovable],aZone->iAllocPages[EPageDiscard]));
 		Panic(EZonesCountErr);
 		}
-	__ASSERT_DEBUG(free == (TUint32)aZone->iBma[KBmaAllPages]->iAvail, Panic(EAllocRamPagesInconsistent));
 	__KTRACE_OPT(KMMU2,Kern::Printf("ZoneFreePages - aCount %x free %x, alloc %x",aCount,free,alloc));
 	__KTRACE_OPT(KMMU2,Kern::Printf("Alloc Unk %x Fx %x Mv %x Dis %x",aZone->iAllocPages[EPageUnknown], 
 					aZone->iAllocPages[EPageFixed],	aZone->iAllocPages[EPageMovable],aZone->iAllocPages[EPageDiscard]));
 
-	if (iAllowBmaVerify)
+	if (!iContiguousReserved)
 		{
+		__ASSERT_DEBUG(free == (TUint32)aZone->iBma[KBmaAllPages]->iAvail, Panic(EAllocRamPagesInconsistent));
 		TBitMapAllocator& bmaType = *(aZone->iBma[(aType != EPageUnknown)? aType : EPageFixed]);
 		TUint allocPages;
 		if (aType == EPageFixed || aType == EPageUnknown)
@@ -495,13 +495,13 @@
 					aZone->iAllocPages[EPageFixed],	aZone->iAllocPages[EPageMovable],aZone->iAllocPages[EPageDiscard]));
 		Panic(EZonesCountErr);
 		}
-	__ASSERT_DEBUG(free == (TUint32)aZone->iBma[KBmaAllPages]->iAvail, Panic(EAllocRamPagesInconsistent));
 	__KTRACE_OPT(KMMU2,Kern::Printf("ZoneFreePages - aCount %x free %x, alloc %x",aCount,free,alloc));
 	__KTRACE_OPT(KMMU2,Kern::Printf("Alloc Unk %x Fx %x Mv %x Dis %x",aZone->iAllocPages[EPageUnknown], 
 					aZone->iAllocPages[EPageFixed],	aZone->iAllocPages[EPageMovable],aZone->iAllocPages[EPageDiscard]));
 
-	if (iAllowBmaVerify)
+	if (!iContiguousReserved)
 		{
+		__ASSERT_DEBUG(free == (TUint32)aZone->iBma[KBmaAllPages]->iAvail, Panic(EAllocRamPagesInconsistent));
 		TBitMapAllocator& bmaType = *(aZone->iBma[(aType != EPageUnknown)? aType : EPageFixed]);
 		TUint allocPages;
 		if (aType == EPageFixed || aType == EPageUnknown)
@@ -968,7 +968,7 @@
 	// Temporarily fill preference list so SetPhysicalRamState can succeed
 #ifdef _DEBUG
 	// Block bma verificaitons as bma and alloc counts aren't consistent yet.
-	iAllowBmaVerify = EFalse;
+	iContiguousReserved = 1;
 #endif
 	const SZone* const lastZone = iZones + iNumZones;
 	zone = iZones;
@@ -984,7 +984,7 @@
 		}
 #ifdef _DEBUG
 	// Only now is it safe to enable bma verifications
-	iAllowBmaVerify = ETrue;
+	iContiguousReserved = 0;
 #endif
 
 	///////////////////////////////////////////////////////////////////////////
@@ -1135,6 +1135,7 @@
 		}
 	}
 
+
 TInt DRamAllocator::MarkPageAllocated(TPhysAddr aAddr, TZonePageType aType)
 	{
 	__KTRACE_OPT(KMMU,Kern::Printf("DRamAllocator::MarkPageAllocated %08x",aAddr));
@@ -1160,7 +1161,12 @@
 		return KErrAlreadyExists;			// page is already allocated
 		}
 	bmaAll.Alloc(n,1);
-	bmaType.Alloc(n,1);
+	if (bmaType.NotAllocated(n,1))
+		bmaType.Alloc(n,1);
+#ifdef _DEBUG
+	else // Allow this page to already be reserved in bmaType as AllocContiguousRam() may have done this.
+		__NK_ASSERT_DEBUG(aType == EPageFixed);
+#endif
 	--iTotalFreeRamPages;
 	ZoneAllocPages(z, 1, aType);
 	__KTRACE_OPT(KMMU,Kern::Printf("Total free RAM pages now = %d",iTotalFreeRamPages));
@@ -1171,6 +1177,7 @@
 	return KErrNone;
 	}
 
+
 TInt DRamAllocator::FreeRamPage(TPhysAddr aAddr, TZonePageType aType)
 	{
 	__KTRACE_OPT(KMMU,Kern::Printf("FreeRamPage %08x",aAddr));
@@ -1201,17 +1208,27 @@
 	__KTRACE_OPT(KMMU2,Kern::Printf("Zone index %d page index %04x",z-iZones,n));
 	TBitMapAllocator& bmaAll = *(z->iBma[KBmaAllPages]);
 	TBitMapAllocator& bmaType = *(z->iBma[aType]);
-	bmaAll.Free(n);
+
 	bmaType.Free(n);
-	++iTotalFreeRamPages;
-	ZoneFreePages(z, 1, aType);
-
+	if (iContiguousReserved && aType != EPageFixed && z->iBma[EPageFixed]->NotFree(n, 1))
+		{// This page has been reserved by AllocContiguous() so don't free it
+		// but allocate it as fixed.
+		ZoneFreePages(z, 1, aType);
+		ZoneAllocPages(z, 1, EPageFixed);
+		}
+	else
+		{
+		bmaAll.Free(n);
+		++iTotalFreeRamPages;
+		ZoneFreePages(z, 1, aType);	
+		}
 #ifdef BTRACE_RAM_ALLOCATOR
 	BTrace8(BTrace::ERamAllocator, BTrace::ERamAllocFreePage, aType, aAddr);
 #endif
 	return KErrNone;
 	}
 
+
 void DRamAllocator::FreeRamPages(TPhysAddr* aPageList, TInt aNumPages, TZonePageType aType)
 	{
 	__KTRACE_OPT(KMMU,Kern::Printf("FreeRamPages count=%08x",aNumPages));
@@ -1259,11 +1276,37 @@
 			pa += KPageSize;
 			}
 		__KTRACE_OPT(KMMU2,Kern::Printf("%d consecutive pages, zp_rem=%x, %d remaining pages",n,zp_rem,aNumPages));
-		bmaAll.Free(ix,n);
 		TBitMapAllocator& bmaType = *(z->iBma[aType]);
 		bmaType.Free(ix,n);
-		iTotalFreeRamPages += n;
-		ZoneFreePages(z, n, aType);
+
+		if (iContiguousReserved && aType != EPageFixed)
+			{// See if a page has been reserved by AllocContiguous() in this range.
+			TUint pagesFreed = 0;
+			TUint allocStart = ix;
+			TUint freeOffset = ix;
+			TUint endOffset = ix + n - 1;
+			while (freeOffset <= endOffset)
+				{
+				TUint runLength =  NextAllocatedRun(z, allocStart, endOffset, EPageFixed);
+				if (allocStart > freeOffset)
+					{
+					TUint freed = allocStart - freeOffset;
+					bmaAll.Free(freeOffset, freed);
+					pagesFreed += freed;
+					}
+				allocStart += runLength;
+				freeOffset = allocStart;
+				}
+			iTotalFreeRamPages += pagesFreed;
+			ZoneFreePages(z, n, aType);
+			ZoneAllocPages(z, n - pagesFreed, EPageFixed);
+			}
+		else
+			{
+			bmaAll.Free(ix,n);
+			iTotalFreeRamPages += n;
+			ZoneFreePages(z, n, aType);
+			}
 #ifdef BTRACE_RAM_ALLOCATOR
 		BTrace12(BTrace::ERamAllocator, BTrace::ERamAllocFreePages, aType, n, first_pa);
 #endif
@@ -1273,6 +1316,7 @@
 #endif
 	}
 
+
 /**
 	Attempt to clear upto the required amount of discardable or movable pages
 	from the RAM zone.
@@ -1286,26 +1330,37 @@
 		Kern::Printf("ZoneClearPages: ID 0x%x, req 0x%x", aZone.iId, aRequiredPages));
 	// Discard the required number of discardable pages.
 	TUint offset = 0;
-	TInt r = NextAllocatedPage(&aZone, offset, EPageDiscard);
-	while (r == KErrNone && aRequiredPages)
+	for (; aRequiredPages; offset++)
 		{
+		TInt r = NextAllocatedPage(&aZone, offset, EPageDiscard);
+		if (r != KErrNone)
+			break;
+		if (iContiguousReserved && aZone.iBma[EPageFixed]->NotFree(offset, 1))
+			{
+			offset++;
+			continue;
+			}
 		TPhysAddr physAddr = (offset << KPageShift) + aZone.iPhysBase;
-		TInt discarded = M::DiscardPage(physAddr, aZone.iId, EFalse);
+		TInt discarded = M::DiscardPage(physAddr, aZone.iId, M::EMoveDisMoveDirty);
 		if (discarded == KErrNone)
 			{// The page was successfully discarded.
 			aRequiredPages--;
 			}
-		offset++;
-		r = NextAllocatedPage(&aZone, offset, EPageDiscard);
 		}
 	// Move the required number of movable pages.
-	offset = 0;
-	r = NextAllocatedPage(&aZone, offset, EPageMovable);
-	while(r == KErrNone && aRequiredPages)
+	for (offset = 0; aRequiredPages; offset++)
 		{
+		TInt r = NextAllocatedPage(&aZone, offset, EPageMovable);
+		if (r != KErrNone)
+			break;
+		if (iContiguousReserved && aZone.iBma[EPageFixed]->NotFree(offset, 1))
+			{
+			offset++;
+			continue;
+			}
 		TPhysAddr physAddr = (offset << KPageShift) + aZone.iPhysBase;
 		TPhysAddr newAddr = KPhysAddrInvalid;
-		if (M::MovePage(physAddr, newAddr, aZone.iId, EFalse) == KErrNone)
+		if (M::MovePage(physAddr, newAddr, aZone.iId, 0) == KErrNone)
 			{// The page was successfully moved.
 #ifdef _DEBUG
 			TInt newOffset = 0;
@@ -1314,8 +1369,6 @@
 #endif
 			aRequiredPages--;
 			}
-		offset++;
-		r = NextAllocatedPage(&aZone, offset, EPageMovable);
 		}
 	}
 
@@ -1397,14 +1450,15 @@
 	TPhysAddr* pageListBase = aPageList;
 	TUint32 numMissing = aNumPages;
 
+	if ((TUint)aNumPages > iTotalFreeRamPages)
+		{// Not enough free pages to fulfill this request so return the amount required
+		return aNumPages - iTotalFreeRamPages;
+		}
+
 	if (aType == EPageFixed)
 		{// Currently only a general defrag operation should set this and it won't
 		// allocate fixed pages.
 		__NK_ASSERT_DEBUG(!aBlockRest);
-		if ((TUint)aNumPages > iTotalFreeRamPages + M::NumberOfFreeDpPages())
-			{// Not enough free space and not enough freeable pages.
-			goto exit;
-			}
 
 		// Search through each zone in preference order until all pages allocated or
 		// have reached the end of the preference list
@@ -1440,11 +1494,6 @@
 		}
 	else
 		{
-		if ((TUint)aNumPages > iTotalFreeRamPages)
-			{// Not enough free pages to fulfill this request so return amount required
-			return aNumPages - iTotalFreeRamPages;
-			}
-
 		// Determine if there are enough free pages in the RAM zones in use.
 		TUint totalFreeInUse = 0;
 		SDblQueLink* link = iZoneLeastMovDis;
@@ -1464,7 +1513,7 @@
 			{// Allocating as part of a general defragmentation and
 			// can't allocate without using a RAM zone less preferable than
 			// the current least prefeable RAM zone with movable and/or 
-			//discardable.
+			// discardable.
 			__NK_ASSERT_DEBUG(numMissing);
 			goto exit;
 			}
@@ -1679,29 +1728,237 @@
 	return r;
 	}
 
+
+#if !defined(__MEMMODEL_MULTIPLE__) && !defined(__MEMMODEL_MOVING__)
+TUint DRamAllocator::BlockContiguousRegion(TPhysAddr aAddrBase, TUint aNumPages)
+	{
+	// Shouldn't be asked to block zero pages, addrEndPage would be wrong if we did.
+	__NK_ASSERT_DEBUG(aNumPages);
+	TPhysAddr addr = aAddrBase;
+	TPhysAddr addrEndPage = aAddrBase + ((aNumPages - 1) << KPageShift);
+	TInt tmpOffset;
+	SZone* endZone = GetZoneAndOffset(addrEndPage, tmpOffset);
+	SZone* tmpZone;
+	TUint totalUnreserved = aNumPages;
+	do
+		{
+		tmpZone = GetZoneAndOffset(addr, tmpOffset);
+		__NK_ASSERT_DEBUG(tmpZone != NULL);
+		TUint runLength = 	(addrEndPage < tmpZone->iPhysEnd)? 
+							((addrEndPage - addr) >> KPageShift) + 1: 
+							tmpZone->iPhysPages - tmpOffset;
+		TUint reserved = tmpZone->iBma[KBmaAllPages]->SelectiveAlloc(tmpOffset, runLength);
+		if (reserved)
+			{
+#ifdef _DEBUG
+			TUint runEnd = tmpOffset + runLength;
+			TUint free = 0;
+			for (TUint i = tmpOffset; i < runEnd; i++)
+				if (tmpZone->iBma[EPageMovable]->NotAllocated(i,1) && tmpZone->iBma[EPageDiscard]->NotAllocated(i,1))
+					free++;
+			__NK_ASSERT_DEBUG(free == reserved);
+#endif
+			ZoneAllocPages(tmpZone, reserved, EPageFixed);
+			iTotalFreeRamPages -= reserved;
+			totalUnreserved -= reserved;
+			}
+		tmpZone->iBma[EPageFixed]->Alloc(tmpOffset, runLength);
+		addr = tmpZone->iPhysEnd + 1;
+		}
+	while (tmpZone != endZone);
+	return totalUnreserved;
+	}
+
+
+FORCE_INLINE void DRamAllocator::UnblockSetAllocRuns(	TUint& aOffset1, TUint& aOffset2, 
+														TUint aRunLength1, TUint aRunLength2, 
+														TUint& aAllocLength, TUint& aAllocStart)
+	{
+	aAllocStart = aOffset1;
+	aAllocLength = aRunLength1;
+	aOffset1 += aAllocLength;
+	if  (aOffset1 == aOffset2)
+		{
+		aAllocLength += aRunLength2;
+		aOffset2 += aRunLength2;
+		aOffset1 = aOffset2;
+		}
+	} 	
+
+
+void DRamAllocator::UnblockContiguousRegion(TPhysAddr aAddrBase, TUint aNumPages)
+	{
+	// Shouldn't be asked to unblock zero pages, addrEndPage would be wrong if we did.
+	__NK_ASSERT_DEBUG(aNumPages);
+	TPhysAddr addr = aAddrBase;
+	TPhysAddr addrEndPage = aAddrBase + ((aNumPages - 1) << KPageShift);
+	TInt tmpOffset;
+	SZone* endZone = GetZoneAndOffset(addrEndPage, tmpOffset);
+	SZone* tmpZone;
+	do
+		{
+		tmpZone = GetZoneAndOffset(addr, tmpOffset);
+		__NK_ASSERT_DEBUG(tmpZone != NULL);
+		TUint runLength = 	(addrEndPage < tmpZone->iPhysEnd)? 
+							((addrEndPage - addr) >> KPageShift) + 1: 
+							tmpZone->iPhysPages - tmpOffset;
+		TUint unreserved = 0;
+		TUint runEnd = tmpOffset + runLength - 1;
+		TUint freeOffset = tmpOffset;
+		TUint discardOffset = freeOffset;
+		TUint movableOffset = freeOffset;
+		__KTRACE_OPT(KMMU2, Kern::Printf("freeOff %d, runEnd %d", freeOffset, runEnd));
+		while (freeOffset <= runEnd)
+			{
+			TUint discardRun;
+			TUint movableRun;
+			discardRun = NextAllocatedRun(tmpZone, discardOffset, runEnd, EPageDiscard);
+			movableRun = NextAllocatedRun(tmpZone, movableOffset, runEnd, EPageMovable);
+			TUint allocLength;
+			TUint allocStart;
+			__KTRACE_OPT(KMMU2, Kern::Printf("disOff %d len %d movOff %d len %d", discardOffset, discardRun, movableOffset, movableRun));
+			if (discardOffset < movableOffset)
+				UnblockSetAllocRuns(discardOffset, movableOffset, discardRun, movableRun, allocLength, allocStart);
+			else
+				UnblockSetAllocRuns(movableOffset, discardOffset, movableRun, discardRun, allocLength, allocStart);
+
+			if (allocStart > freeOffset)
+				{
+				unreserved += allocStart - freeOffset;
+				tmpZone->iBma[KBmaAllPages]->Free(freeOffset, allocStart - freeOffset);
+				__NK_ASSERT_DEBUG(	!tmpZone->iBma[EPageMovable]->NotFree(freeOffset, allocStart - freeOffset) && 
+									!tmpZone->iBma[EPageDiscard]->NotFree(freeOffset, allocStart - freeOffset));
+				}
+			__KTRACE_OPT(KMMU2, Kern::Printf("disOff %d len %d movOff %d len %d start %d len %d", discardOffset, discardRun, movableOffset, movableRun, allocStart, allocLength));
+			freeOffset = allocStart + allocLength;
+			__KTRACE_OPT(KMMU2, Kern::Printf("freeOff %d", freeOffset));
+			}
+		tmpZone->iBma[EPageFixed]->Free(tmpOffset, runLength);
+		ZoneFreePages(tmpZone, unreserved, EPageFixed);
+		iTotalFreeRamPages += unreserved;
+		addr = tmpZone->iPhysEnd + 1;
+		}
+	while (tmpZone != endZone);
+	}
+
+
+TUint DRamAllocator::CountPagesInRun(TPhysAddr aAddrBase, TPhysAddr aAddrEndPage, TZonePageType aType)
+	{
+	__NK_ASSERT_DEBUG(aAddrBase <= aAddrEndPage);
+	TUint totalAllocated = 0;
+	TPhysAddr addr = aAddrBase;
+	TUint tmpOffset;
+	SZone* endZone = GetZoneAndOffset(aAddrEndPage, (TInt&)tmpOffset);
+	SZone* tmpZone;
+	do
+		{
+		tmpZone = GetZoneAndOffset(addr, (TInt&)tmpOffset);
+		__NK_ASSERT_DEBUG(tmpZone != NULL);
+		TUint runLength = 	(aAddrEndPage < tmpZone->iPhysEnd)? 
+							((aAddrEndPage - addr) >> KPageShift) + 1: 
+							tmpZone->iPhysPages - tmpOffset;
+		TUint runEnd = tmpOffset + runLength - 1;
+		while (tmpOffset <= runEnd)
+			{
+			TUint run = NextAllocatedRun(tmpZone, tmpOffset, runEnd, aType);
+			totalAllocated += run;
+			tmpOffset += run;
+			}
+		addr = tmpZone->iPhysEnd + 1;
+		}
+	while (tmpZone != endZone);
+	return totalAllocated;
+	}
+
+
+TInt DRamAllocator::ClearContiguousRegion(TPhysAddr aAddrBase, TPhysAddr aZoneBase, TUint aNumPages, TInt& aOffset, TUint aUnreservedPages)
+	{
+	TPhysAddr addr = aAddrBase;
+	TPhysAddr addrEndPage = aAddrBase + ((aNumPages -1 )<< KPageShift);
+	TInt contigOffset = 0;
+	SZone* contigZone = GetZoneAndOffset(addr, contigOffset);
+	TUint unreservedPages = aUnreservedPages;
+	for (; addr <= addrEndPage; addr += KPageSize, contigOffset++)
+		{
+		if (contigZone->iPhysEnd < addr)
+			{
+			contigZone = GetZoneAndOffset(addr, contigOffset);
+			__NK_ASSERT_DEBUG(contigZone != NULL);
+			}
+
+		__NK_ASSERT_DEBUG(contigZone != NULL);
+		__NK_ASSERT_DEBUG(contigZone->iBma[EPageFixed]->NotFree(contigOffset, 1));
+		__NK_ASSERT_DEBUG(SPageInfo::SafeFromPhysAddr(addr) != NULL);
+
+		if (unreservedPages > iTotalFreeRamPages)
+			{// May need to discard some pages so there is free space for the 
+			// pages in the contiguous run to be moved to.
+			TUint requiredPages = unreservedPages - iTotalFreeRamPages;
+			if (requiredPages)
+				{// Ask the pager to get free some pages.
+				M::GetFreePages(requiredPages);
+
+				// The ram alloc lock may have been flashed so ensure that we still have
+				// enough free ram to complete the allocation.
+				TUint remainingPages = ((addrEndPage - addr) >> KPageShift) + 1;
+				unreservedPages = remainingPages - CountPagesInRun(addr, addrEndPage, EPageFixed);
+				if (unreservedPages > iTotalFreeRamPages + M::NumberOfFreeDpPages())
+					{// Not enough free space and not enough freeable pages.
+					return KErrNoMemory;
+					}
+				}
+			}
+
+		TInt r = M::MoveAndAllocPage(addr, EPageFixed);
+		if (r != KErrNone)
+			{// This page couldn't be moved or discarded so 
+			// restart the search the page after this one.
+			__KTRACE_OPT(KMMU2, Kern::Printf("ContigMov fail contigOffset 0x%x r %d", contigOffset, r));
+			aOffset = (addr < aZoneBase)? 0 : contigOffset + 1;
+			return r;
+			}
+		__NK_ASSERT_DEBUG(contigZone->iBma[EPageFixed]->NotFree(contigOffset, 1));
+		__NK_ASSERT_DEBUG(contigZone->iBma[KBmaAllPages]->NotFree(contigOffset, 1));
+		__NK_ASSERT_DEBUG(contigZone->iBma[EPageDiscard]->NotAllocated(contigOffset, 1));
+		__NK_ASSERT_DEBUG(contigZone->iBma[EPageMovable]->NotAllocated(contigOffset, 1));
+		}
+
+	// Successfully cleared the contiguous run
+	return KErrNone;
+	}
+
+
 /**
 Search through the zones for the requested contiguous RAM, first in preference 
 order then, if that fails, in address order.
 
+No support for non-fixed pages as this will discard and move pages if required.
+
 @param aNumPages The number of contiguous pages to find
 @param aPhysAddr Will contain the base address of any contiguous run if found
-@param aType The page type of the memory to be allocated
 @param aAlign Alignment specified as the alignment shift
-@param aBlockedZoneId The ID of a zone that can't be allocated into, by default this has no effect
-@param aBlockRest Set to ETrue to stop allocation as soon as aBlockedZoneId is reached 
 in preference ordering.  EFalse otherwise.
 
 @return KErrNone on success, KErrNoMemory otherwise
 */	
-TInt DRamAllocator::AllocContiguousRam(TUint aNumPages, TPhysAddr& aPhysAddr, TZonePageType aType, TInt aAlign, TUint aBlockedZoneId, TBool aBlockRest)
+TInt DRamAllocator::AllocContiguousRam(TUint aNumPages, TPhysAddr& aPhysAddr, TInt aAlign)
 	{
 	__KTRACE_OPT(KMMU,Kern::Printf("AllocContiguousRam size %08x align %d",aNumPages,aAlign));
 
 	M::RamAllocIsLocked();
 
-	// No support for non-fixed pages as this will discard and move 
-	// pages if required.
-	__NK_ASSERT_DEBUG(aType == EPageFixed);
+	if ((TUint)aNumPages > iTotalFreeRamPages + M::NumberOfFreeDpPages())
+		{// Not enough free space and not enough freeable pages.
+		return KErrNoMemory;
+		}
+	if (aNumPages > iTotalFreeRamPages)
+		{// Need to discard some pages so there is free space for the pages in 
+		// the contiguous run to be moved to.
+		TUint requiredPages = aNumPages - iTotalFreeRamPages;
+		if (!M::GetFreePages(requiredPages))
+			return KErrNoMemory;
+		}
+
 	TInt alignWrtPage = Max(aAlign - KPageShift, 0);
 	TUint32 alignmask = (1u << alignWrtPage) - 1;
 
@@ -1716,7 +1973,130 @@
 	TInt offset = 0;
 	iZoneTmpAddrIndex = -1;
 	iZoneTmpPrefLink = iZonePrefList.First();
-	while (NextAllocZone(zone, searchState, aType, aBlockedZoneId, aBlockRest))
+	while (NextAllocZone(zone, searchState, EPageFixed, KRamZoneInvalidId, EFalse))
+		{
+		// Be sure to start from scratch if zone not contiguous with previous zone
+		if (prevZone && (zone->iPhysBase == 0 || (zone->iPhysBase - 1) != prevZone->iPhysEnd))
+			{
+			carryAll = 0;
+			carryImmov = 0;
+			}
+		prevZone = zone;
+		TBitMapAllocator& bmaAll = *(zone->iBma[KBmaAllPages]);
+		base = TInt(zone->iPhysBase >> KPageShift);
+		TInt runLength;
+		__KTRACE_OPT(KMMU,Kern::Printf("AllocAligned: base=%08x carryAll=%08x offset=%08x", base, carryAll, offset));
+		offset = bmaAll.AllocAligned(aNumPages, alignWrtPage, base, EFalse, carryAll, runLength);
+		__KTRACE_OPT(KMMU,Kern::Printf("AllocAligned: offset=%08x", offset));
+
+		if (offset >= 0)
+			{
+			// Have found enough contiguous pages so return address of physical page
+			// at the start of the region
+			aPhysAddr = TPhysAddr((base + offset - carryAll + alignmask) & ~alignmask) << KPageShift;
+			MarkPagesAllocated(aPhysAddr, aNumPages, EPageFixed);
+
+			__KTRACE_OPT(KMMU,Kern::Printf("AllocContiguousRam returns %08x",aPhysAddr));
+#ifdef BTRACE_RAM_ALLOCATOR
+			BTrace12(BTrace::ERamAllocator, BTrace::ERamAllocContiguousRam, EPageFixed, aNumPages, aPhysAddr);
+#endif
+			return KErrNone;
+			}
+		// No run found when looking in just the free pages so see if this
+		// RAM zone could be used if pages where moved or discarded.
+		TBitMapAllocator& bmaImmov = *(zone->iBma[EPageFixed]);
+		offset = 0;	// Clear so searches whole of fixed BMA on the first pass.
+		do
+			{
+			__KTRACE_OPT(KMMU,Kern::Printf("AllocAligned: base=%08x carryImmov=%08x offset=%08x", base, carryImmov, offset));
+			offset = bmaImmov.AllocAligned(aNumPages, alignWrtPage, base, EFalse, carryImmov, runLength, offset);
+			__KTRACE_OPT(KMMU,Kern::Printf("AllocAligned: offset=%08x", offset));
+			if (offset >= 0)
+				{// Have found a run in immovable page bma so attempt to clear
+				// it for the allocation.
+				TPhysAddr addrBase = TPhysAddr((base + offset - carryImmov + alignmask) & ~alignmask) << KPageShift;
+				__KTRACE_OPT(KMMU2, Kern::Printf(">AllocContig fix run 0x%08x - 0x%08x 0x%x", addrBase, addrBase + (aNumPages << KPageShift), TheCurrentThread));
+				
+				// Block the contiguous region from being allocated.
+				iContiguousReserved++;
+				TUint unreservedPages = BlockContiguousRegion(addrBase, aNumPages);
+				TInt clearRet = ClearContiguousRegion(addrBase, zone->iPhysBase, aNumPages, offset, unreservedPages);
+				if (clearRet == KErrNone)
+					{// Cleared all the required pages.
+					// Return address of physical page at the start of the region.
+					iContiguousReserved--;
+					aPhysAddr = addrBase;
+					__KTRACE_OPT(KMMU,Kern::Printf("AllocContiguousRam returns %08x",aPhysAddr));
+#ifdef BTRACE_RAM_ALLOCATOR
+					BTrace12(BTrace::ERamAllocator, BTrace::ERamAllocContiguousRam, EPageFixed, aNumPages, aPhysAddr);
+#endif
+					__KTRACE_OPT(KMMU2, Kern::Printf("<AllocContig suc run 0x%08x - 0x%08x 0x%x", addrBase, addrBase + (aNumPages << KPageShift), TheCurrentThread));
+					return KErrNone;
+					}
+				else
+					{
+					// Unblock the contiguous region.
+					UnblockContiguousRegion(addrBase, aNumPages);
+					iContiguousReserved--;
+					__KTRACE_OPT(KMMU2, Kern::Printf("ContigMov fail offset 0x%x carryImmov %x", 
+														offset, carryImmov));
+					// Can't rely on RAM zone preference ordering being
+					// the same so clear carrys and restart search from
+					// within the current RAM zone or skip onto the next 
+					// one if at the end of this one.
+					carryImmov = 0;
+					carryAll = 0;
+					__KTRACE_OPT(KMMU2, Kern::Printf("<AllocContigfail run 0x%08x - 0x%08x 0x%x", addrBase, addrBase + (aNumPages << KPageShift), TheCurrentThread));
+					if (clearRet == KErrNoMemory)
+						{// There are no longer enough free or discardable pages to 
+						// be able to fulfill this allocation.
+						return KErrNoMemory;
+						}
+					}
+				}
+			}
+		// Keep searching immovable page bma of the current RAM zone until 
+		// gone past end of RAM zone or no run can be found.
+		while (offset >= 0 && (TUint)offset < zone->iPhysPages);
+		}
+	return KErrNoMemory;
+	}
+
+#else
+
+/**
+Search through the zones for the requested contiguous RAM, first in preference 
+order then, if that fails, in address order.
+
+No support for non-fixed pages as this will discard and move pages if required.
+
+@param aNumPages The number of contiguous pages to find
+@param aPhysAddr Will contain the base address of any contiguous run if found
+@param aAlign Alignment specified as the alignment shift
+
+@return KErrNone on success, KErrNoMemory otherwise
+*/	
+TInt DRamAllocator::AllocContiguousRam(TUint aNumPages, TPhysAddr& aPhysAddr, TInt aAlign)
+	{
+	__KTRACE_OPT(KMMU,Kern::Printf("AllocContiguousRam size %08x align %d",aNumPages,aAlign));
+
+	M::RamAllocIsLocked();
+
+	TInt alignWrtPage = Max(aAlign - KPageShift, 0);
+	TUint32 alignmask = (1u << alignWrtPage) - 1;
+
+	// Attempt to find enough pages searching in preference order first then
+	// in address order
+	TZoneSearchState searchState = EZoneSearchPref;
+	SZone* zone;
+	SZone* prevZone = NULL;
+	TInt carryAll = 0;		// Carry for all pages bma, clear to start new run.
+	TInt carryImmov = 0;	// Carry for immovable pages bma, clear to start new run.
+	TInt base = 0;
+	TInt offset = 0;
+	iZoneTmpAddrIndex = -1;
+	iZoneTmpPrefLink = iZonePrefList.First();
+	while (NextAllocZone(zone, searchState, EPageFixed, KRamZoneInvalidId, EFalse))
 		{
 		// Be sure to start from scratch if zone not contiguous with previous zone
 		if (prevZone && (zone->iPhysBase == 0 || (zone->iPhysBase - 1) != prevZone->iPhysEnd))
@@ -1736,11 +2116,11 @@
 			{// Have found enough contiguous pages so return address of physical page
 			 // at the start of the region
 			aPhysAddr = TPhysAddr((base + offset - carryAll + alignmask) & ~alignmask) << KPageShift;
-			MarkPagesAllocated(aPhysAddr, aNumPages, aType);
+			MarkPagesAllocated(aPhysAddr, aNumPages, EPageFixed);
 
 			__KTRACE_OPT(KMMU,Kern::Printf("AllocContiguousRam returns %08x",aPhysAddr));
 #ifdef BTRACE_RAM_ALLOCATOR
-			BTrace12(BTrace::ERamAllocator, BTrace::ERamAllocContiguousRam, aType, aNumPages, aPhysAddr);
+			BTrace12(BTrace::ERamAllocator, BTrace::ERamAllocContiguousRam, EPageFixed, aNumPages, aPhysAddr);
 #endif
 			return KErrNone;
 			}
@@ -1788,14 +2168,13 @@
 							contigZone = GetZoneAndOffset(addr, contigOffset);
 							__NK_ASSERT_DEBUG(contigZone != NULL);
 							}
-#ifdef _DEBUG			// This page shouldn't be allocated as fixed, only movable or discardable.
+						// This page shouldn't be allocated as fixed, only movable or discardable.
 						__NK_ASSERT_DEBUG(contigZone != NULL);
 						__NK_ASSERT_DEBUG(contigZone->iBma[EPageFixed]->NotAllocated(contigOffset, 1));
-						SPageInfo* pageInfo = SPageInfo::SafeFromPhysAddr(addr);
-						__NK_ASSERT_DEBUG(pageInfo != NULL);
-#endif
+						__NK_ASSERT_DEBUG(SPageInfo::SafeFromPhysAddr(addr) != NULL);
+
 						TPhysAddr newAddr;
-						TInt moveRet = M::MovePage(addr, newAddr, contigZone->iId, EFalse);
+						TInt moveRet = M::MovePage(addr, newAddr, contigZone->iId, 0);
 						if (moveRet != KErrNone && moveRet != KErrNotFound)
 							{// This page couldn't be moved or discarded so 
 							// restart the search the page after this one.
@@ -1827,11 +2206,11 @@
 						{// Cleared all the required pages so allocate them.
 						// Return address of physical page at the start of the region.
 						aPhysAddr = addrBase;
-						MarkPagesAllocated(aPhysAddr, aNumPages, aType);
+						MarkPagesAllocated(aPhysAddr, aNumPages, EPageFixed);
 
 						__KTRACE_OPT(KMMU,Kern::Printf("AllocContiguousRam returns %08x",aPhysAddr));
 #ifdef BTRACE_RAM_ALLOCATOR
-						BTrace12(BTrace::ERamAllocator, BTrace::ERamAllocContiguousRam, aType, aNumPages, aPhysAddr);
+						BTrace12(BTrace::ERamAllocator, BTrace::ERamAllocContiguousRam, EPageFixed, aNumPages, aPhysAddr);
 #endif
 						return KErrNone;
 						}
@@ -1844,6 +2223,7 @@
 		}
 	return KErrNoMemory;
 	}
+#endif // !defined(__MEMODEL_MULTIPLE__) || !defined(__MEMODEL_MOVING__)
 
 
 /**
@@ -1858,19 +2238,17 @@
 @param aZoneIdCount	The number of the IDs listed by aZoneIdList.
 @param aSize 		The number of contiguous bytes to find
 @param aPhysAddr 	Will contain the base address of the contiguous run if found
-@param aType 		The page type of the memory to be allocated
 @param aAlign 		Alignment specified as the alignment shift
 
 @return KErrNone on success, KErrNoMemory if allocation couldn't succeed or 
 the RAM zone has the KRamZoneFlagNoAlloc flag set.  KErrArgument if a zone of
 aZoneIdList exists or if aSize is larger than the size of the zone.
 */	
-TInt DRamAllocator::ZoneAllocContiguousRam(TUint* aZoneIdList, TUint aZoneIdCount, TInt aSize, TPhysAddr& aPhysAddr, TZonePageType aType, TInt aAlign)
+TInt DRamAllocator::ZoneAllocContiguousRam(TUint* aZoneIdList, TUint aZoneIdCount, TInt aSize, TPhysAddr& aPhysAddr, TInt aAlign)
 	{
 	__KTRACE_OPT(KMMU,Kern::Printf("ZoneAllocContiguousRam zones 0x%x size 0x%08x align %d",aZoneIdCount, aSize, aAlign));
 
 	M::RamAllocIsLocked();
-	__NK_ASSERT_DEBUG(aType == EPageFixed);
 
 
 	TUint numPages = (aSize + KPageSize - 1) >> KPageShift;
@@ -1930,11 +2308,11 @@
 	// Have found enough contiguous pages so mark the pages allocated and 
 	// return address of physical page at the start of the region.
 	aPhysAddr = TPhysAddr((base + offset - carry + alignmask) & ~alignmask) << KPageShift;
-	MarkPagesAllocated(aPhysAddr, numPages, aType);
+	MarkPagesAllocated(aPhysAddr, numPages, EPageFixed);
 
 	__KTRACE_OPT(KMMU,Kern::Printf("ZoneAllocContiguousRam returns %08x",aPhysAddr));
 #ifdef BTRACE_RAM_ALLOCATOR
-	BTrace12(BTrace::ERamAllocator, BTrace::ERamAllocZoneContiguousRam, aType, numPages, aPhysAddr);
+	BTrace12(BTrace::ERamAllocator, BTrace::ERamAllocZoneContiguousRam, EPageFixed, numPages, aPhysAddr);
 #endif
 	return KErrNone;
 	}
@@ -2106,34 +2484,34 @@
 	// Makes things simpler for bma selection.
 	__NK_ASSERT_DEBUG(aType != EPageUnknown);
 
-	if (aOffset >= aZone->iPhysPages)
+	TUint zoneEndOffset = aZone->iPhysPages - 1;
+	if (aOffset > zoneEndOffset)
 		{// Starting point is outside the zone
 		return KErrArgument;
 		}
 
-	TUint offset = aOffset;
-	TUint endOffset = aZone->iPhysPages;
-	TUint endOffsetAligned = endOffset & KWordAlignMask;
+	TUint wordIndex = aOffset >> 5;
+	TUint endWordIndex = zoneEndOffset >> 5;
 
 	// Select the BMA to search, 
 	TUint bmaIndex = (aType == EPageTypes)? KBmaAllPages : aType;
-	TUint32* map = &(aZone->iBma[bmaIndex]->iMap[offset >> 5]);
-	TUint32 bits = *map++;
+	TUint32* map = &(aZone->iBma[bmaIndex]->iMap[wordIndex]);
+	TUint32* mapEnd = &(aZone->iBma[bmaIndex]->iMap[endWordIndex]);
+	TUint32 bits = *map;
 
 	// Set bits for pages before 'offset' (i.e. ones we want to ignore)...
-	bits |= ~(KMaxTUint32 >> (offset & ~KWordAlignMask));
+	bits |= ~(KMaxTUint32 >> (aOffset & ~KWordAlignMask));
 
 	// Find the first bit map word from aOffset in aZone with allocated pages
-	while (bits == KMaxTUint32 && offset < endOffsetAligned)
+	while (bits == KMaxTUint32 && map < mapEnd)
 		{
-		bits = *map++;
-		offset = (offset + 32) & KWordAlignMask;
+		bits = *++map;
 		}
 
-	if (offset >= endOffsetAligned && endOffset != endOffsetAligned)
+	if (map == mapEnd)
 		{// Have reached the last bit mask word so set the bits that are
 		//  outside of the zone so that they are ignored.
-		bits |= KMaxTUint32 >> (endOffset - endOffsetAligned);
+		bits |= (KMaxTUint32 >> (zoneEndOffset & ~KWordAlignMask)) >> 1;
 		}
 
 	if (bits == KMaxTUint32)
@@ -2143,25 +2521,103 @@
 
 	// Now we have bits with allocated pages in it so determine the exact 
 	// offset of the next allocated page
-	TUint32 mask = 0x80000000 >> (offset & ~KWordAlignMask);
-	while (bits & mask)
-		{
-		mask >>= 1;
-		offset++;
-		}
-
-	if (offset >= endOffset)
-		{// Reached the end of the zone without finding an allocated page after aOffset
-		return KErrNotFound;
-		}
-
-	// Should definitely have found an allocated page within aZone's pages
-	__NK_ASSERT_DEBUG(mask != 0 && !(bits & mask) && offset < aZone->iPhysPages);
-
-	aOffset = offset;
+	TInt msOne = __e32_find_ms1_32(~bits);
+	__NK_ASSERT_DEBUG(msOne >= 0);	// Must have at least one allocated page in the word.
+	TUint msOneOffset = 31 - msOne;
+	aOffset = ((map - aZone->iBma[bmaIndex]->iMap) << 5) + msOneOffset;
 	return KErrNone;
 	}
 
+
+/**
+Get the next run of pages in this zone that are allocated after aOffset.
+
+@param aZone	The zone to find the next allocated page in.
+@param aOffset	On entry this is the offset from which the next allocated
+				page in the zone should be found, on return it will be the offset 
+				of the next allocated page.
+@param aEndOffset The last offset within this RAM zone to check for allocated runs.
+@return The length of any run found.
+*/
+TInt DRamAllocator::NextAllocatedRun(SZone* aZone, TUint& aOffset, TUint aEndOffset, TZonePageType aType) const
+	{
+	const TUint KWordAlignMask = KMaxTUint32 << 5;
+
+	M::RamAllocIsLocked();
+
+	__NK_ASSERT_DEBUG(aZone - iZones < (TInt)iNumZones);
+	// Makes things simpler for bma selection.
+	__NK_ASSERT_DEBUG(aType != EPageUnknown);
+
+	if (aOffset > aEndOffset)
+		{// UnblockContiguous() has already searched the whole range for this page type.
+		return 0;
+		}
+
+	TUint wordIndex = aOffset >> 5;
+	TUint endWordIndex = aEndOffset >> 5;
+
+	// Select the BMA to search, 
+	TUint bmaIndex = (aType == EPageTypes)? KBmaAllPages : aType;
+	TUint32* map = &(aZone->iBma[bmaIndex]->iMap[wordIndex]);
+	TUint32* mapEnd = &(aZone->iBma[bmaIndex]->iMap[endWordIndex]);
+	TUint32 bits = *map;
+
+	// Set bits for pages before 'offset' (i.e. ones we want to ignore)...
+	bits |= ~(KMaxTUint32 >> (aOffset & ~KWordAlignMask));
+
+	// Find the first bit map word from aOffset in aZone with allocated pages
+	while (bits == KMaxTUint32 && map < mapEnd)
+		{
+		bits = *++map;
+		}
+
+	if (map == mapEnd)
+		{// Have reached the last bit mask word so set the bits that are
+		//  outside of the range so that they are ignored.
+		bits |= (KMaxTUint32 >> (aEndOffset & ~KWordAlignMask)) >> 1;
+		}
+
+	if (bits == KMaxTUint32)
+		{// No allocated pages found in the range.
+		aOffset = aEndOffset + 1;
+		return 0;
+		}
+
+	// Now we have bits with allocated pages in it so determine the exact 
+	// offset of the next allocated page
+	TInt msOne = __e32_find_ms1_32(~bits);
+	__NK_ASSERT_DEBUG(msOne >= 0);	// Must have at least one allocated page in the word.
+	TUint msOneOffset = 31 - msOne;
+	aOffset = ((map - aZone->iBma[bmaIndex]->iMap) << 5) + msOneOffset;
+	TUint32* runWord = map;
+
+	if (map < mapEnd && __e32_bit_count_32(~bits) == msOne + 1)
+		{// The whole of the region in this word is allocated.
+		// Find the next word which isn't completely allocated within the range.
+		do
+			{
+			bits = *++map;
+			}
+		while (!bits && map < mapEnd);
+		}
+
+	// Clear any bits before the run so can get next free from __e32_find_msl_32().
+	if (runWord == map)
+		bits &= KMaxTUint32 >> (aOffset & ~KWordAlignMask);
+	TInt msFree = __e32_find_ms1_32(bits);
+	__NK_ASSERT_DEBUG(msFree >= 0 || map == mapEnd);
+	TUint msFreeOffset = (msFree >= 0)? 31 - msFree : 32;
+	TUint endIndex = map - aZone->iBma[bmaIndex]->iMap;
+	TUint runEnd = (endIndex << 5) + msFreeOffset;
+	if (runEnd > aEndOffset + 1)	// Ensure we don't go past the range.
+		runEnd = aEndOffset + 1;
+	__NK_ASSERT_DEBUG(runEnd > aOffset);
+
+	return runEnd - aOffset;
+	}
+
+
 /**
 See if any of the least preferable RAM zones can be emptied.  If they can then 
 initialise the allocator for a general defragmentation operation.
--- a/kernel/eka/memmodel/epoc/moving/mchunk.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/moving/mchunk.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -467,7 +467,8 @@
 		{
 		// Allocate a block of contiguous RAM from the free pool
 		TInt numPages=(endOffset-offset)>>m.iPageShift;
-		r=m.AllocContiguousRam(numPages<<m.iPageShift, nextPage, GetPageType(), 0);
+		__NK_ASSERT_DEBUG(EPageFixed == GetPageType());
+		r=m.AllocContiguousRam(numPages<<m.iPageShift, nextPage, 0);
 		if (r!=KErrNone)
 			return r;
 		if(clearRam)
--- a/kernel/eka/memmodel/epoc/multiple/arm/xmmu.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/multiple/arm/xmmu.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1617,7 +1617,7 @@
 	if (aNumPages>1)
 		{
 		TInt align=aSeparateGlobal ? KPageDirectoryShift : KPageDirectoryShift-1;
-		r=AllocContiguousRam(aNumPages<<KPageShift, aPhysAddr, EPageFixed, align);
+		r=AllocContiguousRam(aNumPages<<KPageShift, aPhysAddr, align);
 		}
 	else
 		r=AllocRamPages(&aPhysAddr,1, EPageFixed);
--- a/kernel/eka/memmodel/epoc/multiple/mchunk.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/memmodel/epoc/multiple/mchunk.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -417,7 +417,8 @@
 		{
 		// Allocate a block of contiguous RAM from the free pool
 		TInt numPages=(endOffset-offset)>>m.iPageShift;
-		r=m.AllocContiguousRam(numPages<<m.iPageShift, nextPage, GetPageType(), 0);
+		__NK_ASSERT_DEBUG(EPageFixed == GetPageType());
+		r=m.AllocContiguousRam(numPages<<m.iPageShift, nextPage, 0);
 		if (r!=KErrNone)
 			return r;
 		if(clearRam)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/nkern/arm/nklib.cia	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,194 @@
+// Copyright (c) 2010-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32\nkern\arm\nklib.cia
+// 
+//
+
+#include <e32atomics.h>
+#include <nklib.h>
+
+#ifdef __SRATIO_MACHINE_CODED__
+__NAKED__ void SRatio::Set(TUint32 /*aInt*/, TInt /*aDivisorExp*/)
+	{
+#ifdef __CPU_ARM_HAS_CLZ
+	CLZ(		3,1);						// r3=31-MSB(r1), 32 if r1=0
+	asm("add	r2, r2, r3 ");				// r2=shift+aDivisorExp
+	asm("movs	r1, r1, lsl r3 ");			// shift r1 left so bit 31=1
+	asm("rsb	r2, r2, #0 ");				// r2 = -shift-aDivisorExp
+	asm("moveq	r2, #0 ");					// if aInt=0, r2=0
+	asm("bicne	r2, r2, #0xff000000 ");		// else clear iSpare fields
+	asm("bicne	r2, r2, #0x00ff0000 ");		//
+#else
+	asm("rsb	r2, r2, #0 ");				// r2 = -aDivisorExp
+	asm("cmp	r1, #0x00010000 ");			// if aInt top 16 bits clear ...
+	asm("movcc	r1, r1, lsl #16 ");			// ... shift 16 bits left ...
+	asm("subcc	r2, r2, #16 ");				// ... and subtract 16 from iX
+	asm("cmp	r1, #0x01000000 ");
+	asm("movcc	r1, r1, lsl #8 ");
+	asm("subcc	r2, r2, #8 ");
+	asm("cmp	r1, #0x10000000 ");
+	asm("movcc	r1, r1, lsl #4 ");
+	asm("subcc	r2, r2, #4 ");
+	asm("cmp	r1, #0x40000000 ");
+	asm("movcc	r1, r1, lsl #2 ");
+	asm("subcc	r2, r2, #2 ");
+	asm("cmp	r1, #0x80000000 ");
+	asm("subcc	r2, r2, #1 ");
+	asm("cmp	r1, #0 ");
+	asm("moveq	r2, #0 ");					// if aInt=0, r2=0
+	asm("bicne	r2, r2, #0xff000000 ");		// else clear iSpare fields
+	asm("bicne	r2, r2, #0x00ff0000 ");		//
+#endif
+	asm("stmia	r0, {r1,r2} ");				// iM in r1, iX in bottom 16 bits of r2
+	__JUMP(,	lr);
+	}
+
+__NAKED__ TInt SRatio::Reciprocal()
+	{
+	asm("ldr	r1, [r0] ");				// r1 = iM
+	asm("ldrsh	r12, [r0, #4] ");			// r12 = iX
+	asm("rsbs	r2, r1, #0 ");
+	asm("beq	0f ");						// divide by zero
+	asm("add	r12, r12, #63 ");
+	asm("rsb	r12, r12, #0 ");			// r12 = -63 - iX
+	asm("addvs	r12, r12, #1 ");			// if iM==0x80000000 r12 = -62 - iX (ratio = 2^(31+iX) so reciprocal = 2^(-31-iX) = 2^(31 + (-62-iX))
+	asm("bvs	1f ");						// iM=0x80000000
+
+	// 2^(32+iX) > r > 2^(31+iX)
+	// 2^(-32-iX) < 1/r < 2^(-31-iX)
+	// 2^(31+(-63-iX)) < 1/r < 2^(31+(-62-iX))
+	asm("mov	r2, #0 ");					// accumulates result
+	asm("mov	r3, #0x80000000 ");			// 33 bit accumulator in C:R3 initialised to 2^32
+	asm("2:		");
+	asm("adds	r3, r3, r3 ");
+	asm("cmpcc	r3, r1 ");
+	asm("subcs	r3, r3, r1 ");				// if C=1 or r3>=r1, r3-=r1
+	asm("adcs	r2, r2, r2 ");				// next result bit
+	asm("bcc	2b ");						// finished when we have 33 bits (when top bit shifted off)
+	asm("movs	r2, r2, lsr #1 ");			// rounding bit into C
+	asm("orr	r2, r2, #0x80000000 ");		// top bit back
+	asm("adcs	r2, r2, #0 ");				// add rounding bit
+	asm("movcs	r2, #0x80000000 ");			// if carry, increment exponent
+	asm("addcs	r12, r12, #1 ");
+
+	asm("1:		");
+	asm("cmp	r12, #-32768 ");
+	asm("blt	9f ");						// underflow
+	asm("cmp	r12, #32768 ");
+	asm("bge	8f ");						// overflow
+	asm("str	r2, [r0] ");				// iM
+	asm("strh	r12, [r0, #4] ");			// iX
+	asm("mov	r0, #0 ");
+	__JUMP(,	lr);
+
+	asm("0:		");
+	asm("mov	r0, #%a0" : : "i" ((TInt)KErrDivideByZero));
+	__JUMP(,	lr);
+
+	asm("8:		");
+	asm("mov	r0, #%a0" : : "i" ((TInt)KErrOverflow));
+	__JUMP(,	lr);
+
+	asm("9:		");
+	asm("mov	r0, #%a0" : : "i" ((TInt)KErrUnderflow));
+	__JUMP(,	lr);
+	}
+
+__NAKED__ TInt SRatio::Mult(TUint32& /*aInt32*/)
+	{
+	asm("ldr	r3, [r0] ");				// r3 = iM
+	asm("mov	r12, r0 ");
+	asm("ldr	r0, [r1] ");				// r0 = aInt32
+	asm("cmp	r3, #0 ");
+	asm("cmpne	r0, #0 ");
+	asm("beq	0f ");						// result zero
+	asm("umull	r2, r3, r0, r3 ");			// r3:r2 = aInt32 * iM (lowest value 0x0000000080000000)
+	asm("ldrsh	r12, [r12, #4] ");			// r12 = iX
+#ifdef __CPU_ARM_HAS_CLZ
+	CLZ(		0, 3);						// r0 = number of leading zeros in r3:r2 (can't be >32)
+#else
+	asm("str	r12, [sp, #-4]! ");
+	asm("movs	r12, r3 ");
+	asm("mov	r0, #0 ");
+	asm("cmp	r12, #0x00010000 ");
+	asm("movcc	r12, r12, lsl #16 ");
+	asm("addcc	r0, r0, #16 ");
+	asm("cmp	r12, #0x01000000 ");
+	asm("movcc	r12, r12, lsl #8 ");
+	asm("addcc	r0, r0, #8 ");
+	asm("cmp	r12, #0x10000000 ");
+	asm("movcc	r12, r12, lsl #4 ");
+	asm("addcc	r0, r0, #4 ");
+	asm("cmp	r12, #0x40000000 ");
+	asm("movcc	r12, r12, lsl #2 ");
+	asm("addcc	r0, r0, #2 ");
+	asm("cmp	r12, #0 ");
+	asm("ldr	r12, [sp], #4 ");			// r12 = iX
+	asm("addgt	r0, r0, #1 ");
+	asm("moveq	r0, #32 ");					// r0 = number of leading zeros in r3:r2 (can't be >32)
+#endif
+	asm("rsb	r0, r0, #63 ");				// bit number of most significant bit
+	asm("add	r0, r0, r12 ");				// bit number of most significant bit after exponent shift
+	asm("cmp	r0, #32 ");
+	asm("bge	8f ");						// overflow
+	asm("cmp	r0, #-1 ");
+	asm("blt	9f ");						// underflow
+	asm("adds	r12, r12, #32 ");			// shift needed to get result into top 32 bits (>0 left, <0 right)
+	asm("beq	1f ");						// no shift
+	asm("blt	2f ");						// right shift
+	asm("rsb	r0, r12, #32 ");
+	asm("mov	r3, r3, lsl r12 ");
+	asm("orr	r3, r3, r2, lsr r0 ");
+	asm("mov	r2, r2, lsl r12 ");			// r3:r2 <<= r12
+	asm("b		1f ");
+	asm("2:		");
+	asm("rsb	r12, r12, #0 ");
+	asm("rsb	r0, r12, #32 ");
+	asm("mov	r2, r2, lsr r12 ");
+	asm("orr	r2, r2, r3, lsl r0 ");
+	asm("mov	r3, r3, lsr r12 ");			// r3:r2 >>= r12
+	asm("1:		");
+	asm("adds	r2, r2, r2 ");				// rounding
+	asm("adcs	r3, r3, #0 ");
+	asm("bcs	8f ");						// overflow
+	asm("beq	9f ");						// underflow
+	asm("mov	r0, #0 ");
+	asm("str	r3, [r1] ");
+	__JUMP(,	lr);
+
+	asm("0:		");
+	asm("mov	r0, #0 ");
+	asm("str	r0, [r1] ");
+	__JUMP(,	lr);
+
+	asm("8:		");
+	asm("mvn	r0, #0 ");
+	asm("str	r0, [r1] ");
+	asm("mov	r0, #%a0" : : "i" ((TInt)KErrOverflow));
+	__JUMP(,	lr);
+
+	asm("9:		");
+	asm("mov	r0, #0 ");
+	asm("str	r0, [r1] ");
+	asm("mov	r0, #%a0" : : "i" ((TInt)KErrUnderflow));
+	__JUMP(,	lr);
+	}
+
+//TInt SRatio::Mult(TUint64& aInt64)
+//	{
+//	}
+
+#endif
+
+
--- a/kernel/eka/nkern/nkern.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkern/nkern.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -16,12 +16,13 @@
 //
 
 sourcepath				../nkern
-source					nkern.cpp
+source					nkern.cpp nklib.cpp
 #ifdef MARM
 sourcepath				../common/arm
 source					atomics.cia
 sourcepath				../nkern/arm
 source					vectors.cia ncsched.cpp ncsched.cia nctimer.cia ncutilf.cia
+source					nklib.cia
 
 // X86
 #elif defined(X86)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/nkern/nklib.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,135 @@
+// Copyright (c) 2010-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32\nkern\nklib.cpp
+// 
+//
+
+#include <e32atomics.h>
+#include <nklib.h>
+
+#ifndef __SRATIO_MACHINE_CODED__
+void SRatio::Set(TUint32 aInt, TInt aDivisorExp)
+	{
+	iSpare1 = 0;
+	iSpare2 = 0;
+	iM = aInt;
+	if (iM)
+		{
+		TInt ms1 = __e32_find_ms1_32(iM);
+		TInt shift = 31 - ms1;
+		iM <<= shift;
+		iX = (TInt16)(-shift - aDivisorExp);
+		}
+	else
+		iX = 0;
+	}
+
+TInt SRatio::Reciprocal()
+	{
+	if (iM==0)
+		return KErrDivideByZero;
+	// Calculate 2^32/iM
+	TInt exp=0;
+	if (iM == 0x80000000u)
+		{
+		// ratio = 2^(31+iX) so reciprocal = 2^(-31-iX) = 2^(31 + (-62-iX))
+		exp = -62-iX;
+		}
+	else
+		{
+		// 2^32/iM = 1.xxx
+		TUint64 r64 = MAKE_TUINT64(0u-iM,0);
+		TUint32 q32 = (TUint32)(r64/TUint64(iM));	// next 32 bits of result
+		iM = 0x80000000u | (q32>>1);
+		exp = -63-iX;
+		if (q32 & 1)
+			{
+			if (++iM==0)
+				iM=0x80000000u, ++exp;
+			}
+		}
+	if (exp < -32768)
+		{
+		iM = 0;
+		iX = 0;
+		return KErrUnderflow;
+		}
+	if (exp > 32767)
+		{
+		iM = 0xffffffffu;
+		iX = 32767;
+		return KErrOverflow;
+		}
+	iX = (TInt16)exp;
+	return KErrNone;
+	}
+
+TInt SRatio::Mult(TUint32& aInt32)
+	{
+	TUint64 x = aInt32;
+	x *= TUint64(iM);
+	if (x==0)
+		{
+		aInt32 = 0;
+		return KErrNone;
+		}
+	TInt ms1 = __e32_find_ms1_64(x);
+	TInt ms1b = ms1 + iX;
+	if (ms1b>=32)
+		{
+		aInt32 = ~0u;
+		return KErrOverflow;
+		}
+	if (ms1b<-1)
+		{
+		aInt32 = 0;
+		return KErrUnderflow;
+		}
+	TInt shift = ms1b - ms1 + 31;
+	if (shift > 0)
+		x <<= shift;
+	else if (shift < 0)
+		x >>= (-shift);
+	x += MAKE_TUINT64(0,0x40000000u);
+	if (x >> 63)
+		{
+		aInt32 = ~0u;
+		return KErrOverflow;
+		}
+	aInt32 = (TUint32)(x>>31);
+	return aInt32 ? KErrNone : KErrUnderflow;
+	}
+
+//TInt SRatio::Mult(TUint64& aInt64)
+//	{
+//	}
+#endif
+
+void SRatioInv::Set(const SRatio* a)
+	{
+	if (a)
+		{
+		iR = *a;
+		iI = iR;
+		iI.Reciprocal();
+		}
+	else
+		{
+		iR.Set(1);
+		iI.Set(1);
+		}
+	}
+
+
+
--- a/kernel/eka/nkernsmp/arm/nccpu.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/arm/nccpu.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -20,9 +20,6 @@
 #include <arm_scu.h>
 #include <arm_tmr.h>
 
-extern "C" {
-extern SVariantInterfaceBlock* VIB;
-}
 
 struct SAPBootPage : public SFullArmRegSet
 	{
@@ -94,7 +91,7 @@
 
 	KickCpu(&bootPage.iAPBootPtr[a.iCpu], bp_phys);
 
-	TUint32 n = TUint32(VIB->iMaxCpuClock >> 3);
+	TUint32 n = TUint32(TheScheduler.iVIB->iMaxCpuClock >> 3);
 	n = -n;
 	TUint32 b = 0;
 	do	{
--- a/kernel/eka/nkernsmp/arm/ncglob.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/arm/ncglob.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -33,8 +33,6 @@
 //TSubScheduler*	SubSchedulerLookupTable[256];
 TUint32 CrashStateOut;
 SFullArmRegSet DefaultRegSet;
-
-SVariantInterfaceBlock* VIB;
 }
 
 #ifdef __USE_BTRACE_LOCK__
--- a/kernel/eka/nkernsmp/arm/ncmonitor.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/arm/ncmonitor.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -43,22 +43,20 @@
 	m.Printf("i_ScuAddr  %08x i_GicDist  %08x i_GicCpuIf %08x i_LocTmrA  %08x\r\n", x.iScuAddr, x.iGicDistAddr, x.iGicCpuIfcAddr, x.iLocalTimerAddr);
 	m.Printf("i_IrqCount %08x i_IrqNest  %08x i_ExcInfo  %08x i_CrashSt  %08x\r\n", x.iIrqCount, x.iIrqNestCount, x.iExcInfo, x.iCrashState);
 	m.Printf("i_AbtStkTp %08x i_UndSktTp %08x i_FiqStkTp %08x i_IrqStkTp %08x\r\n", x.iAbtStackTop, x.iUndStackTop, x.iFiqStackTop, x.iIrqStackTop);
-	m.Printf("CpuFreqM   %08x CpuFreqS   %08x CpuPeriodM %08x CpuPeriodS %08x\r\n", x.iCpuFreqM, x.iCpuFreqS, x.iCpuPeriodM, x.iCpuPeriodS);
-	m.Printf("NTmrFreqM  %08x NTmrFreqS  %08x NTmPeriodM %08x NTmPeriodS %08x\r\n", x.iNTimerFreqM, x.iNTimerFreqS, x.iNTimerPeriodM, x.iNTimerPeriodS);
-	m.Printf("TmrFreqM   %08x TmrFreqS   %08x TmrPeriodM %08x TmrPeriodS %08x\r\n", x.iTimerFreqM, x.iTimerFreqS, x.iTimerPeriodM, x.iTimerPeriodS);
-	m.Printf("iLastSyncT %08x %08x            TicksSince %08x LastTmrSet %08x\r\n", I64HIGH(x.iLastSyncTime), I64LOW(x.iLastSyncTime), x.iTicksSinceLastSync, x.iLastTimerSet);
-	m.Printf("GapEstimat %08x GapCount   %08x TotalTicks %08x Ditherer   %08x\r\n", x.iGapEstimate, x.iGapCount, x.iTotalTicks, x.iDitherer);
-	m.Printf("FreqErrEst %08x FreqErrLim %08x ErrorInteg %08x %08x\r\n", x.iFreqErrorEstimate, x.iFreqErrorLimit, I64HIGH(x.iErrorIntegrator), I64LOW(x.iErrorIntegrator));
-	m.Printf("RefAtLastC %08x %08x            M=%02x N=%02x D=%02x\r\n", I64HIGH(x.iRefAtLastCorrection), I64LOW(x.iRefAtLastCorrection), x.iM, x.iN, x.iD);
+	m.Printf("CpuFreqM   %08x CpuFreqS   %08x CpuPeriodM %08x CpuPeriodS %08x\r\n", x.iCpuFreqRI.iR.iM, x.iCpuFreqRI.iR.iX, x.iCpuFreqRI.iI.iM, x.iCpuFreqRI.iI.iX);
+	m.Printf("TmrFreqM   %08x TmrFreqS   %08x TmrPeriodM %08x TmrPeriodS %08x\r\n", x.iTimerFreqRI.iR.iM, x.iTimerFreqRI.iR.iX, x.iTimerFreqRI.iI.iM, x.iTimerFreqRI.iI.iX);
 	}
 
 void DisplaySchedulerExt(Monitor& m, TScheduler& s)
 	{
-	volatile TUint32* sx = (volatile TUint32*)&s.iSX;
-	m.Printf("Extras  0: %08x  1: %08x  2: %08x  3: %08x\r\n",sx[0],sx[1],sx[2],sx[3]);
-	m.Printf("Extras  4: %08x  5: %08x  6: %08x  7: %08x\r\n",sx[4],sx[5],sx[6],sx[7]);
-	m.Printf("Extras  8: %08x  9: %08x  A: %08x  B: %08x\r\n",sx[8],sx[9],sx[10],sx[11]);
-	m.Printf("Extras  C: %08x  D: %08x  E: %08x  F: %08x\r\n",sx[12],sx[13],sx[14],sx[15]);
+	TSchedulerX& sx = s.iSX;
+	m.Printf("iTimerMax  %08x %08x\r\n", I64HIGH(sx.iTimerMax), I64LOW(sx.iTimerMax));
+	m.Printf("iGTmrA     %08x  iScuAddr %08x  iGicDistA %08x  iGicCpuIfcA %08x  iLocTmrA %08x\r\n",
+		sx.iGlobalTimerAddr, sx.iScuAddr, sx.iGicDistAddr, sx.iGicCpuIfcAddr, sx.iLocalTimerAddr);
+	m.Printf("iGTFreqM   %08x iGTFreqS   %08x iGTPeriodM %08x iGTPeriodS %08x\r\n",
+		sx.iGTimerFreqRI.iR.iM, sx.iGTimerFreqRI.iR.iX, sx.iGTimerFreqRI.iI.iM, sx.iGTimerFreqRI.iI.iX);
+	m.Printf("iCount0    %08x %08x   iTimestamp0 %08x %08x\r\n",
+		I64HIGH(sx.iCount0), I64LOW(sx.iCount0), I64HIGH(sx.iTimestamp0), I64LOW(sx.iTimestamp0));
 	}
 
 void DumpRegisters(Monitor& m, SFullArmRegSet& a)
--- a/kernel/eka/nkernsmp/arm/ncsched.cia	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/arm/ncsched.cia	Thu Jul 22 16:46:39 2010 +0100
@@ -949,15 +949,18 @@
 	asm("cmp	r12, #0 ");
 	asm("bne	0f ");					// initial (i.e. idle) thread, so skip
 	asm("ldr	r3, [r2, #%a0]" : : "i" _FOFF(ArmLocalTimer,iTimerCount));
-	asm("ldr	r12, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iSSX.iTimerPeriodM));
-	asm("ldr	r2, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iSSX.iTimerPeriodS));
+	asm("ldr	r12, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iSSX.iTimerFreqRI.iI.iM));
+	asm("ldr	r2, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iSSX.iTimerFreqRI.iI.iX));
 	asm("cmp	r3, #0 ");
 	asm("movmi	r0, #0 ");				// if timer count is negative, save zero
 	asm("bmi	1f ");
-	asm("umull	r0, r3, r12, r3 ");		// scale up to max timer clock (R3:R0)
+	asm("mov	r2, r2, lsl #16 ");
+	asm("mov	r2, r2, asr #16 ");
+	asm("umull	r0, r3, r12, r3 ");		// scale up to max timer clock (R3:R0) - need to shift right by -iX
+	asm("rsb	r2, r2, #0 ");
 	asm("rsb	r12, r2, #32 ");
-	asm("movs	r0, r0, lsr r2 ");		// r0 >>= iSSX.iTimerPeriodS, C = last bit shifted off (rounding)
-	asm("orr	r0, r0, r3, lsl r12 ");	// bottom bits from r12 into top bits of r0
+	asm("movs	r0, r0, lsr r2 ");		// r0 >>= iSSX.iTimerFreqRI.iI.iX, C = last bit shifted off (rounding)
+	asm("orr	r0, r0, r3, lsl r12 ");	// bottom bits from r3 into top bits of r0
 	asm("adcs	r0, r0, #0 ");			// round using last bit shifted off
 	asm("1:		");
 	asm("str	r0, [r1, #%a0]" : : "i" _FOFF(NThreadBase,iTime));
@@ -971,103 +974,7 @@
 #error Use of local timer for NKern::Timestamp() no longer supported
 #else
 
-/*	Update aOld's execution time and set up the timer for aNew
-	Update this CPU's timestamp value
-
-	if (!aOld) aOld=iInitialThread
-	if (!aNew) aNew=iInitialThread
-	newcount = aNew->iTime>0 ? Max(aNew->iTime*iSSX.iTimerFreqM/2^(32+iTimerFreqS), 1) : 2^31-1
-	cli()
-	oldcount = timer count
-	if (oldcount<=0 || aOld!=aNew)
-		{
-		timer count = newcount
-		iSSX.iLastTimerSet = newcount
-		if (aOld!=aNew)
-			{
-			TUint64 now = NKern::Timestamp();
-			elapsed = iLastTimestamp -= now;
-			iLastTimestamp = now;
-			aOld->iTotalCpuTime.i64 += elapsed;
-			if (!aOld->iActiveState)
-				aOld->iTotalActiveTime.i64 += (now - aOld->iLastActivationTime.i64);
-			++iReschedCount.i64;
-			++aNew->iRunCount.i64;
-			}
-		}
-	sti()
- */
-__NAKED__ void TSubScheduler::UpdateThreadTimes(NThreadBase* /*aOld*/, NThreadBase* /*aNew*/)
-	{
-	asm("cmp	r2, #0 ");
-	asm("ldreq	r2, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iInitialThread));
-	asm("ldr	r12, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iSSX.iTimerFreqM));
-	asm("cmp	r1, #0 ");
-	asm("ldreq	r1, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iInitialThread));
-	asm("ldr	r3, [r2, #%a0]" : : "i" _FOFF(NThreadBase,iTime));
-	asm("stmfd	sp!, {r4-r7} ");
-	asm("cmp	r1, r2 ");
-	asm("beq	2f ");
-	asm("ldr	r6, [r2, #%a0]" : : "i" _FOFF(NThreadBase,iRunCount.i32[0]));
-	asm("ldr	r7, [r2, #%a0]" : : "i" _FOFF(NThreadBase,iRunCount.i32[1]));
-	asm("adds	r6, r6, #1 ");
-	asm("str	r6, [r2, #%a0]" : : "i" _FOFF(NThreadBase,iRunCount.i32[0]));
-	asm("ldr	r4, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iReschedCount.i32[0]));
-	asm("ldr	r6, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iReschedCount.i32[1]));
-	asm("adcs	r7, r7, #0 ");
-	asm("str	r7, [r2, #%a0]" : : "i" _FOFF(NThreadBase,iRunCount.i32[1]));
-	asm("adds	r4, r4, #1 ");
-	asm("adcs	r6, r6, #0 ");
-	asm("str	r4, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iReschedCount.i32[0]));
-	asm("str	r6, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iReschedCount.i32[1]));
-	asm("2:		");
-	asm("ldr	r6, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iSSX.iLocalTimerAddr));
-	asm("cmp	r3, #1 ");					// aNew->iTime > 0 ?
-	asm("movlt	r3, #0x7fffffff ");			// if not, use 2^31-1
-	asm("blt	3f ");
-	asm("cmp	r1, r2 ");					// different thread?
-	asm("beq	0f ");						// no - finish
-	asm("ldr	r5, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iSSX.iTimerFreqS));
-	asm("umull	r4, r3, r12, r3 ");			// r3:r4 = aNew->iTime * iTimerFreqM
-	asm("adds	r4, r4, r4 ");				// bit 31 into C
-	asm("teq	r5, #0 ");					// check for iTimerFreqS=0 without changing C
-	asm("movnes	r3, r3, lsr r5 ");			// if not, r3>>=iTimerFreqS, last bit shifted out into C
-	asm("adcs	r3, r3, #0 ");				// round using last bit shifted off
-	asm("3:		");
-	asm("str	r3, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iSSX.iLastTimerSet));
-	asm("str	r3, [r6, #%a0]" : : "i" _FOFF(ArmLocalTimer,iTimerCount));	// set new timeslice value in timer
-
-	asm("ldr	r6, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iLastTimestamp.i32[0]));
-	asm("ldr	r7, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iLastTimestamp.i32[1]));
-	asm("stmfd	sp!, {r0-r2,lr} ");
-	asm("bl	" CSM_ZN5NKern9TimestampEv);		// R1:R0 = current time
-	asm("mov	r4, r0 ");
-	asm("mov	r5, r1 ");					// R5:R4 = current time
-	asm("ldmfd	sp!, {r0-r2,lr} ");
-	asm("str	r4, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iLastTimestamp.i32[0]));
-	asm("ldr	r3, [r1, #%a0]!" : : "i" _FOFF(NThreadBase,iTotalCpuTime.i64));
-	asm("ldr	r12, [r1, #4] ");
-	asm("str	r5, [r0, #%a0]" : : "i" _FOFF(TSubScheduler,iLastTimestamp.i32[1]));
-	asm("stmdb	r1, {r4-r5} ");				// aOld->iLastRunTime
-	asm("ldrb	r2, [r1, #%a0]" : : "i" (_FOFF(NSchedulable,iActiveState)-_FOFF(NThreadBase,iTotalCpuTime.i64)));
-	asm("subs	r6, r4, r6 ");
-	asm("sbcs	r7, r5, r7 ");				// R7:R6 = time since last reschedule
-	asm("adds	r3, r3, r6 ");
-	asm("adcs	r12, r12, r7 ");			// total CPU time of old thread
-	asm("stmia	r1!, {r3,r12} ");			// store, r1=&aOld.iLastActivationTime
-	asm("cmp	r2, #0 ");					// old thread still active?
-	asm("bne	0f ");						// yes - done
-	asm("ldmia	r1!, {r2,r3,r6,r7} ");		// R3:R2 = last activation time, R7:R6=total active time
-	asm("subs	r2, r4, r2 ");
-	asm("sbcs	r3, r5, r3 ");				// R3:R2 = time since last activation
-	asm("adds	r6, r6, r2 ");
-	asm("adcs	r7, r7, r3 ");				// R7:R6 = new total active time
-	asm("stmdb	r1, {r6,r7} ");
-
-	asm("0:		");
-	asm("ldmfd	sp!, {r4-r7} ");
-	__JUMP(,lr);
-	}
+#error UpdateThreadTimes assembler out of date!
 
 #endif
 #endif	// __UTT_MACHINE_CODED__
--- a/kernel/eka/nkernsmp/arm/ncsched.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/arm/ncsched.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -163,26 +163,32 @@
 #if !defined(__UTT_MACHINE_CODED__)
 void TSubScheduler::UpdateThreadTimes(NThreadBase* aOld, NThreadBase* aNew)
 	{
+	/* If necessary update local timer frequency (DVFS) */
+	SRatioInv* pNCF = iSSX.iNewCpuFreqRI;
+	if (pNCF)
+		{
+		iSSX.iCpuFreqRI = *pNCF;
+		__e32_atomic_store_rel_ptr(&iSSX.iNewCpuFreqRI, 0);
+		}
+	SRatioInv* pNTF = iSSX.iNewTimerFreqRI;
+	if (pNTF)
+		{
+		iSSX.iTimerFreqRI = *pNTF;
+		__e32_atomic_store_rel_ptr(&iSSX.iNewTimerFreqRI, 0);
+		}
 	if (!aOld)
 		aOld = iInitialThread;
 	if (!aNew)
 		aNew = iInitialThread;
-	if (aNew!=aOld || aNew->iTime<=0)
+	if (aNew!=aOld || aNew->iTime<=0 || pNTF)
 		{
 		TUint32 tmrval = 0x7fffffffu;
 		if (aNew->iTime > 0)
 			{
-			TUint64 x = TUint64(aNew->iTime) * TUint64(iSSX.iTimerFreqM);
-			tmrval = I64HIGH(x);
-			if (iSSX.iTimerFreqS)
-				{
-				tmrval += ((1u<<iSSX.iTimerFreqS)-1);
-				tmrval >>= iSSX.iTimerFreqS;
-				}
-			else if (I64LOW(x) & 0x80000000u)
-				++tmrval;
+			tmrval = aNew->iTime;	// this will have been computed based on the old timer frequency
+			iSSX.iTimerFreqRI.iR.Mult(tmrval);
 			}
-		iSSX.iLastTimerSet = tmrval;
+//		iSSX.iLastTimerSet = tmrval;
 		iSSX.iLocalTimerAddr->iTimerCount = tmrval;
 		}
 	if (aNew!=aOld)
--- a/kernel/eka/nkernsmp/arm/ncthrd.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/arm/ncthrd.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -132,10 +132,32 @@
 		{
 		NKern::EnableAllInterrupts();
 
+#if defined(__CPU_ARM_HAS_GLOBAL_TIMER_BLOCK) && defined(__NKERN_TIMESTAMP_USE_SCU_GLOBAL_TIMER__)
+
+		if (cpu == 0) 
+			{
+			// start global timer if necessary
+			ArmGlobalTimer& GT = GLOBAL_TIMER;
+			if (!(GT.iTimerCtrl & E_ArmGTmrCtrl_TmrEnb))
+				{
+				// timer not currently enabled
+				GT.iTimerCtrl = 0;
+				__e32_io_completion_barrier();
+				GT.iTimerStatus = E_ArmGTmrStatus_Event;
+				__e32_io_completion_barrier();
+				GT.iTimerCountLow = 0;
+				GT.iTimerCountHigh = 0;
+				__e32_io_completion_barrier();
+				GT.iTimerCtrl = E_ArmGTmrCtrl_TmrEnb;	// enable timer with prescale factor of 1
+				__e32_io_completion_barrier();
+				}
+			}
+		
+#endif
+
 		// start local timer
 		ArmLocalTimer& T = LOCAL_TIMER;
 		T.iTimerCtrl = E_ArmTmrCtrl_IntEn | E_ArmTmrCtrl_Reload | E_ArmTmrCtrl_Enable;
-
 		// Initialise timestamp
 		InitTimestamp(ss, aInfo);
 		}
--- a/kernel/eka/nkernsmp/arm/ncutilf.cia	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/arm/ncutilf.cia	Thu Jul 22 16:46:39 2010 +0100
@@ -20,9 +20,6 @@
 #include <arm_gic.h>
 #include <arm_tmr.h>
 
-extern "C" {
-extern SVariantInterfaceBlock* VIB;
-}
 
 __NAKED__ void Arm::GetUserSpAndLr(TAny*) 
 	{
@@ -304,11 +301,10 @@
 	asm("ldr	r3, __TheScheduler ");
 	asm("mrs	r12, cpsr ");				// r12 = saved interrupt mask
 	asm("stmfd	sp!, {r4-r7} ");
-	asm("ldr	r5, [r3, #%a0]" : : "i" _FOFF(TScheduler,iSub[0]));						// r5->subscheduler for CPU0
 	asm("ldr	r4, [r3, #%a0]" : : "i" _FOFF(TScheduler,iSX.iGlobalTimerAddr));		// r4 points to global timer
 	__ASM_CLI();							// disable all interrupts
-	asm("ldr	r6, [r5, #%a0]" : : "i" _FOFF(TSubScheduler,iSSX.iTicksSinceLastSync));	// r6 = count value of last frequency change (low)
-	asm("ldr	r7, [r5, #%a0]" : : "i" _FOFF(TSubScheduler,iSSX.iLastTimerSet));		// r7 = count value of last frequency change (high)
+	asm("ldr	r6, [r3, #%a0]" : : "i" _FOFF(TScheduler,iSX.iCount0));					// r6 = count value of last frequency change (low)
+	asm("ldr	r7, [r3, #%a0]" : : "i" (_FOFF(TScheduler,iSX.iCount0)+4));				// r7 = count value of last frequency change (high)
 	asm("ldr	r2, [r4, #%a0]" : : "i" _FOFF(ArmGlobalTimer,iTimerCountHigh));			// r2 = current timer counter high word
 
 	// To read 64 bit timer value, read high, low, high
@@ -317,21 +313,23 @@
 	asm("mov	r1, r2 ");					// r1 = previous value of timer counter high word
 	asm("ldr	r0, [r4, #%a0]" : : "i" _FOFF(ArmGlobalTimer,iTimerCountLow));			// r0 = current timer counter low word
 	asm("ldr	r2, [r4, #%a0]" : : "i" _FOFF(ArmGlobalTimer,iTimerCountHigh));			// r2 = current timer counter high word
+	asm("mov	r5, r3 ");					// r5 = &TheScheduler
 	asm("cmp	r1, r2 ");					// high word changed?
 	asm("bne	1b ");						// if so, retry
 
 	// Now have R1:R0 = 64 bit global timer count
-	asm("ldr	r3, [r5, #%a0]" : : "i" _FOFF(TSubScheduler,iSSX.iNTimerPeriodM));		// r3 = period multiplier
-	asm("ldr	r4, [r5, #%a0]" : : "i" _FOFF(TSubScheduler,iSSX.iNTimerPeriodS));		// r4 = period multiplier shift
+	asm("ldr	r3, [r5, #%a0]" : : "i" _FOFF(TScheduler,iSX.iGTimerFreqRI.iI.iM));		// r3 = period multiplier
+	asm("ldrsh	r4, [r5, #%a0]" : : "i" _FOFF(TScheduler,iSX.iGTimerFreqRI.iI.iX));		// r4 = period multiplier shift
 	asm("subs	r6, r0, r6 ");				// r7:r6 = ticks from last frequency change
 	asm("sbcs	r7, r1, r7 ");
 	asm("umull	r0, r1, r6, r3 ");
 	asm("mov	r2, #0 ");
 	asm("umlal	r1, r2, r7, r3 ");			// r2:r1:r0 = delta * period multiplier
-	asm("rsb	r3, r4, #32 ");
-	asm("ldr	r6, [r5, #%a0]!" : : "i" _FOFF(TSubScheduler,iSSX.iLastSyncTime));		// r6 = timestamp at last freq change (low)
+	asm("ldr	r6, [r5, #%a0]!" : : "i" _FOFF(TScheduler,iSX.iTimestamp0));			// r6 = timestamp at last freq change (low)
 	asm("ldr	r7, [r5, #4] ");														// r7 = timestamp at last freq change (high)
 	asm("msr	cpsr, r12 ");				// restore interrupts
+	asm("rsb	r4, r4, #0 ");
+	asm("rsb	r3, r4, #32 ");
 	asm("movs	r0, r0, lsr r4 ");			// rounding bit into C
 	asm("orr	r0, r0, r1, lsl r3 ");
 	asm("mov	r1, r1, lsr r4 ");
@@ -345,6 +343,58 @@
 	asm(".word	%a0" : : "i" ((TInt)&TheScheduler));
 	}
 
+// Compensate for a change of frequency of the clocking driving the ARM Global Timer
+// Call with interrupts disabled
+__NAKED__ void ArmGlobalTimerFreqChg(const SRatioInv* /*aNewGTimerFreqRI*/)
+	{
+	asm("ldr	r3, __TheScheduler ");
+	asm("stmfd	sp!, {r4-r7} ");
+	asm("ldr	r4, [r3, #%a0]" : : "i" _FOFF(TScheduler,iSX.iGlobalTimerAddr));		// r4 points to global timer
+	asm("ldr	r6, [r3, #%a0]" : : "i" _FOFF(TScheduler,iSX.iCount0));					// r6 = count value of last frequency change (low)
+	asm("ldr	r7, [r3, #%a0]" : : "i" (_FOFF(TScheduler,iSX.iCount0)+4));				// r7 = count value of last frequency change (high)
+	asm("ldr	r12, [r4, #%a0]" : : "i" _FOFF(ArmGlobalTimer,iTimerCountHigh));		// r12 = current timer counter high word
+	asm("mov	r5, r3 ");					// r5 = &TheScheduler
+
+	// To read 64 bit timer value, read high, low, high
+	// If two high values match -> OK, else repeat
+	asm("1:		");
+	asm("mov	r3, r12 ");					// r3 = previous value of timer counter high word
+	asm("ldr	r2, [r4, #%a0]" : : "i" _FOFF(ArmGlobalTimer,iTimerCountLow));			// r0 = current timer counter low word
+	asm("ldr	r12, [r4, #%a0]" : : "i" _FOFF(ArmGlobalTimer,iTimerCountHigh));		// r12 = current timer counter high word
+	asm("cmp	r3, r12 ");					// high word changed?
+	asm("bne	1b ");						// if so, retry
+
+	// Now have R3:R2 = 64 bit global timer count
+	asm("str	r2, [r5, #%a0]" : : "i" _FOFF(TScheduler,iSX.iCount0));					// update count value at last frequency change
+	asm("str	r3, [r5, #%a0]" : : "i" (_FOFF(TScheduler,iSX.iCount0)+4));				// to be equal to current count value
+	asm("subs	r6, r2, r6 ");				// r7:r6 = ticks (at old frequency) from last frequency change
+	asm("sbcs	r7, r3, r7 ");
+	asm("ldr	r3, [r5, #%a0]" : : "i" _FOFF(TScheduler,iSX.iGTimerFreqRI.iI.iM));		// r3 = old period multiplier
+	asm("ldrsh	r4, [r5, #%a0]" : : "i" _FOFF(TScheduler,iSX.iGTimerFreqRI.iI.iX));		// r4 = old period multiplier shift
+	asm("ldmia	r0, {r0,r1,r2,r12} ");		// r1:r0=new frequency multiplier, r12:r2=new period multiplier
+	asm("str	r0, [r5, #%a0]" : : "i" _FOFF(TScheduler,iSX.iGTimerFreqRI.iR.iM));		// update frequency multiplier
+	asm("str	r1, [r5, #%a0]" : : "i" _FOFF(TScheduler,iSX.iGTimerFreqRI.iR.iX));		// update frequency multiplier
+	asm("str	r2, [r5, #%a0]" : : "i" _FOFF(TScheduler,iSX.iGTimerFreqRI.iI.iM));		// update period multiplier
+	asm("str	r12, [r5, #%a0]" : : "i" _FOFF(TScheduler,iSX.iGTimerFreqRI.iI.iX));	// update period multiplier
+	asm("umull	r0, r1, r6, r3 ");
+	asm("mov	r2, #0 ");
+	asm("umlal	r1, r2, r7, r3 ");			// r2:r1:r0 = delta * old period multiplier
+	asm("ldr	r6, [r5, #%a0]!" : : "i" _FOFF(TScheduler,iSX.iTimestamp0));			// r6 = timestamp at last freq change (low)
+	asm("ldr	r7, [r5, #4] ");														// r7 = timestamp at last freq change (high)
+	asm("rsb	r4, r4, #0 ");
+	asm("rsb	r3, r4, #32 ");
+	asm("movs	r0, r0, lsr r4 ");			// rounding bit into C
+	asm("orr	r0, r0, r1, lsl r3 ");
+	asm("mov	r1, r1, lsr r4 ");
+	asm("orr	r1, r1, r2, lsl r3 ");		// r1:r0 = (delta * old period multiplier) >> old period multiplier shift
+	asm("adcs	r0, r0, r6 ");				// scaled delta + timestamp at last freq change
+	asm("adcs	r1, r1, r7 ");
+	asm("stmia	r5, {r0,r1} ");				// timestamp at last freq change = now
+	__DATA_MEMORY_BARRIER_Z__(r12);			/* Ensure all updates visible */
+	asm("ldmfd	sp!, {r4-r7} ");
+	__JUMP(,lr);
+	}
+
 #elif defined(__NKERN_TIMESTAMP_USE_INLINE_BSP_CODE__)
 #define __DEFINE_NKERN_TIMESTAMP_ASM__
 #include <variant_timestamp.h>
--- a/kernel/eka/nkernsmp/arm/ncutils.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/arm/ncutils.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,8 +22,6 @@
 #include <nk_irq.h>
 
 extern "C" {
-extern SVariantInterfaceBlock* VIB;
-
 extern TUint KernCoreStats_EnterIdle(TUint aCore);
 extern void KernCoreStats_LeaveIdle(TInt aCookie,TUint aCore);
 
@@ -31,6 +29,7 @@
 extern void send_irq_ipi(TSubScheduler*, TInt);
 }
 
+TInt ClockFrequenciesChanged();
 
 
 /******************************************************************************
@@ -89,66 +88,47 @@
 void NKern::Init0(TAny* a)
 	{
 	__KTRACE_OPT(KBOOT,DEBUGPRINT("VIB=%08x", a));
-	VIB = (SVariantInterfaceBlock*)a;
-	__NK_ASSERT_ALWAYS(VIB && VIB->iVer==0 && VIB->iSize==sizeof(SVariantInterfaceBlock));
-	__KTRACE_OPT(KBOOT,DEBUGPRINT("iVer=%d iSize=%d", VIB->iVer, VIB->iSize));
-	__KTRACE_OPT(KBOOT,DEBUGPRINT("iMaxCpuClock=%08x %08x", I64HIGH(VIB->iMaxCpuClock), I64LOW(VIB->iMaxCpuClock)));
-	__KTRACE_OPT(KBOOT,DEBUGPRINT("iMaxTimerClock=%u", VIB->iMaxTimerClock));
-	__KTRACE_OPT(KBOOT,DEBUGPRINT("iScuAddr=%08x", VIB->iScuAddr));
-	__KTRACE_OPT(KBOOT,DEBUGPRINT("iGicDistAddr=%08x", VIB->iGicDistAddr));
-	__KTRACE_OPT(KBOOT,DEBUGPRINT("iGicCpuIfcAddr=%08x", VIB->iGicCpuIfcAddr));
-	__KTRACE_OPT(KBOOT,DEBUGPRINT("iLocalTimerAddr=%08x", VIB->iLocalTimerAddr));
-	__KTRACE_OPT(KBOOT,DEBUGPRINT("iGlobalTimerAddr=%08x", VIB->iGlobalTimerAddr));
+	SVariantInterfaceBlock* v = (SVariantInterfaceBlock*)a;
+	TheScheduler.iVIB = v;
+	__NK_ASSERT_ALWAYS(v && v->iVer==0 && v->iSize==sizeof(SVariantInterfaceBlock));
+	__KTRACE_OPT(KBOOT,DEBUGPRINT("iVer=%d iSize=%d", v->iVer, v->iSize));
+	__KTRACE_OPT(KBOOT,DEBUGPRINT("iMaxCpuClock=%08x %08x", I64HIGH(v->iMaxCpuClock), I64LOW(v->iMaxCpuClock)));
+	__KTRACE_OPT(KBOOT,DEBUGPRINT("iMaxTimerClock=%u", v->iMaxTimerClock));
+	__KTRACE_OPT(KBOOT,DEBUGPRINT("iScuAddr=%08x", v->iScuAddr));
+	__KTRACE_OPT(KBOOT,DEBUGPRINT("iGicDistAddr=%08x", v->iGicDistAddr));
+	__KTRACE_OPT(KBOOT,DEBUGPRINT("iGicCpuIfcAddr=%08x", v->iGicCpuIfcAddr));
+	__KTRACE_OPT(KBOOT,DEBUGPRINT("iLocalTimerAddr=%08x", v->iLocalTimerAddr));
+	__KTRACE_OPT(KBOOT,DEBUGPRINT("iGlobalTimerAddr=%08x", v->iGlobalTimerAddr));
 
 	TScheduler& s = TheScheduler;
-	s.iSX.iScuAddr = (ArmScu*)VIB->iScuAddr;
-	s.iSX.iGicDistAddr = (GicDistributor*)VIB->iGicDistAddr;
-	s.iSX.iGicCpuIfcAddr = (GicCpuIfc*)VIB->iGicCpuIfcAddr;
-	s.iSX.iLocalTimerAddr = (ArmLocalTimer*)VIB->iLocalTimerAddr;
-	s.iSX.iTimerMax = (VIB->iMaxTimerClock / 1);		// use prescaler value of 1
+	s.iSX.iScuAddr = (ArmScu*)v->iScuAddr;
+	s.iSX.iGicDistAddr = (GicDistributor*)v->iGicDistAddr;
+	s.iSX.iGicCpuIfcAddr = (GicCpuIfc*)v->iGicCpuIfcAddr;
+	s.iSX.iLocalTimerAddr = (ArmLocalTimer*)v->iLocalTimerAddr;
+	s.iSX.iTimerMax = (v->iMaxTimerClock / 1);		// use prescaler value of 1
 #ifdef	__CPU_ARM_HAS_GLOBAL_TIMER_BLOCK
-	s.iSX.iGlobalTimerAddr = (ArmGlobalTimer*)VIB->iGlobalTimerAddr;
+	s.iSX.iGlobalTimerAddr = (ArmGlobalTimer*)v->iGlobalTimerAddr;
+	s.iSX.iGTimerFreqRI.Set(v->iGTimerFreqR);
+	v->iGTimerFreqR = 0;
 #endif
 
 	TInt i;
 	for (i=0; i<KMaxCpus; ++i)
 		{
 		TSubScheduler& ss = TheSubSchedulers[i];
-		ss.iSSX.iCpuFreqM = KMaxTUint32;
-		ss.iSSX.iCpuFreqS = 0;
-		ss.iSSX.iCpuPeriodM = 0x80000000u;
-		ss.iSSX.iCpuPeriodS = 31;
-		ss.iSSX.iNTimerFreqM = KMaxTUint32;
-		ss.iSSX.iNTimerFreqS = 0;
-		ss.iSSX.iNTimerPeriodM = 0x80000000u;
-		ss.iSSX.iNTimerPeriodS = 31;
-		ss.iSSX.iTimerFreqM = KMaxTUint32;
-		ss.iSSX.iTimerFreqS = 0;
-		ss.iSSX.iTimerPeriodM = 0x80000000u;
-		ss.iSSX.iTimerPeriodS = 31;
-		ss.iSSX.iLastSyncTime = 0;
-		ss.iSSX.iTicksSinceLastSync = 0;
-		ss.iSSX.iLastTimerSet = 0;
-		ss.iSSX.iGapEstimate = 10<<16;
-		ss.iSSX.iGapCount = 0;
-		ss.iSSX.iTotalTicks = 0;
-		ss.iSSX.iDitherer = 1;
-		ss.iSSX.iFreqErrorEstimate = 0;
-		ss.iSSX.iFreqErrorLimit = 0x00100000;
-		ss.iSSX.iErrorIntegrator = 0;
-		ss.iSSX.iRefAtLastCorrection = 0;
-		ss.iSSX.iM = 4;
-		ss.iSSX.iN = 18;
-		ss.iSSX.iD = 3;
-		VIB->iTimerMult[i] = 0;
-		VIB->iCpuMult[i] = 0;
-		UPerCpuUncached* u = VIB->iUncached[i];
+		ss.iSSX.iCpuFreqRI.Set(v->iCpuFreqR[i]);
+		ss.iSSX.iTimerFreqRI.Set(v->iTimerFreqR[i]);
+
+		v->iCpuFreqR[i] = 0;
+		v->iTimerFreqR[i] = 0;
+		UPerCpuUncached* u = v->iUncached[i];
 		ss.iUncached = u;
 		u->iU.iDetachCount = 0;
 		u->iU.iAttachCount = 0;
 		u->iU.iPowerOffReq = FALSE;
 		u->iU.iDetachCompleteFn = &DetachComplete;
 		}
+	v->iFrqChgFn = &ClockFrequenciesChanged;
 	__e32_io_completion_barrier();
 	InterruptInit0();
 	}
@@ -374,16 +354,11 @@
 		s.AllCpusIdle();
 	s.iIdleSpinLock.UnlockOnly();
 
-	//TUint cookie = KernCoreStats::EnterIdle((TUint8)ss.iCpuNum);
 	TUint cookie = KernCoreStats_EnterIdle((TUint8)ss.iCpuNum);
 
 	arg |= retire;
 	NKIdle(arg);
 
-	//KernCoreStats::LeaveIdle(cookie, (TUint8)ss.iCpuNum);
-	KernCoreStats_LeaveIdle(cookie, (TUint8)ss.iCpuNum);
-
-
 	// interrupts have not been reenabled
 	s.iIdleSpinLock.LockOnly();
 
@@ -415,6 +390,8 @@
 	if (ci == 0)
 		s.FirstBackFromIdle();
 
+	KernCoreStats_LeaveIdle(cookie, (TUint8)ss.iCpuNum);
+
 	if (retire)
 		{
 		s.iCCReactivateDfc.RawAdd();	// kick load balancer to give us some work
@@ -432,12 +409,12 @@
 
 TBool TScheduler::CoreControlSupported()
 	{
-	return VIB->iCpuPowerUpFn != 0;
+	return TheScheduler.iVIB->iCpuPowerUpFn != 0;
 	}
 
 void TScheduler::CCInitiatePowerUp(TUint32 aCores)
 	{
-	TCpuPowerUpFn pUp = VIB->iCpuPowerUpFn;
+	TCpuPowerUpFn pUp = TheScheduler.iVIB->iCpuPowerUpFn;
 	if (pUp && aCores)
 		{
 		TInt i;
@@ -463,7 +440,7 @@
 
 void TScheduler::CCIndirectPowerDown(TAny*)
 	{
-	TCpuPowerDownFn pDown = VIB->iCpuPowerDownFn;
+	TCpuPowerDownFn pDown = TheScheduler.iVIB->iCpuPowerDownFn;
 	if (pDown)
 		{
 		TInt i;
@@ -555,3 +532,167 @@
 #endif
 	}
 
+/******************************************************************************
+ * Notify frequency changes
+ ******************************************************************************/
+
+struct SFrequencies
+	{
+	void Populate();
+	void Apply();
+	TBool AddToQueue();
+
+	SFrequencies*	iNext;
+	TUint32			iWhich;
+	SRatioInv		iNewCpuRI[KMaxCpus];
+	SRatioInv		iNewTimerRI[KMaxCpus];
+	SRatioInv		iNewGTimerRI;
+	NFastSemaphore*	iSem;
+
+	static SFrequencies* volatile Head;
+	};
+
+SFrequencies* volatile SFrequencies::Head;
+
+TBool SFrequencies::AddToQueue()
+	{
+	SFrequencies* h = Head;
+	do	{
+		iNext = h;
+		} while(!__e32_atomic_cas_rel_ptr(&Head, &h, this));
+	return !h;	// TRUE if list was empty
+	}
+
+
+void SFrequencies::Populate()
+	{
+	TScheduler& s = TheScheduler;
+	TInt cpu;
+	iWhich = 0;
+	SRatio* ri = (SRatio*)__e32_atomic_swp_ord_ptr(&s.iVIB->iGTimerFreqR, 0);
+	if (ri)
+		{
+		iNewGTimerRI.Set(ri);
+		iWhich |= 0x80000000u;
+		}
+	for (cpu=0; cpu<s.iNumCpus; ++cpu)
+		{
+		TSubScheduler& ss = *s.iSub[cpu];
+		ri = (SRatio*)__e32_atomic_swp_ord_ptr(&s.iVIB->iCpuFreqR[cpu], 0);
+		if (ri)
+			{
+			iNewCpuRI[cpu].Set(ri);
+			iWhich |= ss.iCpuMask;
+			}
+		ri = (SRatio*)__e32_atomic_swp_ord_ptr(&s.iVIB->iTimerFreqR[cpu], 0);
+		if (ri)
+			{
+			iNewTimerRI[cpu].Set(ri);
+			iWhich |= (ss.iCpuMask<<8);
+			}
+		}
+	}
+
+#if defined(__NKERN_TIMESTAMP_USE_SCU_GLOBAL_TIMER__)
+extern void ArmGlobalTimerFreqChg(const SRatioInv* /*aNewGTimerFreqRI*/);
+#endif
+
+void SFrequencies::Apply()
+	{
+	if (!iWhich)
+		return;
+	TScheduler& s = TheScheduler;
+	TStopIPI ipi;
+	TUint32 stopped = ipi.StopCPUs();
+	TInt cpu;
+	TUint32 wait = 0;
+	for (cpu=0; cpu<s.iNumCpus; ++cpu)
+		{
+		TSubScheduler& ss = *s.iSub[cpu];
+		TUint32 m = 1u<<cpu;
+		TUint32 m2 = m | (m<<8);
+		if (stopped & m)
+			{
+			// CPU is running so let it update
+			if (iWhich & m2)
+				{
+				if (iWhich & m)
+					ss.iSSX.iNewCpuFreqRI = &iNewCpuRI[cpu];
+				if (iWhich & (m<<8))
+					ss.iSSX.iNewTimerFreqRI = &iNewTimerRI[cpu];
+				ss.iRescheduleNeededFlag = 1;
+				wait |= m;
+				}
+			}
+		else
+			{
+			// CPU is not running so update directly
+			if (iWhich & m)
+				{
+				ss.iSSX.iCpuFreqRI = iNewCpuRI[cpu];
+				}
+			if (iWhich & (m<<8))
+				{
+				ss.iSSX.iTimerFreqRI = iNewTimerRI[cpu];
+				}
+			}
+		}
+#if defined(__NKERN_TIMESTAMP_USE_SCU_GLOBAL_TIMER__)
+	if (iWhich & 0x80000000u)
+		{
+		ArmGlobalTimerFreqChg(&iNewGTimerRI);
+		}
+#endif
+	ipi.ReleaseCPUs();	// this CPU handled here
+	while(wait)
+		{
+		cpu = __e32_find_ls1_32(wait);
+		TSubScheduler& ss = *s.iSub[cpu];
+		if (!ss.iSSX.iNewCpuFreqRI && !ss.iSSX.iNewTimerFreqRI)
+			wait &= ~ss.iCpuMask;
+		__chill();
+		}
+	}
+
+void TScheduler::DoFrequencyChanged(TAny*)
+	{
+	SFrequencies* list = (SFrequencies*)__e32_atomic_swp_ord_ptr(&SFrequencies::Head, 0);
+	if (!list)
+		return;
+	list->Populate();
+	list->Apply();
+	SFrequencies* rev = 0;
+	while (list)
+		{
+		SFrequencies* next = list->iNext;
+		list->iNext = rev;
+		rev = list;
+		list = next;
+		}
+	while (rev)
+		{
+		NFastSemaphore* s = rev->iSem;
+		rev = rev->iNext;
+		NKern::FSSignal(s);
+		}
+	}
+
+TInt ClockFrequenciesChanged()
+	{
+	TScheduler& s = TheScheduler;
+	NFastSemaphore sem(0);
+	SFrequencies f;
+	f.iSem = &sem;
+	NThread* ct = NKern::CurrentThread();
+	NThread* lbt = TScheduler::LBThread();
+	NKern::ThreadEnterCS();
+	TBool first = f.AddToQueue();
+	if (!lbt || lbt == ct)
+		TScheduler::DoFrequencyChanged(&s);
+	else if (first)
+		s.iFreqChgDfc.Enque();
+	NKern::FSWait(&sem);
+	NKern::ThreadLeaveCS();
+	return KErrNone;
+	}
+
--- a/kernel/eka/nkernsmp/nk_bal.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/nk_bal.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -135,6 +135,7 @@
 	s.iCCReactivateDfc.SetDfcQ(rbQ);
 	s.iCCRequestDfc.SetDfcQ(rbQ);
 	s.iCCPowerDownDfc.SetDfcQ(rbQ);
+	s.iFreqChgDfc.SetDfcQ(rbQ);
 	NThreadBase* lbt = rbQ->iThread;
 	lbt->iRebalanceAttr = 1;
 	TUint32 f = NKern::CpuTimeMeasFreq();
--- a/kernel/eka/nkernsmp/nkern.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/nkern.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -2846,28 +2846,62 @@
 
 /**	Stop all other CPUs
 
-	Call with kernel locked
+Call with kernel unlocked, returns with kernel locked.
+Returns mask of CPUs halted plus current CPU.
 */
-void TStopIPI::StopCPUs()
+TUint32 TStopIPI::StopCPUs()
 	{
+	CHECK_PRECONDITIONS(MASK_THREAD_STANDARD,"TStopIPI::StopCPUs()");
+	TScheduler& s = TheScheduler;
 	iFlag = 0;
+	NKern::ThreadEnterCS();
+
+	// Stop any cores powering up or down for now
+	// A core already on the way down will stop just before the transition to SHUTDOWN_FINAL
+	// A core already on the way up will carry on powering up
+	TInt irq = s.iGenIPILock.LockIrqSave();
+	++s.iCCDeferCount;	// stops bits in iIpiAcceptCpus being cleared, but doesn't stop them being set
+						// but iIpiAcceptCpus | s.iCpusComingUp is constant
+	TUint32 act2 = s.iIpiAcceptCpus;		// CPUs still accepting IPIs
+	TUint32 cu = s.iCpusComingUp;			// CPUs powering up
+	s.iGenIPILock.UnlockIrqRestore(irq);
+	TUint32 cores = act2 | cu;
+	if (cu)
+		{
+		// wait for CPUs coming up to start accepting IPIs
+		while (cores & ~s.iIpiAcceptCpus)
+			{
+			__snooze();	// snooze until cores have come up
+			}
+		}
+	NKern::Lock();
 	QueueAllOther(&Isr);	// send IPIs to all other CPUs
 	WaitEntry();			// wait for other CPUs to reach the ISR
+	return cores;
 	}
 
+
+/**	Release the stopped CPUs
+
+Call with kernel locked, returns with kernel unlocked.
+*/
 void TStopIPI::ReleaseCPUs()
 	{
-	iFlag = 1;				// allow other CPUs to proceed
+	__e32_atomic_store_rel32(&iFlag, 1);	// allow other CPUs to proceed
 	WaitCompletion();		// wait for them to finish with this IPI
+	NKern::Unlock();
+	TheScheduler.CCUnDefer();
+	NKern::ThreadLeaveCS();
 	}
 
 void TStopIPI::Isr(TGenericIPI* a)
 	{
 	TStopIPI* s = (TStopIPI*)a;
-	while (!s->iFlag)
+	while (!__e32_atomic_load_acq32(&s->iFlag))
 		{
 		__chill();
 		}
+	__e32_io_completion_barrier();
 	}
 
 
--- a/kernel/eka/nkernsmp/nkern.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/nkern.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -17,6 +17,8 @@
 
 sourcepath				../nkernsmp
 source					nkern.cpp nkerns.cpp sched.cpp dfcs.cpp nk_timer.cpp nk_irq.cpp nk_bal.cpp
+sourcepath				../nkern
+source					nklib.cpp
 
 #ifdef MARM
 sourcepath				../common/arm
@@ -24,6 +26,8 @@
 sourcepath				../nkernsmp/arm
 source					vectors.cia ncsched.cpp ncsched.cia nctimer.cia ncutilf.cia ncirq.cpp ncirq.cia ncthrd.cia
 source					ncutils.cia ncutils.cpp ncthrd.cpp ncglob.cpp nccpu.cpp nccpu.cia
+sourcepath				../nkern/arm
+source					nklib.cia
 
 
 #elif defined(X86)
--- a/kernel/eka/nkernsmp/nkerns.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/nkerns.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -242,8 +242,8 @@
 		iCurrent = iReady;
 		iCpuAffinity = iLastCpu;
 		iEventState = (iLastCpu<<EEventCpuShift) | (iLastCpu<<EThreadCpuShift);
-		i_NThread_Initial = TRUE; // must set as initial before 
-		ss.SSAddEntry(this);      // adding to subsched list
+		i_NThread_Initial = TRUE;	// must set initial thread flag before adding to subscheduler
+		ss.SSAddEntry(this);		// in order to get correct ready thread count (i.e. not including the idle thread)
 		iACount = 1;
 		ss.iInitialThread = (NThread*)this;
 		NKern::Unlock();		// now that current thread is defined
@@ -538,6 +538,7 @@
 
 NThread* TScheduler::LBThread()
 	{
-	return (NThread*)(TheScheduler.iRebalanceDfcQ->iThread);
+	TDfcQue* rbQ = TheScheduler.iRebalanceDfcQ;
+	return rbQ ? (NThread*)(rbQ->iThread) : 0;
 	}
 
--- a/kernel/eka/nkernsmp/sched.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/sched.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -60,7 +60,8 @@
 		iCCRequestLevel(1),		// only boot CPU for now
 		iCCRequestDfc(&CCRequestDfcFn, this, 2),
 		iCCPowerDownDfc(&CCIndirectPowerDown, this, 0),
-		iCCIpiReactIDFC(&CCIpiReactivateFn, this)
+		iCCIpiReactIDFC(&CCIpiReactivateFn, this),
+		iFreqChgDfc(&DoFrequencyChanged, this, 6)
 	{
 	TInt i;
 	for (i=0; i<KMaxCpus; ++i)
@@ -1360,4 +1361,3 @@
 	DoIdle();
 	}
 
-
--- a/kernel/eka/nkernsmp/x86/ncglob.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/x86/ncglob.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -32,8 +32,6 @@
 TSubScheduler TheSubSchedulers[KMaxCpus];
 extern "C" {
 TSubScheduler* SubSchedulerLookupTable[256];
-
-SVariantInterfaceBlock* VIB;
 }
 
 #ifdef __USE_BTRACE_LOCK__
--- a/kernel/eka/nkernsmp/x86/ncmonitor.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/x86/ncmonitor.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -35,9 +35,8 @@
 	m.Printf("Extras[ 4] %08x Extras[ 5] %08x Extras[ 6] %08x Extras[ 7] %08x\r\n", x.iSSXP[4], x.iSSXP[5], x.iSSXP[6], x.iSSXP[7]);
 	m.Printf("Extras[ 8] %08x i_IrqCount %08x i_ExcInfo  %08x i_CrashSt  %08x\r\n", x.iSSXP[8], x.iIrqCount, x.iExcInfo, x.iCrashState);
 	m.Printf("i_APICID   %08x i_IrqNestC %08x i_IrqStkTp %08x i_Tss      %08x\r\n", x.iAPICID, x.iIrqNestCount, x.iIrqStackTop, x.iTss);
-	m.Printf("CpuFreqM   %08x CpuFreqS   %08x CpuPeriodM %08x CpuPeriodS %08x\r\n", x.iCpuFreqM, x.iCpuFreqS, x.iCpuPeriodM, x.iCpuPeriodS);
-	m.Printf("NTmrFreqM  %08x NTmrFreqS  %08x NTmPeriodM %08x NTmPeriodS %08x\r\n", x.iNTimerFreqM, x.iNTimerFreqS, x.iNTimerPeriodM, x.iNTimerPeriodS);
-	m.Printf("TmrFreqM   %08x TmrFreqS   %08x TmrPeriodM %08x TmrPeriodS %08x\r\n", x.iTimerFreqM, x.iTimerFreqS, x.iTimerPeriodM, x.iTimerPeriodS);
+	m.Printf("CpuFreqM   %08x CpuFreqS   %08x CpuPeriodM %08x CpuPeriodS %08x\r\n", x.iCpuFreqRI.iR.iM, x.iCpuFreqRI.iR.iX, x.iCpuFreqRI.iI.iM, x.iCpuFreqRI.iI.iX);
+	m.Printf("TmrFreqM   %08x TmrFreqS   %08x TmrPeriodM %08x TmrPeriodS %08x\r\n", x.iTimerFreqRI.iR.iM, x.iTimerFreqRI.iR.iX, x.iTimerFreqRI.iI.iM, x.iTimerFreqRI.iI.iX);
 	m.Printf("TmstampOff %08x %08x            iSSXP2[0]  %08x iSSXP2[1]  %08x\r\n", I64HIGH(x.iTimestampOffset.i64), I64LOW(x.iTimestampOffset.i64), x.iSSXP2[0], x.iSSXP2[1]);
 	}
 
--- a/kernel/eka/nkernsmp/x86/ncsched.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/x86/ncsched.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -99,11 +99,8 @@
 	{
 	if (aT->iTime>0 && !aT->i_NThread_Initial)
 		{
-		TUint32 remain32 = read_apic_reg(CURRCNT);
-		TUint64 x(remain32);
-		x *= TUint32(iSSX.iTimerPeriodM);
-		x += 1u<<(iSSX.iTimerPeriodS-1);
-		x >>= iSSX.iTimerPeriodS;
+		TUint32 x = read_apic_reg(CURRCNT);
+		iSSX.iTimerFreqRI.iI.Mult(x);
 		aT->iTime = (TInt)x;
 		}
 	write_apic_reg(INITCNT, 0);
@@ -128,13 +125,9 @@
 		aNew = iInitialThread;
 	if (aNew->iTime>0)
 		{
-		TUint32 remain32 = (TUint32)aNew->iTime;
-		TUint64 x(remain32);
-		x *= TUint32(iSSX.iTimerFreqM);
-		x += TUint64(0x80000000u)<<iSSX.iTimerFreqS;
-		x >>= (32+iSSX.iTimerFreqS);
-		write_apic_reg(LVTTMR, TIMESLICE_VECTOR);
-		write_apic_reg(INITCNT, (TUint32)x);
+		TUint32 x = (TUint32)aNew->iTime;
+		iSSX.iTimerFreqRI.iR.Mult(x);
+		write_apic_reg(INITCNT, x);
 		}
 	if (aNew!=aOld)
 		{
--- a/kernel/eka/nkernsmp/x86/ncutilf.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/x86/ncutilf.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -15,11 +15,8 @@
 // 
 //
 
-#include <nkern.h>
+#include <nk_priv.h>
 
-extern "C" {
-extern SVariantInterfaceBlock* VIB;
-}
 
 /******************************************************************************
  * Spin lock
@@ -65,6 +62,6 @@
 */
 EXPORT_C TUint32 NKern::TimestampFrequency()
 	{
-	return VIB->iTimestampFreq;
+	return TheScheduler.iVIB->iTimestampFreq;
 	}
 
--- a/kernel/eka/nkernsmp/x86/ncutils.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/nkernsmp/x86/ncutils.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -17,10 +17,6 @@
 
 #include <x86.h>
 
-extern "C" {
-extern SVariantInterfaceBlock* VIB;
-}
-
 //#define __DBG_MON_FAULT__
 //#define __RAM_LOADED_CODE__
 //#define __EARLY_DEBUG__
@@ -325,33 +321,25 @@
 void NKern::Init0(TAny* a)
 	{
 	__KTRACE_OPT(KBOOT,DEBUGPRINT("VIB=%08x", a));
-	VIB = (SVariantInterfaceBlock*)a;
-	__NK_ASSERT_ALWAYS(VIB && VIB->iVer==0 && VIB->iSize==sizeof(SVariantInterfaceBlock));
-	__KTRACE_OPT(KBOOT,DEBUGPRINT("iVer=%d iSize=%d", VIB->iVer, VIB->iSize));
-	__KTRACE_OPT(KBOOT,DEBUGPRINT("iMaxCpuClock=%08x %08x", I64HIGH(VIB->iMaxCpuClock), I64LOW(VIB->iMaxCpuClock)));
-	__KTRACE_OPT(KBOOT,DEBUGPRINT("iTimestampFreq=%u", VIB->iTimestampFreq));
-	__KTRACE_OPT(KBOOT,DEBUGPRINT("iMaxTimerClock=%u", VIB->iMaxTimerClock));
+	SVariantInterfaceBlock* v = (SVariantInterfaceBlock*)a;
+	TheScheduler.iVIB = v;
+	__NK_ASSERT_ALWAYS(v && v->iVer==0 && v->iSize==sizeof(SVariantInterfaceBlock));
+	__KTRACE_OPT(KBOOT,DEBUGPRINT("iVer=%d iSize=%d", v->iVer, v->iSize));
+	__KTRACE_OPT(KBOOT,DEBUGPRINT("iMaxCpuClock=%08x %08x", I64HIGH(v->iMaxCpuClock), I64LOW(v->iMaxCpuClock)));
+	__KTRACE_OPT(KBOOT,DEBUGPRINT("iTimestampFreq=%u", v->iTimestampFreq));
+	__KTRACE_OPT(KBOOT,DEBUGPRINT("iMaxTimerClock=%u", v->iMaxTimerClock));
 	TInt i;
 	for (i=0; i<KMaxCpus; ++i)
 		{
 		TSubScheduler& ss = TheSubSchedulers[i];
-		ss.iSSX.iCpuFreqM = KMaxTUint32;
-		ss.iSSX.iCpuFreqS = 0;
-		ss.iSSX.iCpuPeriodM = 0x80000000u;
-		ss.iSSX.iCpuPeriodS = 31;
-		ss.iSSX.iNTimerFreqM = KMaxTUint32;
-		ss.iSSX.iNTimerFreqS = 0;
-		ss.iSSX.iNTimerPeriodM = 0x80000000u;
-		ss.iSSX.iNTimerPeriodS = 31;
-		ss.iSSX.iTimerFreqM = KMaxTUint32;
-		ss.iSSX.iTimerFreqS = 0;
-		ss.iSSX.iTimerPeriodM = 0x80000000u;
-		ss.iSSX.iTimerPeriodS = 31;
+		ss.iSSX.iCpuFreqRI.Set(v->iCpuFreqR[i]);
+		ss.iSSX.iTimerFreqRI.Set(v->iTimerFreqR[i]);
+
 		ss.iSSX.iTimestampOffset.i64 = 0;
-		VIB->iTimerMult[i] = 0;
-		VIB->iCpuMult[i] = 0;
+		v->iCpuFreqR[i] = 0;
+		v->iTimerFreqR[i] = 0;
 		}
-	TheScheduler.iSX.iTimerMax = (VIB->iMaxTimerClock / 128);
+	TheScheduler.iSX.iTimerMax = (v->iMaxTimerClock / 128);
 	InitFpu();
 	InterruptInit0();
 	}
@@ -400,3 +388,6 @@
 	{
 	}
 
+void TScheduler::DoFrequencyChanged(TAny*)
+	{
+	}
--- a/kernel/eka/release.txt	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/release.txt	Thu Jul 22 16:46:39 2010 +0100
@@ -1,3 +1,296 @@
+Version 2.00.3098
+=================
+(Made by vfebvre 18/06/2010)
+
+1.	garciato
+	1.	RP520151
+		REQ:417-52765 - SMP: Product Quality SMP Kernel for Bridge
+
+
+Version 2.00.3097
+=================
+(Made by vfebvre 16/06/2010)
+
+1.	jcoppear
+	1.	ou1cimx1#444092 MCL ENV E32TEST T_THRASH test timeout on 92
+
+2.	shubmurt
+	1.	ou1cimx1#423695 MCL:Mobile Crash #25334: CodeAbort exception in CompleteQue method, kernel/sproperty.cpp
+
+
+Version 2.00.3095
+=================
+(Made by vfebvre 14/06/2010)
+
+1.	kingzhan
+	1.	ou1cimx1#425296 MCL Mutex ordering violation in USB driver
+
+2.	jcoppear
+	1.	ou1cimx1#432392 System reset during execution of T_SHBUF_CLIENT
+	2.	ou1cimx1#380623 WDP: Non aligned swap writes increase media wear
+
+3.	martai
+	1.	ou1cimx1#435628 Copy of WDP: Paged data can be corrupted randomly
+	2.	ou1cimx1#424896 E32TEST T_RAMALL occasionally times out
+	3.	ou1cimx1#412959 ENV X86GCC compilation warnings t_ramall.cpp
+	4.	ou1cimx1#384467 Contiguous memory allocations do not use multi-page write support
+
+4.	coliward
+	1.	ou1cimx1#428886 SDK specific: Unable to Install Midlet in the Emulator.
+
+
+Version 2.00.3094
+=================
+(Made by vfebvre 10/06/2010)
+
+1.	jimhofe
+	1.	ou1cimx1#419221 Missing exported kernelhwsrv documentation causes build breaks
+
+2.	lanerobe
+	1.	ou1cimx1#427741 Reset timestamp before running test
+
+
+Version 2.00.3093
+=================
+(Made by vfebvre 09/06/2010)
+
+1.	gcochran
+	1.	ou1cimx1#400079 MCL: E32TEST RMessagePtr2::Kill is not exercised by t_message
+
+2.	jimhofe
+	1.	ou1cimx1#411346 MCL wk22 build break in kernelhwsrv
+
+
+Version 2.00.3092
+=================
+(Made by vfebvre 04/06/2010)
+
+1.	cnotton
+	1.	ou1cimx1#413372 Attempt to export missing file bootstrap_smrif.h
+
+
+Version 2.00.3091
+=================
+(Made by vfebvre 04/06/2010)
+
+1.	mmoate
+	1.	MINOR_CHANGE Correct insource docs for aSingleThread parameter in UserHeap methods
+
+
+Version 2.00.3090
+=================
+(Made by vfebvre 03/06/2010)
+
+1.	jimhofe
+	1.	MINOR_CHANGE Documentation formatting tweaks
+
+
+Version 2.00.3089
+=================
+(Made by vfebvre 01/06/2010)
+
+1.	lanerobe
+	1.	ou1cimx1#397118 Use build-in uint32 sort function
+
+
+Version 2.00.3088
+=================
+(Made by vfebvre 28/05/2010)
+
+1.	necliffo
+	1.	ou1cimx1#407499 modify medmmc to ensure format
+
+2.	lanerobe
+	1.	ou1cimx1#402843 Fix smppower .mmp files
+
+
+Version 2.00.3086
+=================
+(Made by vfebvre 27/05/2010)
+
+1.	atvamos
+	1.	ou1cimx1#376123 h2.arm4.udeb.f32test.page ROFSBUILD failed on dev-cedar build
+
+2.	vfebvre
+	1.	ou1cimx1#400806 Warnings reported by the Symbian Foundation license checker
+
+3.	garciato
+	1.	ou1cimx1#379971 Incorrect Copyright Headers in e32test\timestamp
+
+4.	djkovace
+	1.	ou1cimx1#367370 Bridge platform neither reboots nor runs crash debugger when crashed
+
+5.	martai
+	1.	ou1cimx1#399892 E32TEST T_CHUNK test failure investigation (t_chunk.cpp:885)
+
+6.	elzou
+	1.	ou1cimx1#393943 Phone reset if connect/disconnect USB mouse few times fast
+
+7.	lanerobe
+	1.	ou1cimx1#399642 Build HCR test roms in its own folder
+	2.	ou1cimx1#353110 BM_SUITE does not run on NaviEngine
+
+8.	hengrant
+	1.	ou1cimx1#377057 Trace outputs truncated data for length and position
+
+
+Version 2.00.3085
+=================
+(Made by vfebvre 18/05/2010)
+
+1.	gayarama
+	1.	ou1cimx1#382130 DEV HCR settings to be used by PRM and its clients
+
+2.	mipetzol
+	1.	MINOR_CHANGE Updated comments in dma_v2.h
+
+
+Version 2.00.3084
+=================
+(Made by vfebvre 17/05/2010)
+
+1.	indrasin
+	1.	MINOR_CHANGE: TITANIUM (SIROCCO MIGRATION): submitting build.config.xml for sirocco migration to identify components to be build
+
+2.	shubmurt
+	1.	DEF144569 t_datapaging passes when data paging is not enabled
+		t_datapaging should fail if data paging is not reported in a ROM that is meant to be be data paged
+	2.	ou1cimx1#361046 T_WSD* test set fails to compile / run when built with RVCT4.0 compiler
+
+
+Version 2.00.3083
+=================
+(Made by vfebvre 13/05/2010)
+
+1.	famustaf
+	1.	ou1cimx1#380321 Build on Linux - Incorrect slash in #include in sf_sys.cpp
+
+2.	cnotton
+	1.	ou1cimx1#380725 Public headers in bt are including platform headers
+
+
+Version 2.00.3082
+=================
+(Made by vfebvre 12/05/2010)
+
+1.	mipetzol
+	1.	MINOR_CHANGE Update to DMAv2 Porting Guide
+
+2.	lanerobe
+	1.	ou1cimx1#378811 Change kernel use of %lS to %S
+	2.	ou1cimx1#378808 MCL Stop ExecHandler accessing user descriptors directly
+
+3.	migubarr
+	1.	ou1cimx1#377322 New T_FILECACHE test failures (t_filecache.cpp:356)
+
+4.	hengrant
+	1.	ou1cimx1#370931 Memory card gets locked by itself MCL
+
+
+Version 2.00.3081
+=================
+(Made by vfebvre 11/05/2010)
+
+1.	jimhofe
+	1.	ou1cimx1#367892 Changing MedSD3c PolicyId from 2 to 1461
+
+2.	martai
+	1.	PDEF145025 Support rapu variant specific e32tests 
+
+3.	kmetherm
+	1.	PR457093 RVCT 4 compatible software codebase (SSS)
+
+
+Version 2.00.3080
+=================
+(Made by vfebvre 10/05/2010)
+
+1.	necliffo
+	1.	ou1cimx1#378256 eMMC reliable Write can increase wear of eMMC devices
+
+2.	jessiezh
+	1.	MINOR_CHANGE Re-enable T_SOUND2 test
+	2.	ou1cimx1#367177 E32TEST T_DOMAIN test failure investigation
+
+3.	gcochran
+	1.	ou1cimx1#367939 MCL: Undefined Symbol error with the header "e32math.h"
+
+
+Version 2.00.3079
+=================
+(Made by vfebvre 07/05/2010)
+
+1.	mipetzol
+	1.	MINOR_CHANGE: Updated comment in dma_v1.h
+	2.	MINOR_CHANGE: Updated comment in dma_v2.h
+
+
+Version 2.00.3078
+=================
+(Made by vfebvre 05/05/2010)
+
+1.	cnotton
+	1.	ou1cimx1#345137 idlehelper_lib & Power DLL don't build for ARM4SMP (kernelhwsrv)
+
+2.	jimmzhou
+	1.	ou1cimx1#366912 [kernelmcl][[Internal]t_usbapi test is not ready to run on production phone environment Vasco/hw79
+
+3.	ricoles
+	1.	PDEF144020 SMP known test failures
+
+4.	y153liu
+	1.	ou1cimx1#355904 MCL_Music playback is not correct after resuming the playback from the USB headset AD-83 after long pause
+
+
+Version 2.00.3077
+=================
+(Made by vfebvre 04/05/2010)
+
+1.	martai
+	1.	ou1cimx1#337920 WDP:Potential system impact of flushing the entire page cache is unacceptable
+
+2.	shubmurt
+	1.	PDEF145383 E32TEST T_DATAPAGING occasionally reports KERN-EXEC 17 on SMPDATAPAGE configs
+
+
+Version 2.00.3076
+=================
+(Made by vfebvre 30/04/2010)
+
+1.	stmansfi
+	1.	ou1cimx1#352017 (MCL) Advisory notes related to cat x in TB92SF_1116 and MSF00398
+	2.	ou1cimx1#361803 (MCL) Adjust HAL::GetAll() to ignore DisplayMemoryHandle attribute
+
+2.	vfebvre
+	1.	ou1cimx1#357360 Some test binaries are targeted by several bld.inf files
+	2.	ou1cimx1#363918 Non-test binaries targeted by several bld.inf files
+
+
+Version 2.00.3075
+=================
+(Made by vfebvre 29/04/2010)
+
+1.	seolney
+	1.	REQ417-52838 Upgrade DMA API to support advanced addressing modes
+		PackageReleaseID=485812 FeaturePlanID=428985
+
+
+Version 2.00.3074
+=================
+(Made by vfebvre 28/04/2010)
+
+1.	necliffo
+	1.	ou1cimx1#357516 eMMC with DDR-mode support is not used in 4-bit mode
+
+
+Version 2.00.3073
+=================
+(Made by vfebvre 26/04/2010)
+
+1.	jimmzhou
+	1.	ou1cimx1#352019 [kernelmcl]Can't recieve USB data after Host call SetConfiguraion
+
+
 Version 2.00.3072
 =================
 (Made by vfebvre 22/04/2010)
--- a/kernel/eka/rombuild/base.iby	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/rombuild/base.iby	Thu Jul 22 16:46:39 2010 +0100
@@ -92,7 +92,6 @@
 
 secondary=ABI_DIR\DEBUG_DIR\efile.exe                       \sys\bin\efile.exe  FIXED HEAPMAX(0x40000)
 file=ABI_DIR\DEBUG_DIR\efsrv.dll                            \sys\bin\EFSrv.dll
-device[VARID]=KERNEL_DIR\DEBUG_DIR\d_ftrace.ldd             \sys\bin\d_ftrace.ldd
 
 #ifdef WITH_EXFAT
 file=ABI_DIR\DEBUG_DIR\exfat.fsy                            sys\bin\exfat.fsy
--- a/kernel/eka/rombuild/kernel.hby	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/rombuild/kernel.hby	Thu Jul 22 16:46:39 2010 +0100
@@ -17,10 +17,12 @@
 #define EKernelConfigSMPUnsafeCompat	12
 #define EKernelConfigSMPUnsafeCPU0		13
 #define EKernelConfigSMPCrazyInterrupts	14
+#define EKernelConfigSMPLockKernelThreadsCore0 15
 #define EKernelConfigDisableAPs			30
 
 #define CRAZYSCHEDULING(state)	kernelconfig EKernelConfigCrazyScheduling state
 #define SMPUNSAFECOMPAT(state)	kernelconfig EKernelConfigSMPUnsafeCompat state
 #define SMPUNSAFECPU0(state)	kernelconfig EKernelConfigSMPUnsafeCPU0 state
 #define CRAZYINTERRUPTS(state)	kernelconfig EKernelConfigSMPCrazyInterrupts state
+#define SMPLOCKKERNELTHREADSCPU0(state)	kernelconfig EKernelConfigSMPLockKernelThreadsCore0 state
 #define	SMP_USE_BP_ONLY(state)	kernelconfig EKernelConfigDisableAPs state
--- a/kernel/eka/rombuild/nandtest_test_f32tests.oby	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/rombuild/nandtest_test_f32tests.oby	Thu Jul 22 16:46:39 2010 +0100
@@ -100,7 +100,7 @@
 #else
 rofsname = dir.rofs
 #endif	//MULTIPLEROFS
-rofssize = 0x520000
+rofssize = 0x5E0000
 
 #ifdef PAGED_ROM
 PAGINGOVERRIDE DEFAULTPAGED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/rombuild/not_data_paged.txt	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,1 @@
+#Check if the rom is meant to be datapaged
\ No newline at end of file
--- a/kernel/eka/rombuild/rom_sbs.pl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/rombuild/rom_sbs.pl	Thu Jul 22 16:46:39 2010 +0100
@@ -120,7 +120,7 @@
 	shift(@path);
 	$toroot = ('..\\') x @path;
 	$e32path = $fp0;
-	$e32path =~ s/\\kernelhwsrv\\kernel\\eka\\rombuild\\rom\.pl$//i;
+	$e32path =~ s/\\kernelhwsrv\\kernel\\eka\\rombuild\\.*$//i;
 	$e32path =~ s/^[A-Za-z]://;
 	$rombuildpath = $toroot."sf\\os\\kernelhwsrv\\kernel\\eka\\rombuild";
 	$Epoc32Path = $toroot;
--- a/kernel/eka/rombuild/user.iby	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernel/eka/rombuild/user.iby	Thu Jul 22 16:46:39 2010 +0100
@@ -174,6 +174,10 @@
 #endif
 #endif // PAGED_DATA
 
+#if !defined(PAGED_DATA)
+data=##BASEPATH##kernelhwsrv\kernel\eka\rombuild\not_data_paged.txt  Test\not_data_paged.txt unpaged paging_unmovable
+#endif //#if !defined(PAGED_DATA)
+
 // Test constant patching works by setting KHeapMinCellSize to zero, which is the default anyway
 patchdata ekern.exe @ KHeapMinCellSize 0
 patchdata euser.dll @ KHeapMinCellSize 0
Binary file kernelhwsrv_info/doc_pub/base_how_to_armv7_cache_and_access_remapping_-_design.doc has changed
Binary file kernelhwsrv_info/doc_pub/base_how_to_crash_logging.doc has changed
--- a/kernelhwsrv_info/doc_pub/kernelhwsrv_doc_pub.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernelhwsrv_info/doc_pub/kernelhwsrv_doc_pub.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Kernel and Hardware Services Documentation"
 
 component	kernelhwsrv_doc_pub
--- a/kernelhwsrv_info/kernelhwsrv_metadata/kernelhwsrv_metadata.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kernelhwsrv_info/kernelhwsrv_metadata/kernelhwsrv_metadata.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
-
 component           kernelhwsrv_metadata
 source   \sf\os\kernelhwsrv\kernelhwsrv_info\kernelhwsrv_metadata 
 source   \sf\os\kernelhwsrv\package_definition.xml
--- a/kerneltest/e32test/active/t_messge.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/active/t_messge.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -78,7 +78,8 @@
 class CTestSession : public CSession2
 	{
 public:
-	enum {EStop,ETestInt,ETestPtr,ETestClient,ETestComplete,ETestPtrComplete,ETestCompletePanic,ETestOtherSession,ETestCompleteAfter,ETestMessageConstruction, ETestRMessagePtr2LeavingInterface};
+	enum {EStop,ETestInt,ETestPtr,ETestClient,ETestComplete,ETestPtrComplete,ETestCompletePanic,ETestOtherSession,ETestCompleteAfter,ETestMessageConstruction, 
+		ETestRMessagePtr2LeavingInterface, ETestKillCompletePanic};
 //Override pure virtual
 	IMPORT_C virtual void ServiceL(const RMessage2& aMessage);
 private:
@@ -323,6 +324,10 @@
 		case ETestRMessagePtr2LeavingInterface:
 			r=TestRMessagePtr2LeavingInterface(aMessage);
 			break;
+		case ETestKillCompletePanic:
+			aMessage.Complete(KErrNone);
+			aMessage.Panic(_L("Testing Panic"),0xFF); //This will panic the server!
+			break;
 		default:
 			r=KErrNotSupported;
 
@@ -480,7 +485,7 @@
 
 
 	test.Next(_L("Start ActiveScheduler and signal to client"));
-	test.Printf(_L("        There might be something going on beneath this window"));
+	test.Printf(_L("        There might be something going on beneath this window\n"));
 	sem.Signal();
 	CActiveScheduler::Start();
 	test.Next(_L("Destroy ActiveScheduler"));
@@ -522,6 +527,23 @@
 	session.PublicSendReceive(CTestSession::EStop, TIpcArgs());//panic should occur before this is serviced 
 	return(KErrNone);
 	}
+	
+TInt KillCompletePanicClientThread (TAny*)
+//
+//  A client thread entry - signals to server to kill client after completing the message
+//
+	{
+	sem.Wait();
+	
+	TInt r=session.PublicCreateSession(_L("CTestServer"),1);
+	test(r==KErrNone);
+
+	r=session.PublicSendReceive(CTestSession::ETestKillCompletePanic, TIpcArgs());
+	test(r==KErrNone);
+
+	session.PublicSendReceive(CTestSession::EStop, TIpcArgs());//panic should occur before this is serviced 
+	return(KErrNone);
+	}
 
 void SimpleRMessage()
 //
@@ -575,7 +597,86 @@
 
 	test.End();
 	}
+	
+void TestServerCompleteTwicePanic(void)
+	{
+	TRequestStatus clientStat,serverStat;
+	
+	TBool justInTime=User::JustInTime();
+	
+ 	test.Next(_L("Check server panics if you try to complete a message twice"));
+	test.Start(_L("Create client and server threads"));
+	clientThread.Create(_L("Client Thread1"),CompletePanicClientThread,KDefaultStackSize,KHeapMinSize,KHeapMaxSize,NULL);
+	serverThread.Create(_L("Server Thread"),ServerThread,KDefaultStackSize,KHeapMinSize,KHeapMaxSize,NULL);
+	
+	test.Next(_L("Logon to the threads"));
+	clientThread.Logon(clientStat);
+	serverThread.Logon(serverStat);
 
+	test.Next(_L("Start the threads"));
+	sem.CreateLocal(0);
+	User::SetJustInTime(EFalse); 
+	clientThread.Resume();
+	serverThread.Resume();
+	
+	test.Next(_L("Wait for the threads to stop"));
+	User::WaitForRequest(clientStat); //
+	User::WaitForRequest(serverStat);
+	User::SetJustInTime(justInTime); 
+	test.Next(_L("Check the exit categories"));
+	test(clientThread.ExitType()==EExitKill);
+	test(clientThread.ExitCategory().Compare(_L("Kill"))==0);
+	test(clientThread.ExitReason()==KErrNone);
+		
+	test(serverThread.ExitType()==EExitPanic);
+	test(serverThread.ExitCategory().Compare(_L("USER"))==0);
+	test(serverThread.ExitReason()==ETMesCompletion);
+
+	test.Next(_L("Close the threads"));
+	CLOSE_AND_WAIT(serverThread);
+	CLOSE_AND_WAIT(clientThread);
+	test.End();	  
+	}
+	
+void TestServerKillCompletePanic(void)
+	{
+	TRequestStatus clientStat,serverStat;
+	
+	TBool justInTime=User::JustInTime();
+	
+	test.Next(_L("Check Server panics if you try to panic a client using a completed message"));
+	test.Start(_L("Create client and server threads"));
+	clientThread.Create(_L("Client Thread2"),KillCompletePanicClientThread,KDefaultStackSize,KHeapMinSize,KHeapMaxSize,NULL);
+	serverThread.Create(_L("Server Thread"),ServerThread,KDefaultStackSize,KHeapMinSize,KHeapMaxSize,NULL);
+	
+	test.Next(_L("Logon to the threads"));
+	clientThread.Logon(clientStat);
+	serverThread.Logon(serverStat);
+
+	test.Next(_L("Start the threads"));
+	sem.CreateLocal(0);
+	User::SetJustInTime(EFalse); 
+	clientThread.Resume();
+	serverThread.Resume();
+	
+	test.Next(_L("Wait for the threads to stop"));
+	User::WaitForRequest(clientStat); 
+	User::WaitForRequest(serverStat);
+	User::SetJustInTime(justInTime); 
+	test.Next(_L("Check the exit categories"));
+	test(clientThread.ExitType()==EExitKill);
+	test(clientThread.ExitCategory().Compare(_L("Kill"))==0);
+	test(clientThread.ExitReason()==KErrNone);
+		
+	test(serverThread.ExitType()==EExitPanic);
+	test(serverThread.ExitCategory().Compare(_L("KERN-EXEC"))==0);
+	test(serverThread.ExitReason()==EBadMessageHandle);
+	
+	test.Next(_L("Close the threads"));
+	CLOSE_AND_WAIT(serverThread);
+	CLOSE_AND_WAIT(clientThread);
+	test.End();	 
+	}	
 
 GLDEF_C TInt E32Main()
 	{
@@ -643,41 +744,10 @@
 	CLOSE_AND_WAIT(serverThread);
 	CLOSE_AND_WAIT(clientThread);
 	test.End();
-
-	TBool justInTime=User::JustInTime();
-	
- 	test.Next(_L("Check it Panics if you try to Complete a message twice"));
-	test.Start(_L("Create client and server threads"));
-	clientThread.Create(_L("Client Thread1"),CompletePanicClientThread,KDefaultStackSize,KHeapMinSize,KHeapMaxSize,NULL);
-	serverThread.Create(_L("Server Thread"),ServerThread,KDefaultStackSize,KHeapMinSize,KHeapMaxSize,NULL);
-	
-	test.Next(_L("Logon to the threads"));
-	clientThread.Logon(clientStat);
-	serverThread.Logon(serverStat);
-
-	test.Next(_L("Start the threads"));
-	sem.CreateLocal(0);
-	User::SetJustInTime(EFalse); 
-	clientThread.Resume();
-	serverThread.Resume();
 	
-	test.Next(_L("Wait for the threads to stop"));
-	User::WaitForRequest(clientStat); //
-	User::WaitForRequest(serverStat);
-	User::SetJustInTime(justInTime); 
-	test.Next(_L("Check the exit categories"));
-	test(clientThread.ExitType()==EExitKill);
-	test(clientThread.ExitCategory().Compare(_L("Kill"))==0);
-	test(clientThread.ExitReason()==KErrNone);
-		
-	test(serverThread.ExitType()==EExitPanic);
-	test(serverThread.ExitCategory().Compare(_L("USER"))==0);
-	test(serverThread.ExitReason()==ETMesCompletion);
-
-	test.Next(_L("Close the threads"));
-	CLOSE_AND_WAIT(serverThread);
-	CLOSE_AND_WAIT(clientThread);
-	test.End();	  
+	TestServerCompleteTwicePanic();
+	
+	TestServerKillCompletePanic();
   	
 	test.End();
   
--- a/kerneltest/e32test/benchmark/bm_ldd.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/benchmark/bm_ldd.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -70,7 +70,7 @@
 	TInt StartTimerStampOverhead();
 	TInt RequestTimerStampOverhead();			// iRequestInterrupt() implementation
 
-	TInt SetAbsPrioirty(TInt aThreadHandle, TInt aNewPrio, TInt* aOldPrio);
+	TInt SetAbsPriority(TInt aThreadHandle, TInt aNewPrio, TInt* aOldPrio);
 
 	DMutex*			iLock;	// Shall be acquired by anyone who access the object's writable state.
 
@@ -533,9 +533,9 @@
 //
 
 //
-// The implmentation of RBMDriver::SetAbsPrioirty() call.
+// The implementation of RBMDriver::SetAbsPriority() call.
 //
-TInt DBMLChannel::SetAbsPrioirty(TInt aThreadHandle, TInt aNewPrio, TInt* aOldPrio)
+TInt DBMLChannel::SetAbsPriority(TInt aThreadHandle, TInt aNewPrio, TInt* aOldPrio)
 	{
 	NKern::LockSystem();
 	//
@@ -690,7 +690,7 @@
 			TInt newPrio;
 			TInt oldPrio;
 			umemget(&newPrio, a2, sizeof(newPrio));
-			r = SetAbsPrioirty((TInt) a1, newPrio, &oldPrio);
+			r = SetAbsPriority((TInt) a1, newPrio, &oldPrio);
 			umemput(a2, &oldPrio, sizeof(oldPrio));
 			break;
 			}
--- a/kerneltest/e32test/benchmark/bm_main.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/benchmark/bm_main.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -78,8 +78,6 @@
 #include <e32svr.h>
 #include <u32hal.h>
 
-RTest test(_L("Benchmark Suite"));
-
 //
 // The default value of the time allocated for one benchmark program.  
 //
@@ -300,7 +298,7 @@
 	User::WaitForRequest(iExitStatus);
 	CLOSE_AND_WAIT(iChild);
 	//
-	// Lower the parent thread prioirty and then restore the current one 
+	// Lower the parent thread priority and then restore the current one 
 	// to make sure that the kernel-side thread destruction DFC had a chance to complete.
 	//
 	TInt prio = BMProgram::SetAbsPriority(RThread(), iProg->iOrigAbsPriority);
@@ -362,7 +360,7 @@
 	User::WaitForRequest(iExitStatus);
 	CLOSE_AND_WAIT(iChild);
 	//
-	// Lower the parent thread prioirty and then restore the current one 
+	// Lower the parent thread priority and then restore the current one 
 	// to make sure that the kernel-side thread destruction DFC had a chance to complete.
 	//
 	TInt prio = BMProgram::SetAbsPriority(RThread(), iProg->iOrigAbsPriority);
@@ -418,15 +416,9 @@
 //
 GLDEF_C TInt E32Main()
 	{
+	RTest test(_L("Benchmark Suite"));
 	test.Title();
 
-	TInt r = UserSvr::HalFunction(EHalGroupKernel, EKernelHalNumLogicalCpus, 0, 0);
-	if (r != 1)
-		{
-		test.Printf(_L("%d CPUs detected ... test not run\n"), r);
-		return r;
-		}
-	
 	AddProperty();
 	AddThread();
 	AddIpc();
@@ -434,7 +426,7 @@
 	AddOverhead();
 	AddrtLatency();
 
-	r = User::LoadPhysicalDevice(KBMPddFileName);
+	TInt r = User::LoadPhysicalDevice(KBMPddFileName);
 	BM_ERROR(r, (r == KErrNone) || (r == KErrAlreadyExists));
 
 	r = User::LoadLogicalDevice(KBMLddFileName);
@@ -545,7 +537,7 @@
 		//
 		TBMResult* results = prog->Run(iter, &count);
 
-			// Restore the original prioirty
+			// Restore the original priority
 		BMProgram::SetAbsPriority(RThread(), prog->iOrigAbsPriority);
 
 		//
@@ -617,6 +609,9 @@
 
 void bm_assert_failed(char* aCond, char* aFile, TInt aLine)
 	{
+	RTest test(_L("Benchmark Suite Assert Failed"));
+	test.Title();
+
 	TPtrC8 fd((TUint8*)aFile);
 	TPtrC8 cd((TUint8*)aCond);
 
@@ -634,6 +629,9 @@
 
 void bm_error_detected(TInt aError, char* aCond, char* aFile, TInt aLine)
 	{
+	RTest test(_L("Benchmark Suite Error Detected"));
+	test.Title();
+
 	TPtrC8 fd((TUint8*)aFile);
 	TPtrC8 cd((TUint8*)aCond);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/benchmark/bm_rapu_pdd.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,262 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+/*
+Change History:
+VERSION     : 2     26-01-2010     Ruixing Yang
+REASON      : 
+REFERENCE   : 
+DESCRIPTION : The timer resolution is modified for better interrupt latency calculation
+
+Change History:
+VERSION     : 1     25-01-2010     Ruixing Yang
+REASON      : 
+REFERENCE   : 
+DESCRIPTION : Initial implementation of BM_SUITE PDD for Rapu platform
+
+*/
+
+
+#include <kernel/kernel.h>
+#include <internal/rap_hw.h>
+#include <internal/rap.h>
+#include "k32bm.h"
+
+
+
+
+	
+
+class DBMRapuDevice : public DPhysicalDevice
+	{
+public:
+	DBMRapuDevice();
+	virtual TInt Install();
+	virtual void GetCaps(TDes8& aDes) const;
+	virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
+	virtual TInt Validate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
+	};
+
+class DBMRapuChannel : public DBMPChannel
+	{
+public:
+	DBMRapuChannel();
+	~DBMRapuChannel();
+	virtual TBMTicks TimerPeriod();
+	virtual TBMTicks TimerStamp();
+	virtual TBMNs TimerTicksToNs(TBMTicks);
+	virtual TBMTicks TimerNsToTicks(TBMNs);
+	virtual TInt BindInterrupt(MBMIsr*);
+	virtual TInt BindInterrupt(MBMInterruptLatencyIsr*);
+	virtual void RequestInterrupt();
+	virtual void CancelInterrupt();
+
+private:
+	
+	static const TBMTicks	KBMRapuPeriod = (((TBMTicks) 1) << 32);
+	// Ticks at 1000Hz, input clock to timer @ 32.768 MHz.
+	static const TInt KHighResTimerFrequency = 32768000;   // 32.768 MHz
+	
+	static const TBMNs		KBMRapuNsPerTick = (1000*1000*1000) / KHighResTimerFrequency;	
+	static const TInt KRTC_Freq = 32768;
+	static const TInt KRTC_Ratio = 1172;
+	
+
+		
+	static void Isr(TAny*);
+	
+	MBMIsr*								iIsr;
+	MBMInterruptLatencyIsr*		iInterruptLatencyIsr;	
+	TUint									iTmpStartCount;
+	TUint									iTmpLongCount;	
+	NTimer								iTimer;
+	volatile TUint				iStartCount;
+	volatile TUint				iRunCount;
+	volatile TUint				iCancelCount;
+	};
+	
+	RTC001_STR& RTC001 = *reinterpret_cast<RTC001_STR*>(KRapRegRTC001);
+	GPT003_STR& GPT003 = *reinterpret_cast<GPT003_STR*>(KRapRegGPT003A0);
+	
+	
+DECLARE_STANDARD_PDD()
+//
+// Create a new device
+//
+	{
+	__ASSERT_CRITICAL;
+	return new DBMRapuDevice;
+	}
+	
+DBMRapuDevice::DBMRapuDevice()
+//
+// Constructor
+//
+	{
+	
+	iVersion = TVersion(1,0,1);
+	}
+	
+TInt DBMRapuDevice::Install()
+//
+// Install the device driver.
+//
+	{
+		
+	TInt r = SetName(&KBMPdName);
+	return r;
+	}
+	
+void DBMRapuDevice::GetCaps(TDes8& aDes) const
+//
+// Return the Comm capabilities.
+//
+	{
+	
+	}
+	
+TInt DBMRapuDevice::Create(DBase*& aChannel, TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& /*aVer*/)
+//
+// Create a channel on the device.
+//
+	{
+		
+	__ASSERT_CRITICAL;
+	aChannel = new DBMRapuChannel;
+	return aChannel?KErrNone:KErrNoMemory;
+	}
+
+TInt DBMRapuDevice::Validate(TInt /*aUnit*/, const TDesC8* /*anInfo*/, const TVersion& aVer)
+	{
+		
+	if (!Kern::QueryVersionSupported(iVersion,aVer))
+		{
+		return KErrNotSupported;
+		}
+	return KErrNone;
+	}
+	
+DBMRapuChannel::DBMRapuChannel()
+	: iTimer(&Isr, this)
+	{
+	iTmpStartCount = 0;
+	iTmpLongCount = 0;
+	}
+	
+DBMRapuChannel::~DBMRapuChannel()
+	{
+	//Kern::Printf(("DBMRapuChannel::~DBMRapuChannel()"));	
+	CancelInterrupt();
+	}
+
+TBMTicks DBMRapuChannel::TimerPeriod()
+	{
+		//Kern::Printf(("DBMRapuChannel::TimerPeriod()"));
+	return KBMRapuPeriod;
+	}
+
+TBMTicks DBMRapuChannel::TimerStamp()
+	{
+	//Kern::Printf(("DBMRapuChannel::TimerStamp(), iTimerCount = %u"), RPTimer1::Timer().iTimerCount);	
+	TUint tmpTimeStamp;
+	RTC001.TRIGGER = 0;	
+	tmpTimeStamp = RTC001.LONGCOUNT;
+	tmpTimeStamp *= KRTC_Ratio;
+	tmpTimeStamp += RTC001.SHORTCOUNT;		
+	return tmpTimeStamp;	
+	}	
+
+
+TBMNs DBMRapuChannel::TimerTicksToNs(TBMTicks ticks)
+	{
+	//Kern::Printf(("DBMRapuChannel::TimerTIcksToNs(), iNsPerTick = %u"), (TBMTicks)iNsPerTick);
+	return ticks * KBMRapuNsPerTick;
+	}
+
+TBMTicks DBMRapuChannel::TimerNsToTicks(TBMNs ns)
+	{
+	//Kern::Printf(("DBMRapuChannel::TimerNsToTicks()"));
+	return ns / KBMRapuNsPerTick;	
+	}
+	
+void DBMRapuChannel::Isr(TAny* ptr)
+	{
+	//Kern::Printf(("DBMRapuChannel::Isr()"));
+	// Read RTC001	
+	RTC001.TRIGGER = 0;
+	TUint x = RTC001.LONGCOUNT;
+	x *= KRTC_Ratio;
+	x += RTC001.SHORTCOUNT;
+	TUint wasteTime = 1000000/KBMRapuNsPerTick; //NTimer's resolution is 1 ms = 1000000 ns	
+			
+	DBMRapuChannel* mCh = (DBMRapuChannel*) ptr;
+	BM_ASSERT(mCh->iIsr || mCh->iInterruptLatencyIsr);
+	if (mCh->iIsr)
+		{				
+		mCh->iIsr->Isr( x);	
+		}
+	else
+		{				
+		TUint y = (TUint)( x - mCh->iTmpLongCount - wasteTime);
+		//Kern::Printf(("DBMRapuChannel::Isr(), latency = %u"), y);	
+		mCh->iInterruptLatencyIsr->InterruptLatencyIsr(y);
+		}
+	__e32_atomic_add_ord32(&mCh->iRunCount, 1);
+	}	
+
+TInt DBMRapuChannel::BindInterrupt(MBMIsr* aIsr)
+	{
+	//Kern::Printf(("DBMRapuChannel::BindInterrupt(MBMIsr* aIsr)"));
+	BM_ASSERT(!iIsr);
+	BM_ASSERT(!iInterruptLatencyIsr);
+	iIsr = aIsr;
+	return KErrNone;
+	}
+
+TInt DBMRapuChannel::BindInterrupt(MBMInterruptLatencyIsr* aIsr)
+	{
+	//Kern::Printf(("DBMRapuChannel::BindInterrupt(MBMInterruptLatencyIsr* aIsr)"));
+	BM_ASSERT(!iIsr);
+	BM_ASSERT(!iInterruptLatencyIsr);
+	iInterruptLatencyIsr = aIsr;
+	return KErrNone;
+	}
+
+
+void DBMRapuChannel::RequestInterrupt()
+	{
+	//Kern::Printf(("DBMRapuChannel::RequestInterrupt()"));	
+	BM_ASSERT(iIsr || iInterruptLatencyIsr);		
+	// Read RTC001
+	RTC001.TRIGGER = 0;	
+	iTmpLongCount = RTC001.LONGCOUNT;
+	iTmpLongCount *= KRTC_Ratio;
+	iTmpLongCount += RTC001.SHORTCOUNT;					
+	if (iTimer.OneShot(1)==KErrNone)
+		__e32_atomic_add_ord32(&iStartCount, 1);
+	
+	}
+
+void DBMRapuChannel::CancelInterrupt()
+	{
+	iTmpStartCount = 0;
+	//Kern::Printf(("DBMRapuChannel::CancelInterrupt()"));		
+	if (iTimer.Cancel())
+		__e32_atomic_add_ord32(&iCancelCount, 1);
+	while (iStartCount != iCancelCount + iRunCount)
+		{}
+	}
+	
+	
+		
\ No newline at end of file
--- a/kerneltest/e32test/benchmark/bm_suite.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/benchmark/bm_suite.h	Thu Jul 22 16:46:39 2010 +0100
@@ -226,7 +226,7 @@
 	KBMPriorityHigh = 60, // 60 is above all DFC 26 is below timer DFC
 	/**
 	 * Absolute priority to be used for middle-priority threads.
-	 * This is also the default prioirty - performance benchmarks are started at this prioirty.
+	 * This is also the default priority - performance benchmarks are started at this prioirty.
 	 */	
 	KBMPriorityMid = KBMPriorityHigh - 1,
 	/**
@@ -274,7 +274,7 @@
 	 */
 	TThreadFunction iChildFunc;
 	/**
-	 * The child thread absolute prioirty.
+	 * The child thread absolute priority.
 	 * Intialized by constructor.
 	 */
 	TInt			iChildPrio;
@@ -293,7 +293,7 @@
 	 * Construct a new <code>TBMSpawnArgs</code> object.
 	 *
 	 * @param aChildFunc the child entry point
-	 * @param aChildPrio the child thread absolute prioirty
+	 * @param aChildPrio the child thread absolute priority
 	 * @param aRemote if <code>ETrue</code> the child thread must be created in a separate process; 
 	 *		otherwise, the child thread must be created within the parent's process.
 	 */
@@ -343,7 +343,7 @@
 	 * 
 	 * @param aThread a handle ro the target thread.
 	 * @param aNewPrio a new absolute priority for the target thread
-	 * @return the old absolute prioirty of the target thread 
+	 * @return the old absolute priority of the target thread 
 	 */
 	static TInt SetAbsPriority(RThread aThread, TInt aNewPrio);	
 	
--- a/kerneltest/e32test/benchmark/d32bm.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/benchmark/d32bm.h	Thu Jul 22 16:46:39 2010 +0100
@@ -227,7 +227,7 @@
  * The operations are implmented as <code>KBMLdName</code> logical device by <code>KBMLddFileName</code>
  * logical device driver DLL.
  *
- * The API enables to change the absolute prioirty of a thread. 
+ * The API enables to change the absolute priority of a thread. 
  */
 class RBMDriver : public RBusLogicalChannel
 	{
@@ -243,7 +243,7 @@
 		return DoCreate(KBMLdName, TVersion(1,0,1), KNullUnit, &KBMPdName, NULL);
 		}
 	/**
-	 * Change the absolute prioirty of a thread.
+	 * Change the absolute priority of a thread.
 	 *
 	 * @param aThread a handle to the target thread
 	 * @param aNewPrio a new absolute priority for the target thread
--- a/kerneltest/e32test/benchmark/ipc.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/benchmark/ipc.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -212,11 +212,11 @@
 		BMProgram(
 			aRemote 
 				? ((aPriority == KBMPriorityHigh) 
-					? _L("Client-server Framework[Remote High Prioirty Server]")
-					: _L("Client-server Framework[Remote Low Prioirty Server]"))
+					? _L("Client-server Framework[Remote High Priority Server]")
+					: _L("Client-server Framework[Remote Low Priority Server]"))
 				: ((aPriority == KBMPriorityHigh) 
-					? _L("Client-server Framework[Local High Prioirty Server]")
-					: _L("Client-server Framework[Local Low Prioirty Server]")))
+					? _L("Client-server Framework[Local High Priority Server]")
+					: _L("Client-server Framework[Local Low Priority Server]")))
 		{
 		iPriority = aPriority;
 		iRemote = aRemote;
--- a/kerneltest/e32test/benchmark/property.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/benchmark/property.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -205,25 +205,36 @@
 
 void Property::NotificationLatencyParent(TBMResult* aResult, TBMUInt64 aIter, struct Measurement* aM)
 	{
+	TRequestStatus st1, st2;
+
 	RProperty time;
 	TInt r = time.Define(KPropBenchmarkCategory, 0, RProperty::EByteArray, KPassPolicy, KPassPolicy);
 	BM_ERROR(r, r == KErrNone);	
 	r = time.Attach(KPropBenchmarkCategory, 0);
 	BM_ERROR(r, r == KErrNone);	
+	time.Subscribe(st2);
 
 	RProperty prop;	
 	r = prop.Define(KPropBenchmarkCategory, 1, aM->iType, KPassPolicy, KPassPolicy);
 	BM_ERROR(r, r == KErrNone);	
 	r = prop.Attach(KPropBenchmarkCategory, 1);
 	BM_ERROR(r, r == KErrNone);	
+	prop.Subscribe(st1);
+
+	RSemaphore sync;
+	r = sync.CreateGlobal(_L("sync"), 0);
+	BM_ERROR(r, r == KErrNone);	
 
 	NotificationLatencyArgs sl(aM->iType, aM->iSize, aM->iRemote, aIter, aM->iSetGetType);
 	MBMChild* child = property.SpawnChild(&sl);
+
 	for (TBMUInt64 i = 0; i < aIter; ++i)
 		{
-		TRequestStatus st;
-		prop.Subscribe(st);
-		User::WaitForRequest(st);
+		sync.Signal();
+		User::WaitForRequest(st1);
+		BM_ERROR(st1.Int(), st1.Int() == KErrNone);
+		prop.Subscribe(st1);
+
 		switch(aM->iSetGetType)
 			{
 		case EOneArg:
@@ -258,12 +269,11 @@
 
 		TBMTicks now;
 		::bmTimer.Stamp(&now);
-		BM_ERROR(st.Int(), st.Int() == KErrNone);
 
-		// subscribe for the time just before Set()
-		time.Subscribe(st);
-		User::WaitForRequest(st);
-		BM_ERROR(st.Int(), st.Int() == KErrNone);
+		User::WaitForRequest(st2);
+		BM_ERROR(st2.Int(), st2.Int() == KErrNone);
+		time.Subscribe(st2);
+
 		// get the time just before Set()
 		TBMTicks propSetTime;
 		TPtr8 ptr((TUint8*) &propSetTime, sizeof(propSetTime), sizeof(propSetTime));
@@ -272,9 +282,19 @@
 
 		aResult->Cumulate(TBMTicksDelta(propSetTime, now));
 		}
+
+	prop.Cancel();
+	User::WaitForRequest(st1);
+	BM_ERROR(st1.Int(), st1.Int() == KErrCancel);
+	time.Cancel();
+	User::WaitForRequest(st2);
+	BM_ERROR(st2.Int(), st2.Int() == KErrCancel);
+
 	prop.Close();
 	time.Close();
+	sync.Close();
 	child->WaitChildExit();
+
 	r = prop.Delete(KPropBenchmarkCategory, 1);
 	BM_ERROR(r, r == KErrNone);	
 	r = time.Delete(KPropBenchmarkCategory, 0);
@@ -290,14 +310,25 @@
 		{
 		iOutBuf[j] = (TUint8)(j + 1);
 		}
+
 	RProperty time;
+	TInt r = time.Attach(KPropBenchmarkCategory, 0);
+	BM_ERROR(r, r == KErrNone);	
+
 	RProperty prop;
-	TInt r = prop.Attach(KPropBenchmarkCategory, 1);
+	r = prop.Attach(KPropBenchmarkCategory, 1);
+	BM_ERROR(r, r == KErrNone);
+
+	RSemaphore sync;
+	r = sync.OpenGlobal(_L("sync"));
 	BM_ERROR(r, r == KErrNone);	
+
 	for (TBMUInt64 i = 0; i < sl->iIterationCount; ++i)
 		{
+		sync.Wait();
 		TBMTicks propSetTime;
 		::bmTimer.Stamp(&propSetTime);
+
 		switch(sl->iSetGetType)
 			{
 		case EOneArg:
@@ -336,13 +367,16 @@
 			}
 			break;
 			}
+
 		// publish the time just before Set()
 		TPtr8 ptr((TUint8*) &propSetTime, sizeof(propSetTime), sizeof(propSetTime));
-		r = time.Set(KPropBenchmarkCategory, 0, ptr);
+		r = time.Set(ptr);
 		BM_ERROR(r, r == KErrNone);
 		}
+
 	prop.Close();
 	time.Close();
+	sync.Close();
 
 	BMProgram::SetAbsPriority(RThread(), prio);
 	return KErrNone;
--- a/kerneltest/e32test/benchmark/sync.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/benchmark/sync.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -272,10 +272,15 @@
 
 void Sync::SemaphoreLatencyParent(TBMResult* aResult, TBMUInt64 aIter, TBool aRemote)
 	{
+	RSemaphore slSync;
+	TInt r = slSync.CreateGlobal(_L("slSync"), 0);
+	BM_ERROR(r, r == KErrNone);	
+
 	SemaphoreLatencyArgs sl(aRemote, aIter);
 	MBMChild* child = sync.SpawnChild(&sl);
 	for (TBMUInt64 i = 0; i < aIter; ++i)
 		{
+		slSync.Signal();
 		sl.iSem.Wait();
 		TBMTicks now;
 		::bmTimer.Stamp(&now);
@@ -283,20 +288,27 @@
 		}
 	child->WaitChildExit();
 	sl.Close();
+	slSync.Close();
 	}
 
 TInt Sync::SemaphoreLatencyChild(TAny* ptr)
 	{
+	RSemaphore slSync;
+	TInt r = slSync.OpenGlobal(_L("slSync"));
+	BM_ERROR(r, r == KErrNone);	
+
 	SemaphoreLatencyArgs* sl = (SemaphoreLatencyArgs*) ptr;
 	sl->ChildOpen();
 	for (TBMUInt64 i = 0; i < sl->iIterationCount; ++i)
 		{
+		slSync.Wait();
 		TBMTicks sigTime;
 		::bmTimer.Stamp(&sigTime);		
 		sl->iSem.Signal();
 		sl->ChildSignalTime(sigTime);
 		}
 	sl->ChildClose();
+	slSync.Close();
 	return KErrNone;
 	}
 
@@ -368,11 +380,16 @@
 
 void Sync::ThreadSemaphoreLatencyParent(TBMResult* aResult, TBMUInt64 aIter, TBool aRemote)
 	{
+	RSemaphore tslSync;
+	TInt r = tslSync.CreateGlobal(_L("tslSync"), 0);
+	BM_ERROR(r, r == KErrNone);	
+
 	ThreadSemaphoreLatencyArgs sl(aRemote, aIter);
 	MBMChild* child = sync.SpawnChild(&sl);
 	for (TBMUInt64 i = 0; i < aIter; ++i)
 		{
 		sl.iStatus = KRequestPending;
+		tslSync.Signal();
 		User::WaitForRequest(sl.iStatus);
 		BM_ASSERT(sl.iStatus == KErrNone);
 		TBMTicks now;
@@ -381,14 +398,20 @@
 		}
 	child->WaitChildExit();
 	sl.Close();
+	tslSync.Close();
 	}
 
 TInt Sync::ThreadSemaphoreLatencyChild(TAny* ptr)
 	{
+	RSemaphore tslSync;
+	TInt r = tslSync.OpenGlobal(_L("tslSync"));
+	BM_ERROR(r, r == KErrNone);	
+
 	ThreadSemaphoreLatencyArgs* sl = (ThreadSemaphoreLatencyArgs*) ptr;
 	sl->ChildOpen();
 	for (TBMUInt64 i = 0; i < sl->iIterationCount; ++i)
 		{
+		tslSync.Wait();
 		TRequestStatus* sptr = sl->iStatusPtr;
 		TBMTicks sigTime;
 		::bmTimer.Stamp(&sigTime);		
@@ -396,6 +419,7 @@
 		sl->ChildSignalTime(sigTime);
 		}
 	sl->ChildClose();
+	tslSync.Close();
 	return KErrNone;
 	}
 
--- a/kerneltest/e32test/benchmark/thread.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/benchmark/thread.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -164,8 +164,12 @@
 		TInt r = child.Create(KNullDesC, Thread::KillingChild, 0x2000, NULL, NULL);
 		BM_ERROR(r, r == KErrNone);
 		child.Logon(st);
+		BMProgram::SetAbsPriority(RThread(), KBMPriorityLow);
+		TRequestStatus threadRunning;
+		child.Rendezvous(threadRunning);
+		child.Resume();
+		User::WaitForRequest(threadRunning);	// Wait for the thread to run before killing it.
 		BMProgram::SetAbsPriority(RThread(), KBMPriorityHigh);
-		child.Resume();
 		TBMTicks t1;
 		::bmTimer.Stamp(&t1);
 		child.Kill(KErrCancel);
@@ -181,6 +185,7 @@
 
 TInt Thread::KillingChild(TAny*)
 	{
+	RThread::Rendezvous(KErrNone);
 	User::WaitForAnyRequest();
 	return KErrNone;
 	}
--- a/kerneltest/e32test/buffer/t_char.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/buffer/t_char.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,7 +1,7 @@
 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
+// under the terms of the License "Eclipse Public License v1.0"
 // which accompanies this distribution, and is available
 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 //
@@ -370,9 +370,9 @@
 	}
 
 
-//
+//////////////////////////////////////////////
 // Test Fold, Fold(TChar::EFoldAccents), Collate, LowerCase, UpperCase
-//
+////////////////////////////////////////////
 template<class TCharType>
 GLDEF_C void TestTChar<TCharType>::Test4(TCharTypes CharType)
 	{
--- a/kerneltest/e32test/buffer/t_tbma.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/buffer/t_tbma.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -682,6 +682,62 @@
 	delete pA;
 	}
 
+
+void TestSelectiveAlloc(TInt aSize)
+	{
+	test.Printf(_L("TestSelectiveAlloc %d\n"),aSize);
+	TBitMapAllocator* pA=TBitMapAllocator::New(aSize, ETrue);
+	test(pA!=NULL);
+	test(pA->Avail()==aSize);
+	// Allocate whole free bma
+	test_Equal(aSize, pA->SelectiveAlloc(0, aSize));
+	test_Equal(0,pA->Avail());
+	// Allocate whole full bma
+	test_Equal(0, pA->SelectiveAlloc(0, aSize));
+	test_Equal(0,pA->Avail());
+	TInt i;
+	TInt j;
+	TInt l;
+	for (i=2; i<8; ++i)
+		{
+		for (l=1; l<=aSize; ++l)
+			{
+			new (pA) TBitMapAllocator(aSize, ETrue);
+			for (j=0; j<aSize; j+=i)
+				pA->Alloc(j,1);
+			TInt orig=pA->Avail();
+			test_Equal(aSize-(aSize+i-1)/i, orig);
+			TUint newAllocs = pA->SelectiveAlloc(0,l);
+			TInt allocated = orig - pA->Avail();
+			test_Equal(allocated, newAllocs);
+			test_Equal(l - (l+i-1)/i, allocated);
+			Check(*pA);
+			}
+		}
+	for (i=0; i<=Min(32,aSize-1); ++i)
+		{
+		for (l=1; l<=aSize-i; ++l)
+			{
+			for (j=1; j<=aSize; ++j)
+				{
+				new (pA) TBitMapAllocator(aSize, ETrue);
+				pA->Alloc(i,l);
+				test_Equal(aSize-l, pA->Avail());
+				TUint newAllocs = pA->SelectiveAlloc(0,j);
+				TUint allocated = j - Max(0,Min(i+l,j)-i);
+				test_Equal(allocated, newAllocs);
+				test_Equal(pA->Avail(), aSize-l-allocated);
+				test(!pA->NotAllocated(0,j));
+				if (j>=i && j<i+l)
+					test(!pA->NotAllocated(0,j+1));
+				Check(*pA);
+				}
+			}
+		}
+	delete pA;
+	}
+
+
 TBitMapAllocator* DoSetupBMA(TInt aSize, VA_LIST aList)
 	{
 	TBitMapAllocator* pA=TBitMapAllocator::New(aSize, EFalse);
@@ -1246,6 +1302,11 @@
 	TestSelectiveFree(128);
 	TestSelectiveFree(149);
 
+	TestSelectiveAlloc(3);
+	TestSelectiveAlloc(31);
+	TestSelectiveAlloc(128);
+	TestSelectiveAlloc(149);
+
 	TestAllocConsecutive();
 
 	TestChain();
--- a/kerneltest/e32test/buffer/t_tbma.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/buffer/t_tbma.h	Thu Jul 22 16:46:39 2010 +0100
@@ -39,6 +39,7 @@
 	IMPORT_C void Free(TInt aPos);
 	IMPORT_C void Alloc(TInt aStart, TInt aLength);
 	IMPORT_C void Free(TInt aStart, TInt aLength);
+	IMPORT_C TUint SelectiveAlloc(TInt aStart, TInt aLength);
 	IMPORT_C void SelectiveFree(TInt aStart, TInt aLength);
 	IMPORT_C TBool NotFree(TInt aStart, TInt aLength) const;
 	IMPORT_C TBool NotAllocated(TInt aStart, TInt aLength) const;
--- a/kerneltest/e32test/cppexceptions/second_excp.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/cppexceptions/second_excp.h	Thu Jul 22 16:46:39 2010 +0100
@@ -41,7 +41,11 @@
 
 class MyFourthException : public VB1 , public VB2 {
 public:
+#if defined(__ARMCC__) && __ARMCC_VERSION >= 400000
+  EXPORT_C MyFourthException(int x) { iVal = x; iVal2=x+2;};
+#else
   MyFourthException(int x) { iVal = x; iVal2=x+2;};
+#endif
   int iVal2;
 };
 
--- a/kerneltest/e32test/defrag/t_ramdefrag.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/defrag/t_ramdefrag.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -33,6 +33,7 @@
 #include <e32math.h>
 #include <hal.h>
 #include "testdefs.h"
+#include "..\mmu\mmudetect.h"
 
 
 #include <dptest.h>
@@ -128,6 +129,7 @@
 LOCAL_D TInt* gCandList1;											// Array of zones that have the same preference and the same
 LOCAL_D TInt* gCandList2;											// amount of free pages
 const TInt KInvalidCandIndex = -1;
+LOCAL_D TUint gMemModel;
 
 //
 // GetDrive
@@ -489,6 +491,8 @@
 									currentCacheSize >> gPageShift));
 		}
 
+	// Get the memory model of the kernel that this test is running on.
+	gMemModel = MemModelType();
 	return KErrNone;
 	}
 
@@ -1514,7 +1518,7 @@
 				}
 			else
 				{
-				if ((allocMov || allocDis) && prevZoneNotFull)
+				if (verifySpread && (allocMov || allocDis) && prevZoneNotFull)
 					{// The previous least preferable RAM zones were not full so shouldn't
 					// be any movable or discardable pages in the RAM zones of this preference.
 					test.Printf(_L("Movable or discardable pages in more preferable RAM zones unnecessarily\n"));
@@ -1536,7 +1540,7 @@
 		}
 
 	if (totalMorePrefInUse > requiredMovDis)
-		{// There enough allocatable pages in the RAM zones below the currently 
+		{// There are enough allocatable pages in the RAM zones below the currently 
 		// least preferable RAM in use.
 		test.Printf(_L("Memory is spread out totalMorePref 0x%x required 0x%x\n"), totalMorePrefInUse, requiredMovDis);
 		if (verifySpread)
@@ -3049,8 +3053,9 @@
 				break;
 				}
 			totMov -= gZoneUtilArray[zoneIndexCand].iAllocMovable;
-			if (gZoneUtilArray[zoneIndexCand].iFreePages != gZoneUtilArray[zoneIndexCand].iPhysPages &&
-				gZoneUtilArray[zoneIndexCand].iFreePages != 0)
+			if (gZoneUtilArray[zoneIndexCand].iFreePages &&
+				(gZoneUtilArray[zoneIndexCand].iAllocMovable || 
+				gZoneUtilArray[zoneIndexCand].iAllocDiscardable))
 				{
 				zoneNotEmptyOrFull = ETrue;
 				}
@@ -9439,6 +9444,14 @@
 
 	test.Next(_L("Test5: Filling the FS Cache and allocating more than 16 contiguous fixed pages"));	
 	TestStart();
+
+	if (gMemModel >= EMemModelTypeFlexible)
+		{// The flexible memory model won't flush the whole paging cache for 
+		// contiguous allocations >16 pages so skip the next test.
+		test.Printf(_L("This memory model won't flush the cache - Skipping...\n"));
+		goto SkipTest5;
+		}
+
 	// TestEnd() will have reduced any cache pages to minimum so just get current 
 	// count of discardable pages.
 	GetAllPageInfo();
--- a/kerneltest/e32test/demandpaging/t_datapaging.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/demandpaging/t_datapaging.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -38,7 +38,7 @@
 #include <e32msgqueue.h>
 #include <e32atomics.h>
 #include <e32math.h>
-
+#include <f32file.h>
 #include "t_dpcmn.h"
 #include "../mmu/mmudetect.h"
 #include "../mmu/d_memorytest.h"
@@ -236,7 +236,7 @@
 		CLOSE_AND_WAIT(thread);
 		}
 	CLOSE_AND_WAIT(gChunk);
-	User::After(1000000);
+	UserSvr::HalFunction(EHalGroupKernel, EKernelHalSupervisorBarrier, 0, 0);
 	__KHEAP_MARKEND;
 	}
 
@@ -783,6 +783,9 @@
 	test_KErrNone(timeoutStatus.Int());
 	
 	CLOSE_AND_WAIT(gChunk);
+	
+	UserSvr::HalFunction(EHalGroupKernel, EKernelHalSupervisorBarrier, 0, 0);
+	
 	__KHEAP_MARKEND;
 	}
 
@@ -1199,6 +1202,17 @@
 	test.Title();
 	test_KErrNone(GetGlobalPolicies());
 
+	_LIT(KFileName,"Z:\\Test\\not_data_paged.txt");
+	RFs fs;
+	RFile file;
+	TInt error;
+	test(KErrNone == fs.Connect());
+	error = file.Open(fs, KFileName, EFileRead);
+	TBool isFilePresent = (error == KErrNone);
+	file.Close();
+	fs.Close();
+	test(gDataPagingSupported == !isFilePresent);
+
 	test.Start(_L("Test HAL APIs"));
 	TestHal();
 
--- a/kerneltest/e32test/demandpaging/t_thrash.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/demandpaging/t_thrash.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -270,10 +270,10 @@
 		RThread thread;
 		test_KErrNone(thread.Create(_L("EnsureSystemIdleThread"), EnsureSystemIdleThread, 1024, NULL, NULL));		
 		thread.SetPriority(EPriorityLess);
+		TRequestStatus status;
+		thread.Rendezvous(status);
 		thread.Resume();
 
-		TRequestStatus status;
-		thread.Rendezvous(status);
 		User::WaitForRequest(status);
 		test_KErrNone(status.Int());
 
@@ -667,7 +667,7 @@
 	delete [] data;
 	}
 
-void BenchmarkReplacement()
+void TestDistributions()
 	{
  	test.Next(_L("Test uniform distribution"));
 	TUniformRandom rand1;
@@ -678,6 +678,49 @@
 	TNormalRandom rand2;
 	rand2.SetParams(100, 25);
 	TestDistribution(rand2, 10000);
+	}
+
+void BenchmarkReplacement()
+	{
+	// Report block write and physical access settings
+	test.Next(_L("Report media physical access and preferred write size settings"));
+	TInt physAccessSupported = UserSvr::HalFunction(EHalGroupVM, EVMHalGetPhysicalAccessSupported, 0, 0);
+	test(physAccessSupported == 0 || physAccessSupported == 1);
+	if (physAccessSupported)
+ 		test.Printf(_L("Physical access supported\n"));
+	else
+ 		test.Printf(_L("Physical access not supported\n"));
+
+	TInt preferredWriteSize = UserSvr::HalFunction(EHalGroupVM, EVMHalGetPreferredDataWriteSize, 0, 0);
+	test(preferredWriteSize >= 0);
+	test.Printf(_L("Preferred write size %d pages\n"), 1 << preferredWriteSize);
+
+	for (TInt physAccess = 0 ; physAccess <= physAccessSupported ; ++physAccess)
+		{
+		test_KErrNone(UserSvr::HalFunction(EHalGroupVM, EVMHalSetUsePhysicalAccess, (TAny*)physAccess, 0));
+		test_Equal(physAccess, UserSvr::HalFunction(EHalGroupVM, EVMHalGetUsePhysicalAccess, 0, 0));
+		TInt writeSize = 0;
+		for (;;)
+			{
+			test_KErrNone(UserSvr::HalFunction(EHalGroupVM, EVMHalSetDataWriteSize, (TAny*)writeSize, 0));
+			TInt writeSizeSet = UserSvr::HalFunction(EHalGroupVM, EVMHalGetDataWriteSize, 0, 0);
+			test (writeSizeSet >= 0);
+			if (writeSizeSet != writeSize)
+				break;  // stop loop when we reach limit of supported write size
+
+			TBuf<128> title;
+			title.AppendFormat(_L("Thrash test: single thread, normal random workload 2, phys access %d, write size %dKB"),
+							   physAccess, 1 << (writeSize - 2));
+			ThrashTest(title, 1, ETrue, EWorkloadNormalRandom2, (2 * gMaxCacheSize) / 3, 2 * gMaxCacheSize, 0);
+
+			++writeSize;
+			}
+		}
+
+	test_KErrNone(UserSvr::HalFunction(EHalGroupVM, EVMHalSetUsePhysicalAccess, (TAny*)physAccessSupported, 0));
+	test_Equal(physAccessSupported, UserSvr::HalFunction(EHalGroupVM, EVMHalGetUsePhysicalAccess, 0, 0));
+	test_KErrNone(UserSvr::HalFunction(EHalGroupVM, EVMHalSetDataWriteSize, (TAny*)preferredWriteSize, 0));
+	test_Equal(preferredWriteSize, UserSvr::HalFunction(EHalGroupVM, EVMHalGetDataWriteSize, 0, 0));
 
 	ThrashTest(_L("Thrash test: single thread, normal random workload 1"),
 			   1, ETrue, EWorkloadNormalRandom1, (2 * gMaxCacheSize) / 3, 2 * gMaxCacheSize, 0);
@@ -853,6 +896,7 @@
 	if (actions & EActionBenchmarks)
 		{	
 		test.Next(_L("Benchmarking page replacement"));
+		TestDistributions();
 		BenchmarkReplacement();
 		}
 
--- a/kerneltest/e32test/device/t_usbapi.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/device/t_usbapi.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1849,6 +1849,29 @@
 	{
 	test.Start(_L("Test Endpoint Stall Status"));
 
+#ifdef BSW_USB_DRC
+	// The MACRO comes from ncp adaptation to indicate that otg is built in.
+	// Newly added code for defect ou1cimx1#267421. When otg is built in and the device is not 
+	// in peripheral role, the ncp adaptation will return a dummy endpoint for the stall operation.
+	// The solution is to check if the device is in peripheral mode, if not, skip the stall
+	// operation. A problem is now we can't find a good solution to check the current role of the device.
+	// For the test environement, it's ok to use the USB state to confirm and from the test result,
+	// it works fine. Later when we find accurate method, we will change the confirmation logic.
+	TInt ret = KErrNone;
+
+	TUsbcDeviceState devstate = EUsbcDeviceStateUndefined;
+	ret = gPort.DeviceStatus(devstate);
+	test(ret == KErrNone);
+
+	if( EUsbcDeviceStateUndefined==devstate )
+		{
+		test.Printf( _L("Device not connected, state EUsbcDeviceStateUndefined.\n")  );
+		test.Printf( _L("Skipping endpoint stall status tests.\n") );
+		test.End();
+		return;
+		}
+#endif
+
 	if (!SupportsEndpointStall())
 		{
 		test.Printf(_L("*** Not supported - skipping endpoint stall status tests\n"));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/digitiser/digi.auto.bat	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,19 @@
+rem
+rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of the License "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+t_userdigitisertest
+t_userdigitisernocap
+t_ldddigitisertest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/digitiser/digitiser.inf	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,44 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Digitiser Driver Tests
+// Convienence INF file to build just Digitiser tests "bldmake -f digitiser.inf bldfiles"
+// Test MMPs also part of the offical ../group/bld.inf e32test component.
+//
+
+/**
+@file
+
+@SYMPurpose Kernel and User library test code
+*/
+
+PRJ_PLATFORMS
+
+BASEDEFAULT
+
+PRJ_TESTEXPORTS
+
+digitiser_tests.iby			/epoc32/rom/include/digitiser_tests.iby
+tshell_digitisertests.oby	../../../kernel/eka/rombuild/tshell_digitisertests.oby
+
+digi.auto.bat				/epoc32/rom/include/digi.auto.bat
+
+PRJ_TESTMMPFILES
+
+..\group\d_ldddigitisertest			support
+
+#ifndef SMP
+..\group\t_userdigitisertest
+..\group\t_userdigitisernocaps
+..\group\t_ldddigitisertest
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/digitiser/digitiser_tests.iby	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,27 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Digitiser Driver Test Application
+//
+
+#ifndef __DIGITISER_TEST_IBY__
+#define __DIGITISER_TEST_IBY__
+
+device[VARID]=\Epoc32\Release\##KMAIN##\##BUILD##\d_ldddigitisertest.ldd	\sys\bin\d_ldddigitisertest.ldd
+file=\Epoc32\Release\##MAIN##\##BUILD##\t_ldddigitisertest.exe				\sys\bin\t_ldddigitisertest.exe
+file=\Epoc32\Release\##MAIN##\##BUILD##\t_userdigitisertest.exe				\sys\bin\t_userdigitisertest.exe
+file=\Epoc32\Release\##MAIN##\##BUILD##\t_userdigitisernocaps.exe			\sys\bin\t_userdigitisernocaps.exe
+
+data=\epoc32\rom\include\digi.auto.bat										\digi.auot.bat
+
+#endif // __DIGITISER_TEST_IBY__
--- a/kerneltest/e32test/digitiser/t_traweventdigitiser.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// e32test\digitiser\t_traweventdigitiser.cpp
-// Overview:
-// Test the TRawEvent APIS and events associated with the Digitiser and also verify the BTRACEs (manually)
-// API Information:
-// UserSvr
-// Details:
-// - Test the following 6  Events types 
-// 1.	EPointerMove
-// 2.	EPointer3DInRange,
-// 3.	EPointer3DOutOfRange,
-// 4.	EPointer3DTilt,
-// 5.	EPointer3DRotation,
-// 6.	EPointer3DTiltAndMove,
-// Platforms/Drives/Compatibility:
-// All.
-// Assumptions/Requirement/Pre-requisites: 
-// Failures and causes:
-// 
-//
-
-#include <e32test.h>
-#include <e32svr.h>
-#include <e32cmn.h>
-#include <e32cmn_private.h>
-
-LOCAL_D RTest test(_L("t_TRawEventDigitiser"));
-
-class TestTRawDigitiserEvent
-	{
-public:
-	TestTRawDigitiserEvent(TRawEvent::TType aType,TInt aX,TInt aY,TInt aZ,TInt aScanCode,TInt aPhi,TInt aTheta,TInt aAlpha,TUint8 aPointerNumber,TUint8 iTip);
-	void TestEvents();	
-private:	
-	TRawEvent::TType iType;
-	TInt iX;
-    TInt iY;
-	TInt iZ;
-	TInt iScanCode;
-	TInt iPhi;
-	TInt iTheta;
-	TInt iAlpha;
-	TUint8 iPointerNumber;
-	TUint8 iTip;
-	TRawEvent iDigitiser3DEvent;
-	};
-
-
-TestTRawDigitiserEvent::TestTRawDigitiserEvent(TRawEvent::TType aType,TInt aX,TInt aY,TInt aZ,TInt aScanCode,TInt aPhi,TInt aTheta,TInt aAlpha,TUint8 aPointerNumber,TUint8 aTip):iType(aType),iX(aX),iY(aY),iZ(aZ),iScanCode(aScanCode),iPhi(aPhi),iTheta(aTheta),iAlpha(aAlpha),iPointerNumber(aPointerNumber),iTip(aTip)
-	{}
-
-
-void TestTRawDigitiserEvent::TestEvents()
-	{
-	
-	test(iDigitiser3DEvent.Type()==0);
-	iDigitiser3DEvent.Set(iType);
-	test(iDigitiser3DEvent.Type()==iType);
-	iDigitiser3DEvent.SetPointerNumber(iPointerNumber);
-	test(iPointerNumber == iDigitiser3DEvent.PointerNumber());
-	iDigitiser3DEvent.Set(iType,iScanCode);
-	//Set the Type temporarily to get through the assertion 
-	iDigitiser3DEvent.Set(TRawEvent::EKeyDown);
-    test(iScanCode==iDigitiser3DEvent.ScanCode());
-	iDigitiser3DEvent.Set(iType,iX,iY);
-	//Set the Type temporarily to get through the assertion
-	iDigitiser3DEvent.Set(TRawEvent::EPointerMove);
-	test(TPoint(iX,iY)==iDigitiser3DEvent.Pos());
-	iDigitiser3DEvent.Set(iType,iX,iY,iZ);
-	//Set the Type temporarily to get through the assertion
-	iDigitiser3DEvent.Set(TRawEvent::EPointerMove);
-	test(TPoint3D(iX,iY,iZ)==iDigitiser3DEvent.Pos3D());
-	iDigitiser3DEvent.SetTip(iTip);
-	test(TBool(iTip) == iDigitiser3DEvent.IsTip());
-	iDigitiser3DEvent.SetTilt(iType,iPhi,iTheta);
-	//Set the Type temporarily to get through the assertion
-	iDigitiser3DEvent.Set(TRawEvent::EPointer3DTilt);
-	TAngle3D rawEventAnge3D=iDigitiser3DEvent.Tilt();
-	test((rawEventAnge3D.iPhi==iPhi) && (rawEventAnge3D.iTheta==iTheta)) ;
-	
-
-	iDigitiser3DEvent.SetRotation(iType,iAlpha);
-	//Set the Type temporarily to get through the assertion
-	iDigitiser3DEvent.Set(TRawEvent::EPointer3DRotation);
-	test(iAlpha == iDigitiser3DEvent.Rotation());
-	iDigitiser3DEvent.Set(iType,iX+1,iY+1,iZ+1,iPhi+1,iTheta+1,iAlpha+1);
-	//Set the Type temporarily to get through the assertion
-	iDigitiser3DEvent.Set(TRawEvent::EPointer3DTiltAndMove);
-	test(TPoint3D(iX+1,iY+1,iZ+1)==iDigitiser3DEvent.Pos3D());
-    rawEventAnge3D=iDigitiser3DEvent.Tilt();
-	test((rawEventAnge3D.iPhi==iPhi+1) &&(rawEventAnge3D.iTheta==iTheta+1));	
-	test((iAlpha+1) == iDigitiser3DEvent.Rotation());   
-	iDigitiser3DEvent.Set(iType,iX+2,iY+2,iZ+2,static_cast<TUint8>(iPointerNumber+1));
-	//Set the Type temporarily to get through the assertion
-	iDigitiser3DEvent.Set(TRawEvent::EPointer3DTiltAndMove);
-  	test(TPoint3D(iX+2,iY+2,iZ+2)==iDigitiser3DEvent.Pos3D());
-	test((iPointerNumber+1) == iDigitiser3DEvent.PointerNumber());
-
-	UserSvr::AddEvent(iDigitiser3DEvent);
-	}
-
-
-GLDEF_C TInt E32Main()
-//
-//
-    {
-
- 	test.Title();
-	test.Start(_L("Testing Digitiser Events"));
-	
-    TestTRawDigitiserEvent digitiserEvent1(TRawEvent::EPointerMove, -890,-123, -823,455,2563,156,62,3,1);
-	TestTRawDigitiserEvent digitiserEvent2(TRawEvent::EPointer3DInRange, 23,45,23,1,2,6,4,2,1);
-	TestTRawDigitiserEvent digitiserEvent3(TRawEvent::EPointer3DOutOfRange, 23,45,23,1,2,6,4,2,0);
-	TestTRawDigitiserEvent digitiserEvent4(TRawEvent::EPointer3DTilt, 23,45,23,1,2,6,4,2,1);
-	TestTRawDigitiserEvent digitiserEvent5(TRawEvent::EPointer3DRotation, 23,45,23,1,2,6,4,2,1);
-	TestTRawDigitiserEvent digitiserEvent6(TRawEvent::EPointer3DTiltAndMove, 23,45,23,1,2,6,4,2,0);
-
-    digitiserEvent1.TestEvents();
-	digitiserEvent2.TestEvents();
-	digitiserEvent3.TestEvents();
-	digitiserEvent4.TestEvents();
-	digitiserEvent5.TestEvents();
-	digitiserEvent6.TestEvents();    
-	test.Printf(_L("T_TRAWEVENTDIGITISER: TEST Successfully Completed\n"));
-	test.End();
-	test.Close();
-
-    return KErrNone;
-
-    }
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/digitiser/t_userdigitisertest.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,267 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32test\digitiser\t_userdigitisertest.cpp
+// Overview:
+// Test the TRawEvent APIS and events associated with the Digitiser and also verify the BTRACEs (manually)
+// Test HAL digitiser orientation attribute
+// API Information:
+// UserSvr
+// Details:
+// - Test the following 6  Events types 
+// 1.	EPointerMove
+// 2.	EPointer3DInRange,
+// 3.	EPointer3DOutOfRange,
+// 4.	EPointer3DTilt,
+// 5.	EPointer3DRotation,
+// 6.	EPointer3DTiltAndMove,
+// Platforms/Drives/Compatibility:
+// All.
+// Assumptions/Requirement/Pre-requisites: 
+// Failures and causes:
+// 
+//
+
+#define __E32TEST_EXTENSION__
+#include <e32test.h>
+#include <e32svr.h>
+#include <e32cmn.h>
+#include <e32cmn_private.h>
+#include <hal.h>
+
+#ifndef E32TEST_NOCAPS
+LOCAL_D RTest test(_L("T_UserDigitiserTest"));
+#else
+LOCAL_D RTest test(_L("T_UserDigitiserNoCaps"));
+#endif
+
+class TestTRawDigitiserEvent
+	{
+public:
+	TestTRawDigitiserEvent(TRawEvent::TType aType,TInt aX,TInt aY,TInt aZ,TInt aScanCode,TInt aPhi,TInt aTheta,TInt aAlpha,TUint8 aPointerNumber,TUint8 iTip);
+	void TestEvents();	
+private:	
+	TRawEvent::TType iType;
+	TInt iX;
+    TInt iY;
+	TInt iZ;
+	TInt iScanCode;
+	TInt iPhi;
+	TInt iTheta;
+	TInt iAlpha;
+	TUint8 iPointerNumber;
+	TUint8 iTip;
+	TRawEvent iDigitiser3DEvent;
+	};
+
+
+TestTRawDigitiserEvent::TestTRawDigitiserEvent(TRawEvent::TType aType,TInt aX,TInt aY,TInt aZ,TInt aScanCode,TInt aPhi,TInt aTheta,TInt aAlpha,TUint8 aPointerNumber,TUint8 aTip):iType(aType),iX(aX),iY(aY),iZ(aZ),iScanCode(aScanCode),iPhi(aPhi),iTheta(aTheta),iAlpha(aAlpha),iPointerNumber(aPointerNumber),iTip(aTip)
+	{}
+
+
+void TestTRawDigitiserEvent::TestEvents()
+	{
+	static TInt count = 0;
+	count++;
+	test.Printf(_L("TestTRawDigitiserEvent test case %2d\n"), count);
+	
+	test(iDigitiser3DEvent.Type()==0);
+	iDigitiser3DEvent.Set(iType);
+	test(iDigitiser3DEvent.Type()==iType);
+	iDigitiser3DEvent.SetPointerNumber(iPointerNumber);
+	test(iPointerNumber == iDigitiser3DEvent.PointerNumber());
+	iDigitiser3DEvent.Set(iType,iScanCode);
+	//Set the Type temporarily to get through the assertion 
+	iDigitiser3DEvent.Set(TRawEvent::EKeyDown);
+    test(iScanCode==iDigitiser3DEvent.ScanCode());
+	iDigitiser3DEvent.Set(iType,iX,iY);
+	//Set the Type temporarily to get through the assertion
+	iDigitiser3DEvent.Set(TRawEvent::EPointerMove);
+	test(TPoint(iX,iY)==iDigitiser3DEvent.Pos());
+	iDigitiser3DEvent.Set(iType,iX,iY,iZ);
+	//Set the Type temporarily to get through the assertion
+	iDigitiser3DEvent.Set(TRawEvent::EPointerMove);
+	test(TPoint3D(iX,iY,iZ)==iDigitiser3DEvent.Pos3D());
+	iDigitiser3DEvent.SetTip(iTip);
+	test(TBool(iTip) == iDigitiser3DEvent.IsTip());
+	iDigitiser3DEvent.SetTilt(iType,iPhi,iTheta);
+	//Set the Type temporarily to get through the assertion
+	iDigitiser3DEvent.Set(TRawEvent::EPointer3DTilt);
+	TAngle3D rawEventAnge3D=iDigitiser3DEvent.Tilt();
+	test((rawEventAnge3D.iPhi==iPhi) && (rawEventAnge3D.iTheta==iTheta)) ;
+	
+
+	iDigitiser3DEvent.SetRotation(iType,iAlpha);
+	//Set the Type temporarily to get through the assertion
+	iDigitiser3DEvent.Set(TRawEvent::EPointer3DRotation);
+	test(iAlpha == iDigitiser3DEvent.Rotation());
+	iDigitiser3DEvent.Set(iType,iX+1,iY+1,iZ+1,iPhi+1,iTheta+1,iAlpha+1);
+	//Set the Type temporarily to get through the assertion
+	iDigitiser3DEvent.Set(TRawEvent::EPointer3DTiltAndMove);
+	test(TPoint3D(iX+1,iY+1,iZ+1)==iDigitiser3DEvent.Pos3D());
+    rawEventAnge3D=iDigitiser3DEvent.Tilt();
+	test((rawEventAnge3D.iPhi==iPhi+1) &&(rawEventAnge3D.iTheta==iTheta+1));	
+	test((iAlpha+1) == iDigitiser3DEvent.Rotation());   
+	iDigitiser3DEvent.Set(iType,iX+2,iY+2,iZ+2,static_cast<TUint8>(iPointerNumber+1));
+	//Set the Type temporarily to get through the assertion
+	iDigitiser3DEvent.Set(TRawEvent::EPointer3DTiltAndMove);
+  	test(TPoint3D(iX+2,iY+2,iZ+2)==iDigitiser3DEvent.Pos3D());
+	test((iPointerNumber+1) == iDigitiser3DEvent.PointerNumber());
+
+	UserSvr::AddEvent(iDigitiser3DEvent);
+	}
+	
+	
+struct HalAttribute_TestCase
+	{
+	HALData::TAttribute iAttr;
+	TInt				iValueIn;
+	TInt				iSetRC;		// Set to KMaxTInt to skip set test case
+	TInt				iGetRC;		// Set to KMaxTInt to skip get test case
+
+	};
+	
+static HalAttribute_TestCase gHalAttributeTests[] =
+	{
+#ifndef E32TEST_NOCAPS
+	// Normal all pass tests
+	{ HALData::EDigitiserOrientation, HALData::EDigitiserOrientation_000,		KErrNone, KErrNone},
+	{ HALData::EDigitiserOrientation, HALData::EDigitiserOrientation_090,		KErrNone, KErrNone},	
+	{ HALData::EDigitiserOrientation, HALData::EDigitiserOrientation_180,		KErrNone, KErrNone},
+	{ HALData::EDigitiserOrientation, HALData::EDigitiserOrientation_270,		KErrNone, KErrNone},
+	{ HALData::EDigitiserOrientation, HALData::EDigitiserOrientation_default,	KErrNone, KErrNone},
+				
+	// Negative tests
+	{ HALData::EDigitiserOrientation, -1,		KErrArgument, KMaxTInt},
+	{ HALData::EDigitiserOrientation, 100,		KErrArgument, KMaxTInt},
+		
+#else
+	// Platsec tests for no capabilities executable.
+	{ HALData::EDigitiserOrientation, HALData::EDigitiserOrientation_default,		KMaxTInt, KErrNone},			 // Get, No caps needed
+	{ HALData::EDigitiserOrientation, HALData::EDigitiserOrientation_default,		KErrPermissionDenied, KMaxTInt}, // Set WDD cap needed
+#endif
+	};
+	
+static TInt gNumHalAttributeTests = sizeof(gHalAttributeTests)/sizeof(HalAttribute_TestCase);
+
+void DoTestDigitiserHalAttributes()
+	{
+	__UHEAP_MARK;
+#ifndef E32TEST_NOCAPS
+	test.Start(_L("DoTestDigitiserHalAttributes tests"));
+#else
+	test.Start(_L("DoTestDigitiserHalAttributes NO CAPS tests"));
+	
+	// Skip No Caps testing for WDD caps when enforcement is not enabled on the
+	// platform i.e. when a emulator epoc.ini is missing.
+	if (!PlatSec::IsCapabilityEnforced(ECapabilityWriteDeviceData))
+		{
+		test.Printf(_L("Platform security enforcement off, skipping\n"));
+		test.End();
+		__UHEAP_MARKEND;
+		return;
+		}
+#endif
+
+	TInt i = 0;
+	TInt origValue = -1;
+	TInt r = HAL::Get(HALData::EDigitiserOrientation, origValue);
+	if (r == KErrNotSupported)
+		{
+		test.Printf(_L("Platform doesn't support EDigitiserOrientation, skipping\n"));
+		test.End();
+		__UHEAP_MARKEND;
+		return;
+		}
+	test_KErrNone(r);
+	
+	// Attribute supported on platform, proceed with test.
+	TInt value = -1;
+	for (i=0; i < gNumHalAttributeTests; i++)
+		{
+		test.Printf(_L("DoTestDigitiserHalAttributes - step/row %2d\n"), i+1);
+		
+		if (gHalAttributeTests[i].iSetRC != KMaxTInt) // Skip set test?
+			{
+			r = HAL::Set(gHalAttributeTests[i].iAttr,  gHalAttributeTests[i].iValueIn);
+			test_Equal( gHalAttributeTests[i].iSetRC, r);	
+			}
+			
+		if (gHalAttributeTests[i].iGetRC != KMaxTInt) // Skip get test?
+			{
+			r = HAL::Get(gHalAttributeTests[i].iAttr,  value);
+			test_Equal(gHalAttributeTests[i].iGetRC, r);
+			test_Equal(gHalAttributeTests[i].iValueIn, value);
+			}
+		}
+		
+#ifndef E32TEST_NOCAPS
+	// Return system state back to before the test
+	r = HAL::Set(HALData::EDigitiserOrientation, origValue);
+	test_KErrNone(r);
+#endif
+		
+	test.Printf(_L("DoTestDigitiserHalAttributes - complete\n"));
+	test.End();
+	__UHEAP_MARKEND;
+	}
+
+#ifndef E32TEST_NOCAPS
+void DoTestRawDigitiserEvent()
+	{
+	__UHEAP_MARK;
+	test.Start(_L("DoTestRawDigitiserEvent tests"));
+
+    TestTRawDigitiserEvent digitiserEvent1(TRawEvent::EPointerMove, -890,-123, -823,455,2563,156,62,3,1);
+	TestTRawDigitiserEvent digitiserEvent2(TRawEvent::EPointer3DInRange, 23,45,23,1,2,6,4,2,1);
+	TestTRawDigitiserEvent digitiserEvent3(TRawEvent::EPointer3DOutOfRange, 23,45,23,1,2,6,4,2,0);
+	TestTRawDigitiserEvent digitiserEvent4(TRawEvent::EPointer3DTilt, 23,45,23,1,2,6,4,2,1);
+	TestTRawDigitiserEvent digitiserEvent5(TRawEvent::EPointer3DRotation, 23,45,23,1,2,6,4,2,1);
+	TestTRawDigitiserEvent digitiserEvent6(TRawEvent::EPointer3DTiltAndMove, 23,45,23,1,2,6,4,2,0);
+
+    digitiserEvent1.TestEvents();
+	digitiserEvent2.TestEvents();
+	digitiserEvent3.TestEvents();
+	digitiserEvent4.TestEvents();
+	digitiserEvent5.TestEvents();
+	digitiserEvent6.TestEvents();    
+	
+	test.End();
+	__UHEAP_MARKEND;
+	}
+#endif
+
+
+GLDEF_C TInt E32Main()
+//
+//
+    {
+	__UHEAP_MARK;
+	
+ 	test.Title();
+	test.Start(_L("User-side Digitiser Testing Events/HAL"));
+	
+	DoTestDigitiserHalAttributes();
+	
+#ifndef E32TEST_NOCAPS
+	DoTestRawDigitiserEvent();
+#endif
+
+	test.Printf(_L("\n"));
+	test.End();
+	test.Close();
+
+	__UHEAP_MARKEND;
+    return KErrNone;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/digitiser/tshell_digitisertests.oby	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#define BASE_ROM
+#include <rom\##VARIANT##\header.iby>
+
+
+files=
+
+#include <rom\##VARIANT##\kernel.iby>
+#include "user.iby"
+#include <rom\hal\hal.iby>
+#include <rom\f32\f32.iby>
+
+#include <rom\include\digitiser_tests.iby>
--- a/kerneltest/e32test/dmav2/d_dma2.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/dmav2/d_dma2.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -55,7 +55,7 @@
 			}
 		return FastCountToMicroSecs(diff);
 #else
-		//TODO On SMP it is possible for the value returned from
+		//On SMP it is possible for the value returned from
 		//NKern::FastCounter to depend on the current CPU (ie.
 		//NaviEngine)
 		//
@@ -100,6 +100,7 @@
 	TInt DoGetInfo(TAny* aInfo);
 
 	TInt OpenDmaChannel(TUint aPslCookie, TUint& aDriverCookie);
+	TInt OpenDmaChannel(TUint& aDriverCookie, TDmaChannel::SCreateInfo& aInfo);
 	TInt CloseDmaChannelByCookie(TUint aDriverCookie);
 	TInt PauseDmaChannelByCookie(TUint aDriverCookie);
 	TInt ResumeDmaChannelByCookie(TUint aDriverCookie);
@@ -127,9 +128,6 @@
 	*/
 	TInt CreateDmaRequest(TUint aChannelCookie, TUint& aRequestCookie, TBool aNewCallback = EFalse, TInt aMaxFragmentSizeBytes=0);
 
-	//TODO what happens if a client closes a channel that
-	//it still has dma requests associated with?
-	
 	/**
 	Destroys a previously created dma request object
 	*/
@@ -141,7 +139,7 @@
 	TInt CookieToChannelIndex(TUint aDriverCookie) const;
 	TInt CookieToRequestIndex(TUint aRequestCookie) const;
 
-	void FixupTransferArgs(TDmaTransferArgs& aTransferArgs) const;
+	void MakeAddressesAbsoulute(TDmaTransferArgs& aTransferArgs) const;
 	TInt FragmentRequest(TUint aRequestCookie, const TDmaTransferArgs& aTransferArgs, TBool aLegacy=ETrue);
 
 	TInt QueueRequest(TUint aRequestCookie, TRequestStatus* aStatus, TCallbackRecord* aRecord, TUint64* aDurationMicroSecs);
@@ -177,6 +175,19 @@
 	TUint64 GetDuration()
 		{return iStopwatch.ReadMicroSecs();}
 
+	/**
+	Store a copy of the TDmaTransferArgs which was used for fragmentation
+	for argument checking
+	*/
+	void SetAddressParms(const TDmaTransferArgs& aAddressParms)
+		{iFragmentedTransfer = aAddressParms;}
+
+	/**
+	Retrieve stored TDmaTransferArgs
+	*/
+	const TDmaTransferArgs& GetAddressParms() const
+		{return iFragmentedTransfer;}
+
 protected:
 	TInt Create();
 	/** Construct with old style callback */
@@ -202,6 +213,13 @@
 
 	TStopwatch iStopwatch;
 	TIsrRequeArgsSet iIsrRequeArgSet;
+
+	/**
+	This will be updated each time fragment is called.
+	It is required so that, at queue time, if ISR re-queue
+	arguments are added, they can be checked for sanity
+	*/
+	TDmaTransferArgs iFragmentedTransfer;
 	};
 
 DClientDmaRequest* DClientDmaRequest::Construct(DThread* aClient, TDfcQue* const aDfcQ, TDmaChannel& aChannel, TBool aNewStyle, TInt aMaxTransferSize)
@@ -341,38 +359,7 @@
 #endif
 	}
 
-/**
-Check that both source and destination of ISR reque args will
-lie within the range specified by aStart and aSize.
-
-@param aStart The linear base address of the region
-@param aSize The size of the region
-*/
-TBool TIsrRequeArgs::CheckRange(TLinAddr aStart, TUint aSize) const
-	{
-	TUint physStart = Epoc::LinearToPhysical(aStart);
-	TEST_ASSERT(physStart != KPhysAddrInvalid);
-
-	TAddrRange chunk(physStart, aSize);
-	TBool sourceOk = (iSrcAddr == KPhysAddrInvalid) ? ETrue : chunk.Contains(SourceRange());
-
-	TBool destOk = (iDstAddr == KPhysAddrInvalid) ? ETrue : chunk.Contains(DestRange());
-
-	return sourceOk && destOk;
-	}
-
-TBool TIsrRequeArgsSet::CheckRange(TLinAddr aAddr, TUint aSize) const
-	{
-	for(TInt i=0; i<iCount; i++)
-		{
-		if(!iRequeArgs[i].CheckRange(aAddr, aSize))
-			return EFalse;
-		}
-	return ETrue;
-	}
-
-/**
-Translate an old style dma callback to a new-style one
+/** Translate an old style dma callback to a new-style one
 */
 void DClientDmaRequest::CallbackOldStyle(TResult aResult, TAny* aArg)
 	{
@@ -431,7 +418,9 @@
 		self.iDfc.Add();
 		break;
 		}
-	case NKern::EIDFC: //fall-through
+	//Fall-through: If context is IDFC or the EEscaped marker occur
+	//it is an error
+	case NKern::EIDFC:
 	case NKern::EEscaped:
 	default:
 		TEST_FAULT;
@@ -593,10 +582,34 @@
 			{
 			TUint pslCookie = (TUint)a1;
 			TUint driverCookie = 0;
-			TInt r = OpenDmaChannel(pslCookie, driverCookie);	
+			TInt r = OpenDmaChannel(pslCookie, driverCookie);
 			umemput32(a2, &driverCookie, sizeof(TAny*));
 			return r;
 			}
+	case RDmaSession::EOpenChannelExposed:
+			{
+			TDmaChannel::SCreateInfo openInfo;
+			TUint driverCookie = 0;
+
+			TPckgBuf<SCreateInfoTest> openArgsBuf;
+			Kern::KUDesGet(openArgsBuf, *reinterpret_cast<TDes8*>(a2));
+
+			SCreateInfoTest& openTestInfo = openArgsBuf();
+			openInfo.iCookie = openTestInfo.iCookie;
+			openInfo.iDesCount = openTestInfo.iDesCount;
+			openInfo.iDfcQ = iDfcQ;
+			openInfo.iDfcPriority = openTestInfo.iDfcPriority;
+
+			#ifdef DMA_APIV2
+				openInfo.iPriority = openTestInfo.iPriority;
+				openInfo.iDynChannel = openTestInfo.iDynChannel;
+			#endif
+
+			TInt r = OpenDmaChannel(driverCookie, openInfo);
+			umemput32(a1, &driverCookie, sizeof(TAny*));
+			Kern::KUDesPut(*reinterpret_cast<TDes8*>(a2), openArgsBuf);
+			return r;
+			}
 	case RDmaSession::ECloseChannel:
 			{
 			TUint driverCookie = reinterpret_cast<TUint>(a1);
@@ -660,11 +673,15 @@
 			TDmaTransferArgs& transferArgs = const_cast<TDmaTransferArgs&>(argsBuff().iTransferArgs);
 
 			//convert address offsets in to kernel virtual addresses
-			FixupTransferArgs(transferArgs);
-
-			TEST_ASSERT((TAddressParms(transferArgs).CheckRange(iChunkBase, iChunk->Size())));
+			MakeAddressesAbsoulute(transferArgs);
 
 			TInt r = KErrGeneral;
+			if (!TAddressParms(transferArgs).CheckRange(iChunkBase, iChunk->Size()))
+			{
+				// Return error code for invalid src and destination arguments used in tranferArgs
+				r=KErrArgument;
+				return r;
+			}
 
 			TStopwatch clock;
 			clock.Start();
@@ -708,7 +725,6 @@
 			}	
 	case RDmaSession::EQueueRequestWithReque:
 			{
-			//TODO can common code with EQueueRequest be extracted?
 			TPckgBuf<RDmaSession::TQueueArgsWithReque> argsBuff;
 			Kern::KUDesGet(argsBuff, *reinterpret_cast<TDes8*>(a1));
 
@@ -723,13 +739,11 @@
 			DClientDmaRequest* const request = RequestFromCookie(requestCookie);
 			if(request != NULL)
 				{
-				argsBuff().iRequeSet.Fixup(iChunkBase);
-				//TODO reque args must be substituted in order to
-				//check the range. The original transfer args are not
-				//available when queue is called, they could
-				//however be stored within DClientDmaRequest
-				//TEST_ASSERT((argsBuff().iRequeSet.CheckRange(iChunkBase, iChunk->Size())));
-				request->AddRequeArgs(argsBuff().iRequeSet);
+				TIsrRequeArgsSet& requeArgs = argsBuff().iRequeSet;
+				requeArgs.Fixup(iChunkBase);
+
+				TEST_ASSERT(requeArgs.CheckRange(iChunkBase, iChunk->Size(), request->GetAddressParms() ));
+				request->AddRequeArgs(requeArgs);
 
 				r = QueueRequest(requestCookie, requestStatus, callbackRec, duration);
 				}
@@ -740,21 +754,6 @@
 				}
 			return r;
 			}
-	case RDmaSession::EIsrRedoRequest:
-			{
-			TPckgBuf<RDmaSession::TIsrRedoReqArgs> argsBuff;
-			Kern::KUDesGet(argsBuff, *reinterpret_cast<TDes8*>(a1));
-
-			const TUint driverCookie = argsBuff().iDriverCookie;
-			const TUint32 srcAddr = argsBuff().iSrcAddr;
-			const TUint32 dstAddr = argsBuff().iDstAddr;
-			const TInt transferCount = argsBuff().iTransferCount;
-			const TUint32 pslRequestInfo = argsBuff().iPslRequestInfo;
-			const TBool isrCb = argsBuff().iIsrCb;
-
-			TInt r = IsrRedoRequestByCookie(driverCookie,srcAddr,dstAddr,transferCount,pslRequestInfo,isrCb);
-			return r;
-			}
 	case RDmaSession::EIsOpened:
 			{
 			TUint driverCookie = (TUint)a1;
@@ -797,29 +796,21 @@
 		}
 	}
 
-TInt DDmaTestSession::OpenDmaChannel(TUint aPslCookie, TUint& aDriverCookie )
+TInt DDmaTestSession::OpenDmaChannel(TUint& aDriverCookie, TDmaChannel::SCreateInfo& aInfo)
 	{
-	TDmaChannel::SCreateInfo info;
-	info.iCookie = aPslCookie;
-	info.iDfcQ = iDfcQ;
-	info.iDfcPriority = 3;
-	info.iDesCount = 128;
-
-	TDmaChannel* channel = NULL;
-
 	//cs so thread can't be killed between
 	//opening channel and adding to array
 	NKern::ThreadEnterCS();
-	TInt r = TDmaChannel::Open(info, channel);
+	TDmaChannel* channel = NULL;
+	TInt r = TDmaChannel::Open(aInfo, channel);
 	if(KErrNone == r)
 		{
 		__NK_ASSERT_ALWAYS(channel);
-		
-		__KTRACE_OPT(KDMA, Kern::Printf("OpenDmaChannel: channel@ 0x%08x", channel)); 
+
+		__KTRACE_OPT(KDMA, Kern::Printf("OpenDmaChannel: channel@ 0x%08x", channel));
 
-
-		TInt err = iChannels.Append(channel);
-		if(KErrNone == err)
+		r = iChannels.Append(channel);
+		if(KErrNone == r)
 			{
 			aDriverCookie = reinterpret_cast<TUint>(channel);
 			}
@@ -834,6 +825,20 @@
 	return r;
 	}
 
+/**
+Open a DMA channel with arbitrary default parameters
+*/
+TInt DDmaTestSession::OpenDmaChannel(TUint aPslCookie, TUint& aDriverCookie )
+	{
+	TDmaChannel::SCreateInfo info;
+	info.iCookie = aPslCookie;
+	info.iDfcQ = iDfcQ;
+	info.iDfcPriority = 3;
+	info.iDesCount = 128;
+
+	return OpenDmaChannel(aDriverCookie, info);
+	}
+
 TInt DDmaTestSession::CookieToChannelIndex(TUint aDriverCookie) const
 	{
 	const TInt r = iChannels.Find(reinterpret_cast<TDmaChannel*>(aDriverCookie));
@@ -906,8 +911,7 @@
 	__KTRACE_OPT(KDMA, Kern::Printf("CancelAllByIndex: %d", aIndex)); 
 	__NK_ASSERT_DEBUG(aIndex < iChannels.Count()); 
 	
-	TDmaChannel* channel = iChannels[aIndex];
-	iChannels.Remove(aIndex);
+	TDmaChannel* channel = iChannels[aIndex];	
 	channel->CancelAll();
 	}
 
@@ -1188,7 +1192,11 @@
 	return r;
 	}
 
-void DDmaTestSession::FixupTransferArgs(TDmaTransferArgs& aTransferArgs) const
+/**
+Replace addresses specified as an offset from the chunk base with absolute
+virtual addresses.
+*/
+void DDmaTestSession::MakeAddressesAbsoulute(TDmaTransferArgs& aTransferArgs) const
 	{
 	aTransferArgs.iSrcConfig.iAddr += iChunkBase;
 	aTransferArgs.iDstConfig.iAddr += iChunkBase;
@@ -1225,23 +1233,29 @@
 	if(requestIndex < 0)
 		return requestIndex;
 
+	DClientDmaRequest& request = *iClientDmaReqs[requestIndex];
+	request.SetAddressParms(aTransferArgs);
+
 	TInt r = KErrNotSupported;
+
+	if (aTransferArgs.iTransferCount < 1)
+		{
+		// Return error code for invalid transfer size used in tranferArgs
+		r=KErrArgument;
+		return r;
+		}
+
 	if(aLegacy)
 		{
-		// TODO we can extract the required info from the struct to
-		// set flags
 		TUint flags = KDmaMemSrc | KDmaIncSrc | KDmaMemDest | KDmaIncDest;
-
 		const TUint src = aTransferArgs.iSrcConfig.iAddr;
 		const TUint dst = aTransferArgs.iDstConfig.iAddr;
-		r = iClientDmaReqs[requestIndex]->Fragment(src, dst, aTransferArgs.iTransferCount, flags, NULL);
+		r = request.Fragment(src, dst, aTransferArgs.iTransferCount, flags, NULL);
 		}
 	else
 		{
 #ifdef DMA_APIV2
-		r = iClientDmaReqs[requestIndex]->Fragment(aTransferArgs);
-#else
-		r = KErrNotSupported;
+		r = request.Fragment(aTransferArgs);
 #endif
 		}
 	return r;
@@ -1296,9 +1310,6 @@
 	for(TInt i=0; i<aOldInfo.iMaxSgChannels; i++)
 		newInfo.iSgChannels[i] = aOldInfo.iSgChannels[i];
 
-	//TODO will want to add initialisation for Asym channels
-	//when these are available
-
 	return newInfo;
 	}
 //////////////////////////////////////////////////////////////////////////////
@@ -1321,8 +1332,7 @@
 DDmaTestFactory::DDmaTestFactory()
     {
     iVersion = TestDmaLddVersion();
-    iParseMask = KDeviceAllowUnit;							// no info, no PDD
-    // iUnitsMask = 0;										// Only one thing
+    iParseMask = KDeviceAllowUnit;							// no info, no PDD    
     }
 
 
--- a/kerneltest/e32test/dmav2/d_dma2.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/dmav2/d_dma2.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -30,11 +30,13 @@
 	#include <kernel.h>
 	#define TEST_FAULT FAULT();
 	#define PRINT(N) Kern::Printf("%s = 0x%08x (%d)", #N, (N), (N))
+	#define PRINTF(X) Kern::Printf X ;
 #else
 	#include <e32std.h>
 	#include <e32debug.h>
-	#define TEST_FAULT RDebug::Printf("Assertion failure in %s, %d", __FILE__, __LINE__); User::Invariant()
+	#define TEST_FAULT {RDebug::Printf("Assertion failure in %s, %d", __FILE__, __LINE__); User::Invariant();}
 	#define PRINT(N) RDebug::Printf("%s = 0x%08x (%d)", #N, (N), (N))
+	#define PRINTF(X) RDebug::Printf X ;
 #endif
 
 #define TEST_ASSERT(C) if(!(C)) {TEST_FAULT;}
@@ -44,8 +46,21 @@
 //if this fails then KPhysAddrInvalidUser must be updated to match
 //KPhysAddrInvalid
 __ASSERT_COMPILE(KPhysAddrInvalidUser == KPhysAddrInvalid);
+#else
+const TUint KPhysAddrInvalid = KPhysAddrInvalidUser;
 #endif
 
+#ifdef __KERNEL_MODE__
+//Function to format the output.
+inline void DmaAppendFormat(TDes8& aBuf, const char* aFmt, ...)
+	{
+	if(!(&aBuf))
+		return;
+	VA_LIST list;
+	VA_START(list,aFmt);
+	Kern::AppendFormat(aBuf,aFmt,list);
+	}
+#endif
 
 _LIT(KTestDmaLddName, "TestDmaV2");
 
@@ -57,7 +72,7 @@
 Indicates the number of each type of call back received
 and their context
 
-TODO as yet, it does not indicate the context of each callback, only
+@note It does not indicate the context of each callback, only
 the final one
 */
 const TInt KNumberOfCallbacks = 12;
@@ -157,6 +172,63 @@
 	};
 
 
+/** SCreateInfo for opening DMA - Reused for testing */
+struct SCreateInfoTest
+		{
+		/** Default constructor. Initializes all fields with meaningful default
+			values.
+
+			Must be inline (for now) because exporting it would break existing
+			custom DMA libs as their clients would need the export which would
+			be missing from the custom .def files.
+		*/
+		SCreateInfoTest() : iPriority(KDmaPriorityNone), iDynChannel(EFalse) {};
+
+		/** Identifier used by PSL to select channel to open */
+		TUint32 iCookie;
+		/** Number of descriptors this channel can use.
+
+			This number is not used in the upgraded version of the DMA
+			framework and is kept there only for source compatibility. If the
+			client is certain that it will only ever use that version, then the
+			value passed here doesn't matter - the framework will ignore it.
+
+			@deprecated
+		 */
+		TInt iDesCount;
+		/** DFC queue used to service DMA interrupts.
+
+			The DFC thread priority must be higher than any client thread
+			priority to avoid a situation where a transfer completes while
+			being cancelled and another transfer is started before the DFC
+			thread gets a chance to run. This would lead to a stray DFC.
+		*/
+		//TDfcQue* iDfcQ;
+
+		TAny* iDfcQ;
+
+		/** DFC priority */
+		TUint8 iDfcPriority;
+		/** Used by PSL to configure a channel priority (if possible).
+
+			The default is KDmaPriorityNone (the don't care value).
+
+		    @see TDmaPriority
+		*/
+		TUint iPriority;
+		/** Request a dynamic DMA channel.
+
+			If this is set to ETrue then the Open call is for a 'dynamic' as
+			opposed to a static and solely owned DMA channel. A number of
+			properties of the opened TDmaChannel object will be different in
+			that case.
+
+			The default value is EFalse.
+		 */
+		TBool iDynChannel;
+		};
+
+
 class TDmaChannel;
 
 struct TAddrRange
@@ -169,6 +241,8 @@
 	TBool Contains(TAddrRange aRange) const;
 
 	TBool Overlaps(const TAddrRange& aRange) const;
+	TBool IsFilled(TUint8 aValue) const;
+
 	static void SelfTest();
 
 private:
@@ -190,13 +264,21 @@
 		{}
 
 	/**
-	If any src, dst, or transfer count are zero, substitute the values from
-	aTransferArgs in their place
+	If addresses have been left as KPhysAddrInvalid or the count as 0 (ie.
+	the default values used for IsrRedoRequest) then substitute the values from
+	aTransferArgs.
 	*/
 	void Substitute(const TDmaTransferArgs& aTransferArgs);
 
 	/**
-	When recieved by the test driver, src and dst
+	If addresses have been left as KPhysAddrInvalid or the count as 0 (ie.
+	the default values used for IsrRedoRequest) then substitute the values from
+	aTransferArgs.
+	*/
+	void Substitute(const TAddressParms& aTransferArgs);
+
+	/**
+	When received by the test driver, src and dst
 	addresses will be offsets from the dma test session's
 	chunk base. They must be converted to absolute, *physical* addresses
 	*/
@@ -216,6 +298,22 @@
 
 	TBool operator==(const TAddressParms& aOther) const;
 
+
+	/**
+	Produce a printable representation
+	*/
+	void AppendString(TDes& aBuf) const
+		{
+		_LIT(KOutput, "TAddressParms: src=0x%08x (%d) dst=0x%08x (%d) count=0x%08x (%d)\0");
+#ifdef __KERNEL_MODE__
+		DmaAppendFormat(aBuf, (const char*)KOutput().Ptr(), iSrcAddr, iSrcAddr, iDstAddr, iDstAddr, iTransferCount, iTransferCount);
+#else
+		aBuf.AppendFormat(KOutput, iSrcAddr, iSrcAddr, iDstAddr, iDstAddr, iTransferCount, iTransferCount);
+#endif
+		}
+
+	void MakePhysical();
+
 	static void SelfTest();
 
 	TUint32 iSrcAddr;
@@ -255,8 +353,7 @@
 */
 struct TIsrRequeArgsSet
 	{
-
-	friend class CIsrRequeTest; //TODO see line 394 t_dma2.cpp
+	friend class CIsrRequeTest;
 	TIsrRequeArgsSet(TIsrRequeArgs* aRequeueArgs=NULL, TInt aCount =0)
 		:iCount(aCount), iIndex(0)
 		{
@@ -273,10 +370,26 @@
 
 	TIsrRequeArgs GetArgs();
 
+	/**
+	If addresses have been left as KPhysAddrInvalid or the count as 0 (ie.
+	the default values used for IsrRedoRequest) then substitute the appropriate
+	value from the previous argument struct. aTransferArgs is used to
+	substitute values for the initial argument struct.
+	*/
 	void Substitute(const TDmaTransferArgs& aTransferArgs);
 	void Fixup(TLinAddr aChunkBase);
 	TBool CheckRange(TLinAddr aAddr, TUint aSize) const;
 
+	/**
+	Check that all re-queue parameters will remain within the region defined
+	by aAddr and aSize. This overload assumes that the requeue parameters have
+	not been substituted hence the data in aInitialParms is required.
+
+	@param aInitialParms The original transfer that the re-queues in this set are based on
+	*/
+	TBool CheckRange(TLinAddr aAddr, TUint aSize, const TDmaTransferArgs& aInitialParms) const;
+
+	static void SelfTest();
 private:
 	enum {MaxCount=6};
 	TInt iCount;
@@ -300,13 +413,6 @@
 		return DoControl(EIsOpened, reinterpret_cast<TAny*>(aDriverCookie), &aChannelOpen);		
 		}
 
-	TInt ChannelIsrRedoRequest(TUint aDriverCookie,TUint32 aSrcAddr,TUint32 aDstAddr,TInt aTransferCount,TUint32 aPslRequestInfo,TBool aIsrCb)
-		{
-		TIsrRedoReqArgs args(aDriverCookie,aSrcAddr,aDstAddr,aTransferCount,aPslRequestInfo,aIsrCb);
-		TPckgC<TIsrRedoReqArgs> package(args);
-		return DoControl(EIsrRedoRequest,&package);
-		}
-
 	TInt ChannelCancelAll(TUint aDriverCookie)
 		{	
 		return DoControl(ECancelAllChannel, reinterpret_cast<TAny*>(aDriverCookie));
@@ -317,6 +423,12 @@
 		return DoControl(EOpenChannel, reinterpret_cast<TAny*>(aPslCookie), &aDriverCookie);
 		}
 
+	TInt ChannelOpen(TUint& aDriverCookie, SCreateInfoTest& aInfo)
+		{
+		TPckg<SCreateInfoTest> package(aInfo);
+		return DoControl(EOpenChannelExposed,&aDriverCookie, &package);
+		}
+
 	TInt ChannelClose(TUint aDriverCookie)
 		{	
 		return DoControl(ECloseChannel, reinterpret_cast<TAny*>(aDriverCookie));
@@ -347,23 +459,18 @@
 		}
 	
 	TInt Open()
-		{// TO DO: Add Info , this  class is just to test the opening of channels
-		//TPckgBuf<TOpenInfo> infoBuf;
-		//infoBuf().iWhat = TOpenInfo::EOpen;
-		//infoBuf().U.iOpen.iId = aId;
-		//infoBuf().U.iOpen.iDesCount = aDesCount;
-		//infoBuf().U.iOpen.iMaxTransferSize = aMaxTransferSize;
+		{
 		return DoCreate(KTestDmaLddName,TestDmaLddVersion(), 0, NULL, NULL, EOwnerThread);
 		}
 
-	//TODO rename this (append "old")
-	TInt RequestCreate(TUint aChannelCookie, TUint& aRequestCookie, TUint aMaxTransferSize=0)
+
+	TInt RequestCreateOld(TUint aChannelCookie, TUint& aRequestCookie, TUint aMaxTransferSize=0)
 		{	
 		return DoRequestCreate(aChannelCookie, EFalse, aMaxTransferSize, aRequestCookie);
 		}
 
-	//TODO rename this (get rid of "new"
-	TInt RequestCreateNew(TUint aChannelCookie, TUint& aRequestCookie, TUint aMaxTransferSize=0)
+
+	TInt RequestCreate(TUint aChannelCookie, TUint& aRequestCookie, TUint aMaxTransferSize=0)
 		{
 		return DoRequestCreate(aChannelCookie, ETrue, aMaxTransferSize, aRequestCookie);
 		}
@@ -407,6 +514,8 @@
 		TCallbackRecord dummyRec;
 		TUint64 dummyTime=0;
 
+		aStatus = KRequestPending;
+
 		TQueueArgs args(aRequestCookie, &aStatus, aRecord ? aRecord : &dummyRec, aDurationMicroSecs ? aDurationMicroSecs : &dummyTime);
 		TPckgC<TQueueArgs> package(args);
 		return DoControl(EQueueRequest, &package);
@@ -439,6 +548,8 @@
 		TCallbackRecord dummyRec;
 		TUint64 dummyTime=0;
 
+		aStatus = KRequestPending;
+
 		TQueueArgsWithReque args(aRequeueArgs, aCount, aRequestCookie, &aStatus, aRecord ? aRecord : &dummyRec, aDurationMicroSecs ? aDurationMicroSecs : &dummyTime);
 		TPckgC<TQueueArgsWithReque> package(args);
 		return DoControl(EQueueRequestWithReque, &package);
@@ -518,19 +629,6 @@
 		TUint64* iDurationMicroSecs;
 		};
 
-	struct TIsrRedoReqArgs 	
-		{
-		TIsrRedoReqArgs(TUint aDriverCookie=0,TUint32 aSrcAddr=0, TUint32 aDstAddr=0, TInt aTransferCount=0, TUint32 aPslRequestInfo=0,TBool aIsrCb=ETrue)
-			:iDriverCookie(aDriverCookie),iSrcAddr(aSrcAddr),iDstAddr(aDstAddr),iTransferCount(aTransferCount),iPslRequestInfo(aPslRequestInfo),iIsrCb(aIsrCb)
-			{}
-		TUint iDriverCookie;
-		TUint32 iSrcAddr;
-		TUint32 iDstAddr;
-		TInt iTransferCount;
-		TUint32 iPslRequestInfo;
-		TBool iIsrCb;
-		};
-
 	/**
 	This struct is used for queing and including a set of transfers
 	to be setup from ISR context callback
@@ -546,10 +644,10 @@
 		TIsrRequeArgsSet iRequeSet;
 		};
 
-
 	enum TControl
 		{
 		EOpenChannel,
+		EOpenChannelExposed,
 		ECloseChannel,
 		EPauseChannel,
 		EResumeChannel,
--- a/kerneltest/e32test/dmav2/d_dma2_cmn.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/dmav2/d_dma2_cmn.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -133,7 +133,9 @@
 		return EThread;
 	case NKern::EInterrupt:
 		return EIsr;
-	case NKern::EIDFC: //fall-through
+	//Fall-through: If context is IDFC or the EEscaped marker occur
+	//it is an error
+	case NKern::EIDFC:
 	case NKern::EEscaped:
 	default:
 		return EInvalid;
@@ -175,7 +177,6 @@
 TAddrRange::TAddrRange(TUint aStart, TUint aLength)
 	:iStart(aStart), iLength(aLength)
 	{
-	TEST_ASSERT(iLength > 0);
 	}
 
 TBool TAddrRange::Contains(TAddrRange aRange) const
@@ -188,21 +189,43 @@
 	return (aRange.Contains(iStart) || aRange.Contains(End()) ||
 			Contains(aRange.Start()) || Contains(aRange.End()));
 	}
+
+TBool TAddrRange::IsFilled(TUint8 aValue) const
+	{
+	TUint8* buffer = reinterpret_cast<TUint8*>(iStart);
+	for(TUint i = 0; i < iLength; i++)
+		{
+		if(buffer[i] != aValue)
+			return EFalse;
+		}
+	return ETrue;
+	}
+
 /**
-If addresses have been left as KPhysAddrInvalid or the count as 0
-(ie. the default values used for IsrRedoRequest)
-then substitute the values from aTransferArgs.
+If addresses have been left as KPhysAddrInvalid or the count as 0 (ie. the
+default values used for IsrRedoRequest) then substitute the values from
+aTransferArgs.
 */
 void TAddressParms::Substitute(const TDmaTransferArgs& aTransferArgs)
 	{
+	Substitute(GetAddrParms(aTransferArgs));
+	}
+
+/**
+If addresses have been left as KPhysAddrInvalid or the count as 0 (ie. the
+default values used for IsrRedoRequest) then substitute the values from
+aTransferArgs.
+*/
+void TAddressParms::Substitute(const TAddressParms& aAddrParams)
+	{
 	if(iSrcAddr == KPhysAddrInvalidUser)
-		iSrcAddr = aTransferArgs.iSrcConfig.iAddr;
+		iSrcAddr = aAddrParams.iSrcAddr;
 
 	if(iDstAddr == KPhysAddrInvalidUser)
-		iDstAddr = aTransferArgs.iDstConfig.iAddr;
+		iDstAddr = aAddrParams.iDstAddr;
 
 	if(iTransferCount == 0)
-		iTransferCount = aTransferArgs.iTransferCount;
+		iTransferCount = aAddrParams.iTransferCount;
 	}
 
 /**
@@ -295,6 +318,18 @@
 	return TAddrRange(iDstAddr, iTransferCount);
 	}
 
+void TAddressParms::MakePhysical()
+	{
+#ifdef __KERNEL_MODE__
+	iSrcAddr = Epoc::LinearToPhysical(iSrcAddr);
+	TEST_ASSERT(iSrcAddr != KPhysAddrInvalid);
+	iDstAddr = Epoc::LinearToPhysical(iDstAddr);
+	TEST_ASSERT(iDstAddr != KPhysAddrInvalid);
+#else
+	TEST_FAULT;
+#endif
+	}
+
 void SetAddrParms(TDmaTransferArgs& aTransferArgs, const TAddressParms& aAddrParams)
 	{
 	aTransferArgs.iSrcConfig.iAddr = aAddrParams.iSrcAddr;
@@ -311,14 +346,27 @@
 	return args;
 	}
 
-
 void TIsrRequeArgsSet::Substitute(const TDmaTransferArgs& aTransferArgs)
 	{
+	TAddressParms initial(aTransferArgs);
+
+	//if on user side it is assumed that aTransferArgs addresses will be offset
+	//based (from a virtual address). In kernel mode it is expected that address
+	//will be absolute virtual addresses, and must therefore be made physical
+#ifdef __KERNEL_MODE__
+	initial.MakePhysical();
+#endif
+
+	const TAddressParms* previous = &initial;
+
 	for(TInt i=0; i<iCount; i++)
 		{
-		iRequeArgs[i].Substitute(aTransferArgs);
+		TAddressParms& current = iRequeArgs[i];
+		current.Substitute(*previous);
+		previous = &current;
 		}
 	}
+
 void TIsrRequeArgsSet::Fixup(TLinAddr aChunkBase)
 	{
 	for(TInt i=0; i<iCount; i++)
@@ -326,3 +374,58 @@
 		iRequeArgs[i].Fixup(aChunkBase);
 		}
 	}
+
+/** Check that both source and destination of ISR reque args will lie within the
+range specified by aStart and aSize.
+
+@param aStart The linear base address of the region
+@param aSize The size of the region
+*/
+TBool TIsrRequeArgs::CheckRange(TLinAddr aStart, TUint aSize) const
+	{
+	TUint chunkStart = 0;
+#ifdef __KERNEL_MODE__
+	chunkStart = Epoc::LinearToPhysical(aStart);
+	TEST_ASSERT(chunkStart != KPhysAddrInvalid);
+#else
+	chunkStart = aStart;
+#endif
+
+	// If an address is still KPhysAddrInvalid it means the arguments haven't
+	// yet been substituted
+	TAddrRange chunk(chunkStart, aSize);
+	TBool sourceOk = (iSrcAddr != KPhysAddrInvalid) && chunk.Contains(SourceRange());
+
+	TBool destOk = (iDstAddr != KPhysAddrInvalid) && chunk.Contains(DestRange());
+
+	TBool ok = sourceOk && destOk;
+	if(!ok)
+		{
+		PRINTF(("Error, re-queue args: "));
+		TBuf<128> buf;
+		AppendString(buf);
+		PRINTF(("%S", &buf));
+		PRINTF(("overflow buffer base=0x%08x, size=0x%08x", chunkStart, aSize));
+		}
+	return ok;
+	}
+
+TBool TIsrRequeArgsSet::CheckRange(TLinAddr aAddr, TUint aSize) const
+	{
+	for(TInt i=0; i<iCount; i++)
+		{
+		if(!iRequeArgs[i].CheckRange(aAddr, aSize))
+			return EFalse;
+		}
+	return ETrue;
+	}
+
+TBool TIsrRequeArgsSet::CheckRange(TLinAddr aAddr, TUint aSize, const TDmaTransferArgs& aInitialParms) const
+	{
+	// apply substitution, without modifying the original
+	TIsrRequeArgsSet copy(*this);
+	copy.Substitute(aInitialParms);
+
+	return copy.CheckRange(aAddr, aSize);
+	}
+
--- a/kerneltest/e32test/dmav2/dma_api_tests.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// e32test\dma\dma_api_tests.cpp
-// 
-// Overview:
-//  This file contains API tests for the new DMA framework
-//
-
-#define __E32TEST_EXTENSION__
-#include "d_dma2.h"
-#include "u32std.h"
-#include "t_dma2.h"
-#include "cap_reqs.h"
-
-#include <e32test.h>
-#include <e32debug.h>
-#include <e32svr.h>
-
-static RTest test(_L("DMA Test Framework API"));
-//----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2564
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    This test checks the correct behaviour of Open API in the new DMA framework
-//!
-//! @SYMTestActions     
-//!						1.  Open a DMA channel
-//!						2.	Verify that channel is really open.
-//!
-//! @SYMTestExpectedResults 
-//!						1.  DMA channel opens and KErrNone returned
-//!						2.  Call to ChannelIsOpened() return as ETrue.
-//!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
-//----------------------------------------------------------------------------------------------
-void test_open_api()
-{
-	//TO DO : Expose TInt Open(const SCreateInfo& aInfo, TDmaChannel*& aChannel)
-	//TO DO : Implement more test cases
-	test.Start(_L("*** Testing Open() API  ***"));
-
-	test.Next(_L("Open session"));
-	RDmaSession session;
-	TInt r = session.Open();
-	test_KErrNone(r);
-
-	TUint channelCookie_open_api=0;
-	
-	test.Next(_L("Open DMA Channel"));
-	channelCookie_open_api=0;
-	r = session.ChannelOpen(16, channelCookie_open_api);
-	test.Printf(_L("cookie recieved = 0x%08x\n"), channelCookie_open_api);
-	test_KErrNone(r);
-
-	//Check if channel is open
-	// test.Printf(_L("Verify that the specified DMA channel is opened\n"));	
-	// TBool channelOpened;
-	// TBool channelNotOpened = EFalse;
-	// r = session.ChannelIsOpened(channelCookie_open_api,  channelOpened);
-	// test_KErrNone(r);	
- 	// TEST_ASSERT(channelOpened != channelNotOpened)
-	
-	//close channel
-	test.Next(_L("Channel close"));
-	r = session.ChannelClose(channelCookie_open_api);
-	test_KErrNone(r);
-	
-	RTest::CloseHandleAndWaitForDestruction(session);
-	test.End();
-}
-
-//----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2568
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    This test checks the correct behaviour of Close API in the new DMA framework
-//!
-//! @SYMTestActions     
-//!						1.  Open a DMA channel
-//!						2.	Open DMA Channel again
-//!						3	Close the DMA channel.
-//!						4	Open DMA channel to verify that the DMA channel closed.
-//!						5.	Open DMA channel again.
-//!						6.	Queue a request on the channel.
-//!						7.	Close DMA channel while request is still queued on it.
-//!
-//! @SYMTestExpectedResults 
-//!						1.  DMA channel opens and KErrNone returned.
-//!						2.	DMA Framework returns KErrInUse as channel is already open.					
-//!						3.	DMA channel closes and KErrNone returned.
-//!						4.	DMA channel opens and KErrNone returned.
-//!						5.	DMA Framework returns KErrInUse as channel is already open.
-//!						6.	DMA request queued and KErrNone returned.
-//!						7.	DMA channel closes and DMA framework flags an error.
-//!							
-//!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
-//----------------------------------------------------------------------------------------------
-void test_close_api()
-{
-	test.Start(_L("*** Testing Close() API  ***"));
-	
-	test.Next(_L("Open session"));
-	RDmaSession session;
-	TInt r = session.Open();
-	test_KErrNone(r);
-
-	const TInt size = 64 * KKilo;
-	TUint reqCookieNewStyle_close_api=0;	
-	TUint channelCookie_close_api=0;
-	
-	test.Next(_L("Open a single DMA channel"));
-	r = session.ChannelOpen(16, channelCookie_close_api);
-	test.Printf(_L("cookie recieved = 0x%08x\n"), channelCookie_close_api);
-	test_KErrNone(r);
-
-	// test.Next(_L("Open DMA channel again"));
-	// TUint channelCookie_close_api_1=0;
-	// r = session.ChannelOpen(16, channelCookie_close_api_1);
-	// test.Printf(_L("Verify that DMA channel is already opened\n"));
-	// test_Equal(KErrInUse,r); 
-
-	test.Next(_L("Close the DMA channel"));
-	r = session.ChannelClose(channelCookie_close_api);
-	test_KErrNone(r);
-
-	test.Next(_L("Open DMA channel again"));
-	r = session.ChannelOpen(16, channelCookie_close_api);
-	test.Printf(_L("Verify that DMA channel was closed\n"));
-	test_KErrNone(r); 
-
-	//Fails if a request is created and cancel
-	test.Next(_L("Queue a request on the channel"));
-  	r = session.RequestCreateNew(channelCookie_close_api, reqCookieNewStyle_close_api); //Create Dma request (with new-style callback)
-  	test.Printf(_L("cookie recieved for open channel = 0x%08x\n"), reqCookieNewStyle_close_api);
-  	test_KErrNone(r);
-  
-  	TDmaTransferArgs transferArgs_close_api;
-  	transferArgs_close_api.iSrcConfig.iAddr = 0;
-  	transferArgs_close_api.iDstConfig.iAddr = size;
-  	transferArgs_close_api.iSrcConfig.iFlags = KDmaMemAddr;
-  	transferArgs_close_api.iDstConfig.iFlags = KDmaMemAddr;
-  	transferArgs_close_api.iTransferCount = size;
-  	r = session.FragmentRequest(reqCookieNewStyle_close_api, transferArgs_close_api);
-  	test_KErrNone(r);
-  	
-  	test.Next(_L("Queue DMA Request"));
-  	TCallbackRecord record_close_api;
-  	r = session.QueueRequest(reqCookieNewStyle_close_api, &record_close_api);
-  	test_KErrNone(r);
-	
-	test.Next(_L("Destroy Dma request"));
-	r = session.RequestDestroy(reqCookieNewStyle_close_api);
-	test_KErrNone(r);
-
-	test.Next(_L("Close the DMA channel"));
-	r = session.ChannelClose(channelCookie_close_api);
-	test_KErrNone(r);
-
-	test.End();
-	RTest::CloseHandleAndWaitForDestruction(session);
-}
-
-void RDmaSession::ApiTest()
-	{
-    test_open_api();     // Verify that Open() opens a DMA channel
-    test_close_api();    // Verify that Close() closes a DMA channel
-	}
-
-void ApiTests()
-	{
-	test.Next(_L("Running framework API tests"));
-	RDmaSession::ApiTest();	
-	test.Close();
-	}
--- a/kerneltest/e32test/dmav2/self_test.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/dmav2/self_test.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -49,9 +49,32 @@
 	Print(testInfo);
 	}
 
-	test.Next(_L("Channel open"));
+	// Self test just needs 1 channel
+	// The real test will test all available ones
+	test.Next(_L("Select test channel"));
+	TUint testChannel = 0;
+	if(testInfo.iMaxSbChannels > 0)
+		{
+		testChannel = testInfo.iSbChannels[0];
+		}
+	else if(testInfo.iMaxDbChannels > 0)
+		{
+		testChannel = testInfo.iDbChannels[0];
+		}
+	else if(testInfo.iMaxSgChannels > 0)
+		{
+		testChannel = testInfo.iSgChannels[0];
+		}
+	else
+		{
+		test.Printf(_L("Driver exposes no channels to test"));
+		test(EFalse);
+		}
+
+	test.Printf(_L("using PSL cookie %d (0x%08x)\n"), testChannel, testChannel);
+	test.Next(_L("Open channel"));
 	TUint channelCookie=0;
-	r = session.ChannelOpen(16, channelCookie);
+	r = session.ChannelOpen(testChannel, channelCookie);
 	test.Printf(_L("cookie recived = 0x%08x\n"), channelCookie);
 	test_KErrNone(r);
 
@@ -99,7 +122,7 @@
 
 	test.Next(_L("Create Dma request - max fragment size 32K"));
 	TUint reqCookie=0;
-	r = session.RequestCreate(channelCookie, reqCookie, 32 * KKilo);
+	r = session.RequestCreateOld(channelCookie, reqCookie, 32 * KKilo);
 	test.Printf(_L("cookie recived = 0x%08x\n"), reqCookie);
 	test_KErrNone(r);
 
@@ -107,7 +130,7 @@
 		{
 		test.Next(_L("Create Dma request (with new-style callback)"));
 		TUint reqCookieNewStyle=0;
-		r = session.RequestCreateNew(channelCookie, reqCookieNewStyle);
+		r = session.RequestCreate(channelCookie, reqCookieNewStyle);
 		test.Printf(_L("cookie recived = 0x%08x\n"), reqCookieNewStyle );
 		test_KErrNone(r);
 
@@ -271,50 +294,6 @@
 void TDmaCapability::SelfTest()
 	{
 	test.Start(_L("Unit test_Value of TDmaCapability::CompareToDmaCaps\n"));
-
-	{
-	test.Next(_L("ENone\n"));
-	TResult t = none.CompareToDmaCaps(KTestCapSet);
-	test_Value(t, t == ERun);
-	}
-
-	{
-	test.Next(_L("EChannelPauseAndResume - wanted\n"));
-	TResult t = pauseRequired.CompareToDmaCaps(KTestCapSet);
-	test_Value(t, t == EFail);
-	}
-	{
-	test.Next(_L("EChannelPauseAndResume - wanted - Allow skip\n"));
-	TResult t = pauseRequired_skip.CompareToDmaCaps(KTestCapSet);
-	test_Value(t, t == ESkip);
-	}
-	{
-	test.Next(_L("EChannelPauseAndResume - not wanted\n"));
-	TResult t = pauseNotWanted.CompareToDmaCaps(KTestCapSet);
-	test_Value(t, t == ERun);
-	}
-
-	{
-	test.Next(_L("EHwDescriptors - not wanted\n"));
-	TResult t = hwDesNotWanted.CompareToDmaCaps(KTestCapSet);
-	test_Value(t, t == EFail);
-	}
-
-	{
-	test.Next(_L("EHwDescriptors - not wanted - Allow skip\n"));
-	TResult t = hwDesNotWanted_skip.CompareToDmaCaps(KTestCapSet);
-	test_Value(t, t == ESkip);
-	}
-
-	{
-	test.Next(_L("EHwDescriptors - wanted\n"));
-	TResult t = hwDesWanted.CompareToDmaCaps(KTestCapSet);
-	test_Value(t, t == ERun);
-	}
-
-
-//TODO use this macro for the above tests
-
 // Note: The construction of the test description message
 // is horribly confusing. The _L macro will make the
 // *first* string token wide, but not the next two.
@@ -328,6 +307,13 @@
 	test_Equal(EXPCT, t);\
 	}
 
+	CAP_TEST(none, KTestCapSet, ERun);
+	CAP_TEST(pauseRequired, KTestCapSet, EFail);
+	CAP_TEST(pauseRequired_skip, KTestCapSet, ESkip);
+	CAP_TEST(pauseNotWanted, KTestCapSet, ERun);
+	CAP_TEST(hwDesNotWanted, KTestCapSet, EFail);	
+	CAP_TEST(hwDesNotWanted_skip, KTestCapSet, ESkip);
+	CAP_TEST(hwDesWanted, KTestCapSet, ERun);
 
 	CAP_TEST(capEqualV1, KDmacTestCapsV1, ERun);
 	CAP_TEST(capEqualV2, KDmacTestCapsV2, ERun);
@@ -345,56 +331,39 @@
 
 void TTestCase::SelfTest()
 	{
-	//TODO should use macros for these tests
 	test.Start(_L("Unit test of TTestCase::TestCaseValid\n"));
 
-	TTestCase testCase(NULL, EFalse, pauseRequired, hwDesNotWanted);
-	test.Next(_L("pauseRequired, hwDesNotWanted\n"));
-	TResult t = testCase.TestCaseValid(KTestCapSet);
-	test_Value(t, t == EFail);
-
-	test.Next(_L("pauseRequired_skip, hwDesNotWanted\n"));
-	testCase.iChannelCaps[0] = pauseRequired_skip;
-	t = testCase.TestCaseValid(KTestCapSet);
-	test_Value(t, t == EFail);
-
-	test.Next(_L("pauseRequired_skip, hwDesNotWanted_skip\n"));
-	testCase.iChannelCaps[1] = hwDesNotWanted_skip;
-	t = testCase.TestCaseValid(KTestCapSet);
-	test_Value(t, t == ESkip);
-
-	test.Next(_L("pauseNotWanted, hwDesNotWanted_skip\n"));
-	testCase.iChannelCaps[0] = pauseNotWanted;
-	t = testCase.TestCaseValid(KTestCapSet);
-	test_Value(t, t == ESkip);
+// Create a TTestCase with paramaters CAP1 and CAP2
+// call TTestCase::TestCaseValid against CAPSET
+// Expected result is EXPCT
+#define TEST_TEST_CASE(CAP1, CAP2, CAPSET, EXPCT)\
+	{\
+	test.Next(_L(#CAP1 L", " L ## #CAP2 L" -- Against: " L ## #CAPSET L", Expect: " L ## #EXPCT));\
+	TTestCase testCase(NULL, EFalse, CAP1, CAP2);\
+	testCase.iChannelCaps[0] = (CAP1);\
+	TResult t = testCase.TestCaseValid(CAPSET);\
+	test_Equal(EXPCT, t);\
+	}
 
-	test.Next(_L("pauseNotWanted, hwDesWanted\n"));
-	testCase.iChannelCaps[1] = hwDesWanted;
-	t = testCase.TestCaseValid(KTestCapSet);
-	test_Value(t, t == ERun);
+	TEST_TEST_CASE(pauseRequired, hwDesNotWanted, KTestCapSet, EFail);
+	TEST_TEST_CASE(pauseRequired_skip, hwDesNotWanted, KTestCapSet, EFail);
+	TEST_TEST_CASE(pauseRequired_skip, hwDesNotWanted_skip, KTestCapSet, ESkip);
+	TEST_TEST_CASE(pauseNotWanted, hwDesNotWanted_skip, KTestCapSet, ESkip);
+	TEST_TEST_CASE(pauseNotWanted, hwDesWanted, KTestCapSet, ERun);
+    TEST_TEST_CASE(pauseNotWanted, none, KTestCapSet, ERun);
 
-	test.Next(_L("pauseNotWanted\n"));
-	testCase.iChannelCaps[1] = none;
-	t = testCase.TestCaseValid(KTestCapSet);
-	test_Value(t, t == ERun);
+	TEST_TEST_CASE(pauseNotWanted, capAboveV1, KDmacTestCapsV1, ESkip);
+	TEST_TEST_CASE(pauseNotWanted, capAboveV1, KDmacTestCapsV2, ERun);
 
-	test.Next(_L("pauseNotWanted + V1 PIL required\n"));
-	testCase.iChannelCaps[1] = capAboveV1;
-	test.Next(_L("Against KDmacTestCapsV1"));
-	t = testCase.TestCaseValid(KDmacTestCapsV1);
-	test_Equal(ESkip, t);
-	test.Next(_L("Against KDmacTestCapsV2"));
-	t = testCase.TestCaseValid(KDmacTestCapsV2);
-	test_Equal(ERun, t);
+	TEST_TEST_CASE(pauseNotWanted, capBelowV2, KDmacTestCapsV1, ERun);
+	TEST_TEST_CASE(pauseNotWanted, capBelowV2, KDmacTestCapsV2, ESkip);
 
-	test.Next(_L("pauseNotWanted + >V1 PIL required\n"));
-	testCase.iChannelCaps[1] = capBelowV2;
-	test.Next(_L("Against KDmacTestCapsV1"));
-	t = testCase.TestCaseValid(KDmacTestCapsV1);
-	test_Equal(ERun, t);
-	test.Next(_L("Against KDmacTestCapsV2"));
-	t = testCase.TestCaseValid(KDmacTestCapsV2);
-	test_Equal(ESkip, t);
+	// contradictory requirements
+	TEST_TEST_CASE(capAboveV1, capBelowV2, KDmacTestCapsV2, ESkip);
+	TEST_TEST_CASE(capBelowV2, capAboveV1, KDmacTestCapsV2, ESkip);
+
+	TEST_TEST_CASE(capAboveV1, capBelowV2, KDmacTestCapsV1, ESkip);
+	TEST_TEST_CASE(capBelowV2, capAboveV1, KDmacTestCapsV1, ESkip);
 
 	test.End();
 	test.Close();
@@ -461,7 +430,7 @@
 
 void TCallbackRecord::SelfTest()
 	{
-	test.Start(_L("SeltTest of TCallbackRecord"));
+	test.Start(_L("SelfTest of TCallbackRecord"));
 
 	test.Next(_L("create default TCallbackRecord record, record2"));
 	TCallbackRecord record;
@@ -559,6 +528,7 @@
 	test.Start(_L("SelfTest of CDmaBenchmark"));
 	test.Next(_L("MeanResult()"));
 
+	// The mean of these numbers is 10
 	TUint64 results[] = {8, 12, 1, 19, 3, 17, 10};
 	const TInt count = ARRAY_LENGTH(results);
 
@@ -612,6 +582,18 @@
 
 	test(!a.Contains(b));
 	test(!b.Contains(a));
+
+	test.Next(_L("Test IsFilled()"));
+	TUint8 buffer[] = {0,0,0,0};
+	TAddrRange range((TUint)buffer, 4);
+	test(range.IsFilled(0));
+	buffer[3] = 1;
+	test(!range.IsFilled(0));
+	buffer[2] = 1;
+	buffer[1] = 1;
+	buffer[0] = 1;
+	test(range.IsFilled(1));
+
 	test.End();
 	}
 
@@ -649,6 +631,187 @@
 	test.End();
 	}
 
+void TIsrRequeArgsSet::SelfTest()
+	{
+	test.Start(_L("Selftest of TIsrRequeArgsSet"));
+
+	TUint size = 0x1000;
+	TDmaTransferArgs tferArgs(0, 1*size, size, KDmaMemAddr, KDmaSyncAuto, KDmaRequestCallbackFromIsr);
+
+	TIsrRequeArgs requeArgArray[] = {
+		TIsrRequeArgs(),									// Repeat
+		TIsrRequeArgs(KPhysAddrInvalidUser, 2*size, 0),		// Change destination
+		TIsrRequeArgs(),									// Repeat
+		TIsrRequeArgs(3*size, KPhysAddrInvalidUser, 0),		// Change source
+		TIsrRequeArgs(),									// Repeat
+	};
+	TIsrRequeArgsSet argSet(requeArgArray, ARRAY_LENGTH(requeArgArray));
+
+	test.Next(_L("Test that Substitute updates transfer args in order"));
+	argSet.Substitute(tferArgs);
+
+	TAddressParms expectedFinal(3*size, 2*size, size);
+	if(!(expectedFinal == argSet.iRequeArgs[4]))
+		{
+		TBuf<0x100> out;
+
+		out += _L("substitue: ");
+		GetAddrParms(tferArgs).AppendString(out);
+		test.Printf(out);
+
+		out.Zero();
+		out += _L("\nexpected final: ");
+		expectedFinal.AppendString(out);
+		test.Printf(out);
+
+		out.Zero();
+		out += _L("\nactual: ");
+		argSet.iRequeArgs[4].AppendString(out);
+		test.Printf(out);
+
+		test(EFalse);
+		}
+
+	TIsrRequeArgs requeArgArray2[] = {
+		TIsrRequeArgs(),									// Repeat
+		TIsrRequeArgs(KPhysAddrInvalidUser, 2*size, 0),		// Change destination
+		TIsrRequeArgs(KPhysAddrInvalidUser, 1*size, 0),		// Change destination back
+	};
+	argSet = TIsrRequeArgsSet(requeArgArray2, ARRAY_LENGTH(requeArgArray2));
+
+	test.Next(_L("CheckRange(), negative"));
+
+	test(!argSet.CheckRange(0, (2 * size) - 1, tferArgs));
+	test(!argSet.CheckRange(0, (2 * size) + 1, tferArgs));
+	test(!argSet.CheckRange(0, (2 * size), tferArgs));
+
+	test(!argSet.CheckRange(1 ,(3 * size), tferArgs));
+	test(!argSet.CheckRange(1 ,(3 * size) + 1, tferArgs));
+
+	test(!argSet.CheckRange(1 * size , 2 * size, tferArgs));
+
+	test.Next(_L("CheckRange(), positive"));
+	test(argSet.CheckRange(0, 3 * size, tferArgs));
+	test(argSet.CheckRange(0, 3 * size+1, tferArgs));
+	test(argSet.CheckRange(0, 4 * size, tferArgs));
+
+
+	test.End();
+	}
+
+void RArrayCopyTestL()
+	{
+	test.Start(_L("Selftest of RArray CopyL"));
+
+	RArray<TInt> orig;
+	TInt i;													// VC++
+	for(i=0; i<10; i++)
+		{
+		orig.AppendL(i);
+		}
+
+	RArray<TInt> newArray;
+	CopyL(orig, newArray);
+
+	test_Equal(10, newArray.Count());
+
+	for(i=0; i<10; i++)
+		{
+		test_Equal(orig[i], newArray[i])
+		}
+
+	orig.Close();
+	newArray.Close();
+	test.End();
+	}
+
+void RArrayInsertLTest()
+	{
+	test.Start(_L("Selftest of RArray InsertL"));
+
+	RArray<TInt> array;
+	TInt numbers[10] = {0,1,2,3,4,5,6,7,8,9};
+	ArrayAppendL(array, &numbers[0], numbers + ARRAY_LENGTH(numbers));
+
+	test_Equal(10, array.Count());
+	for(TInt i=0; i<10; i++)
+		{
+		test_Equal(numbers[i], array[i])
+		}
+
+	array.Close();
+	test.End();
+	}
+
+/**
+Run check buffers on the supplied TAddressParms array
+*/
+TBool DoTferParmTestL(const TAddressParms* aParms, TInt aCount, TBool aAllowRepeat, TBool aPositive)
+	{
+	_LIT(KPositive, "positive");
+	_LIT(KNegative, "negative");
+	test.Printf(_L("CheckBuffers %S test: %d args, repeats allowed %d\n"),
+			(aPositive ? &KPositive : &KNegative), aCount, aAllowRepeat);
+	RArray<const TAddressParms> array;
+	ArrayAppendL(array, aParms, aParms + aCount);
+	TPreTransferIncrBytes preTran;
+	TBool r = preTran.CheckBuffers(array, aAllowRepeat);
+	array.Close();
+	return r;
+	}
+
+void TPreTransferIncrBytes::SelfTest()
+	{
+	// Test that TPreTransferIncrBytes::CheckBuffers can identify
+	// overlapping buffers
+	test.Start(_L("Selftest of TPreTransferIncrBytes"));
+
+// Macro generates test for 2 element array
+#define TPARM_TEST2(EXPECT, ALLOW_REPEAT, EL0, EL1)\
+		{\
+		TAddressParms set[2] = {EL0, EL1}; \
+		const TBool r = DoTferParmTestL(set, 2, ALLOW_REPEAT, EXPECT);\
+		test_Equal(EXPECT, r);\
+		}
+
+// Generate positive 2 element test
+#define TPARM_TEST2_POSITIVE(ALLOW_REPEAT, EL0, EL1) TPARM_TEST2(ETrue, ALLOW_REPEAT, EL0, EL1)
+// Generate negative 2 element test
+#define TPARM_TEST2_NEG(ALLOW_REPEAT, EL0, EL1) TPARM_TEST2(EFalse, ALLOW_REPEAT, EL0, EL1)
+
+// Macro generates test for 3 element array
+#define TPARM_TEST3(EXPECT, ALLOW_REPEAT, EL0, EL1, EL2)\
+		{\
+		TAddressParms set[3] = {EL0, EL1, EL2}; \
+		const TBool r = DoTferParmTestL(set, 3, ALLOW_REPEAT, EXPECT);\
+		test_Equal(EXPECT, r);\
+		}
+
+// Generate positive 3 element test
+#define TPARM_TEST3_POSITIVE(ALLOW_REPEAT, EL0, EL1, EL2) TPARM_TEST3(ETrue, ALLOW_REPEAT, EL0, EL1, EL2)
+// Generate negative 3 element test
+#define TPARM_TEST3_NEG(ALLOW_REPEAT, EL0, EL1, EL2) TPARM_TEST3(EFalse, ALLOW_REPEAT, EL0, EL1, EL2)
+
+	TPARM_TEST2_POSITIVE(EFalse, TAddressParms(0,16,16), TAddressParms(32, 48, 16));
+	TPARM_TEST2_POSITIVE(ETrue, TAddressParms(0, 16, 16), TAddressParms(0, 16, 16)); // both overlap (repeat allowed)
+
+	TPARM_TEST2_NEG(EFalse, TAddressParms(0,16,16), TAddressParms(24, 40, 16)); // second source depends on first destination
+	TPARM_TEST2_NEG(EFalse, TAddressParms(0,16,16), TAddressParms(16, 0, 16)); // second dest overwrites first source
+	TPARM_TEST2_NEG(EFalse, TAddressParms(0, 16, 16), TAddressParms(0, 16, 16)); // both overlap (repeat not allowed)
+	TPARM_TEST2_NEG(ETrue, TAddressParms(0, 16, 16), TAddressParms(0, 20, 16)); // exact repeat allowed, but overlap is only partial
+	TPARM_TEST2_NEG(ETrue, TAddressParms(0, 16, 16), TAddressParms(32, 16, 16)); // exact repeat allowed, but 2nd overwrites first dest
+
+
+	TPARM_TEST3_POSITIVE(EFalse, TAddressParms(0,16,16), TAddressParms(32, 48, 16), TAddressParms(64, 128, 64)); // no overlaps
+	TPARM_TEST3_POSITIVE(ETrue, TAddressParms(0, 16, 16), TAddressParms(0, 16, 16), TAddressParms(0, 16, 16)); // all overlap (repeat allowed)
+	TPARM_TEST3_POSITIVE(EFalse, TAddressParms(0,16,16), TAddressParms(0, 32, 16), TAddressParms(0, 48, 16)); // no overlaps (1 src to 3 dsts)
+
+	TPARM_TEST3_NEG(EFalse, TAddressParms(0,16,16), TAddressParms(128, 256, 128), TAddressParms(24, 40, 16)); // 3rd source depends on first destination
+	TPARM_TEST3_NEG(EFalse, TAddressParms(0,16,16), TAddressParms(128, 256, 128), TAddressParms(16, 0, 16)); // 3rd dest overwrites first source
+	TPARM_TEST3_NEG(EFalse, TAddressParms(0, 16, 16), TAddressParms(0, 16, 16), TAddressParms(0, 16, 16)); // all overlap (repeat not allowed)
+	test.Next(_L("CheckBuffers(RArray<TAddressParms>)"));
+	}
+
 void SelfTests()
 	{
 	test.Next(_L("Running framework unit tests"));
@@ -660,6 +823,10 @@
 	CDmaBmFragmentation::SelfTest();
 	TAddrRange::SelfTest();
 	TAddressParms::SelfTest();
+	TIsrRequeArgsSet::SelfTest();
+	RArrayCopyTestL();
+	RArrayInsertLTest();
+	TPreTransferIncrBytes::SelfTest();
 	test.End();
 	test.Close();
 	}
--- a/kerneltest/e32test/dmav2/t_dma2.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/dmav2/t_dma2.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -11,7 +11,7 @@
 // Contributors:
 //
 // Description:
-// e32test\dma\t_dma.cpp
+// e32test\dmav2\t_dma2.cpp
 
 #include "d_dma2.h"
 #include "u32std.h"
@@ -26,18 +26,67 @@
 
 // DMA test framework command  parameter options
 
-// SelfTest Option
+// SelfTest option
 _LIT(KArgSelfTest, "/SELFTEST");  
 _LIT(KArgSelfTest2, "/S");		  
 
-//Verbose Option
+//Verbose option
 _LIT(KArgVerboseOutput, "/VERBOSE"); 
 _LIT(KArgVerboseOutput2, "/V");	     
   
+//Simple transfer test option
+_LIT(KArgSimpleTest, "/simple"); 
+
+//Callback test option
+_LIT(KArgCallBackTest, "/callback");
+
+//Suspend test option
+_LIT(KArgSuspendTest, "/suspend");
+
+//Multipart transfer tests
+_LIT(KArgMultiPartTest, "/multi");
+
+//Isr and dfc test option
+_LIT(KArgIsrDfcTest, "/isrdfc");
+
+//Isr reque  test option
+_LIT(KArgIsrequeTest, "/isreque");
+
+//Benchmark test option
+_LIT(KArgBenchmarkTest, "/bench");
+
+//Graphics test option
+_LIT(KArgGraphicTest, "/graphic");
+
+//DMA channel (opening and closing)  test option
+_LIT(KArgChannelTest, "/channel");
+
+//Queue test option
+_LIT(KArgQueueTest, "/queue");
+
+//Fragment test option
+_LIT(KArgFragmentTest, "/fragment");
+
+//Request test option
+_LIT(KArgRequestTest, "/request");
+
+
 
 TBool gHelpRequested;   // print usage 
 TBool gVerboseOutput;   // enable verbose output 
 TBool gSelfTest;        // run SelfTest 
+TBool gSimpleTest;		// run only Simple transfer test
+TBool gCallBack;		// run only Callback test
+TBool gSuspend;			// run only Pause and resume tests
+TBool gIsrReque;		// run only IsrReque tests
+TBool gMultiPart;		// run only Multipart tests
+TBool gIsrAndDfc;		// run only IsrAndDfc tests
+TBool gBenchmark;		// run only Benchmark tests
+TBool gGraphic;			// run only Graphic tests
+TBool gFragment;		// run only Fragment related tests
+TBool gChannel;			// run only Channel(open/close)tests
+TBool gQueue;			// run only Queue related tests
+TBool gRequest;			// run only Request related tests
 
 /**
 This function prints out the PSL test Information
@@ -77,8 +126,25 @@
 
 void CDmaTest::OpenDmaSession()
 	{
-	TInt r = iDmaSession.Open();
+	// Only open a new session if one
+	// was not already supplied
+	if(iDmaSession.Handle() == KNullHandle)
+		{
+		TInt r = iDmaSession.Open();
+		TEST_ASSERT(r == KErrNone);
+		r = iDmaSession.OpenSharedChunk(iChunk);
+		TEST_ASSERT(r == KErrNone);
+		}
+	}
+
+// Open another handle to the test driver
+void CDmaTest::OpenDmaSession(const RDmaSession& aSession)
+	{
+	iDmaSession = aSession;
+	TInt r = iDmaSession.Duplicate(RThread(), EOwnerThread);
 	TEST_ASSERT(r == KErrNone);
+
+	// open another handle to the test driver chunk
 	r = iDmaSession.OpenSharedChunk(iChunk);
 	TEST_ASSERT(r == KErrNone);
 	}
@@ -89,6 +155,26 @@
 	iDmaSession.Close();
 	}
 
+void CDmaTest::PreTransferSetup()
+	{
+	}
+
+TInt CDmaTest::DoPostTransferCheck()
+	{
+	return KErrNotSupported;
+	}
+
+void CDmaTest::ChannelPause(TUint aChannelSessionCookie)
+{
+	TInt r = iDmaSession.ChannelPause(aChannelSessionCookie);
+	TEST_ASSERT(r == KErrNone);
+}
+
+void CDmaTest::ChannelResume(TUint aChannelSessionCookie)
+{
+	TInt r = iDmaSession.ChannelResume(aChannelSessionCookie);
+	TEST_ASSERT(r == KErrNone);
+}
 //////////////////////////////////////////////////////////////////////
 // CSingleTransferTest
 //////////////////////////////////////////////////////////////////////
@@ -123,7 +209,7 @@
 			RDebug::Printf("Calling New Request API\n");
 			}
 		iActual.iRequestResult.iCreate =
-			iDmaSession.RequestCreateNew(iChannelSessionCookie, iRequestSessionCookie, iMaxFragmentSize);
+			iDmaSession.RequestCreate(iChannelSessionCookie, iRequestSessionCookie, iMaxFragmentSize);
 		}
 	else
 		{
@@ -132,7 +218,7 @@
 			RDebug::Printf("Calling Old Request API\n");
 			}
 		iActual.iRequestResult.iCreate =
-			iDmaSession.RequestCreate(iChannelSessionCookie, iRequestSessionCookie, iMaxFragmentSize);
+			iDmaSession.RequestCreateOld(iChannelSessionCookie, iRequestSessionCookie, iMaxFragmentSize);
 		}
 	}
 
@@ -158,7 +244,6 @@
 			}
 		iActual.iRequestResult.iFragmentationResult =
 			iDmaSession.FragmentRequestOld(iRequestSessionCookie, iTransferArgs);
-
 		}
 
 	const TInt fragmentCount = iDmaSession.RequestFragmentCount(iRequestSessionCookie);
@@ -211,6 +296,22 @@
 	RDebug::RawPrint(_L("Single transfer"));
 	}
 
+void CSingleTransferTest::PrintTestInfo() const
+	{
+	CDmaTest::PrintTestInfo();
+
+	// State which API versions are being used
+	if(iUseNewFragment)
+		RDebug::RawPrint(_L(", Fragment v2,"));
+	else
+		RDebug::RawPrint(_L(", Fragment v1,"));
+
+	if(iUseNewRequest)
+		RDebug::RawPrint(_L(" DDmaRequest v2"));
+	else
+		RDebug::RawPrint(_L(" DDmaRequest v1"));
+	}
+
 void CSingleTransferTest::PreTransferSetup()
 	{
 	if(iPreTransfer)
@@ -239,18 +340,166 @@
 	return result;
 	}
 
+//////////////////////////////////////////////////////////////////////
+// CDmaTestDecorator
+//////////////////////////////////////////////////////////////////////
 
+CDmaTestDecorator::CDmaTestDecorator(CDmaTest* aDecoratedTest)
+	: CDmaTest(_L("Decorated Test"), 1, NULL, NULL), iDecoratedTest(aDecoratedTest)
+	{}
+
+CDmaTestDecorator::CDmaTestDecorator(const CDmaTestDecorator& aOther)
+	: CDmaTest(aOther), iDecoratedTest( static_cast<CDmaTest*>( aOther.iDecoratedTest->Clone() ) )
+	// Need cast because Clone does not have a covariant return type,
+	// as not all compillers allow it
+	{}
+
+//////////////////////////////////////////////////////////////////////
+// CMultiVersionTest
+//////////////////////////////////////////////////////////////////////
+
+CMultiVersionTest::CMultiVersionTest(CSingleTransferTest* aDmaTest)
+	: CDmaTestDecorator(aDmaTest), iNewVersionTest(NULL)
+	{
+	}
+
+CMultiVersionTest::CMultiVersionTest(const CMultiVersionTest& aOther)
+	: CDmaTestDecorator(aOther), iNewVersionTest( aOther.iNewVersionTest ? static_cast<CSingleTransferTest*>(aOther.iNewVersionTest->Clone()) : NULL)
+	{
+	}
+
+CMultiVersionTest::~CMultiVersionTest()
+	{
+	delete iDecoratedTest;
+	delete iNewVersionTest;
+	}
+
+void CMultiVersionTest::SetupL()
+	{
+	// Open a tempory dma session to find out the
+	// capabilities of the dma channel.
+	OpenDmaSession();
+	Configure();
+	CloseDmaSession();
+	}
+
+void CMultiVersionTest::Announce() const
+	{
+	CTest::Announce();
+
+	iDecoratedTest->Announce();
+
+	if(iNewVersionTest)
+		iNewVersionTest->Announce();
+	}
+
+void CMultiVersionTest::PrintTestType() const
+	{
+	RDebug::RawPrint(_L("Multi version test wrapper"));
+	}
+
+void CMultiVersionTest::PrintTestInfo() const
+	{
+		if(iNewVersionTest)
+			{ 		
+			RDebug::RawPrint(_L("Running tests using Version 2 PIL"));
+			}
+		else
+			{
+			RDebug::RawPrint(_L("Running tests using Version 1 PIL"));		
+			}
+	}
+
+void CMultiVersionTest::RunTest()
+	{
+	OpenDmaSession();
+
+	// iDecoratedTest is the test, in the old configuration
+	// iNewVersionTest is the same test, configured
+	// to use the new APIs
+	//
+	// 2 objects are needed since they can each store
+	// their own results
+
+	iDecoratedTest->OpenDmaSession(iDmaSession);
+	(*iDecoratedTest)();
+
+	if(iNewVersionTest)
+		{
+		iNewVersionTest->OpenDmaSession(iDmaSession);
+		(*iNewVersionTest)();
+		}
+
+	CloseDmaSession();
+	}
+
+/**
+Maybe create another test object to run with new API
+
+Pass on the cookie for the channel they must test
+*/
+void CMultiVersionTest::Configure()
+	{
+	static_cast<CSingleTransferTest*>(iDecoratedTest)->UseNewDmaApi(EFalse);
+	iDecoratedTest->SetChannelCookie(iChannelCookie);
+
+	if(Version2PILAvailable())
+		{
+		iNewVersionTest = static_cast<CSingleTransferTest*>(iDecoratedTest->Clone());
+		TEST_ASSERT(iNewVersionTest != NULL);
+
+		iNewVersionTest->UseNewDmaApi(ETrue);
+		iNewVersionTest->SetChannelCookie(iChannelCookie);
+		}
+	}
+
+/**
+Discover from DMA channel what PIL versions are available.
+In practice V1 APIs will always be available, V2 may be.
+*/
+TBool CMultiVersionTest::Version2PILAvailable()
+	{
+	TUint channelSessionCookie;
+	TInt r = iDmaSession.ChannelOpen(iChannelCookie, channelSessionCookie);
+	TEST_ASSERT(r == KErrNone);
+
+	TDmacTestCaps channelCaps;
+	r = iDmaSession.ChannelCaps(channelSessionCookie, channelCaps);
+	TEST_ASSERT(r == KErrNone);
+
+	r = iDmaSession.ChannelClose(channelSessionCookie);
+	TEST_ASSERT(r == KErrNone);
+
+	return channelCaps.iPILVersion >= 2;
+	}
+
+TBool CMultiVersionTest::Result()
+	{
+	TBool v1Result = iDecoratedTest->Result();
+	if(gVerboseOutput || !v1Result)
+		RDebug::Printf("V1 API result: %s", v1Result ? "success" : "failure");
+
+	TBool v2Result = iNewVersionTest ? iNewVersionTest->Result() : ETrue;
+	if(gVerboseOutput || !v1Result)
+		RDebug::Printf("V2 API result: %s", v2Result ? "success" : "failure");
+	return v1Result && v2Result;
+	}
 
 //////////////////////////////////////////////////////////////////////
 // CDmaBenchmark
 //////////////////////////////////////////////////////////////////////
-
 CDmaBenchmark::CDmaBenchmark(const TDesC& aName, TInt aIterations, const TResultSet& aExpectedResults, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize)
 	:CSingleTransferTest(aName, aIterations, aTransferArgs, aExpectedResults, aMaxFragmentSize, NULL, NULL)
 	{
 	UseNewDmaApi(EFalse);
 	}
 
+CDmaBenchmark::CDmaBenchmark(const CDmaBenchmark& aOriginal)
+	:CSingleTransferTest(aOriginal)
+	{
+	CopyL(aOriginal.iResultArray, iResultArray);
+	}
+
 CDmaBenchmark::~CDmaBenchmark()
 	{
 	iResultArray.Close();
@@ -288,17 +537,12 @@
 		RDebug::Printf("  Mean time: %lu us", MeanResult());
 		}
 
-	//TODO this will be handled by the ctor later
-	iResultArray.Close();
-
 	return result;
 	}
 
-
 //////////////////////////////////////////////////////////////////////
 // CDmaBmFragmentation
 //////////////////////////////////////////////////////////////////////
-
 CDmaBmFragmentation::CDmaBmFragmentation(const TDesC& aName, TInt aIterations, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize)
 	:CDmaBenchmark(aName, aIterations, ExpectedResults, aTransferArgs, aMaxFragmentSize)
 	{}
@@ -331,21 +575,334 @@
 	Fragment();
 	FreeRequest();
 	CloseChannel();
+	CloseDmaSession();
+	}
+
+//////////////////////////////////////////////////////////////////////
+//	CPauseResumeTest
+//
+//	-Time how long a given transfer takes
+//	-Pause the channel
+//	-repeat the transfer (queued asynchronously)
+//	-wait for some time (say, 3 times the time measured)
+//	-read the value of the TRequestStatus object, to check it is still pending
+//	-resume the channel
+//	-Wait on the request
+//	-Confirm that the request completed
+//////////////////////////////////////////////////////////////////////
+CPauseResumeTest::~CPauseResumeTest()
+	{
+	}
+
+void CPauseResumeTest::RunTest()
+	{
+	OpenDmaSession();
+
+	//Open a single DMA channel for a transfer
+	OpenChannel();
+
+	RDebug::Printf("Resume unpaused idle channel");
+	TInt r = iDmaSession.ChannelResume(iChannelSessionCookie);
+	TEST_ASSERT(KErrCompletion == r);
+
+	RDebug::Printf("Pause idle channel");
+	r = iDmaSession.ChannelPause(iChannelSessionCookie);
+	TEST_ASSERT(KErrNone == r);
+
+	RDebug::Printf("Pause paused idle Channel");
+	r = iDmaSession.ChannelPause(iChannelSessionCookie);
+	TEST_ASSERT(KErrCompletion == r);
+
+	RDebug::Printf("Resume paused idle channel");
+	r = iDmaSession.ChannelResume(iChannelSessionCookie);
+	TEST_ASSERT(KErrNone == r);
+
+	//Setup a DMA request and Fragment the request.
+	CreateDmaRequest();
+	Fragment();
+
+	//Queue the DMA request and time how long a transfer takes
+	TUint64 queueTime;
+	DoCalibrationTransfer(queueTime);
+
+	RDebug::Printf("Calibration transfer completed in %Lu us",queueTime);
+	TUint32 waitQueueReqTime = I64LOW(queueTime*3); //3 times the time measured in DoCalibrationTransfer
+	TEST_ASSERT(I64HIGH(queueTime*3) == 0); // If transfer takes over an hour, something has gone wrong anyway
+
+	// Initialise buffers, after calibration transfer
+	PreTransferSetup();
+
+	RDebug::Printf("Resume unpaused channel");
+	r = iDmaSession.ChannelResume(iChannelSessionCookie);
+	TEST_ASSERT(KErrCompletion == r);
+
+	//Pause DMA Transfer
+	RDebug::Printf("Pausing DMA Channel");
+	r = iDmaSession.ChannelPause(iChannelSessionCookie);
+	TEST_ASSERT(KErrNone == r);
+
+	RDebug::Printf("Pause paused Channel");
+	r = iDmaSession.ChannelPause(iChannelSessionCookie);
+	TEST_ASSERT(KErrCompletion == r);
+
+	//Repeat the transfer (queued asynchronously)
+	TRequestStatus queueRequestStatus;
+	iActual.iRequestResult.iQueueResult = QueueAsyncRequest(queueRequestStatus,queueTime);
+	RDebug::Printf("Queue a DMA Request and wait for %u us ", waitQueueReqTime);
+
+	User::After(waitQueueReqTime);
+	RDebug::Printf("Finished waiting");
+	TEST_ASSERT(queueRequestStatus.Int() == KRequestPending);
+
+	TBool queueEmpty = ETrue;
+	r = iDmaSession.ChannelIsQueueEmpty(iChannelSessionCookie,queueEmpty);
+	TEST_ASSERT(r == KErrNone);
+	TEST_ASSERT(!queueEmpty);
+
+	//Resume DMA channel
+	RDebug::Printf("Resuming paused DMA Channel");
+	r = iDmaSession.ChannelResume(iChannelSessionCookie);
+	TEST_ASSERT(KErrNone == r);
+
+	//Wait for transfer to complete
+	User::WaitForRequest(queueRequestStatus);
+	if (queueRequestStatus.Int() == KErrNone)
+		{
+		RDebug::Printf("DMA QueueAsyncRequest completed");
+		}
+
+	FreeRequest();
+	CloseChannel();
+
+	PostTransferCheck();
+	CloseDmaSession();
+	}
+
+/**
+Time how long transfer takes, with no pausing
+*/
+void CPauseResumeTest::DoCalibrationTransfer(TUint64 &atime)
+	{
+	//Queue the DMA request.
+	TCallbackRecord pCallbackRecord;
+	TInt r = iDmaSession.QueueRequest(iRequestSessionCookie,&pCallbackRecord,&atime);
+	TEST_ASSERT(r == KErrNone);
+	}
+
+TInt CPauseResumeTest::QueueAsyncRequest(TRequestStatus &aRequestState, TUint64 &atime)
+	{
+	return iDmaSession.QueueRequest(iRequestSessionCookie,aRequestState, &iActual.iCallbackRecord, &atime);
+	}
+
+void CPauseResumeTest::PrintTestType() const
+	{
+	RDebug::RawPrint(_L("Pause and Resume API Test"));
+	}
+
+//////////////////////////////////////////////////////////////////////
+// COpenCloseTest
+//////////////////////////////////////////////////////////////////////
+COpenCloseTest::~COpenCloseTest()
+	{
+	}
+
+TBool COpenCloseTest::DoRunClose()
+	{
+	// For storing cookie during neagtive test i,e open channel twice
+	TUint testChannelSessionCookie = 0; 
+
+	// Open a single DMA channel
+	TInt r = iDmaSession.ChannelOpen(iChannelCookie, iChannelSessionCookie);
+	if (r == KErrNone)//Check that DMA channel opened with no errors
+		{
+		RDebug::Printf("DMA channel opened");					
+		}
+	else
+		{
+		RDebug::Printf("Open DMA channel failed");			
+		return EFalse;
+		}
+
+	// Open DMA channel again and check that opening DMA channel again fails		
+	r = iDmaSession.ChannelOpen(iChannelCookie, testChannelSessionCookie);
+	if (r == KErrInUse)
+		{
+		RDebug::Printf("Opening DMA channel again fails as expected");	
+		}
+	else
+		{
+		RDebug::Printf("Open DMA channel again failed");
+		return EFalse;
+		}
+
+	// Close the DMA channel and check that DMA channel closes with no errors
+	r =iDmaSession.ChannelClose(iChannelSessionCookie);	 
+	if (r == KErrNone) 
+		{
+		RDebug::Printf("DMA channel closes with no errors");				
+		}
+	else
+		{
+		RDebug::Printf("Close the DMA channel failed");
+		return EFalse;
+		}
+	
+	// Verify that the DMA channel was actually closed by opening DMA channel
+	r = iDmaSession.ChannelOpen(iChannelCookie, iChannelSessionCookie);
+	if (r == KErrNone)
+		{
+		RDebug::Printf("DMA channel opened after a previous close operation");
+		return ETrue;
+		}
+	else
+		{
+		RDebug::Printf("Open DMA channel to verify that the DMA channel closed failed");
+		return EFalse;
+		}	
+	}
+
+TBool COpenCloseTest::DoRunOpen()
+	{
+	// Open a single DMA channel
+	TInt r = iDmaSession.ChannelOpen(iChannelCookie, iChannelSessionCookie);
+	if (r == KErrNone)//Check that DMA channel opened with no errors
+		{			
+		RDebug::Printf("DoRunOpen:DMA channel opened");			
+		}
+	else
+		{
+		RDebug::Printf("DoRunOpenDMA channel failed to open");				
+		return EFalse;
+		}	
+
+	// Verify that channel is really open by closing DMA channel
+	// and checking that DMA channel closes with no errors
+	r = iDmaSession.ChannelClose(iChannelSessionCookie);
+	if (r == KErrNone)
+		{
+		RDebug::Printf("DoRunOpen:DMA channel closes with no errors");			
+		return ETrue;
+		}
+	else
+		{
+		RDebug::Printf("DoRunOpen:DMA channel failed to close");		
+		return EFalse;
+		}
+	}
+
+TBool COpenCloseTest::DoRunOpenExposed()
+	{
+	SCreateInfoTest TOpenInfo;
+	TOpenInfo.iCookie =iChannelCookie;
+	TOpenInfo.iDfcPriority = 3;
+	
+	const TInt desCount[3] = {0,1,128}; 
+	const TBool dynChannel[3] =	{EFalse,EFalse,ETrue};  
+	const TInt expectedResults[3] = {KErrArgument,KErrNone,KErrInUse};  
+	TInt actualResults[3] = {1, 1, 1};
+
+	for (TInt i =0; i<3; i++)
+		{	
+		TOpenInfo.iDesCount = desCount[i];
+		TOpenInfo.iDynChannel = dynChannel[i];		
+
+		// Open a single DMA channel
+		RDebug::Printf("DoRunOpenExposed:Trying to open DMA channel using iDesCount(%d) and iDynChannel(%d)  ", TOpenInfo.iDesCount,TOpenInfo.iDynChannel);
+		actualResults[i] = iDmaSession.ChannelOpen(iChannelSessionCookie, TOpenInfo);
+		if (actualResults[i] == KErrNone)// Verify that channel is really open by closing DMA channel	
+			{
+			TInt err = iDmaSession.ChannelClose(iChannelSessionCookie);
+			TEST_ASSERT(err == KErrNone)//Check that DMA channel closed with no errors
+			}
+		}
+
+	// This case should fail if idesCount  =  0.
+	// PIL has been changed to return KErrArgument instead of using an assertion check
+	if (expectedResults[0] == actualResults[0])
+		{
+		RDebug::Printf("DoRunOpenExposed:DMA channel failed to open as expected as for iDesCount = 0 ");			
+		}
+	else
+		{
+		RDebug::Printf("DoRunOpenExposed:Error code returned (%d), expected KErrArgument as iDesCount= 0) ", actualResults[0]);	
+		return EFalse;
+		}
+
+	// For this case( idesCount  =  1), DMA channel should open with no issues	
+	if (expectedResults[1] == actualResults[1])
+		{		
+		RDebug::Printf("DoRunOpenExposed:DMA channel closes with no errors as expected for iDesCount = 1 ");
+		}
+	else
+		{
+		RDebug::Printf("DoRunOpenExposed:Failed to open DMA channel with error code (%d)", actualResults[1]);	
+		return EFalse;
+		}
+
+	// For this case(dynaChannel=ETrue), DMA channel now returns KErrInUse. dynaChannel is not supported in the PSL.
+	// PSL now returns a NULL pointer when dynaChannel is requested. The PIL interprets a NULL 
+	// pointer being returned from opening a DMA channel as a channel in use. Hence, KErrInUse is returned.
+	if (expectedResults[2] == actualResults[2])
+		{
+		RDebug::Printf("DoRunOpenExposed:DMA channel failed to open as expected as dynamic channel is not supported");		
+		}
+	else
+		{
+		RDebug::Printf("DoRunOpenExposed:Error code returned (%d), expected KErrInUse as as dynamic channel is not supported", actualResults[2]);			
+		return EFalse;
+		}
+
+	return ETrue;
+	}
+
+void COpenCloseTest::RunTest()
+	{
+	OpenDmaSession(); 
+
+	if (iRunOpen) 
+	{	// Run Open() API test
+		iOpenCloseResult = DoRunOpenExposed();
+		if(iOpenCloseResult)
+			iOpenCloseResult = DoRunOpen();
+	}
+	else
+	{
+		// Run Close() API test	
+		iOpenCloseResult = DoRunClose();
+	}
 
 	CloseDmaSession();
 	}
 
+void COpenCloseTest::PrintTestType() const
+	{
+	RDebug::RawPrint(_L("Close/Open API Test"));
+
+	}
+
+TBool COpenCloseTest::Result()
+	{
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("Results for Close/Open API Test");
+		}
+
+	if(!iOpenCloseResult)
+		{
+		RDebug::Printf("Open/Close test sequence failed"); 
+		}
+			
+	return iOpenCloseResult;
+	}
 //////////////////////////////////////////////////////////////////////
 // CDmaBmTransfer
 //////////////////////////////////////////////////////////////////////
-
 CDmaBmTransfer::CDmaBmTransfer(const TDesC& aName, TInt aIterations, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize)
 	:CDmaBenchmark(aName, aIterations,
 		TResultSet(KErrNone, TRequestResults(),	KErrUnknown, TCallbackRecord(TCallbackRecord::EThread,1)),
 		aTransferArgs, aMaxFragmentSize)
 	{}
 
-
 void CDmaBmTransfer::PrintTestType() const
 	{
 	RDebug::RawPrint(_L("Transfer Benchmark"));
@@ -375,13 +932,247 @@
 		}
 	}
 
+/*
+1.	Open a DMA channel for a transfer.
+2.	Queue multiple request on the DMA channel.
+3.	Call CancelAll () on the DMA channel.
+4.	Verify that all transfers have been cancelled.
+5.	Open a DMA channel for a transfer. This channel should support pause and resume.
+6.	Call Pause () on the channel.
+7.	Queue multiple request on the DMA channel.
+8.	Call CancelAll () on the channel.
+9.	Verify that all transfers have been cancelled.
+
+   Note: This check does not add results to TResultSet like some
+   other tests as its operation is different. The test checks for 
+   the the cancelllation of all transfers queued on a channel by
+   calling iDmaSession.ChannelIsQueueEmpty(); 
+*/
+
+//////////////////////////////////////////////////////////////////////
+// CCancelAllTest
+//////////////////////////////////////////////////////////////////////
+
+
+CCancelAllTest::CCancelAllTest(const TDesC& aName, TInt aIterations,
+		const TDmaTransferArgs* aTransferArgs, const TResultSet* aResultSets,
+		TInt aCount)
+	:CMultiTransferTest(aName, aIterations, aTransferArgs, aResultSets, aCount)
+	{}
+
+void CCancelAllTest::RunTest()
+	{
+	OpenDmaSession();
+	PreTransferSetup();
+
+	// Open a DMA channel for a transfer.This channel should support pause and resume.
+	OpenChannel();
+
+	//Call Pause () on the channel
+	RDebug::Printf("Pausing DMA Channel");
+	ChannelPause(iChannelSessionCookie);
+	
+	// Queue multiple request on the DMA channel.
+	CreateDmaRequests();
+	Fragment();
+
+	QueueRequestsAsync();
+
+	// Call CancelAll () on the DMA channel and Verify that all transfers have been cancelled.
+	TInt r = CancelAllRequests();
+	TEST_ASSERT(r == KErrNone);
+
+	//Call Resume () on the channel.
+	RDebug::Printf("Cancel should clear Pause state: resuming channel should fail");
+	ChannelResume(iChannelSessionCookie);		
+	//TEST_ASSERT(r == KErrCompletion);
+
+	r = DoPostTransferCheck();
+	TEST_ASSERT(r == KErrNone);
+	//Destroy request
+    for(TInt i=0; i<2; i++)
+		{
+		r = iDmaSession.RequestDestroy(iRequestCookies[i]);
+		TEST_ASSERT(r == KErrNone);
+		}
+
+	//Close DMA channel
+	CloseChannel();
+
+	CloseDmaSession();
+	}
+
+TInt CCancelAllTest::CancelAllRequests()
+	{
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("CCancelAllTest::CancelAllRequests()");
+		}
+	TInt r = KErrGeneral;
+	r  = iDmaSession.ChannelCancelAll(iChannelSessionCookie);
+	if (r != KErrNone)
+		return r;
+
+	TBool queueEmpty;
+	r = iDmaSession.ChannelIsQueueEmpty(iChannelSessionCookie,queueEmpty);
+	if (r != KErrNone)
+		return r;
+
+	if(!queueEmpty)
+		return KErrGeneral;
+
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("Both current and pending requests cancelled");
+		}
+	return KErrNone;
+	}
+
+void CCancelAllTest::PrintTestType() const
+	{
+	RDebug::RawPrint(_L("CCancelAllTest"));
+	}
+
+void CCancelAllTest::QueueRequestsAsync()
+	{
+	if(iPauseWhileQueuing)
+		{
+		TInt r = iDmaSession.ChannelPause(iChannelSessionCookie);
+		TEST_ASSERT(r == KErrNone);
+		}
+
+	// Queue all the DMA requests asynchronously
+	TEST_ASSERT(iActualResults.Count() == iTransferArgsCount);
+	for(TInt i=0; i<iTransferArgsCount; i++)
+		{
+		TResultSet& resultSet = iActualResults[i];
+		if(resultSet.iRequestResult.iFragmentationResult != KErrNone)
+			continue;
+
+		TInt r = iDmaSession.QueueRequest(iRequestCookies[i], iDummyRequestStatus, &resultSet.iCallbackRecord, NULL);
+		resultSet.iRequestResult.iQueueResult = r;
+		}
+
+	if(iPauseWhileQueuing)
+		{
+		TInt r = iDmaSession.ChannelResume(iChannelSessionCookie);
+		TEST_ASSERT(r == KErrNone);
+		}
+	}
+
+//////////////////////////////////////////////////////////////////////
+// CIsQueueEmptyTest
+//////////////////////////////////////////////////////////////////////
+CIsQueueEmptyTest::CIsQueueEmptyTest(const TDesC& aName, TInt aIterations, const TDmaTransferArgs* aTransferArgs,
+		const TResultSet* aResultSets, TInt aCount)
+	:CMultiTransferTest(aName, aIterations, aTransferArgs, aResultSets, aCount)
+	{}
+
+CIsQueueEmptyTest::CIsQueueEmptyTest(const CIsQueueEmptyTest& aOther)
+	:CMultiTransferTest(aOther)
+	{}
+
+CIsQueueEmptyTest::~CIsQueueEmptyTest()
+	{
+	}
+
+void CIsQueueEmptyTest::RunTest()
+	{
+	OpenDmaSession();
+	PreTransferSetup();
+	
+	OpenChannel();
+
+	CreateDmaRequests();
+	Fragment();
+	QueueRequests();
+
+	TInt r = DoPostTransferCheck();
+	TEST_ASSERT(r == KErrNone);
+
+	CloseDmaSession();
+	}
+
+void CIsQueueEmptyTest::DoIsQueueEmpty()
+	{
+	TBool queueEmpty;
+	TInt r = iDmaSession.ChannelIsQueueEmpty(iChannelSessionCookie,queueEmpty);
+	TEST_ASSERT(r == KErrNone);
+
+	if(queueEmpty)
+		{
+		RDebug::Printf("Verified that calling IsQueueEmpty() returns ETrue before calling Queue()");
+		}
+	else
+		{
+		RDebug::Printf("IsQueueEmpty() fails to return ETrue before calling Queue()");
+		TEST_ASSERT(queueEmpty);	
+		}
+	}
+
+void CIsQueueEmptyTest::DoQueueNotEmpty()
+	{
+	TBool queueEmpty;
+	TInt r = iDmaSession.ChannelIsQueueEmpty(iChannelSessionCookie,queueEmpty);
+	TEST_ASSERT(r == KErrNone);
+
+	if (!queueEmpty)
+		{
+		RDebug::Printf("Verified that calling IsQueueEmpty() returns EFalse after calling Queue()");
+		}
+	else
+		{
+		RDebug::Printf("IsQueueEmpty() fails to return EFalse after calling Queue()");
+		TEST_ASSERT(!queueEmpty);
+		}
+	}
+
+void CIsQueueEmptyTest::PrintTestType() const
+	{
+	RDebug::RawPrint(_L("IsQueue Empty Test using Multi Transfer"));
+	}
+
+void CIsQueueEmptyTest::QueueRequests()
+	{
+	// Queue all the DMA requests asynchronously
+	TInt i;
+	RArray<TRequestStatus> requestStates;
+	
+	ChannelPause(iChannelSessionCookie);
+	DoIsQueueEmpty();
+
+	TEST_ASSERT(iActualResults.Count() == iTransferArgsCount);
+	for(i=0; i<iTransferArgsCount; i++)
+		{
+		TResultSet& resultSet = iActualResults[i];
+		if(resultSet.iRequestResult.iFragmentationResult != KErrNone)
+			continue;
+
+		TInt r = requestStates.Append(TRequestStatus());
+		TEST_ASSERT(r == KErrNone);
+
+		r = iDmaSession.QueueRequest(iRequestCookies[i], requestStates[i], &resultSet.iCallbackRecord, NULL);
+		resultSet.iRequestResult.iQueueResult = r;
+
+		DoQueueNotEmpty();
+		}
+	
+	ChannelResume(iChannelSessionCookie);
+
+	// wait for all transfers to complete
+	const TInt count = requestStates.Count();
+
+	for(i=0; i<count; i++)
+		{
+		User::WaitForRequest(requestStates[i]);
+		}
+
+	requestStates.Close();
+	}
 
 //////////////////////////////////////////////////////////////////////
 // CMultiTransferTest
 //////////////////////////////////////////////////////////////////////
-
-//TODO
-// Add pre and post transfer for CMultiTransferTest
 CMultiTransferTest::CMultiTransferTest(const TDesC& aName, TInt aIterations, const TDmaTransferArgs* aTransferArgs,
 		const TResultSet* aResultSets, TInt aCount)
 	: CDmaTest(aName, aIterations, NULL, NULL), iTransferArgs(aTransferArgs), iTransferArgsCount(aCount), iNewDmaApi(ETrue),
@@ -392,10 +1183,8 @@
 	: CDmaTest(aOther), iTransferArgs(aOther.iTransferArgs), iTransferArgsCount(aOther.iTransferArgsCount),
 	iNewDmaApi(aOther.iNewDmaApi),
 	iExpectedArray(aOther.iExpectedArray), iPauseWhileQueuing(aOther.iPauseWhileQueuing)
-	//const cast is required because their isn't a ctor taking const
-	//array values
-	//TODO iRequestCookies(const_cast<TUint*>(&aOther.iRequestCookies[0]), aOther.iRequestCookies.Count())
 	{
+	CopyL(aOther.iRequestCookies, iRequestCookies);
 	}
 
 CMultiTransferTest::~CMultiTransferTest()
@@ -497,10 +1286,13 @@
 	TEST_ASSERT(iActualResults.Count() == iTransferArgsCount);
 	for(TInt i=0; i<iTransferArgsCount; i++)
 		{
-		// Since all transfers will use the same channel,
-		// they all get the same result
-		// Arguably, iChannelOpenResult doesn't
-		// belong TResultSet
+		// In a multi transfer test a series of requests are created and queued.
+		// They all use the same channel, is opened here at the beginning of the test
+		//
+		// Each transfer has a TResultSet which holds a result for the channel opening,
+		// which we store here. Although in this case it is redundant,
+		// in future it might be that different transfers open
+		// different channels.
 		iActualResults[i].iChannelOpenResult = r;
 		}
 	}
@@ -528,11 +1320,11 @@
 
 		if(iNewDmaApi)
 			{
-			r = iDmaSession.RequestCreateNew(iChannelSessionCookie, cookie);
+			r = iDmaSession.RequestCreate(iChannelSessionCookie, cookie);
 			}
 		else
 			{
-			r = iDmaSession.RequestCreate(iChannelSessionCookie, cookie);
+			r = iDmaSession.RequestCreateOld(iChannelSessionCookie, cookie);
 			}
 		iActualResults[i].iRequestResult.iCreate = r;
 
@@ -611,9 +1403,9 @@
 	requestStates.Close();
 	}
 
-//TODO support test setup for CMultiTransferTest
 void CMultiTransferTest::PreTransferSetup()
 	{
+	// TODO this is the wrong place to do this!
 	for(TInt i=0; i<iTransferArgsCount; i++)
 		{
 		//pre-fill actual results with error values
@@ -634,8 +1426,6 @@
 //////////////////////////////////////////////////////////////////////
 // CIsrRequeTest
 //////////////////////////////////////////////////////////////////////
-
-
 CIsrRequeTest::CIsrRequeTest(const TDesC& aName, TInt aIterations, const TDmaTransferArgs& aArgs,
 			TIsrRequeArgs* aRequeueArgs, TInt aCount,
 			const TResultSet& aExpected,const MPreTransfer* aPreTfer,const MPostTransferCheck* aPostTferChk, TUint aMaxFragmentSize)
@@ -655,14 +1445,6 @@
 	RDebug::RawPrint(_L("ISR Requeue"));
 	}
 
-/*
-//TODO will need to support buffer checking of the trasnfers
-TBool CIsrRequeTest::Result()
-	{
-	return CSingleTransferTest::Result();
-	}
-*/
-
 void CIsrRequeTest::PreTransferSetup()
 	{
 	if(iPreTransfer)
@@ -677,7 +1459,6 @@
 //////////////////////////////////////////////////////////////////////
 // TResultSet
 //////////////////////////////////////////////////////////////////////
-
 void TResultSet::Print() const
 	{
 	PRINT(iChannelOpenResult);
@@ -696,7 +1477,6 @@
 //////////////////////////////////////////////////////////////////////
 // MPostTransferCheck classes
 //////////////////////////////////////////////////////////////////////
-
 TInt TCompareSrcDst::Check(const CSingleTransferTest& aTest) const
 	{
 	if(gVerboseOutput)
@@ -706,9 +1486,14 @@
 	return Check(aTest.TransferArgs(), aTest.Chunk().Base());
 	}
 
-//TODO
-//this check will not deal correctly transfers were subsequent
-//requeues overlap
+// Note: this check will not deal correctly with transfers were subsequent
+// requeues overlap previous sources or destinations
+// or where the source of transfer depends on a previous transfer.
+// This is because it simply compares the source and destination
+// pairwise for each transfer
+//
+// If TPreTransferIncrBytes is used for the pre-test then the transfers
+// will be checked however.
 TInt TCompareSrcDst::Check(const CIsrRequeTest& aTest) const
 	{
 	if(gVerboseOutput)
@@ -729,8 +1514,7 @@
 	}
 
 TInt TCompareSrcDst::Check(const TDmaTransferArgs& aTransferArgs, TUint8* aChunkBase) const
-	{
-	//TODO could make use of Fixup() method
+	{	
 	const TUint32 srcOffset = aTransferArgs.iSrcConfig.iAddr;
 	const TUint32 dstOffset = aTransferArgs.iDstConfig.iAddr;
 	const TInt size = aTransferArgs.iTransferCount;
@@ -780,6 +1564,14 @@
 	return memcompare(src, size, dst, size);
 	}
 
+// Note: this check will not deal correctly with transfers were subsequent
+// requeues overlap previous sources or destinations
+// or where the source of trasnfer depends on a previous trasnfer.
+// This is because it simply compares the source and destination
+// pairwise for each transfer
+//
+// If TCompareSrcDst is used for the pre-test then the transfers
+// will be checked however.
 TInt TCompareSrcDst::Check(CMultiTransferTest& aTest) const
 	{
 	if(gVerboseOutput)
@@ -833,10 +1625,57 @@
 	{
 	return KErrNotSupported;
 	}
+
+
+TInt TCheckNoTransfer::Check(const CSingleTransferTest&) const
+	{
+	return KErrNotSupported;
+	}
+
+TInt TCheckNoTransfer::Check(const CIsrRequeTest&) const
+	{
+	return KErrNotSupported;
+	}
+
+TInt TCheckNoTransfer::Check(CMultiTransferTest& aTest) const
+	{
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("TCheckNoTransfer Comparing CMultiTransferTest buffers");
+		}
+
+	const TInt transferCount = aTest.TransferCount();
+	TUint8* const chunkBase = aTest.Chunk().Base();
+
+	// check buffers for each transfer
+	for(TInt i=0; i<transferCount; i++)
+		{
+		TInt r = KErrCorrupt;
+		if(IsZeroed(aTest.TransferArgs(i), chunkBase))
+			{
+			r = KErrNone;
+			}
+
+		aTest.SetPostTransferResult(i, r);
+		}
+	// CMultiTransferTest is handled differently to the others.
+	// Whereas CSingleTransferTest logs just the return value
+	// of the check, here, we write back a result for each transfer
+	// so the return value from this function is not important
+	return KErrNone;
+	}
+
+TBool TCheckNoTransfer::IsZeroed(const TDmaTransferArgs& aTransferArgs, TUint8* aChunkBase) const
+	{
+	TAddressParms parms = GetAddrParms(aTransferArgs);
+	parms.Fixup(reinterpret_cast<TLinAddr>(aChunkBase));
+	const TAddrRange destination = parms.DestRange();
+
+	return destination.IsFilled(0);
+	}
 //////////////////////////////////////////////////////////////////////
 // MPreTransfer classes
 //////////////////////////////////////////////////////////////////////
-
 void TPreTransferIncrBytes::Setup(const CSingleTransferTest& aTest) const
 	{
 	if(gVerboseOutput)
@@ -904,7 +1743,12 @@
 		{
 		RDebug::Printf("TPreTransferIncrBytes(CMultiTransferTest)");
 		}
-	//TODO check for overlap
+
+	if(!CheckBuffers(aTest))
+		{
+		RDebug::Printf("Successive transfer destinations may not overlap previous src or dst buffers");
+		TEST_FAULT;
+		}
 
 	TUint8* const chunkBase = aTest.Chunk().Base();
 	const TInt transferCount = aTest.TransferCount();
@@ -943,26 +1787,85 @@
 	}
 
 /**
+A CMultiTransferTest will wait for all transfers to complete
+before comapairing source and destination buffers. For this to be successful
+each transfer must be independent ie. no destination or source may be
+overwritten by another transfer and source buffers may not depend on an
+earlier transfer
+*/
+TBool TPreTransferIncrBytes::CheckBuffers(const CMultiTransferTest& aTest) const
+	{
+	TUint8* const chunkBase = aTest.Chunk().Base();
+	const TInt transferCount = aTest.TransferCount();
+
+	// assemble an array of TAddressParams from aTest, that
+	// can then be passed to CheckBuffers(RArray<TAddressParms>)
+	RArray<const TAddressParms> array;
+
+	for(TInt i=0; i<transferCount; i++)
+		{
+		TAddressParms params = GetAddrParms(aTest.TransferArgs(i));
+		params.Fixup((TLinAddr)chunkBase);
+
+		array.AppendL(params);
+		}
+
+	 // 2nd arg EFalse as there is no need to permit exact repeats
+	const TBool r = CheckBuffers(array, EFalse);
+
+	array.Close();
+	return r;
+	}
+
+/**
 Check that the destination of each TAddressParms does not overlap with
 any previous source or destination or that if it does the whole transfer
 matches.
 This is so that successive transfers do not overwrite the destinations or
 sources of preceeding ones.
-Exactly matching transfers are allowed to test the case that a repeat
-transfer is required - though it can't then be determined just from
-looking at the buffers that the repeat was successful
+
+If aAllowExactRepeat is true then exactly matching transfers are allowed
+to test the case where a repeat transfer is required - though it can't
+then be determined just from looking at the buffers that the repeat was
+successful
 */
-TBool TPreTransferIncrBytes::CheckBuffers(const RArray<const TAddressParms> aTransferParams) const
+TBool TPreTransferIncrBytes::CheckBuffers(const RArray<const TAddressParms>& aTransferParams, TBool aAllowExactRepeat) const
 	{
+
 	const TInt count = aTransferParams.Count();
 
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("CheckBuffers, %d transfers", count);
+		}
+
+	TBuf<128> buf;
 	for(TInt i=1; i<count; i++)
 		{
 		const TAddressParms& current = aTransferParams[i];
+
+		if(gVerboseOutput)
+			{
+			buf.Zero();
+			current.AppendString(buf);
+			RDebug::Print(_L("Check current: %S, against:"), &buf);
+			}
+
 		for(TInt j=0; j<i; j++)
 			{
 			const TAddressParms& previous = aTransferParams[j];
-			const TBool ok = !previous.Overlaps(current.DestRange()) || current == previous;
+			if(gVerboseOutput)
+				{
+				buf.Zero();
+				previous.AppendString(buf);
+				RDebug::Print(_L("Previous: %S"), &buf);
+				}
+
+			const TBool curDstOverlapsPrevTfer = previous.Overlaps(current.DestRange());
+			const TBool curSrcDependsOnPrevDest = current.SourceRange().Overlaps(previous.DestRange());
+			const TBool permitExactRepeat = aAllowExactRepeat && (current == previous);
+
+			const TBool ok = !(curDstOverlapsPrevTfer || curSrcDependsOnPrevDest) || permitExactRepeat;
 			if(!ok)
 				return EFalse;
 			}
@@ -972,7 +1875,6 @@
 //////////////////////////////////////////////////////////////////////
 // TTransferIter class
 //////////////////////////////////////////////////////////////////////
-
 void TTransferIter::operator++ ()
 	{
 	iPtr++; //the standard post increment
@@ -1007,7 +1909,7 @@
 	{
 	const TInt elemSize = iCfg->iElementSize;
 	RTest test(_L("TTransferIter invariant"));
-	const TInt bytesTransfered = (
+	const TUint bytesTransfered = (
 			elemSize * (iFrame * iCfg->iElementsPerFrame + iElem)
 			+ ((TUint)iPtr % (elemSize))
 			);
@@ -1237,9 +2139,6 @@
 		//Here, we must create a test thread for each channel
 		RPointerArray<CTest> concurrentTests;
 
-		if(testCase.iConcurrentTest)
-			RDebug::Printf("== Begin concurrent test run ==");
-
 		const TInt chanRecCount = iChannelRecords.Count();
 		for(TInt j=0; j < chanRecCount; j++)
 			{
@@ -1256,7 +2155,7 @@
 				TEST_ASSERT(dmaTest != NULL);
 
 				dmaTest->SetChannelCookie(record.iCookie);
-				dmaTest->Announce();
+				dmaTest->SetupL();
 				if(testCase.iConcurrentTest)
 					{
 					//Add test to array to be run concurrently
@@ -1265,9 +2164,9 @@
 					}
 				else
 					{
+					dmaTest->Announce();
 					//Run test in this thread
 					(*dmaTest)();
-					//TTestThread(
 					TBool result = dmaTest->Result();
 					TEST_ASSERT(result);
 
@@ -1297,11 +2196,20 @@
 			//if the test case has been run on all channels it will then  wait for all threads to complete.
 			}
 
+		// Run the tests which should happen concurrently
 		const TInt count = concurrentTests.Count();
 		if(count>0)
 			{
+			RDebug::Printf("== Begin concurrent test run ==");
+
+			TInt i;											// VC++
+			for(i=0; i<count; i++)
+				{
+				concurrentTests[i]->Announce();
+				}
+
 			MultipleTestRun(concurrentTests);
-			for(TInt i=0; i<count; i++)
+			for(i=0; i<count; i++)
 				{
 				TBool result = static_cast<CDmaTest*>(concurrentTests[i])->Result();
 				TEST_ASSERT(result);
@@ -1374,8 +2282,20 @@
 	{
 	test.Printf(_L("*** DMA TEST FRAMEWORK ***\n"));
 	test.Printf(_L("Usage : t_dma2.exe [/option]\n"));
-	test.Printf(_L("  /V  or /VERBOSE    = Control test output\n"));
-	test.Printf(_L("  /S  or /SELFTEST   = Run DMA self test\n"));
+	test.Printf(_L("  /V or /VERBOSE  = Control test output\n"));
+	test.Printf(_L("  /S or /SELFTEST = Run DMA self tests\n"));
+	test.Printf(_L("  /simple = Run only simple transfer tests\n"));
+	test.Printf(_L("  /callback = Run only callback tests\n"));
+	test.Printf(_L("  /multi = Run only multipart transfer tests\n"));
+	test.Printf(_L("  /isrdfc = Run only isr and dfc tests\n"));
+	test.Printf(_L("  /isreque = Run only isr reque tests\n"));
+	test.Printf(_L("  /bench = Run only benchmark tests\n"));
+	test.Printf(_L("  /suspend = Run only pause and resume tests\n"));
+	test.Printf(_L("  /graphic = Run only graphic tests\n"));
+	test.Printf(_L("  /channel = Run only DMA channel (opening and closing) tests\n"));
+	test.Printf(_L("  /queue = Run only queue tests\n"));
+	test.Printf(_L("  /fragment = Run only fragmentation related tests\n"));
+	test.Printf(_L("  /request = Run only requests tests related tests\n"));
 	test.Printf(_L("\n"));
 	}
 
@@ -1424,6 +2344,90 @@
 			tokenParsed = ETrue;			
 			}
 
+		// '/suspend' option
+		if ((0== tc->FindF(KArgSuspendTest)))
+			{
+			gSuspend = ETrue;
+			tokenParsed = ETrue;
+			}	
+		
+		// '/simple' option
+		if ((0== tc->FindF(KArgSimpleTest)))
+			{
+			gSimpleTest = ETrue;
+			tokenParsed = ETrue;
+			}	
+		
+		// '/multi' option
+		if ((0== tc->FindF(KArgMultiPartTest)))
+			{
+			gMultiPart = ETrue;
+			tokenParsed = ETrue;
+			}	
+	
+		// '/callback' option
+		if ((0== tc->FindF(KArgCallBackTest)))
+			{
+			gCallBack = ETrue;
+			tokenParsed = ETrue;
+			}	
+		
+		// '/IsrAndDfc' option
+		if ((0== tc->FindF(KArgIsrDfcTest)))
+			{
+			gIsrAndDfc  = ETrue;
+			tokenParsed = ETrue;
+			}	
+		
+		// '/IsrReque' option
+		if ((0== tc->FindF(KArgIsrequeTest)))
+			{
+			gIsrReque = ETrue;
+			tokenParsed = ETrue;
+			}	
+
+		// '/Benchmark' option
+		if ((0== tc->FindF(KArgBenchmarkTest)))
+			{
+			gBenchmark = ETrue;
+			tokenParsed = ETrue;
+			}	
+
+		// '/Queue' option
+		if ((0== tc->FindF(KArgQueueTest)))
+			{
+			gQueue = ETrue;
+			tokenParsed = ETrue;
+			}	
+
+		// '/Fragment' option
+		if ((0== tc->FindF(KArgFragmentTest)))
+			{
+			gFragment = ETrue;
+			tokenParsed = ETrue;
+			}	
+		
+		// '/Channel' option
+		if ((0== tc->FindF(KArgChannelTest)))
+			{
+			gChannel = ETrue;
+			tokenParsed = ETrue;
+			}	
+		
+		// '/Graphic' option
+		if ((0== tc->FindF(KArgGraphicTest)))
+			{
+			gGraphic = ETrue;
+			tokenParsed = ETrue;
+			}	
+
+		// '/Request' option
+		if ((0== tc->FindF(KArgRequestTest)))
+			{
+			gRequest = ETrue;
+			tokenParsed = ETrue;
+			}	
+	
 		if (!tokenParsed)
 			{
 			// warn about unparsed parameter
@@ -1444,8 +2448,61 @@
 	TTestRunner testRunner;
 
 	test.Next(_L("Add global test cases to test runner\n"));
-	testRunner.AddTestCases(TestArray);
 
+	if (gSimpleTest) //Add only simple tranfer test cases
+	{
+		testRunner.AddTestCases(TestArraySimple);
+	}
+	else if (gCallBack)  //Add only callback test cases
+	{
+		testRunner.AddTestCases(TestArrayCallback);
+	}
+	else if (gIsrReque)  //Add only ISR Reque test cases
+	{
+		testRunner.AddTestCases(TestArrayIsrReque);
+	}
+	else if (gMultiPart)  //Add only Multipart test cases
+	{
+		testRunner.AddTestCases(TestArrayMultiPart);
+	}
+	else if (gIsrAndDfc)  //Add only IsrAndDfc test cases
+	{
+		testRunner.AddTestCases(TestArrayIsrAndDfc);
+	}
+	else if (gBenchmark)  //Add only Benchmark test cases
+	{
+		testRunner.AddTestCases(TestArrayBenchmark);
+	}
+	else if (gGraphic)  //Add only 2D test cases
+	{
+		testRunner.AddTestCases(TestArray2DTest);
+	}
+	else if (gFragment)  //Add only Fragment test cases
+	{
+		testRunner.AddTestCases(TestArrayFragment);
+	}
+	else if (gChannel)  //Add only Channel test cases
+	{
+		testRunner.AddTestCases(TestArrayChannel);
+	}
+	else if (gSuspend)  //Add only Suspend test cases
+	{
+		testRunner.AddTestCases(TestArraySuspend);
+	}
+	else if (gQueue)  //Add only queue test cases
+	{
+		testRunner.AddTestCases(TestArrayQueue);
+	}
+	else if (gRequest)  //Add only request test cases
+	{
+		testRunner.AddTestCases(TestArrayRequest);
+	}
+	else
+	{
+		testRunner.AddTestCases(TestArray);//Add all test cases
+	}
+
+	
 	test.Next(_L("call TTestRunner::RunTests()\n"));
 	testRunner.RunTests();
 
@@ -1455,7 +2512,6 @@
 TInt E32Main()
 	{
 	__UHEAP_MARK;
-	//__KHEAP_MARK;
 	test.Title();
 
 	gHelpRequested = EFalse;
@@ -1495,10 +2551,7 @@
 
 	if (!(dma2Loaded || dma2CompatLoaded))
 		{
-		//TODO how can we distinguish this case from a platform where
-		//dma is supposed to be supported but the dma test ldd is
-		//missing?
-		test.Printf(_L("DMA not supported - test skipped\n"));
+		test.Printf(_L("DMA test driver not found - test skipped\n"));
 		return 0;
 		}
 	else if (dma2Loaded && !dma2CompatLoaded)
@@ -1527,10 +2580,12 @@
 	SelfTests(); 	
 	}
 
-	ApiTests();
-
 	RunDMATests();
 
+	// Wait for the supervisor thread to run and perform asynchronous
+	// cleanup, so that kernel heap space will be freed
+	r = UserSvr::HalFunction(EHalGroupKernel, EKernelHalSupervisorBarrier, (TAny*)5000, 0);
+	test_KErrNone(r);
 	__KHEAP_MARKEND;
 
 	r = User::FreeLogicalDevice(KTestDmaLddName);
@@ -1540,7 +2595,6 @@
 
 	delete cleanup;
 
-	//__KHEAP_MARKEND;
 	__UHEAP_MARKEND;
 	return 0;
 	}
--- a/kerneltest/e32test/dmav2/t_dma2.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/dmav2/t_dma2.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -22,15 +22,25 @@
 #include "d_dma2.h"
 #include <e32std.h>
 
-
 class TTestCase;
 // Global array of test cases
 extern RPointerArray<TTestCase> TestArray;
-
+extern RPointerArray<TTestCase> TestArrayCallback;
+extern RPointerArray<TTestCase> TestArrayIsrReque;
+extern RPointerArray<TTestCase> TestArrayMultiPart;
+extern RPointerArray<TTestCase> TestArrayIsrAndDfc;
+extern RPointerArray<TTestCase> TestArrayBenchmark;
+extern RPointerArray<TTestCase> TestArray2DTest;
+extern RPointerArray<TTestCase> TestArrayIsrAndDfc;
+extern RPointerArray<TTestCase> TestArrayChannel;
+extern RPointerArray<TTestCase> TestArraySuspend;
+extern RPointerArray<TTestCase> TestArrayQueue;
+extern RPointerArray<TTestCase>	TestArraySimple;
+extern RPointerArray<TTestCase>	TestArrayRequest;
+extern RPointerArray<TTestCase>	TestArrayFragment;
 
 extern TBool gVerboseOutput;   // Verbose output control
 
-
 const TInt KParameterTextLenMax = 80;	// command-line param length
 
 /**
@@ -43,18 +53,13 @@
 */
 void SelfTests();
 
-void ApiTests();
-
 class CSingleTransferTest;
 class CIsrRequeTest;
 class CMultiTransferTest;
 
-
 /**
 An interface to a classs that sets up the buffers before a test
 */
-//TODO both pre and post transfer checks should perhaps derive from an
-//abstract visitor base
 class MPreTransfer
 	{
 public:
@@ -134,6 +139,25 @@
 	};
 
 /**
+Check whether destination buffers are zero filled
+
+Used to check that a transfer hasn't taken place.
+*/
+class TCheckNoTransfer : public MPostTransferCheck
+	{
+public:
+	TCheckNoTransfer()
+		{}
+
+	virtual TInt Check(const CSingleTransferTest& aTest) const;
+	virtual TInt Check(const CIsrRequeTest& aTest) const;
+	virtual TInt Check(CMultiTransferTest& aTest) const;
+
+protected:
+	TBool IsZeroed(const TDmaTransferArgs& aTransferArgs, TUint8* aChunkBase) const;
+	};
+
+/**
 Base class for all DMA tests
 */
 class CDmaTest : public CTest
@@ -144,8 +168,11 @@
 		{}
 
 	void OpenDmaSession();
+	/* Duplicate aSession */
+	void OpenDmaSession(const RDmaSession& aSession);
 	void CloseDmaSession();
-
+	void ChannelPause(const TUint aChannelSessionCookie);
+	void ChannelResume(const TUint aChannelSessionCookie);
 	virtual void PrintTestInfo() const;
 	virtual TBool Result() = 0;
 
@@ -158,8 +185,8 @@
 	void SetChannelCookie(TUint32 aCookie)
 		{iChannelCookie = aCookie;}
 
-	virtual void PreTransferSetup() =0;
-	virtual TInt DoPostTransferCheck() =0;
+	virtual void PreTransferSetup();
+	virtual TInt DoPostTransferCheck();
 protected:
 	RDmaSession iDmaSession;
 	RChunk iChunk;
@@ -174,6 +201,49 @@
 	};
 
 /**
+The Decorator Pattern is used allowing test classes to be optionally extended
+using wrapper/decorator classes.
+This is the base class for test decorators
+*/
+class CDmaTestDecorator : public CDmaTest
+	{
+public:
+
+protected:
+	CDmaTestDecorator(CDmaTest* aDecoratedTest);
+	CDmaTestDecorator(const CDmaTestDecorator& aOther);
+
+	CDmaTest* iDecoratedTest;
+	};
+
+/**
+Will run the wrapped test against both versions of the DMA
+API if available, otherwise just the old version.
+*/
+class CMultiVersionTest : public CDmaTestDecorator
+	{
+public:
+	CMultiVersionTest(CSingleTransferTest* aDmaTest); 
+	CMultiVersionTest(const CMultiVersionTest& aOther);
+	~CMultiVersionTest();
+
+	virtual void Announce() const;
+	virtual void PrintTestType() const;
+	virtual void PrintTestInfo() const; 
+
+	virtual CTest* Clone() const {return new CMultiVersionTest(*this);}
+	virtual void SetupL();
+
+	virtual void RunTest();
+	virtual TBool Result();
+
+protected:
+	void Configure();
+	TBool Version2PILAvailable();
+	CSingleTransferTest* iNewVersionTest;
+	};
+
+/**
 Holds return codes for the various functions which must be called
 to create, fragment, and queue a DMA request
 */
@@ -186,14 +256,20 @@
 		TInt aFragmentationResult = KErrNone,
 		TInt aQueueResult = KErrNone
 		)
-		:iCreate(aCreate), iFragmentCount(aFragmentCount), iFragmentationResult(aFragmentationResult), iQueueResult(aQueueResult)
+		:iCreate(aCreate), 
+		 iFragmentCount(aFragmentCount), 
+		 iFragmentationResult(aFragmentationResult), 
+		 iQueueResult(aQueueResult)
 		{}
 
 	/**
 	Constructs with error results
 	*/
 	TRequestResults(TFalse)
-		:iCreate(KErrUnknown), iFragmentCount(0), iFragmentationResult(KErrUnknown), iQueueResult(KErrUnknown)
+		:iCreate(KErrUnknown), 
+		 iFragmentCount(0), 
+		 iFragmentationResult(KErrUnknown), 
+		 iQueueResult(KErrUnknown)
 		{}
 
 	inline TRequestResults& CreationResult(TInt aErrorCode) {iCreate = aErrorCode; return *this;}
@@ -273,15 +349,24 @@
 	virtual void Setup(const CSingleTransferTest& aTest) const;
 	virtual void Setup(const CIsrRequeTest& aTest) const;
 	virtual void Setup(const CMultiTransferTest& aTest) const;
+
+	static void SelfTest();
 protected:
 	virtual void Setup(const TAddressParms& aParams) const;
+
 	TBool CheckBuffers(const CIsrRequeTest& aTest) const;
-	TBool CheckBuffers(const RArray<const TAddressParms> aTransferParams) const;
+	TBool CheckBuffers(const CMultiTransferTest& aTest) const;
+
+	TBool CheckBuffers(const RArray<const TAddressParms>& aTransferParams, TBool aAllowExactRepeat=ETrue) const;
+
+	// This function is part of the unit test
+	friend TBool DoTferParmTestL(const TAddressParms* aParms, TInt aCount, TBool aAllowRepeat, TBool aPositive);
 	};
 
 const TPreTransferIncrBytes KPreTransferIncrBytes;
 const TCompareSrcDst KCompareSrcDst;
 const TCompare2D KCompare2D;
+const TCheckNoTransfer KCheckNoTransfer;
 
 
 /**
@@ -328,7 +413,7 @@
 
 	TUint8* iPtr; //<! Pointer to the current byte
 
-	TInt iBytes; //!< The number of bytes traversed
+	TUint iBytes; //!< The number of bytes traversed
 	};
 
 /**
@@ -360,6 +445,7 @@
 	*/
 	virtual void RunTest();
 	virtual void PrintTestType() const;
+	virtual void PrintTestInfo() const;
 
 	virtual CTest* Clone() const {return new CSingleTransferTest(*this);}
 
@@ -422,12 +508,102 @@
 	};
 
 /**
+This class will be used for testing DMA Close() and Open() API
+
+Extends CDmaTest by implemeting a RunTest() with a sequence of operations 
+to test Close() and Open() API 
+*/
+class COpenCloseTest : public CDmaTest 
+	{
+public:
+	COpenCloseTest(
+			const TDesC& aName, TInt aIterations,	
+			const MPostTransferCheck* aPostTferChk = NULL,
+			const MPreTransfer* aPreTfer = NULL
+			)
+		: CDmaTest(aName, aIterations, aPreTfer, aPostTferChk), iOpenCloseResult(EFalse) , iRunOpen(EFalse)
+		{}
+
+	~COpenCloseTest();
+
+	virtual void RunTest();
+	virtual void PrintTestType() const;
+
+	virtual CTest* Clone() const {return new COpenCloseTest(*this);}
+	
+	/**
+	Checks the results of the sequeunce of  sequence of operations 
+	to test Close() and Open() API, return ETrue for a pass, EFalse for a fail
+	 */
+	virtual TBool Result();
+
+	// The methods below is a setters ie. The Named Parameter Idiom
+	// @see http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.18
+	inline COpenCloseTest& RunOpenApiTest(TBool aFlag) {iRunOpen=aFlag; return *this;}
+
+protected:	
+	TBool DoRunClose();
+	TBool DoRunOpen();
+	TBool DoRunOpenExposed();
+
+protected:
+	/**
+	A handle to kernel side TDmaChannel object received after a channel is opened.
+	*/
+	TUint iChannelSessionCookie;
+	/**
+	A handle to kernel side DDmaRequest object.
+	*/
+	TUint iRequestSessionCookie;
+
+	/**
+	If true then Close/Open  API test passed
+	*/
+	TBool iOpenCloseResult;
+	
+	/**
+	 If true then run Open API test otherwise run Close API test
+	*/
+	TBool iRunOpen;
+	};
+
+/**
+Used for testing Pause and Resume
+
+Extends CSingle transfer by adding the capability to test
+Pause  & Resume() API.
+*/
+class CPauseResumeTest : public CSingleTransferTest
+	{
+public:
+	 CPauseResumeTest(const TDesC& aName, TInt aIterations, const TDmaTransferArgs& aArgs, const TResultSet& aExpected)
+		:CSingleTransferTest(aName, aIterations, aArgs, aExpected)
+	 {}
+
+	~CPauseResumeTest();
+
+	virtual void RunTest();
+	virtual void PrintTestType() const;
+
+	virtual CTest* Clone() const {return new  CPauseResumeTest(*this);}
+
+	// The methods below is a setters ie. The Named Parameter Idiom
+	// @see http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.18
+	inline CPauseResumeTest& UseNewDmaApi(TBool aFlag) {CSingleTransferTest::UseNewDmaApi(aFlag); return *this;}
+
+protected:
+	void DoCalibrationTransfer(TUint64 &atime);
+	TInt QueueAsyncRequest(TRequestStatus &aRequestState,TUint64 &atime);
+	};
+
+/**
 This class will be used for tests which benchmark certain DMA operations
 */
 class CDmaBenchmark : public CSingleTransferTest
 	{
 public:
 	CDmaBenchmark(const TDesC& aName, TInt aIterations, const TResultSet& aExpectedResults, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize);
+	CDmaBenchmark(const CDmaBenchmark& aOriginal);
 	~CDmaBenchmark();
 
 	virtual TBool Result();
@@ -440,15 +616,11 @@
 	*/
 	TUint64 MeanResult();
 
-	//TODO must be included within copy ctor or all instances will
-	//share on result set!
 	RArray<TUint64> iResultArray;
-
 	};
 
 /**
 Fragments requests (only) and records duration
-TODO make sure we are using old style DDmaRequest
 */
 class CDmaBmFragmentation : public CDmaBenchmark
 	{
@@ -550,6 +722,68 @@
 	};
 
 /**
+Used for testing TDmaChannel::IsQueueEmpty
+Extends CMultiTransferTest by adding the capability to test IsQueueEmpty() API. 
+*/
+class CIsQueueEmptyTest : public  CMultiTransferTest 
+	{
+public:
+	CIsQueueEmptyTest(const TDesC& aName, TInt aIterations, const TDmaTransferArgs* aTransferArgs, const TResultSet* aResultSets, TInt aCount);
+	CIsQueueEmptyTest(const CIsQueueEmptyTest& aOther);
+	~CIsQueueEmptyTest();
+
+	inline CIsQueueEmptyTest& SetPreTransferTest(const MPreTransfer* aPreTfer) {iPreTransfer = aPreTfer; return *this;}
+	inline CIsQueueEmptyTest& SetPostTransferTest(const MPostTransferCheck* aPostTfer) {iPostTransferCheck = aPostTfer; return *this;}
+
+	virtual CTest* Clone() const {return new CIsQueueEmptyTest(*this);}
+	virtual void RunTest();
+	virtual void PrintTestType() const;
+
+protected:
+	void DoQueueNotEmpty();	
+	void DoIsQueueEmpty();
+	void QueueRequests();
+	};
+
+/**
+Used for testing CancelAll, Will create and queue multiple requests
+Extends CSingle transfer by adding the capability to test CancelAll API
+*/
+class CCancelAllTest : public CMultiTransferTest
+	{
+public:
+	CCancelAllTest(const TDesC& aName, TInt aIterations,
+		const TDmaTransferArgs* aTransferArgs, const TResultSet* aResultSets,
+		TInt aCount
+		);
+	//CCancelAllTest(const CCacheNotifyDirCh
+
+	virtual void RunTest();
+	virtual void PrintTestType() const;
+	virtual CTest* Clone() const {return new CCancelAllTest(*this);}
+
+	inline CCancelAllTest& PauseWhileQueuing()
+		{iPauseWhileQueuing = ETrue; return *this;}
+	inline CCancelAllTest& SetPreTransferTest(const MPreTransfer* aPreTfer)
+		{iPreTransfer = aPreTfer; return *this;}
+	inline CCancelAllTest& SetPostTransferTest(const MPostTransferCheck* aPostTfer)
+		{iPostTransferCheck = aPostTfer; return *this;}
+
+protected:
+	void QueueRequestsAsync();
+	TInt CancelAllRequests();
+	void PauseChannel();
+	void ResumeChannel();
+
+	/**
+	A single request status that we use for all
+	asynchronously queued requests (we do not intend
+	to wait for them)
+	*/
+	TRequestStatus iDummyRequestStatus;
+	};
+
+/**
 Used for testing TDmaChannel::IsrRedoRequest
 
 Extends CSingle transfer by adding the capability to queue with
@@ -567,15 +801,6 @@
 	virtual void PrintTestType() const;
 
 	virtual void Queue();
-
-	/**
-	Compares the actual vs the exepected results and reports
-	of the test passed
-	@return ETrue for a pass, EFalse for a fail
-	 */
-	//virtual TBool Result();
-
-
 	virtual CTest* Clone() const {return new CIsrRequeTest(*this);}
 
 	const TIsrRequeArgsSet& GetRequeueArgs() const
@@ -617,8 +842,6 @@
 class TTestCase
 	{
 public:
-	//TODO it might be better to group sets of TDmaCapability
-	//into their own class eg. TDmaCapSet.
 	TTestCase(CDmaTest* aTest,
            TBool aConcurrent = EFalse,
 		   const TDmaCapability = TDmaCapability(),
@@ -661,11 +884,10 @@
 	~TTestRunner();
 
 	/**
-	This function will populate TTestRunner with an array of test cases which 
-	would be a collection of DMA test,its hardware prerequisites,and other 
-	information about how the test	
+	This function will populate TTestRunner with an array of test cases
+	to be run
 
-	@aTTestCases on return, this contains an the DMA test cases 
+	@param aTTestCases Array of test cases
 	*/
 	void AddTestCases(RPointerArray<TTestCase>& aTTestCases);
 
@@ -715,5 +937,25 @@
 	RArray<TUint> iPslCookies;
 };
 
+/**
+Copy an RArray
+*/
+template <typename T>
+void CopyL(const RArray<T>& aOriginal, RArray<T>& aNew)
+	{
+	const TInt count = aOriginal.Count();
+	for(TInt i=0; i<count; ++i)
+		{
+		aNew.AppendL(aOriginal[i]);
+		}
+	}
+
+template <typename T, typename Iterator>
+void ArrayAppendL(RArray<T>& aArray, Iterator aBegin, Iterator aEnd)
+	{
+	for(Iterator begin = aBegin; begin != aEnd; ++begin)
+		aArray.AppendL(*begin);
+	}
+
 
 #endif // #ifndef __T_DMA2_H__
--- a/kerneltest/e32test/dmav2/test_cases.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/dmav2/test_cases.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -24,24 +24,121 @@
 const TCallbackRecord isrCallback(TCallbackRecord::EIsr,1);
 
 const TInt size = 128 * KKilo;
-//--------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2560
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    Simple DMA transfer test using CSingleTransferTest and New DMA APIs
+const TInt trans64K_1 = ((64 * KKilo) -1); // 65535
+
+//----------------------------------------------------------------------------------------------
+//! TestCaseID      KBASE-DMA-2571
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    This test verifies the correct behavior of CancelAll API in the new DMA 
+//!					framework 
 //!
-//! @SYMTestActions     
-//!						1.
-//!						2.	
+//! TestActions     
+//!						1.	Open a DMA channel for a transfer.
+//!						2.  Queue multiple request on the DMA channel.
+//!						3.	Call CancelAll () on the DMA channel.
+//!						4.  Verify that all transfers have been cancelled.
+//!						5   Open a DMA channel for a transfer. This channel should support pause and resume.
+//!						6.  Call Pause () on the channel.
+//!						7.	Queue multiple request on the DMA channel.
+//!						8.	Call CancelAll () on the channel.
+//!						9.	Verify that all transfers have been cancelled.
+//!
+//!
+//! TestExpectedResults 1.  DMA channel opens and KErrNone returned.
+//!						2.  DMA queue request created and KErrNone returned.
+//!						3.  CancelAll () cancels all queued request.
+//!						4.  All queued request are cancelled
+//!						5.	DMA Request completes
 //!
 //!
-//! @SYMTestExpectedResults 
-//!						1.  
-//!						2.		
+//! TestPriority        High
+//! TestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace CancelAllTest
+	{
+	const TInt size = 2 * KMega;
+	const TDmaTransferArgs transferArgArray[] = {
+		TDmaTransferArgs(0, size, size, KDmaMemAddr),
+		TDmaTransferArgs(2 * size, 3 * size, size, KDmaMemAddr)
+	};
+
+	TResultSet noTransferExpected = TResultSet()
+		.PostTransferResult(KErrNone)
+		.CallbackRecord(TCallbackRecord::Empty());
+
+	const TResultSet expected[] =
+		{
+		TResultSet(noTransferExpected),
+		TResultSet(noTransferExpected)
+		};
+
+	// Test that 2 requests can be queued on a paused channel
+	// then cleared using CancelAll.
+	// It is expected that no data will have been transferred to the
+	// destination buffer.
+	CCancelAllTest testcancelall =
+		CCancelAllTest(_L("CancelAllTest : Cancel and verify cancellation of requests"), 1, transferArgArray, expected, ARRAY_LENGTH(transferArgArray))
+			.SetPreTransferTest(&KPreTransferIncrBytes)
+			.SetPostTransferTest(&KCheckNoTransfer);
+
+	TTestCase testCase(&testcancelall,EFalse,capAboveV1,pauseRequired_skip);
+	}
+
+//--------------------------------------------------------------------------------------------
+//! TestCaseID      KBASE-DMA-2569
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    This test verifies the correct behavior of Pause and Resume API in the new DMA 
+//!					framework 
+//!
+//! TestActions     
+//!						1.	Open a DMA channel for a transfer.
+//!						2.  Setup a DMA request and time how long the transfer takes
+//!						3.	Pause the DMA channel
+//!						4.  Repeat DMA transfer (queued asynchronously)
+//!						5.  Resume DMA Channel
+//! 
+//!	TestExpectedResults 1.  DMA channel opens and KErrNone returned.
+//!						2.  DMA request created and KErrNone returned.
+//!						3.  DMA channel Paused.
+//!						4.  Request queued and waits until Resume is called
+//!						5.	DMA Request completes
+//!
+//! TestPriority        High
+//! TestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace PauseResumeApiTest
+	{
+	const TInt srcAddr		= 0;
+	const TInt desAddr		= 2 * KMega;	
+	const TInt transferSize = 1 * KMega;	
+
+	TDmaTransferArgs transferArgs(srcAddr, desAddr, transferSize, KDmaMemAddr);
+	const TResultSet expectedResults(threadCallback);
+	CPauseResumeTest testPauseResume = CPauseResumeTest(_L("Pause and Resume Test"), 1, transferArgs, expectedResults); 
+	TTestCase testCasePauseResume(&testPauseResume, EFalse, capAboveV1,pauseRequired_skip);	
+	}
+
+//--------------------------------------------------------------------------------------------
+//! TestCaseID      KBASE-DMA-2560
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    Simple DMA transfer test using CSingleTransferTest and New DMA APIs
+//!
+//! TestActions     
+//!						1.	Open a DMA channel for a transfer.
+//!						2.	Create single transfer test and run test
+//!				
+//!
+//!
+//! TestExpectedResults 
+//!						1.  DMA channel opens and KErrNone returned.
+//!						2.	DMA transfer completes with no errors.
 //!							
 //!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
+//! TestPriority        High
+//! TestStatus          Implemented
 //----------------------------------------------------------------------------------------------
 namespace Simple_1
 	{
@@ -51,60 +148,29 @@
 
 	CSingleTransferTest simpleTest(_L("Simple Test - New DMA APIs"), 1, transferArgs, expectedResults);
 
-	TTestCase testCase(&simpleTest, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&simpleTest, ETrue, capAboveV1);
+	TTestCase testCase(new (ELeave) CMultiVersionTest(&simpleTest), EFalse);
+	TTestCase testCaseConcurrent(new (ELeave) CMultiVersionTest(&simpleTest), ETrue);
 	}
 
 //----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2561
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    Simple DMA transfer test using CSingleTransferTest and OLD DMA APIs
-//!
-//! @SYMTestActions     
-//!						1.
-//!						2.	
-//!
-//!
-//! @SYMTestExpectedResults 
-//!						1.  
-//!						2.						
-//!							
+//! TestCaseID      KBASE-DMA-2573
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    DMA ISR Callback test (Isr Callback - use old request Ctor)
 //!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
-//----------------------------------------------------------------------------------------------
-namespace Simple_2
-	{
-	TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr);
-
-	const TResultSet expectedResults(threadCallback);
-
-	CSingleTransferTest simpleTest = CSingleTransferTest(_L("Simple Test - Old DMA APIs"), 1, transferArgs, expectedResults, 0).
-		UseNewDmaApi(EFalse);
-
-	TTestCase testCase(&simpleTest, EFalse);
-	TTestCase testCaseConcurrent(&simpleTest, ETrue);
-	}
-
-//----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2573
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    DMA ISR Callback test (Isr Callback - use old request Ctor)
+//! TestActions     
+//!						1.	Setup DMA transfer to request a callback from ISR using old style DDmaRequest.
+//!						2.	Create single transfer test and run test
+//!						3.	Verify that DDmaRequest request fails
 //!
-//! @SYMTestActions     
-//!						1.
-//!						2.	
-//!
+//! TestExpectedResults 
+//!						1.  DMA channel opens and KErrNone returned.
+//!						2.	DMA transfer created with no errors.
+//!						3.	DDmaRequest request fails. 
+//!						
 //!
-//! @SYMTestExpectedResults 
-//!						1.  
-//!						2.		
-//!							
-//!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
+//! TestPriority        High
+//! TestStatus          Implemented
 //----------------------------------------------------------------------------------------------
 namespace Callback
 	{
@@ -131,23 +197,25 @@
 	}
 
 //----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2574,KBASE-DMA-2575
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    DMA ISR Reque test
+//! TestCaseID      KBASE-DMA-2574,KBASE-DMA-2575
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    DMA ISR Reque test
 //!
-//! @SYMTestActions     
-//!						1.
-//!						2.	
+//! TestActions     
+//!					1.	Setup DMA transfer to request a callback from ISR.
+//!					2.	Set up ISR to requeue the DMA request on the same channel and adjust its transfer parameters.
+//!					3.	Create single transfer test and run test
+//!					4.	Verify a client can queue the just completed DMA request from within an ISR callback.
 //!
-//!
-//! @SYMTestExpectedResults 
-//!						1.  
-//!						2.		
+//! TestExpectedResults 
+//!					
+//!					DMA transfer completes and just completed request can be requeued from within an ISR 
+//!					callback on the same channel. Requeued DMA request completes successfully
 //!							
 //!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
+//! TestPriority        High
+//! TestStatus          Implemented
 //----------------------------------------------------------------------------------------------
 namespace ISR_Reque
 	{
@@ -156,6 +224,9 @@
 
 	const TRequestResults requestResult(KErrNone, 1); // request must be in a single fragment
 
+	//-------------------------------------------------------------
+	//This case requeues 4 transfers at the end of an ISR callback
+	//-------------------------------------------------------------
 	namespace endOnIsrCb
 		{
 		TIsrRequeArgs requeArgs[] = {
@@ -174,6 +245,9 @@
 		TTestCase testCase(new (ELeave) CIsrRequeTest(_L("4 Requeues - end on isr cb"), 1, tferArgs, requeArgs, count, expected, &KPreTransferIncrBytes, &KCompareSrcDst), ETrue, capAboveV1);
 		}
 
+	//---------------------------------------------------------------
+	///This case requeues 4 transfers at the end of a thread callback
+	//---------------------------------------------------------------
 	namespace endOnThreadCb
 		{
 		TIsrRequeArgs requeArgs[] = {
@@ -189,7 +263,10 @@
 
 		TTestCase testCase(new (ELeave) CIsrRequeTest(_L("4 Requeues - end on thread cb"), 1, tferArgs, requeArgs, count, expected, &KPreTransferIncrBytes, &KCompareSrcDst), ETrue, capAboveV1);
 		}
-
+	
+	//----------------------------------------------------------------------------------------------
+	// This case requeues a transfer from within an thread callback after changing the transfer size
+	//----------------------------------------------------------------------------------------------
 	namespace changeSize
 		{
 		TIsrRequeArgs requeArgs[] = {
@@ -203,10 +280,13 @@
 		TTestCase testCase(new (ELeave) CIsrRequeTest(_L("1 Requeues - change transfer size"), 1, tferArgs, requeArgs, count, expected, &KPreTransferIncrBytes, &KCompareSrcDst), ETrue, capAboveV1);
 		}
 
+	//--------------------------------------------------------------------------------------------
+	// This case requeues a just completed request from within an ISR callback 
+	//--------------------------------------------------------------------------------------------
 	namespace endOnRedo
 		{
-		// TODO have made this bigger than 4k so that we don't miss the second interrupt when tracing enabled
-		// this indicates the PSL's interrupt handler misses an interrupt if it occurs during the interrupt.
+		// The transfer size has been made bigger than 4K so that we do not miss the second interrupt when tracing 
+		// enabled is. This indicates the PSL's interrupt handler misses an interrupt if it occurs during the interrupt.
 		const TInt size = 0x10000;
 		TDmaTransferArgs tferArgs(0, 2*size, size, KDmaMemAddr, KDmaSyncAuto, KDmaRequestCallbackFromIsr);
 
@@ -222,6 +302,9 @@
 		TTestCase testCase(new (ELeave) CIsrRequeTest(_L("2 Requeues - Isr redo request repeated"), 1, tferArgs, requeArgs, count, expected, &KPreTransferIncrBytes, &KCompareSrcDst), EFalse, capAboveV1);
 		}
 
+	//--------------------------------------------------------------------------------------------
+	// This case requeues a request from within an ISR callback using invalid requeue parameters
+	//--------------------------------------------------------------------------------------------
 	namespace invalidAddresses
 		{
 		TIsrRequeArgs requeArgs[] = {
@@ -235,41 +318,51 @@
 		// pre and post test would fail because of bad requeue parameters
 		TTestCase testCase(new (ELeave) CIsrRequeTest(_L("Requeue with matching addresses"), 1, tferArgs, requeArgs, count, expected, NULL, NULL), ETrue, capAboveV1);
 		}
-
+	//--------------------------------------------------------------------------------------------
+	// This case requeues a request containing more than 1 fragment from within an ISR callback
+	// 
+	//		
+	// This test case is currently caught by a FAULT instead of a return code
+	// as expected. Currently, the facility to return an error code to the test
+	// framework is not yet supported.
+	//
+	// It has been implemented to expect an error code of KErrGeneral as requeues for request that
+	// contains more than one fragments are not allowed. 
+	//--------------------------------------------------------------------------------------------
 	namespace multipleFragments
 		{
 		TIsrRequeArgs requeArgs[] = {
 			TIsrRequeArgs()
 		};
 		const TInt count = ARRAY_LENGTH(requeArgs);
+		const TRequestResults isrequestResult(KErrNone, 2); // request contains 2 fragments
 
-		const TCallbackRecord callbackRecord = TCallbackRecord(TCallbackRecord::EThread, count + 1).IsrRedoResult(KErrNone);
-
-		TRequestResults results2Fragments = TRequestResults(requestResult).FragmentCount(2);
+		const TCallbackRecord callbackRecord = TCallbackRecord(TCallbackRecord::EIsr, 1).IsrRedoResult(KErrGeneral);
+		TRequestResults results2Fragments = TRequestResults(isrequestResult).FragmentCount(2); 
 		const TResultSet expected(KErrNone, results2Fragments, KErrNone, callbackRecord);
 
 		TTestCase testCase(new (ELeave) CIsrRequeTest(_L("Attempt to Requeue 2 fragment request"), 1, tferArgs, requeArgs, count, expected, &KPreTransferIncrBytes, &KCompareSrcDst, size/2), ETrue, capAboveV1);
 
 		}
-	}
+	}	
 
 //----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      PBASE-DMA-FUNC-xxx
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    DMA Multiple transfer test
-//! @SYMTestActions     
-//!						1.
-//!						2.	
+//! TestCaseID      PBASE-DMA-FUNC-2586
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    DMA Multiple transfer test
+//! TestActions     
+//!						1.Setup DMA transfer to using muliple transfers.
+//!						2.Create multipart transfer test and run test.	
 //!
 //!
-//! @SYMTestExpectedResults 
-//!						1.  
-//!						2.		
+//! TestExpectedResults 
+//!						1.  DMA tranfer set up with no errors. 
+//!						2.	Multipart transfer tests completes with no issues.		
 //!							
 //!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
+//! TestPriority        High
+//! TestStatus          Implemented
 //----------------------------------------------------------------------------------------------
 namespace Multipart
 	{
@@ -278,7 +371,7 @@
 	const TInt size = 2 * KMega;
 	const TDmaTransferArgs transferArgArray[] = {
 		TDmaTransferArgs(0, size, size, KDmaMemAddr),
-		TDmaTransferArgs(size, 2 * size, size, KDmaMemAddr)
+		TDmaTransferArgs(2 * size, 3 * size, size, KDmaMemAddr)
 	};
 
 	const TResultSet expected[] =
@@ -286,7 +379,6 @@
 		TResultSet(),
 		TResultSet()
 		};
-	const TResultSet expectedResults(isrCallback);
 
 	CMultiTransferTest multipart =
 		CMultiTransferTest(_L("Sg request concatination"), 1, transferArgArray, expected, ARRAY_LENGTH(transferArgArray))
@@ -297,32 +389,32 @@
 	}
 
 //----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2580
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    These tests attempt to queue ISR cb requests while the queue is not 
-//!						empty and queing normal requests when an ISR cb is pending
-//! @SYMTestActions     
-//!						1.
-//!						2.	
+//! TestCaseID      KBASE-DMA-2580
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    These tests attempt to queue ISR cb requests while the queue is not 
+//!					empty and queing normal requests when an ISR cb is pending
+//! TestActions     
+//!				
+//!					1.	Setup DMA transfer to request a callback from ISR.
+//!					2.	Create single transfer test and run test
+//!					3.	Queue another request using Queue()before ISR Callback completion
+//!					4.	Verify a DMA framework flags an error.
 //!
 //!
-//! @SYMTestExpectedResults 
-//!						1.  
-//!						2.		
-//!							
+//! TestExpectedResults 
+//!					DMA framework flags an error  if ISR callback has not been executed 
+//!					for the last time without re-queueing the initial transfer request		
 //!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
+//! TestPriority        High
+//! TestStatus          Implemented
 //----------------------------------------------------------------------------------------------
 namespace IsrAndDfc
 	{
-	// need long transfer, so that 1st request is still queued
-	// when the second one is queued
-	// TODO pause is the better way to ensure this
-	//const TInt size = 2 * KMega;
-	//TODO have changed size to ensure that the first isr callback request in IsrBeforeDfc
-	//will only have one fragment
+	// This test case needs a long transfer so that 1st request is still queued when the second 
+	// one is queued. The use of Pause is recommended in order to guarantee this. For this case, 
+	// the size has been selected to ensure that the first isr callback request in IsrBeforeDfc
+	// will only have one fragment
 	const TInt size = 0x40000;
 	TDmaTransferArgs dfcTransfer(0, size, size, KDmaMemAddr);
 	TDmaTransferArgs isrTransfer(2*size, 3*size, size, KDmaMemAddr, KDmaSyncAuto, KDmaRequestCallbackFromIsr);
@@ -348,8 +440,9 @@
 		CMultiTransferTest dfcBeforeIsr =
 			CMultiTransferTest(_L("DFC cb req before ISR cb req "), 1, transferArgArray, expected, ARRAY_LENGTH(transferArgArray))
 				.SetPreTransferTest(&KPreTransferIncrBytes)
-				.SetPostTransferTest(&KCompareSrcDst);
-		TTestCase testCase(&dfcBeforeIsr, EFalse, hwDesWanted_skip);
+				.SetPostTransferTest(&KCompareSrcDst)
+				.PauseWhileQueuing();
+		TTestCase testCase(&dfcBeforeIsr, EFalse, pauseRequired_skip, capAboveV1);
 		}
 
 	namespace IsrBeforeDfc
@@ -368,30 +461,32 @@
 		CMultiTransferTest dfcBeforeIsr =
 			CMultiTransferTest(_L("ISR cb req before DFC cb req "), 1, transferArgArray, expected, ARRAY_LENGTH(transferArgArray))
 				.SetPreTransferTest(&KPreTransferIncrBytes)
-				.SetPostTransferTest(&KCompareSrcDst);
-		TTestCase testCase(&dfcBeforeIsr, EFalse, hwDesWanted_skip);
+				.SetPostTransferTest(&KCompareSrcDst)
+				.PauseWhileQueuing();
+		TTestCase testCase(&dfcBeforeIsr, EFalse, pauseRequired_skip, capAboveV1);
 		}
 
 	}
 
 //----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      PBASE-DMA-FUNC-xxx
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    DMA 2D transfer test
+//! TestCaseID      PBASE-DMA-FUNC-2587
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    DMA 2D transfer test
 //!
-//! @SYMTestActions     
-//!						1.
-//!						2.	
+//! TestActions     
+//!						1. Set up DMA transfer using TDmaTransArgs parameters specified in order to
+//!						   rotate an image by 90 degrees clockwise.
+//!						2. Verify that destination buffer gets transformed according to the DMA
+//!						   transfer arguments after transfer.
 //!
-//!
-//! @SYMTestExpectedResults 
-//!						1.  
-//!						2.		
+//! TestExpectedResults 
+//!						1. DMA tranfer set up with no errors. 
+//!						2. Destination buffer gets transformed accordingly.
 //!							
 //!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
+//! TestPriority        High
+//! TestStatus          Implemented
 //----------------------------------------------------------------------------------------------
 namespace _2D_Test
 	{
@@ -429,23 +524,25 @@
 	}
 
 //----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2565
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    DMA Fragmentation count test
+//! TestCaseID      KBASE-DMA-2565
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    DMA Fragmentation count test
 //!
-//! @SYMTestActions     
-//!						1.
-//!						2.	
+//! TestActions     
+//!					1.	Set up the arguments for Fragment using the setting in the test scenario table below.
+//!					2.	Create single transfer test and run test
+//!					3.	Verify that FragmentCount API returns the expected value and framework responds correctly
+//!					4.	Repeat steps 1 to 3 above until all the settings in the scenario table below have been used.
 //!
-//!
-//! @SYMTestExpectedResults 
-//!						1.  
-//!						2.		
+//! TestExpectedResults 
+//!					On calling FragmentCount (), the number of fragments (descriptors / pseudo descriptors) that
+//!					the transfer request has been split into is returned. 
+//!					
 //!							
 //!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
+//! TestPriority        High
+//! TestStatus          Implemented
 //----------------------------------------------------------------------------------------------
 namespace FragmentationCount
 	{
@@ -454,32 +551,42 @@
 	const TRequestResults requestResult(KErrNone, 128);
 	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
 	CSingleTransferTest test1(_L("Fragmentation Count - 128 fragments"), 1, transferArgs, expectedResults, KKilo);
-	TTestCase testCase(&test1, EFalse);
+	TTestCase testCase(new (ELeave) CMultiVersionTest(&test1), EFalse);
 
 	const TRequestResults requestResult2(KErrNone, 4);
 	const TResultSet expectedResults2(KErrNone, requestResult2, KErrNone, threadCallback);
 	CSingleTransferTest test2(_L("Fragmentation Count - 4 fragments"), 1, transferArgs, expectedResults2, 32*KKilo);
-	TTestCase testCase2(&test2, EFalse);
+	TTestCase testCase2(new (ELeave) CMultiVersionTest(&test2), EFalse);
+
+	// Also specifying an element size to get the PIL to further adjust the
+	// fragment size(s): element size = 32, transfer length = 128KB, max
+	// transfer length = 6500 bytes, # of fragments expected = 21 (20 with 6496
+	// bytes each + 1 with 1152 bytes).
+	TDmaTransferArgs transferArgs3(0, size, size, KDmaMemAddr, KDmaSyncAuto, 0, KDmaAddrModePostIncrement, 32);
+	const TRequestResults requestResult3(KErrNone, 21);
+	const TResultSet expectedResults3(KErrNone, requestResult3, KErrNone, threadCallback);
+	CSingleTransferTest test3(_L("Fragmentation Count - 21 fragments"),
+							  1, transferArgs3, expectedResults3, 6500);
+	TTestCase testCase3(new (ELeave) CMultiVersionTest(&test3), EFalse);
 	}
 
 //----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2584,KBASE-DMA-2585
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    DMA Benchmark tests
-//!
-//! @SYMTestActions     
-//!						1.
-//!						2.	
+//! TestCaseID      KBASE-DMA-2584,KBASE-DMA-2585
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    DMA Benchmark tests
+//!					To compare the speed of request fragmentation for a given transfer
+//!					between the new and old frameworks on the NaviEngine platform.
+//! TestActions     
+//!				1.	Fragment a memory to memory dma transfer of 4Mb, where both source and destination are physically contiguous. 
+//!				2.	Fragment using the default element size, and also with a 4K limit.
+//!				3.	Carry out for a channel using pseudo descriptors and for a scatter gather channel.
 //!
+//! TestExpectedResults 
+//!				 The results obtained for both framework versions should  be comparable.							
 //!
-//! @SYMTestExpectedResults 
-//!						1.  
-//!						2.		
-//!							
-//!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
+//! TestPriority        High
+//! TestStatus          Implemented
 //-----------------------------------------------------------------------------------------------
 namespace Benchmark
 	{
@@ -489,8 +596,8 @@
 		const TInt size = 1 * KMega;
 		TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr);
 
-		TTestCase testCase_256k(new (ELeave) CDmaBmFragmentation(_L("1 Mb transfer - 256k frag size"), bmIters, transferArgs, 256 * KKilo), EFalse);
-		TTestCase testCase_8k(new (ELeave) CDmaBmFragmentation(_L("1 Mb transfer - 8k frag size"), bmIters, transferArgs, 8 * KKilo), EFalse);
+		TTestCase testCase_256K(new (ELeave) CDmaBmFragmentation(_L("1 MB transfer - 256K frag size"), bmIters, transferArgs, 256 * KKilo), EFalse);
+		TTestCase testCase_8K(new (ELeave) CDmaBmFragmentation(_L("1 MB transfer - 8K frag size"), bmIters, transferArgs, 8 * KKilo), EFalse);
 		}
 
 	namespace Transfer
@@ -509,16 +616,16 @@
 			TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr);
 
 			TTestCase testCase_128(new (ELeave) CDmaBmTransfer(_L("128 K - 128K frag size"), bmIters, transferArgs, 128 * KKilo), EFalse);
-			TTestCase testCase_16(new (ELeave) CDmaBmTransfer(_L("128 K - 16k frag size"), bmIters, transferArgs, 16 * KKilo), EFalse);
-			TTestCase testCase_4(new (ELeave) CDmaBmTransfer(_L("128 K - 4k frag size"), bmIters, transferArgs, 4 * KKilo), EFalse);
-			TTestCase testCase_1(new (ELeave) CDmaBmTransfer(_L("128 K - 1k frag size"), bmIters, transferArgs, 1 * KKilo), EFalse);
+			TTestCase testCase_16(new (ELeave) CDmaBmTransfer(_L("128 K - 16K frag size"), bmIters, transferArgs, 16 * KKilo), EFalse);
+			TTestCase testCase_4(new (ELeave) CDmaBmTransfer(_L("128 K - 4K frag size"), bmIters, transferArgs, 4 * KKilo), EFalse);
+			TTestCase testCase_1(new (ELeave) CDmaBmTransfer(_L("128 K - 1K frag size"), bmIters, transferArgs, 1 * KKilo), EFalse);
 			}
-		namespace _4Mb
+		namespace _4MB
 			{
 			const TInt size = 4 * KMega;
 			TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr);
 
-			CDmaBmTransfer bmTest(_L("4 Mb"), bmIters, transferArgs, 0);
+			CDmaBmTransfer bmTest(_L("4 MB"), bmIters, transferArgs, 0);
 			TTestCase testCase(&bmTest, EFalse);
 			}
 		}
@@ -544,7 +651,7 @@
 				CDmaBmTransfer bmTest = CDmaBmTransfer(_L("4 bytes DFC cb"), iterations, transferArgs, 0).
 					UseNewDmaApi(ETrue).
 					ExpectedResults(expected);
-				TTestCase testCase(&bmTest, EFalse);
+				TTestCase testCase(&bmTest, EFalse, capAboveV1);
 				}
 			namespace _4K
 				{
@@ -553,7 +660,7 @@
 				CDmaBmTransfer bmTest = CDmaBmTransfer(_L("4K DFC cb"), iterations, transferArgs, 0).
 					UseNewDmaApi(ETrue).
 					ExpectedResults(expected);
-				TTestCase testCase(&bmTest, EFalse);
+				TTestCase testCase(&bmTest, EFalse, capAboveV1);
 				}
 			}
 
@@ -569,7 +676,7 @@
 				CDmaBmTransfer bmTest = CDmaBmTransfer(_L("4 bytes Isr cb"), iterations, transferArgs, 0).
 					UseNewDmaApi(ETrue).
 					ExpectedResults(expected);
-				TTestCase testCase(&bmTest, EFalse);
+				TTestCase testCase(&bmTest, EFalse, capAboveV1);
 				}
 			namespace _4K
 				{
@@ -578,20 +685,21 @@
 				CDmaBmTransfer bmTest = CDmaBmTransfer(_L("4K Isr cb"), iterations, transferArgs, 0).
 					UseNewDmaApi(ETrue).
 					ExpectedResults(expected);
-				TTestCase testCase(&bmTest, EFalse);
+				TTestCase testCase(&bmTest, EFalse, capAboveV1);
 				}
 			}
 		}
 	}
 
 //----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2560
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    TestNewStyleFragment using CSingleTransferTest
+//! TestCaseID      KBASE-DMA-2560
+//! TestCaseID      KBASE-DMA-2561
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    Test new & old style fragment using CSingleTransferTest
 //!						Test Scenario 1 - DstAddr > SrcAddr & TransferSize=32K & Location is 
 //!						address of a memory buffer
-//! @SYMTestActions     
+//! TestActions     
 //!						1.	Set up the arguments for aTransfeArgs using the settings below.
 //!							
 //!							SrcAddr		 = 4 * KKilo;
@@ -602,15 +710,15 @@
 //!						2.	Setup expected result.
 //!						3.	Create single transfer test and run test
 //!
-//! @SYMTestExpectedResults 
+//! TestExpectedResults 
 //!						1.  TransfeArgs set up in DMA framework
 //!						2.	Expected results set up in DMA framework					
 //!						3.	Fragment request completes and KErrNone returned
 //!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
+//! TestPriority        High
+//! TestStatus          Implemented
 //----------------------------------------------------------------------------------------------
-namespace TestNewStyleFragment_1
+namespace Fragment_1
 	{	
 	const TInt srcAddr = 4 * KKilo;
 	const TInt desAddr = 64 * KKilo;
@@ -622,59 +730,18 @@
 	const TRequestResults requestResult(KErrNone, 32); 
 	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
 
-	CSingleTransferTest testscenario_1(_L("TestNewStyleFragment - Test Scenario 1"), 1, transferArgs, expectedResults,KKilo);
+	CMultiVersionTest multiVersion(new (ELeave) CSingleTransferTest(_L("Fragment - Scenario 1"), 1, transferArgs, expectedResults,KKilo));
 
-	TTestCase testCase(&testscenario_1, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&testscenario_1, ETrue, capAboveV1);
+	TTestCase testCase(&multiVersion, EFalse);
+	TTestCase testCaseConcurrent(&multiVersion, ETrue);
 	}
 
 //----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2560
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    TestNewStyleFragment using CSingleTransferTest
-//!						Test Scenario 2 -  SrcAddr	== DstAddr   					
-//!		
-//!						1.	Set up the arguments for aTransfeArgs using the settings below.
-//!							
-//!							SrcAddr	 = 4 * KKilo;
-//!							desAddr	 = 4 * KKilo;
-//!							transferSize = 32 * KKilo;	
-//!							iFlags		 = KDmaMemAddr;
-//!
-//!						2.	Setup expected result.
-//!						3.	Create single transfer test and run test
-//!
-//! @SYMTestExpectedResults 
-//!
-//!						1.  TransfeArgs set up in DMA framework
-//!						2.	Expected results set up in DMA framework					
-//!						3.	Fragment passes and KErrNone returned
-//!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
-//----------------------------------------------------------------------------------------------
-namespace TestNewStyleFragment_2
-	{
-	const TInt srcAddr = 4 * KKilo;
-	const TInt desAddr = 4 * KKilo;
-	const TInt transferSize =  32 * KKilo;
-
-	TDmaTransferArgs transferArgs(srcAddr,desAddr, transferSize, KDmaMemAddr);
-	const TRequestResults requestResult(KErrNone, 32); 
-	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
-
-	CSingleTransferTest testscenario_2(_L("TestNewStyleFragment - Test Scenario 2"), 1, transferArgs, expectedResults,KKilo);
-
-	TTestCase testCase(&testscenario_2, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&testscenario_2, ETrue, capAboveV1);
-	}
-
-//----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2560
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    TestNewStyleFragment using CSingleTransferTest
+//! TestCaseID      KBASE-DMA-2560
+//! TestCaseID      KBASE-DMA-2561
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    Test new & old style fragment using CSingleTransferTest
 //!						Test Scenario 3 -  TransferSize=0   
 //!
 //!						1.	Set up the arguments for aTransfeArgs using the settings below.
@@ -688,36 +755,38 @@
 //!						3.	Create single transfer test and run test
 //!
 //!
-//! @SYMTestExpectedResults 
+//! TestExpectedResults 
 //!
 //!						1.  TransfeArgs set up in DMA framework
 //!						2.	Expected results set up in DMA framework			
 //!						3.	Fragment request fails and KErrArgument returned
 //!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
+//! TestPriority        High
+//! TestStatus          Implemented
 //----------------------------------------------------------------------------------------------
-namespace TestNewStyleFragment_3
+namespace Fragment_2
 	{
 	const TInt srcAddr = 32 * KKilo;
 	const TInt desAddr = 64 * KKilo;
 	const TInt transferSize = 0;
 	
 	TDmaTransferArgs transferArgs( srcAddr, desAddr, transferSize,KDmaMemAddr);
-	const TRequestResults requestResult(KErrArgument, 0); 
-	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+	const TRequestResults requestResult(KErrNone, 0, KErrArgument, KErrUnknown); 
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, TCallbackRecord::Empty());
+
 
-	CSingleTransferTest testscenario_3(_L("TestNewStyleFragment - Test Scenario 3"), 1, transferArgs, expectedResults);
+	CMultiVersionTest multiVersion(new (ELeave) CSingleTransferTest(_L("Fragment - Scenario 3"), 1, transferArgs, expectedResults));
 
-	TTestCase testCase(&testscenario_3, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&testscenario_3, ETrue, capAboveV1);
+	TTestCase testCase(&multiVersion, EFalse);
+	TTestCase testCaseConcurrent(&multiVersion, ETrue);
 	}
 
 //----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2560
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    TestNewStyleFragment using CSingleTransferTest
+//! TestCaseID      KBASE-DMA-2560
+//! TestCaseID      KBASE-DMA-2561
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    Test new & old style fragment using CSingleTransferTest
 //!						Test Scenario 4 -  TransferSize=1Byte   
 //!
 //!						1.	Set up the arguments for aTransfeArgs using the settings below.
@@ -730,16 +799,16 @@
 //!						2.	Setup expected result.
 //!						3.	Create single transfer test and run test
 //!
-//! @SYMTestExpectedResults 
+//! TestExpectedResults 
 //!
 //!						1.  TransfeArgs set up in DMA framework
 //!						2.	Expected results set up in DMA framework			
 //!						3.	Fragment request completes and KErrNone returned
 //!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
+//! TestPriority        High
+//! TestStatus          Implemented
 //----------------------------------------------------------------------------------------------
-namespace TestNewStyleFragment_4
+namespace Fragment_3
 	{	
 	const TInt srcAddr = 32 * KKilo;
 	const TInt desAddr = 64 * KKilo;
@@ -749,17 +818,18 @@
 	const TRequestResults requestResult(KErrNone, 1);
 	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
 
-	CSingleTransferTest testscenario_4(_L("TestNewStyleFragment - Test Scenario 4"), 1, transferArgs, expectedResults);
+	CMultiVersionTest multiVersion(new (ELeave) CSingleTransferTest(_L("Fragment - Scenario 4"), 1, transferArgs, expectedResults));
 
-	TTestCase testCase(&testscenario_4, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&testscenario_4, ETrue, capAboveV1);
+	TTestCase testCase(&multiVersion, EFalse);
+	TTestCase testCaseConcurrent(&multiVersion, ETrue);
 	}
 
 //----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2560
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    TestNewStyleFragment using CSingleTransferTest
+//! TestCaseID      KBASE-DMA-2560
+//! TestCaseID      KBASE-DMA-2561
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    Test new & old style fragment using CSingleTransferTest
 //!						Test Scenario 5 -  TransferSize=128KB    
 //!
 //!						1.	Set up the arguments for aTransfeArgs using the settings below.
@@ -772,18 +842,17 @@
 //!						2.	Setup expected result.
 //!						3.	Create single transfer test and run test
 //!
-//! @SYMTestExpectedResults 
+//! TestExpectedResults 
 //!
 //!						1.  TransfeArgs set up in DMA framework
 //!						2.	Expected results set up in DMA framework			
 //!						3.	Fragment request completes and KErrNone returned
 //!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
+//! TestPriority        High
+//! TestStatus          Implemented
 //----------------------------------------------------------------------------------------------
-namespace TestNewStyleFragment_5
+namespace Fragment_4
 	{
-	
 	const TInt srcAddr		= 16 * KKilo;
 	const TInt desAddr		= 2 * KMega;	
 	const TInt transferSize = 1 * KMega;
@@ -792,17 +861,18 @@
 	const TRequestResults requestResult(KErrNone); 
 	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
 
-	CSingleTransferTest testscenario_5(_L("TestNewStyleFragment - Test Scenario 5"), 1, transferArgs, expectedResults);
+	CMultiVersionTest multiVersion(new (ELeave) CSingleTransferTest(_L("Fragment - Scenario 5"), 1, transferArgs, expectedResults));
 
-	TTestCase testCase(&testscenario_5, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&testscenario_5, ETrue, capAboveV1);
+	TTestCase testCase(&multiVersion, EFalse);
+	TTestCase testCaseConcurrent(&multiVersion, ETrue);
 	}
 
 //----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2560
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    TestNewStyleFragment using CSingleTransferTest
+//! TestCaseID      KBASE-DMA-2560
+//! TestCaseID      KBASE-DMA-2561
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    Test new & old style fragment using CSingleTransferTest
 //!						Test Scenario 6 -  TransferSize=3MB   
 //!
 //!						1.	Set up the arguments for aTransfeArgs using the settings below.
@@ -815,451 +885,122 @@
 //!						2.	Setup expected result.
 //!						3.	Create single transfer test and run test
 //!
-//! @SYMTestExpectedResults 
+//! TestExpectedResults 
 //!
 //!						1.  TransfeArgs set up in DMA framework
 //!						2.	Expected results set up in DMA framework			
 //!						3.	Fragment request completes and KErrNone returned
 //!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
+//! TestPriority        High
+//! TestStatus          Implemented
 //----------------------------------------------------------------------------------------------
-namespace TestNewStyleFragment_6
+namespace Fragment_5
 	{
 	const TInt srcAddr = 16 * KKilo;
 	const TInt desAddr = 4 * KMega;
 	const TInt transferSize = 3 * KMega;
 
 	TDmaTransferArgs transferArgs(srcAddr, desAddr, transferSize, KDmaMemAddr);
-	const TRequestResults requestResult(KErrNone); 
+	const TRequestResults requestResult(KErrNone);
 	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
 
-	CSingleTransferTest testscenario_6(_L("TestNewStyleFragment - Test Scenario 6"), 1, transferArgs, expectedResults);
+	CMultiVersionTest multiVersion(new (ELeave) CSingleTransferTest(_L("Fragment - Scenario 6"), 1, transferArgs, expectedResults));
 
-	TTestCase testCase(&testscenario_6, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&testscenario_6, ETrue, capAboveV1);
+	TTestCase testCase(&multiVersion, EFalse);
+	TTestCase testCaseConcurrent(&multiVersion, ETrue);
 	}
 
-//----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2561
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    TestOldstyleFragment using CSingleTransferTest
-//!						Test Scenario 1 - DstAddr > SrcAddr & TransferSize=32K & Location is 
-//!						address of a memory buffer
-//!
-//!						1.	Set up the arguments for aTransfeArgs using the settings below.
-//!							
-//!							SrcAddr		 = 4 * KKilo;
-//!							desAddr		 = 64 * KKilo;
-//!							transferSize = 32 * KKilo;	
-//!							iFlags		 = KDmaMemAddr;
-
-//!						2.	Setup expected result.
-//!						3.	Create single transfer test and run test
-//!
-//! @SYMTestExpectedResults 
-//!
-//!						1.  TransfeArgs set up in DMA framework
-//!						2.	Expected results set up in DMA framework					
-//!						3.	Fragment request completes and KErrNone returned
-//!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
-//----------------------------------------------------------------------------------------------
-namespace TestOldStyleFragment_1
-	{	
-	const TInt srcAddr = 4 * KKilo;
-	const TInt desAddr = 64 * KKilo;
-	const TInt transferSize =  32 * KKilo;
-	
-	TDmaTransferArgs transferArgs( srcAddr, desAddr, transferSize, KDmaMemAddr);
-
-	const TRequestResults requestResult(KErrNone,32); 
-	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
-
-	CSingleTransferTest testscenario_1 = CSingleTransferTest(_L("TestOldStyleFragment - Test Scenario 1"), 1, transferArgs, expectedResults,KKilo).
-		UseNewDmaApi(EFalse);
-
-	TTestCase testCase(&testscenario_1, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&testscenario_1, ETrue, capAboveV1);
-	}
 
 //----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2561
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    TestOldstyleFragment using CSingleTransferTest
-//!						Test Scenario 2 - DstAddr == SrcAddr
-//!
-//!						1.	Set up the arguments for aTransfeArgs using the settings below.
-//!							
-//!							SrcAddr	 = 4 * KKilo;
-//!							desAddr	 = 4 * KKilo;
-//!							transferSize = 4 * KKilo
-//!							iFlags		 = KDmaMemAddr;
-//!
-//!						2.	Setup expected result.
-//!						3.	Create single transfer test and run test
-//!
-//! @SYMTestExpectedResults 
-//!
-//!						1.  TransfeArgs set up in DMA framework
-//!						2.	Expected results set up in DMA framework			
-//!						3.	Fragment passes and KErrNone returned
+//! TestCaseID      KBASE-DMA-2562
+//! TestCaseID      KBASE-DMA-2563
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    Test new and old style DDmaRequest using CSingleTransferTest
+//!						Test Scenario 1 -  aMaxTransferSize=0
 //!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
-//----------------------------------------------------------------------------------------------
-namespace TestOldStyleFragment_2
-	{
-	const TInt srcAddr = 4 * KKilo;
-	const TInt desAddr = 4 * KKilo;
-	const TInt transferSize =  4 * KKilo;
-
-	TDmaTransferArgs transferArgs(srcAddr,desAddr, transferSize, KDmaMemAddr);
-	const TRequestResults requestResult(KErrNone, 4);  
-	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
-
-	CSingleTransferTest testscenario_2 = CSingleTransferTest(_L("TestOldStyleFragment - Test Scenario 2"), 1, transferArgs, expectedResults,KKilo)
-		.UseNewDmaApi(EFalse);
-
-	TTestCase testCase(&testscenario_2, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&testscenario_2, ETrue, capAboveV1);
-	}
-
-//----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2561
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    TestOldstyleFragment using CSingleTransferTest
-//!						Test Scenario 3 -  TransferSize=0  
-//!
-//!						1.	Set up the arguments for aTransfeArgs using the settings below.
-//!							
-//!							SrcAddr	 = 32K
-//!							desAddr	 = 64K;
-//!							transferSize = 0
-//!							iFlags		 = KDmaMemAddr;
-//!
+//!						1.	Set up the DDmaRequest using  aMaxTransferSize set to 0.
 //!						2.	Setup expected result.
 //!						3.	Create single transfer test and run test
 //!
-//! @SYMTestExpectedResults 
-//!
-//!						1.  TransfeArgs set up in DMA framework
-//!						2.	Expected results set up in DMA framework			
-//!						3.	Fragment request Fails and KErrArgument returned
-//!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
-//----------------------------------------------------------------------------------------------
-namespace TestOldStyleFragment_3
-	{
-
-	const TInt srcAddr = 32 * KKilo;
-	const TInt desAddr = 64 * KKilo;
-	const TInt transferSize = 0;
-	
-	TDmaTransferArgs transferArgs(srcAddr, desAddr, transferSize,KDmaMemAddr);
-	const TRequestResults requestResult(KErrArgument, 0); 
-	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
-
-	CSingleTransferTest testscenario_3 = CSingleTransferTest(_L("TestOldStyleFragment - Test Scenario 3"), 1, transferArgs, expectedResults).
-		UseNewDmaApi(EFalse);
-
-	TTestCase testCase(&testscenario_3, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&testscenario_3, ETrue, capAboveV1);
-	}
-
-//----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2561
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    TestOldstyleFragment using CSingleTransferTest
-//!						Test Scenario 4 -  TransferSize=1Byte   
-//!
-//!						1.	Set up the arguments for aTransfeArgs using the settings below.
-//!							
-//!	
-//!							SrcAddr		 = 32K;
-//!							desAddr		 = 64K;
-//!							transferSize = 1 byte	
-//!							iFlags		 = KDmaMemAddr;
-//!
-//!						2.	Setup expected result.
-//!						3.	Create single transfer test and run test
-//!
-//! @SYMTestExpectedResults 
+//! TestExpectedResults
 //!
 //!						1.  TransfeArgs set up in DMA framework
-//!						2.	Expected results set up in DMA framework			
-//!						3.	Fragment request completes and KErrNone returned
-//!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
-//------------------------------------------------------------------------------------------------
-namespace TestOldStyleFragment_4
-	{	
-	const TInt srcAddr = 32 * KKilo;
-	const TInt desAddr = 64 * KKilo;
-	const TInt transferSize = 1;
-	
-	TDmaTransferArgs transferArgs( srcAddr, desAddr, transferSize, KDmaMemAddr);
-	const TRequestResults requestResult(KErrNone, 1); 
-	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
-
-	CSingleTransferTest testscenario_4 = CSingleTransferTest(_L("TestOldStyleFragment - Test Scenario 4"), 1, transferArgs, expectedResults).
-		UseNewDmaApi(EFalse);
-
-	TTestCase testCase(&testscenario_4, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&testscenario_4, ETrue, capAboveV1);
-	}
-
-//----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2561
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    TestOldstyleFragment using CSingleTransferTest
-//!						Test Scenario 5 -  TransferSize=1MB
-//!
-//!						1.	Set up the arguments for aTransfeArgs using the settings below.
-//!							
-//!							SrcAddr		 = 16K;
-//!							desAddr		 = 2MB;
-//!							transferSize = 1MB	
-//!							iFlags		 = KDmaMemAddr;
-//!
-//!						2.	Setup expected result.
-//!						3.	Create single transfer test and run test
-//!
-//! @SYMTestExpectedResults 
-//!
-//!						1.  TransfeArgs set up in DMA framework
-//!						2.	Expected results set up in DMA framework			
-//!						3.	Fragment request completes and KErrNone returned
-//!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
-//----------------------------------------------------------------------------------------------
-namespace TestOldStyleFragment_5
-	{
-	const TInt srcAddr = 16 * KKilo;	
-	const TInt desAddr = 2 * KMega;
-	const TInt transferSize = 1 *  KMega;
-
-	TDmaTransferArgs transferArgs(srcAddr, desAddr, transferSize, KDmaMemAddr);
-
-	const TRequestResults requestResult(KErrNone); 
-	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
-
-	CSingleTransferTest testscenario_5 = CSingleTransferTest(_L("TestOldStyleFragment - Test Scenario 5"), 1, transferArgs, expectedResults).
-		UseNewDmaApi(EFalse);
-
-	TTestCase testCase(&testscenario_5, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&testscenario_5, ETrue, capAboveV1);
-	}
-
-//----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2561
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    TestOldstyleFragment using CSingleTransferTest
-//!						Test Scenario 6 -  TransferSize=3MB     
-//!
-//!						1.	Set up the arguments for aTransfeArgs using the settings below.
-//!							
-//!							SrcAddr	 = 16K
-//!							desAddr	 = 4MB;
-//!							transferSize = 3MB  
-//!							iFlags		 = KDmaMemAddr;
-//!
-//!						2.	Setup expected result.
-//!						3.	Create single transfer test and run test
-//!
-//! @SYMTestExpectedResults 
-//!
-//!						1.  TransfeArgs set up in DMA framework
-//!						2.	Expected results set up in DMA framework			
-//!						3.	Fragment request completes and KErrNone returned
-//!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
-//----------------------------------------------------------------------------------------------
-namespace TestOldStyleFragment_6
-	{
-	const TInt srcAddr = 16 * KKilo;
-	const TInt desAddr = 4 * KMega;
-	const TInt transferSize = 3 * KMega; 
-	TDmaTransferArgs transferArgs(srcAddr, desAddr, transferSize, KDmaMemAddr);
-
-	const TRequestResults requestResult(KErrNone); 
-	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
-
-	CSingleTransferTest testscenario_6 = CSingleTransferTest(_L("TestOldStyleFragment - Test Scenario 6"), 1, transferArgs, expectedResults).
-		UseNewDmaApi(EFalse);
-
-	TTestCase testCase(&testscenario_6, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&testscenario_6, ETrue, capAboveV1);
-	}
-
-//----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2562
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    TestOldStyleDDmaRequest using CSingleTransferTest
-//!						Test Scenario 1 -  aMaxTransferSize=0 
-//!
-//!						1.	Set up the DDmaRequest using  aMaxTransferSize set to 0. 
-//!						2.	Setup expected result.
-//!						3.	Create single transfer test and run test
-//!
-//! @SYMTestExpectedResults 
-//!
-//!						1.  TransfeArgs set up in DMA framework
-//!						2.	Expected results set up in DMA framework			
+//!						2.	Expected results set up in DMA framework
 //!						3.	DDmaRequest constructor behaves as expected and KErrArgument returned
 //!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
+//! TestPriority        High
+//! TestStatus          Implemented
 //------------------------------------------------------------------------------------------------
-namespace TestOldStyleDDmaRequest_1
+namespace DDmaRequest_1
 	{
 	const TInt desAddr = 4 * KKilo;
 	const TInt transferSize = 4 * KKilo;
 	TDmaTransferArgs transferArgs(0, desAddr, transferSize, KDmaMemAddr);
 
-	const TRequestResults requestResult(KErrNone, 0); 
+	const TRequestResults requestResult(KErrNone, 0);
 	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
 
-	CSingleTransferTest testscenario_1 = CSingleTransferTest(_L("TestOldStyleDDmaRequest - Test Scenario 1"), 1, transferArgs, expectedResults,0).
-		UseNewDmaApi(EFalse);
+	CMultiVersionTest multiVersion(new (ELeave) CSingleTransferTest(_L("DDmaRequest - Scenario 1"), 1, transferArgs, expectedResults,0));
 
-	TTestCase testCase(&testscenario_1, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&testscenario_1, ETrue, capAboveV1);
+	TTestCase testCase(&multiVersion, EFalse);
+	TTestCase testCaseConcurrent(&multiVersion, ETrue);
 	}
 
 //!-------------------------------------------------------------------------------------------------
-//! @SYMTestCaseID       KBASE-DMA-2562
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    TestOldStyleDDmaRequest using CSingleTransferTest
-//!						Test Scenario 2 -  aMaxTransferSize= 65535   
+//! TestCaseID      KBASE-DMA-2562
+//! TestCaseID      KBASE-DMA-2563
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    Test new and old style DDmaRequest using CSingleTransferTest
+//!						Test Scenario 2 -  aMaxTransferSize= (64K - 1)   // 65535
 //!
-//!						1.	Set up the arguments for DDmaRequest using aMaxTransferSize set to 65535.
+//!						1.	Set up the arguments for DDmaRequest using aMaxTransferSize set to (64K - 1).
 //!						2.	Setup expected result.
 //!						3.	Create single transfer test and run test
 //!
-//! @SYMTestExpectedResults 
+//! TestExpectedResults
 //!
 //!						1.  TransfeArgs set up in DMA framework
-//!						2.	Expected results set up in DMA framework			
+//!						2.	Expected results set up in DMA framework
 //!						3.	DDmaRequest constructor behaves as expected and KErrArgument returned
 //!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
+//! TestPriority        High
+//! TestStatus          Implemented
 //---------------------------------------------------------------------------------------------------
-namespace TestOldStyleDDmaRequest_2
+namespace DDmaRequest_2
 	{
 	const TInt desAddr = 4 * KKilo;
 	const TInt transferSize = 4 * KKilo;
 	TDmaTransferArgs transferArgs(0, desAddr, transferSize, KDmaMemAddr);
 
-	const TRequestResults requestResult(KErrNone, 1); 
+	const TRequestResults requestResult(KErrNone, 1);
 	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
 
-	CSingleTransferTest testscenario_2 = CSingleTransferTest(_L("TestOldStyleDDmaRequest - Test Scenario 2"), 1, transferArgs, expectedResults, 65535).
-		UseNewDmaApi(EFalse);
+	CMultiVersionTest multiVersion(new (ELeave) CSingleTransferTest(_L("DDmaRequest - Scenario 2"), 1, transferArgs, expectedResults, trans64K_1));
 
-	TTestCase testCase(&testscenario_2, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&testscenario_2, ETrue, capAboveV1);
+	TTestCase testCase(&multiVersion, EFalse);
+	TTestCase testCaseConcurrent(&multiVersion, ETrue);
 	}
 
 //----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2563
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    TestNewStyleDDmaRequest using CSingleTransferTest
-//!						Test Scenario 1 -  aMaxTransferSize=0 
-//!
-//!						1.	Set up the DDmaRequest using  aMaxTransferSize set to 0. 
-//!						2.	Setup expected result.
-//!						3.	Create single transfer test and run test
-//!
-//! @SYMTestExpectedResults 
-//!
-//!						1.  TransfeArgs set up in DMA framework
-//!						2.	Expected results set up in DMA framework			
-//!						3.	DDmaRequest constructor behaves as expected and KErrArgument returned
-//!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
-//----------------------------------------------------------------------------------------------
-namespace TestNewStyleDDmaRequest_1
-	{
-	const TInt desAddr = 4 * KKilo;
-	const TInt transferSize = 4 * KKilo;
-	TDmaTransferArgs transferArgs(0, desAddr, transferSize, KDmaMemAddr);
-
-	const TRequestResults requestResult(KErrNone, 0); 
-	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
-
-	CSingleTransferTest testscenario_1(_L("TestNewStyleDDmaRequest - Test Scenario 1"), 1, transferArgs, expectedResults,0);
-
-	TTestCase testCase(&testscenario_1, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&testscenario_1, ETrue, capAboveV1);
-	}
-
-//!-------------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      KBASE-DMA-2563
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    TestNewStyleDDmaRequest using CSingleTransferTest
-//!						Test Scenario 2 -  aMaxTransferSize= 65535   
-//!
-//!						1.	Set up the arguments for DDmaRequest using aMaxTransferSize set to 65535.
-//!						2.	Setup expected result.
-//!						3.	Create single transfer test and run test
-//!
-//! @SYMTestExpectedResults 
-//!
-//!						1.  TransfeArgs set up in DMA framework
-//!						2.	Expected results set up in DMA framework			
-//!						3.	DDmaRequest constructor behaves as expected and KErrArgument returned
-//!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
-//---------------------------------------------------------------------------------------------------
-namespace TestNewStyleDDmaRequest_2
-	{
-	const TInt desAddr = 4 * KKilo;
-	const TInt transferSize = 4 * KKilo;
-	TDmaTransferArgs transferArgs(0, desAddr, transferSize, KDmaMemAddr);
-
-	const TRequestResults requestResult(KErrNone, 1); 
-	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
-
-	CSingleTransferTest testscenario_2(_L("TestNewStyleDDmaRequest - Test Scenario 2"), 1, transferArgs, expectedResults, 65535);
-
-	TTestCase testCase(&testscenario_2, EFalse, capAboveV1);
-	TTestCase testCaseConcurrent(&testscenario_2, ETrue, capAboveV1);
-	}
-
-//----------------------------------------------------------------------------------------------
-//! @SYMTestCaseID      PBASE-DMA-FUNC-xxx
-//! @SYMTestType        CIT
-//! @SYMPREQ            REQ
-//! @SYMTestCaseDesc    SmallFrags: This test provokes the failure seen in DEF140598
+//! TestCaseID      KBASE-DMA-2585
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    SmallFrags: This test provokes the failure seen in DEF140598
 //!						The test checks that requests with small fragments
 //!						do not trigger a spurious missed interrupt clean up
 //!
-//! @SYMTestExpectedResults 
+//! TestActions     
+//!						1.	Open a DMA channel for a transfer.
+//!						2.	Create single transfer test using small frags and run test
 //!
-//!						1.  		
-//!						2.	
+//! TestExpectedResults 
+//!						1.  DMA channel opens and KErrNone returned.
+//!						2.	DMA transfer completes with no errors.
 //!
-//! @SYMTestPriority        High
-//! @SYMTestStatus          Implemented
+//! TestPriority        High
+//! TestStatus          Implemented
 //----------------------------------------------------------------------------------------------
 namespace SmallFrags
 	{
@@ -1269,19 +1010,205 @@
 	const TResultSet expectedResults(threadCallback);
 
 	TTestCase testCase(
-			new (ELeave) CSingleTransferTest(_L("8 * 4byte frags"), 10, transferArgs, expectedResults, 4),
-			EFalse, capAboveV1);
+			new (ELeave) CMultiVersionTest(new (ELeave) CSingleTransferTest(_L("8 * 4byte frags"), 10, transferArgs, expectedResults, 4)),
+			EFalse);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! TestCaseID      KBASE-DMA-2568
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    This test checks the correct behaviour of Close API in the new DMA framework
+//!
+//! TestActions     
+//!						1.  Open a DMA channel
+//!						2.	Open DMA Channel again
+//!						3	Close the DMA channel.
+//!						4	Open DMA channel to verify that the DMA channel closed.						
+//!
+//! TestExpectedResults 
+//!						1.  DMA channel opens and KErrNone returned.
+//!						2.	DMA Framework returns KErrInUse as channel is already open.					
+//!						3.	DMA channel closes and KErrNone returned.
+//!						4.	DMA channel opens and KErrNone returned.						
+//!							
+//!
+//! TestPriority        High
+//! TestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace CloseApiTest
+	{
+	COpenCloseTest testCloseApi = COpenCloseTest(_L("Close API Test"), 1).RunOpenApiTest(EFalse); 
+	TTestCase testCaseCloseApi(&testCloseApi, EFalse, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! TestCaseID      KBASE-DMA-2564
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    This test checks the correct behaviour of Open API in the new DMA framework
+//!
+//! TestActions     
+//!						1.  Open a DMA channel
+//!						2.	Verify that channel is really open by closing DMA channel
+//!
+//! TestExpectedResults 
+//!						1.  DMA channel opens and KErrNone returned
+//!						2.  DMA channel closes again returns KErrNone.
+//!
+//! TestPriority        High
+//! TestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace OpenApiTest
+	{
+	COpenCloseTest testOpenApi = COpenCloseTest(_L("Open API Test"), 1).RunOpenApiTest(ETrue); 
+	TTestCase testCaseOpenApi(&testOpenApi, EFalse, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! TestCaseID      KBASE-DMA-2567
+//! TestType        CIT
+//! PREQ            REQ
+//! TestCaseDesc    This test verifies the correct behavior of TBool IsQueueEmpty() in the new DMA 
+//!					framework and check its return value 
+//!
+//! TestActions     
+//!						1.	Open a single DMA channel for a transfer.
+//!						2.	Setup a DMA request and Fragment the request.
+//!						3.	Call IsQueueEmpty().
+//!						4.	Queue the DMA request.
+//!						5.	Call IsQueueEmpty().
+//! TestExpectedResults 
+//!						1.  DMA channel opens and KErrNone returned.
+//!						2.  DMA request created and fragmented and KErrNone returned.
+//!						3.  IsQueueEmpty() returns ETrue.
+//!						4.  Request queued and KErrNone returned
+//!						5.	IsQueueEmpty() returns EFalse.
+//!
+//! TestPriority        High
+//! TestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace IsQueueEmptyTest
+	{
+	const TInt size = 2 * KMega;
+	const TDmaTransferArgs transferArgArray[] = {
+		TDmaTransferArgs(0, size, size, KDmaMemAddr),
+		TDmaTransferArgs(2 * size, 3 * size, size, KDmaMemAddr)
+	};
+
+	const TResultSet expected[] =
+		{
+		TResultSet(),
+		TResultSet()
+		};
+	const TResultSet expectedResults(isrCallback);
+
+	CIsQueueEmptyTest isQueueEmpty =
+		CIsQueueEmptyTest(_L("IsQueueEmptyTest using muliple frags"), 1, transferArgArray, expected, ARRAY_LENGTH(transferArgArray))
+			.SetPreTransferTest(&KPreTransferIncrBytes)
+			.SetPostTransferTest(&KCompareSrcDst);
+
+	TTestCase testCase(&isQueueEmpty,EFalse,capAboveV1,pauseRequired_skip);
 	}
 
 
-//TODO TTestCase could automatically be added to aray by ctor
-//
+static TTestCase* StaticSimpleTestArray[] = {
+	&Simple_1::testCase,
+	&Simple_1::testCaseConcurrent,
+};
+
+static TTestCase* StaticCallbackTestArray[] = {
+	&Callback::testCase,
+	&Callback::testCaseOldRequest,	
+};
+
+static TTestCase* StaticIsrRequeTestArray[] = {
+	&ISR_Reque::endOnRedo::testCase,
+	&ISR_Reque::endOnIsrCb::testCase,
+	&ISR_Reque::endOnThreadCb::testCase,
+	&ISR_Reque::changeSize::testCase,
+#ifdef _DEBUG
+	&ISR_Reque::invalidAddresses::testCase, // addresses only checked in UDEB
+#endif
+#ifdef _REMOVEDTEST
+	// This test case is currently caught by a FAULT instead of a return code
+	// as expected. Currently, the facility to return an error code to the test
+	// framework is not yet supported.
+	&ISR_Reque::multipleFragments::testCase, 
+#endif
+};
+
+static TTestCase* StaticMultipartTestArray[] = {
+	&Multipart::testCase,
+};
+
+static TTestCase* StaticIsrAndDfcTestArray[] = {
+	&IsrAndDfc::DfcBeforeIsr::testCase,
+	&IsrAndDfc::IsrBeforeDfc::testCase,
+};
+
+static TTestCase* Static2DTestArray[] = {
+	&_2D_Test::testCase2d
+};
+
+static TTestCase* StaticFragmentTestArray[] = {
+	&FragmentationCount::testCase,
+	&FragmentationCount::testCase2,
+	&SmallFrags::testCase,
+	&Fragment_1::testCase,
+	&Fragment_1::testCaseConcurrent,
+	&Fragment_2::testCase,
+	&Fragment_2::testCaseConcurrent,
+	&Fragment_3::testCase,
+	&Fragment_3::testCaseConcurrent,
+	&Fragment_4::testCase,
+	&Fragment_4::testCaseConcurrent,
+	&Fragment_5::testCase,
+	&Fragment_5::testCaseConcurrent,
+};
+
+static TTestCase* StaticBenchmarkTestArray[] = {
+	// Benchmarks are only really meaningful
+	// on UREL builds
+	&Benchmark::Frag::testCase_256K,
+	&Benchmark::Frag::testCase_8K,
+	&Benchmark::Transfer::_128K::testCase_128,
+	&Benchmark::Transfer::_128K::testCase_16,
+	&Benchmark::Transfer::_128K::testCase_4,
+	&Benchmark::Transfer::_128K::testCase_1,
+	&Benchmark::Transfer::_4Bytes::testCase,
+	&Benchmark::Transfer::_4MB::testCase,
+	&Benchmark::CompareIsrDfcCb::Dfc::_4Bytes::testCase,
+	&Benchmark::CompareIsrDfcCb::Isr::_4Bytes::testCase,
+	&Benchmark::CompareIsrDfcCb::Dfc::_4K::testCase,
+	&Benchmark::CompareIsrDfcCb::Isr::_4K::testCase,
+};
+
+static TTestCase* StaticRequestTestArray[] = {
+	&DDmaRequest_1::testCase,
+	&DDmaRequest_1::testCaseConcurrent,
+	&DDmaRequest_2::testCase,
+	&DDmaRequest_2::testCaseConcurrent,
+};
+
+static TTestCase* StaticChannelTestArray[] = {
+	&CloseApiTest::testCaseCloseApi,
+	&OpenApiTest::testCaseOpenApi,
+};
+
+static TTestCase* StaticSuspendTestArray[] = {
+	&PauseResumeApiTest::testCasePauseResume,  
+};
+
+static TTestCase* StaticQueueTestArray[] = {
+	&CancelAllTest::testCase, 
+	&IsQueueEmptyTest::testCase,	
+};
+
 //Append new test cases here
 static TTestCase* StaticTestArray[] = {
 	&Simple_1::testCase,
-	&Simple_1::testCaseConcurrent,
-	&Simple_2::testCase,
-	&Simple_2::testCaseConcurrent,
+	&Simple_1::testCaseConcurrent,	
 	&Callback::testCase,
 	&Callback::testCaseOldRequest,
 	&ISR_Reque::endOnRedo::testCase,
@@ -1291,62 +1218,67 @@
 #ifdef _DEBUG
 	&ISR_Reque::invalidAddresses::testCase, // addresses only checked in UDEB
 #endif
-	//&ISR_Reque::multipleFragments::testCase, // This error condition is currently caught by a FAULT instead of a return code
+#ifdef _REMOVEDTEST
+	// This test case is currently caught by a FAULT instead of a return code
+	// as expected. Currently, the facility to return an error code to the test
+	// framework is not yet supported.
+	&ISR_Reque::multipleFragments::testCase, 
+#endif
 	&Multipart::testCase,
 	&IsrAndDfc::DfcBeforeIsr::testCase,
 	&IsrAndDfc::IsrBeforeDfc::testCase,
 	&_2D_Test::testCase2d,
 	&FragmentationCount::testCase,
 	&FragmentationCount::testCase2,
+	&FragmentationCount::testCase3,
 	&SmallFrags::testCase,
 #ifndef _DEBUG
 	// Benchmarks are only really meaningful
 	// on UREL builds
-	&Benchmark::Frag::testCase_256k,
-	&Benchmark::Frag::testCase_8k,
+	&Benchmark::Frag::testCase_256K,
+	&Benchmark::Frag::testCase_8K,
 	&Benchmark::Transfer::_128K::testCase_128,
 	&Benchmark::Transfer::_128K::testCase_16,
 	&Benchmark::Transfer::_128K::testCase_4,
 	&Benchmark::Transfer::_128K::testCase_1,
 	&Benchmark::Transfer::_4Bytes::testCase,
-	&Benchmark::Transfer::_4Mb::testCase,
+	&Benchmark::Transfer::_4MB::testCase,
 	&Benchmark::CompareIsrDfcCb::Dfc::_4Bytes::testCase,
 	&Benchmark::CompareIsrDfcCb::Isr::_4Bytes::testCase,
 	&Benchmark::CompareIsrDfcCb::Dfc::_4K::testCase,
 	&Benchmark::CompareIsrDfcCb::Isr::_4K::testCase,
 #endif
-	&TestNewStyleFragment_1::testCase,
-	&TestNewStyleFragment_1::testCaseConcurrent,
-	&TestNewStyleFragment_2::testCase,
-	&TestNewStyleFragment_2::testCaseConcurrent,
-	//&TestNewStyleFragment_3::testCase,
-	//&TestNewStyleFragment_3::testCaseConcurrent,
-	&TestNewStyleFragment_4::testCase,
-	&TestNewStyleFragment_4::testCaseConcurrent,
-	&TestNewStyleFragment_5::testCase,
-	&TestNewStyleFragment_5::testCaseConcurrent,
-	&TestNewStyleFragment_6::testCase,
-	&TestNewStyleFragment_6::testCaseConcurrent,
-	&TestOldStyleFragment_1::testCase,
-	&TestOldStyleFragment_1::testCaseConcurrent,
-	&TestOldStyleFragment_2::testCase,
-	&TestOldStyleFragment_2::testCaseConcurrent,
-	//&TestOldStyleFragment_3::testCase,
-	//&TestOldStyleFragment_3::testCaseConcurrent,
-	&TestOldStyleFragment_4::testCase,
-	&TestOldStyleFragment_4::testCaseConcurrent,
-	&TestOldStyleFragment_5::testCase,
-	&TestOldStyleFragment_5::testCaseConcurrent,
-	&TestOldStyleFragment_6::testCase,
-	&TestOldStyleFragment_6::testCaseConcurrent,
-	&TestOldStyleDDmaRequest_1::testCase,
-	&TestOldStyleDDmaRequest_1::testCaseConcurrent,
-	&TestOldStyleDDmaRequest_2::testCase,
-	&TestOldStyleDDmaRequest_2::testCaseConcurrent,
-	&TestNewStyleDDmaRequest_1::testCase,
-	&TestNewStyleDDmaRequest_1::testCaseConcurrent,
-	&TestNewStyleDDmaRequest_2::testCase,
-	&TestNewStyleDDmaRequest_2::testCaseConcurrent,
+	&Fragment_1::testCase,
+	&Fragment_1::testCaseConcurrent,
+	&Fragment_2::testCase,
+	&Fragment_2::testCaseConcurrent,
+	&Fragment_3::testCase,
+	&Fragment_3::testCaseConcurrent,
+	&Fragment_4::testCase,
+	&Fragment_4::testCaseConcurrent,
+	&Fragment_5::testCase,
+	&Fragment_5::testCaseConcurrent,	
+	&DDmaRequest_1::testCase,
+	&DDmaRequest_1::testCaseConcurrent,
+	&DDmaRequest_2::testCase,
+	&DDmaRequest_2::testCaseConcurrent,
+	&CloseApiTest::testCaseCloseApi,
+	&OpenApiTest::testCaseOpenApi,
+	&PauseResumeApiTest::testCasePauseResume,  
+	&CancelAllTest::testCase,
+	&IsQueueEmptyTest::testCase,	
 };
 
 RPointerArray<TTestCase> TestArray(StaticTestArray, ARRAY_LENGTH(StaticTestArray));
+RPointerArray<TTestCase> TestArrayIsrAndDfc(StaticIsrAndDfcTestArray, ARRAY_LENGTH(StaticIsrAndDfcTestArray));
+RPointerArray<TTestCase> TestArraySimple(StaticSimpleTestArray, ARRAY_LENGTH(StaticSimpleTestArray));
+RPointerArray<TTestCase> TestArrayQueue(StaticQueueTestArray, ARRAY_LENGTH(StaticQueueTestArray));
+RPointerArray<TTestCase> TestArrayChannel(StaticChannelTestArray, ARRAY_LENGTH(StaticChannelTestArray));
+RPointerArray<TTestCase> TestArraySuspend(StaticSuspendTestArray, ARRAY_LENGTH(StaticSuspendTestArray));
+RPointerArray<TTestCase> TestArrayFragment(StaticFragmentTestArray, ARRAY_LENGTH(StaticFragmentTestArray));
+RPointerArray<TTestCase> TestArrayBenchmark(StaticBenchmarkTestArray, ARRAY_LENGTH(StaticBenchmarkTestArray));
+RPointerArray<TTestCase> TestArray2DTest(Static2DTestArray, ARRAY_LENGTH(Static2DTestArray));
+RPointerArray<TTestCase> TestArrayMultiPart(StaticMultipartTestArray, ARRAY_LENGTH(StaticMultipartTestArray));
+RPointerArray<TTestCase> TestArrayIsrReque(StaticIsrRequeTestArray, ARRAY_LENGTH(StaticIsrRequeTestArray));
+RPointerArray<TTestCase> TestArrayCallback(StaticCallbackTestArray, ARRAY_LENGTH(StaticCallbackTestArray));
+RPointerArray<TTestCase> TestArrayRequest(StaticRequestTestArray, ARRAY_LENGTH(StaticRequestTestArray));
--- a/kerneltest/e32test/dmav2/test_thread.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/dmav2/test_thread.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -38,7 +38,6 @@
 
 TTestThread::~TTestThread()
 	{
-	//RTest::CloseHandleAndWaitForDestruction(iThread);
 	iThread.Close();
 	}
 
@@ -90,6 +89,10 @@
 	iName.Close();
 	}
 
+void CTest::SetupL()
+	{
+	}
+
 void CTest::operator()()
 	{
 	for(TInt i=0; i<iIterations; i++)
@@ -139,7 +142,7 @@
 
 	for(TInt i=0; i<aNumberOfThreads; i++)
 		{
-		//test.Next(_L("Create test thread"));
+		test.Next(_L("Create test thread"));
 		CTest* newTest = aTest.Clone();
 		test_NotNull(newTest);
 
--- a/kerneltest/e32test/dmav2/test_thread.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/dmav2/test_thread.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -88,23 +88,24 @@
 class CTest : public CBase, public TFunctor
 	{
 public:
-	~CTest();
+	virtual ~CTest();
 
 	virtual void operator()();
 	virtual void RunTest() = 0;
 	virtual CTest* Clone() const = 0;
 
+	virtual void SetupL();
+
 	/**
 	Prints a formatted description of the test
 	*/
-	void Announce() const;
+	virtual void Announce() const;
 
 	const TDesC& Name() const;
 
 	/**
 	Should print the type of test, with no newlines.
 	eg. "Transfer", "Fragmentation"
-	TODO drop the function, just add a test type member
 	*/
 	virtual void PrintTestType() const = 0;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/eabi/d_second_excp2_40u.def	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,12 @@
+EXPORTS
+	_Z8thrower2i @ 1 NONAME
+	_Z8thrower3i @ 2 NONAME
+	_Z8thrower4i @ 3 NONAME
+	_Z8thrower5i @ 4 NONAME
+	_ZN14UncaughtTesterC1ERi @ 5 NONAME
+	_ZN14UncaughtTesterC2ERi @ 6 NONAME
+	_ZN14UncaughtTesterD1Ev @ 7 NONAME
+	_ZN14UncaughtTesterD2Ev @ 8 NONAME
+	_ZN17MyFourthExceptionC1Ei @ 9 NONAME
+	_ZN17MyFourthExceptionC2Ei @ 10 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/eabi/d_second_excp_40u.def	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,12 @@
+EXPORTS
+	_Z8thrower2i @ 1 NONAME
+	_Z8thrower3i @ 2 NONAME
+	_Z8thrower4i @ 3 NONAME
+	_Z8thrower5i @ 4 NONAME
+	_ZN14UncaughtTesterC1ERi @ 5 NONAME
+	_ZN14UncaughtTesterC2ERi @ 6 NONAME
+	_ZN14UncaughtTesterD1Ev @ 7 NONAME
+	_ZN14UncaughtTesterD2Ev @ 8 NONAME
+	_ZN17MyFourthExceptionC1Ei @ 9 NONAME
+	_ZN17MyFourthExceptionC2Ei @ 10 NONAME
+
--- a/kerneltest/e32test/group/base_e32test.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/base_e32test.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "E32 Tests"
 
 component	base_e32test
--- a/kerneltest/e32test/group/bld.inf	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/bld.inf	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -83,6 +83,7 @@
  positive check ( #ifdef SMP ), however these binaries will not be included in BTB 
  autotest images for SMP platforms. Refer to DTW-KHS BTB00055 for more details.
  ******************************************************************************/
+d_timestamp					support
 d_kerncorestats				support
 d_implicit					support
 d_emitest					support
@@ -387,7 +388,8 @@
 t_newldd
 t_lddpowerseqtest
 t_ldddigitisertest
-t_traweventdigitiser
+t_userdigitisertest
+t_userdigitisernocaps
 t_persistrestart	manual
 halsettings	support
 
@@ -496,11 +498,13 @@
 ../ethernet/pump/etherpump  manual
 ../ethernet/macset/macset   manual
 
-// /e32test/heap tests
+// /E32TEST/HEAP tests
+t_fail
+
 #ifdef EPOC32
-t_hcomp			support
+t_hcomp     support
 #endif
-t_fail
+
 t_heap
 t_heap2
 t_heapdb
@@ -708,6 +712,9 @@
 t_domain_slave  support
 domainPolicyTest support
 t_switchoff
+t_frqchg
+// /E32TEST/TIMESTAMP test
+t_timestamp
 
 // /E32TEST/PRIME tests
 t_kern      support
@@ -1063,7 +1070,4 @@
 //pci tests
 t_pci
 #endif
-// timestamp or fastcounter test
-t_timestamp
-d_timestamp		support
 
--- a/kerneltest/e32test/group/bm_pdd.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/bm_pdd.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -68,6 +68,10 @@
 source			bm_ne1_pdd.cpp
 #endif
 
+#if defined(NCP_COMMON_RAPU_FAMILY)
+SYMBIAN_BASE_SYSTEMINCLUDE(assp/rapu)
+source			bm_rapu_pdd.cpp
+#endif
 start wins
 win32_library	kernel32.lib
 end
--- a/kerneltest/e32test/group/d_cache.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/d_cache.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -15,7 +15,9 @@
 // 
 //
 
-#include            <../variant.mmh>
+#include		<variant_test.mmh>
+
+
 #include            "kernel/kern_ext.mmh"
 
 target              VariantTarget(d_cache,ldd)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/group/d_frqchg.mmh	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,48 @@
+// Copyright (c) 2010-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32test/group/d_frqchg.mmh
+// 
+//
+
+// NOTE : include your variant.mmh before this file
+
+#ifdef EPOC32
+target			VariantTarget(d_frqchg,ldd)
+#else
+target			d_frqchg.ldd
+#endif
+#include		"kernel/kern_ext.mmh"
+
+targettype		ldd
+romtarget		d_frqchg.ldd
+
+sourcepath		../power
+source			d_frqchg.cpp
+
+sourcepath		../../../kernel/eka/nkern
+source			nklib.cpp
+
+#ifdef MARM
+sourcepath		../../../kernel/eka/nkern/arm
+source			nklib.cia
+#endif
+
+
+epocallowdlldata
+
+vendorid		0x70000001
+capability		all
+
+macro CPU_AFFINITY_ANY
+smpsafe
--- a/kerneltest/e32test/group/d_kerncorestats.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/d_kerncorestats.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,7 +1,7 @@
 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
+// under the terms of the License "Eclipse Public License v1.0"
 // which accompanies this distribution, and is available
 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 //
--- a/kerneltest/e32test/group/d_second_excp.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/d_second_excp.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -40,5 +40,10 @@
 capability		all
 vendorid		0x70000001
 
+#if defined ARMCC_4_0
+deffile		d_second_excp_40.def
+#else
+deffile		d_second_excp.def
+#endif
 
 SMPSAFE
--- a/kerneltest/e32test/group/d_second_excp2.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/d_second_excp2.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -28,6 +28,10 @@
 capability		all
 vendorid		0x70000001
 
-
+#if defined ARMCC_4_0
+deffile		d_second_excp2_40.def
+#else
+deffile		d_second_excp2.def
+#endif
 
 SMPSAFE
--- a/kerneltest/e32test/group/t_cachechunk.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/t_cachechunk.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -18,7 +18,7 @@
 TARGET			t_cachechunk.exe        
 TARGETTYPE		EXE
 SOURCEPATH		../mmu
-SOURCE			t_cachechunk.cpp
+SOURCE			t_cachechunk.cpp ..\demandpaging\t_dpcmn.cpp
 LIBRARY			euser.lib hal.lib dptest.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
--- a/kerneltest/e32test/group/t_chunk.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/t_chunk.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -19,7 +19,7 @@
 TARGETTYPE     EXE
 SOURCEPATH	../mmu
 SOURCE         t_chunk.cpp
-LIBRARY        euser.lib
+LIBRARY        euser.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 
--- a/kerneltest/e32test/group/t_datapaging.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/t_datapaging.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -20,7 +20,7 @@
 sourcepath		../demandpaging
 source			t_datapaging.cpp ../mmu/paging_info.cpp
 source			t_dpcmn.cpp
-library			euser.lib hal.lib dptest.lib
+library			euser.lib hal.lib dptest.lib efsrv.lib 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 capability		all
 vendorid		0x70000001
--- a/kerneltest/e32test/group/t_dma2.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/t_dma2.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -16,7 +16,7 @@
 TARGET         t_dma2.exe
 TARGETTYPE     EXE
 SOURCEPATH	../dmav2
-SOURCE         t_dma2.cpp test_cases.cpp self_test.cpp dma_api_tests.cpp d_dma2_cmn.cpp
+SOURCE         t_dma2.cpp test_cases.cpp self_test.cpp  d_dma2_cmn.cpp
 SOURCE		   test_thread.cpp
 SOURCEPATH	../../../kernel/eka/drivers/dma
 SOURCE		dma2_shared.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/group/t_frqchg.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,27 @@
+// Copyright (c) 2010-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32test\group\t_frqchg.mmp
+// 
+//
+
+target			t_frqchg.exe
+targettype		exe
+sourcepath		../power
+source			t_frqchg.cpp
+library			euser.lib hal.lib
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+capability		all
+vendorid		0x70000001
+epocheapsize	0x00001000 0x00100000
+smpsafe
--- a/kerneltest/e32test/group/t_kerncorestats.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/t_kerncorestats.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,7 +1,7 @@
 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
+// under the terms of the License "Eclipse Public License v1.0"
 // which accompanies this distribution, and is available
 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 //
--- a/kerneltest/e32test/group/t_ramall.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/t_ramall.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -19,7 +19,7 @@
 targettype		exe
 sourcepath		../mmu
 source			t_ramall.cpp
-library			euser.lib
+library			euser.lib  dptest.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 
--- a/kerneltest/e32test/group/t_semutx.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/t_semutx.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -19,7 +19,7 @@
 TARGETTYPE     EXE
 SOURCEPATH	../prime
 SOURCE         t_semutx.cpp
-LIBRARY        euser.lib
+LIBRARY        euser.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 
--- a/kerneltest/e32test/group/t_smpsoakspin.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/t_smpsoakspin.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,20 +1,18 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32test/group/t_smpsoakspin.mmp
+//
 
 target			t_smpsoakspin.exe        
 targettype		exe
--- a/kerneltest/e32test/group/t_suser.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/t_suser.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -19,7 +19,7 @@
 targettype		exe
 sourcepath		../secure
 source			t_suser.cpp
-library			euser.lib
+library			euser.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 ROMTARGET
 RAMTARGET 	    \sys\bin\	//
--- a/kerneltest/e32test/group/t_timestamp.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/group/t_timestamp.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
--- a/kerneltest/e32test/group/t_traweventdigitiser.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-TARGET         t_traweventdigitiser.exe        
-TARGETTYPE     EXE
-SOURCEPATH	../digitiser
-SOURCE         t_traweventdigitiser.cpp
-LIBRARY        euser.lib
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-
-
-capability		all
-
-VENDORID 0x70000001
-
-SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/group/t_userdigitisernocaps.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+TARGET		t_userdigitisernocaps.exe
+TARGETTYPE	EXE
+
+CAPABILITY	None
+MACRO		E32TEST_NOCAPS
+
+VENDORID	0x70000001
+SMPSAFE
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH	../digitiser
+SOURCE		t_userdigitisertest.cpp
+
+LIBRARY		euser.lib
+LIBRARY		hal.lib
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/group/t_userdigitisertest.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+TARGET		t_userdigitisertest.exe
+TARGETTYPE	EXE
+
+CAPABILITY	SwEvent WriteDeviceData
+VENDORID	0x70000001
+SMPSAFE
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH	../digitiser
+SOURCE		t_userdigitisertest.cpp
+
+LIBRARY		euser.lib
+LIBRARY		hal.lib
+
+
+
--- a/kerneltest/e32test/hcr/d_hcrut_psl.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/hcr/d_hcrut_psl.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -127,7 +127,7 @@
 #if !defined(__WINS__) && !defined(__X86__)
     
     // Note to future implementor:
-	// #include <kernel\kernboot.h>
+	// #include <kernel/kernboot.h>
 	// First check to see if SMRIB was created during boot time. 
     // If SSuperPageBase::iSmrData == KSuperPageAddressFieldUndefined (i.e. -1) 
 	// it does not exist, return KErrNotSupported, SMR not support by base port
--- a/kerneltest/e32test/hcr/hcr.inf	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/hcr/hcr.inf	Thu Jul 22 16:46:39 2010 +0100
@@ -29,8 +29,6 @@
 PRJ_TESTEXPORTS
 
 hcr_tests.iby			/epoc32/rom/include/hcr_tests.iby
-tshell_hcrtest.oby		../../../kernel/eka/rombuild/tshell_hcrtest.oby
-nandloader_hcrtest.oby	../../../kernel/eka/rombuild/nandloader_hcrtest.oby
 
 hcrtest.auto.bat	/epoc32/rom/include/hcrtest.auto.bat
 hcr_autoexec.bat	/epoc32/rom/include/hcr_autoexec.bat
--- a/kerneltest/e32test/hcr/hcrtest_h4roms.mbc	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/hcr/hcrtest_h4roms.mbc	Thu Jul 22 16:46:39 2010 +0100
@@ -17,57 +17,57 @@
 #ifndef BUILD_NO_UREL
 	// Multiple Memory Model
 	//
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v h4hrp -b urel -i armv5 --zip --symbol --name=H4_TBARMV5D-TSHELL.IMG         --type=tshell_hcrtest
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v h4hrp -b urel -i armv5 --zip --symbol --name=H4_TBARMV5D-BOOTLDR.IMG        --type=ubootldr
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v h4hrp -b urel -i armv5 --zip --symbol --name=H4_TBARMV5D-BOOTLDR-FAT32.IMG  --type=ubootldr -D WITH_FAT32
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v h4hrp -b urel -i armv5 --zip --symbol --name=H4_TBARMV5D-TSHELL.IMG         --type=tshell_hcrtest
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v h4hrp -b urel -i armv5 --zip --symbol --name=H4_TBARMV5D-BOOTLDR.IMG        --type=ubootldr
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v h4hrp -b urel -i armv5 --zip --symbol --name=H4_TBARMV5D-BOOTLDR-FAT32.IMG  --type=ubootldr -D WITH_FAT32
 	
 	// Small block NAND support
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v h4hrp -b urel -i armv5 --zip --symbol --name=H4_TBARMV5D-NAND2LDR.IMG        --type=nandloader -D _NAND2
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v h4hrp -b urel -i armv5 --zip --symbol --name=H4_TBARMV5D-TSHELL_NAND2.IMG    --type=tshell_hcrtest -D _NAND2
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v h4hrp -b urel -i armv5 --zip --symbol --name=H4_TBARMV5D-NAND2LDR.IMG        --type=nandloader -D _NAND2
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v h4hrp -b urel -i armv5 --zip --symbol --name=H4_TBARMV5D-TSHELL_NAND2.IMG    --type=tshell_hcrtest -D _NAND2
 	
 	// OneNAND support
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v h4hrp -b urel -i armv5 --zip --symbol --name=H4_TBARMV5D-NANDLDR.IMG        --type=nandloader -D _ONENAND
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v h4hrp -b urel -i armv5 --zip --symbol --name=H4_TBARMV5D-TSHELL_NAND.IMG    --type=tshell_hcrtest -D _ONENAND
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v h4hrp -b urel -i armv5 --zip --symbol --name=H4_TBARMV5D-NANDLDR.IMG        --type=nandloader -D _ONENAND
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v h4hrp -b urel -i armv5 --zip --symbol --name=H4_TBARMV5D-TSHELL_NAND.IMG    --type=tshell_hcrtest -D _ONENAND
 	
 	
 	// Direct/Single Memory model - not supported I think
 	//
-	// oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v sh4hrp -b urel -i armv5 --zip --symbol --name=SH4_TBARMV5D-TSHELL.IMG   --type=tshell_hcrtest
+	// oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v sh4hrp -b urel -i armv5 --zip --symbol --name=SH4_TBARMV5D-TSHELL.IMG   --type=tshell_hcrtest
 	
 	// Flexible Memory model
 	//
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fh4hrp -b urel -i armv5 --zip --symbol --name=FH4_TBARMV5D-TSHELL.IMG   --type=tshell_hcrtest
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fh4hrp -b urel -i armv5 --zip --symbol --name=FH4_TBARMV5D-TSHELL.IMG   --type=tshell_hcrtest
 	
 #endif
 
 // Direct/Single Memory model - not supported I think
 //
-// oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v sh4hrp -b udeb -i armv5 --zip --symbol --name=SH4_TBARMV5D-TSHELL-D.IMG   --type=tshell_hcrtest
+// oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v sh4hrp -b udeb -i armv5 --zip --symbol --name=SH4_TBARMV5D-TSHELL-D.IMG   --type=tshell_hcrtest
 
 // Multiple Memory Model
 //
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v h4hrp -b udeb -i armv5 --zip --symbol --name=H4_TBARMV5D-TSHELL-D.IMG         --type=tshell_hcrtest
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v h4hrp -b udeb -i armv5 --zip --symbol --name=H4_TBARMV5D-BOOTLDR-D.IMG        --type=ubootldr
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v h4hrp -b udeb -i armv5 --zip --symbol --name=H4_TBARMV5D-BOOTLDR-FAT32-D.IMG  --type=ubootldr -D WITH_FAT32
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v h4hrp -b udeb -i armv5 --zip --symbol --name=H4_TBARMV5D-TSHELL-D.IMG         --type=tshell_hcrtest
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v h4hrp -b udeb -i armv5 --zip --symbol --name=H4_TBARMV5D-BOOTLDR-D.IMG        --type=ubootldr
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v h4hrp -b udeb -i armv5 --zip --symbol --name=H4_TBARMV5D-BOOTLDR-FAT32-D.IMG  --type=ubootldr -D WITH_FAT32
 // Small block NAND support
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v h4hrp -b udeb -i armv5 --zip --symbol --name=H4_TBARMV5D-NAND2LDR-D.IMG        --type=nandloader -D _NAND2
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v h4hrp -b udeb -i armv5 --zip --symbol --name=H4_TBARMV5D-TSHELL_NAND2-D.IMG    --type=tshell_hcrtest -D _NAND2
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v h4hrp -b udeb -i armv5 --zip --symbol --name=H4_TBARMV5D-TSHELL_PAGED_NAND2B-D.IMG  	--type=tshell_hcrtest -D USE_SDIO_SD_MMC,WITH_FAT32,_NAND2,PAGED_ROM,PAGED_CODE
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v h4hrp -b udeb -i armv5 --zip --symbol --name=H4_TBARMV5D-NAND2LDR-D.IMG        --type=nandloader -D _NAND2
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v h4hrp -b udeb -i armv5 --zip --symbol --name=H4_TBARMV5D-TSHELL_NAND2-D.IMG    --type=tshell_hcrtest -D _NAND2
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v h4hrp -b udeb -i armv5 --zip --symbol --name=H4_TBARMV5D-TSHELL_PAGED_NAND2B-D.IMG  	--type=tshell_hcrtest -D USE_SDIO_SD_MMC,WITH_FAT32,_NAND2,PAGED_ROM,PAGED_CODE
 // OneNAND support
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v h4hrp -b udeb -i armv5 --zip --symbol --name=H4_TBARMV5D-NANDLDR-D.IMG        --type=nandloader -D _ONENAND
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v h4hrp -b udeb -i armv5 --zip --symbol --name=H4_TBARMV5D-TSHELL_NAND-D.IMG    --type=tshell_hcrtest -D _ONENAND
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v h4hrp -b udeb -i armv5 --zip --symbol --name=H4_TBARMV5D-NANDLDR-D.IMG        --type=nandloader -D _ONENAND
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v h4hrp -b udeb -i armv5 --zip --symbol --name=H4_TBARMV5D-TSHELL_NAND-D.IMG    --type=tshell_hcrtest -D _ONENAND
 
 
 // Flexible Memory model
 //
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fh4hrp -b udeb -i armv5 --zip --symbol --name=FH4_TBARMV5D-TSHELL-D.IMG   		--type=tshell_hcrtest
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fh4hrp -b udeb -i armv5 --zip --symbol --name=FH4_TBARMV5D-TSHELL-D.IMG   		--type=tshell_hcrtest
 // Small block NAND support
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fh4hrp -b udeb -i armv5 --zip --symbol --name=FH4_TBARMV5D-NAND2LDR-D.IMG     	--type=nandloader -D _NAND2
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fh4hrp -b udeb -i armv5 --zip --symbol --name=FH4_TBARMV5D-TSHELL_NAND2-D.IMG  	--type=tshell_hcrtest -D _NAND2
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fh4hrp -b udeb -i armv5 --zip --symbol --name=FH4_TBARMV5D-TSHELL_PAGED_NAND2B-D.IMG  	--type=tshell_hcrtest -D USE_SDIO_SD_MMC,WITH_FAT32,_NAND2,PAGED_ROM,PAGED_CODE
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fh4hrp -b udeb -i armv5 --zip --symbol --name=FH4_TBARMV5D-NAND2LDR-D.IMG     	--type=nandloader -D _NAND2
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fh4hrp -b udeb -i armv5 --zip --symbol --name=FH4_TBARMV5D-TSHELL_NAND2-D.IMG  	--type=tshell_hcrtest -D _NAND2
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fh4hrp -b udeb -i armv5 --zip --symbol --name=FH4_TBARMV5D-TSHELL_PAGED_NAND2B-D.IMG  	--type=tshell_hcrtest -D USE_SDIO_SD_MMC,WITH_FAT32,_NAND2,PAGED_ROM,PAGED_CODE
 // OneNAND support
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fh4hrp -b udeb -i armv5 --zip --symbol --name=FH4_TBARMV5D-NANDLDR-D.IMG      	--type=nandloader -D _ONENAND
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fh4hrp -b udeb -i armv5 --zip --symbol --name=FH4_TBARMV5D-TSHELL_NAND-D.IMG   	--type=tshell_hcrtest -D _ONENAND
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fh4hrp -b udeb -i armv5 --zip --symbol --name=FH4_TBARMV5D-NANDLDR-D.IMG      	--type=nandloader -D _ONENAND
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fh4hrp -b udeb -i armv5 --zip --symbol --name=FH4_TBARMV5D-TSHELL_NAND-D.IMG   	--type=tshell_hcrtest -D _ONENAND
 
 
 
--- a/kerneltest/e32test/hcr/hcrtest_ne1roms.mbc	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/hcr/hcrtest_ne1roms.mbc	Thu Jul 22 16:46:39 2010 +0100
@@ -29,64 +29,64 @@
 #ifndef BUILD_NO_UREL
 	// Direct/Single Memory model - unicore - udeb
 	//
-	// oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v sne1_tb -b urel -i armv5 --zip --symbol --name=SNE1_TBARMV5D-TSHELL.IMG   --type=tshell_hcrtest
+	// oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v sne1_tb -b urel -i armv5 --zip --symbol --name=SNE1_TBARMV5D-TSHELL.IMG   --type=tshell_hcrtest
 	
 	// Multiple Memory Model - unicore - udeb
 	//
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v ne1_tb -b urel -i armv5 --zip --symbol --name=NE1_TBARMV5D-TSHELL.IMG        --type=tshell_hcrtest -D HCR_INCLUDE_VARIANT_TEST_DRIVERS
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v ne1_tb -b urel -i armv5 --zip --symbol --name=NE1_TBARMV5D-BOOTLDR.IMG       --type=ubootldr
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v ne1_tb -b urel -i armv5 --zip --symbol --name=NE1_TBARMV5D-BOOTLDR-FAT32.IMG --type=ubootldr -D WITH_FAT32
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v ne1_tb -b urel -i armv5 --zip --symbol --name=NE1_TBARMV5D-TSHELL.IMG        --type=tshell_hcrtest -D HCR_INCLUDE_VARIANT_TEST_DRIVERS
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v ne1_tb -b urel -i armv5 --zip --symbol --name=NE1_TBARMV5D-BOOTLDR.IMG       --type=ubootldr
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v ne1_tb -b urel -i armv5 --zip --symbol --name=NE1_TBARMV5D-BOOTLDR-FAT32.IMG --type=ubootldr -D WITH_FAT32
 	
 	// Large block NAND support
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v ne1_tb -b urel -i armv5 --zip --symbol --name=NE1_TBARMV5D-NAND2LDR.IMG        --type=nandloader_hcrtest -D _NAND2
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v ne1_tb -b urel -i armv5 --zip --symbol --name=NE1_TBARMV5D-TSHELL_NAND2.IMG    --type=tshell_hcrtest -D _NAND2,HCR_INCLUDE_VARIANT_TEST_DRIVERS
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v ne1_tb -b urel -i armv5 --zip --symbol --name=NE1_TBARMV5D-NAND2LDR.IMG        --type=nandloader_hcrtest -D _NAND2
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v ne1_tb -b urel -i armv5 --zip --symbol --name=NE1_TBARMV5D-TSHELL_NAND2.IMG    --type=tshell_hcrtest -D _NAND2,HCR_INCLUDE_VARIANT_TEST_DRIVERS
 	// OneNAND support -- -D _ONENANDE not supported on NE1
 	
 	
 	// Flexible Memory model - unicore & SMP - udeb
 	//
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fne1_tb -b urel -i armv5 --zip --symbol --name=FNE1_TBARMV5D-TSHELL.IMG   --type=tshell_hcrtest -D HCR_INCLUDE_VARIANT_TEST_DRIVERS
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fne1_tb -b urel -i armv5 -x armv5smp --zip --symbol --name=FNE1_TBARMV5SMPD-TSHELL.IMG   --type=tshell_hcrtest -D HCR_INCLUDE_VARIANT_TEST_DRIVERS
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fne1_tb -b urel -i armv5 --zip --symbol --name=FNE1_TBARMV5D-TSHELL.IMG   --type=tshell_hcrtest -D HCR_INCLUDE_VARIANT_TEST_DRIVERS
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fne1_tb -b urel -i armv5 -x armv5smp --zip --symbol --name=FNE1_TBARMV5SMPD-TSHELL.IMG   --type=tshell_hcrtest -D HCR_INCLUDE_VARIANT_TEST_DRIVERS
 	
 	// Large block NAND support
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fne1_tb -b urel -i armv5 --zip --symbol --name=FNE1_TBARMV5D-NAND2LDR.IMG        --type=nandloader_hcrtest -D _NAND2
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fne1_tb -b urel -i armv5 --zip --symbol --name=FNE1_TBARMV5D-TSHELL_NAND2.IMG    --type=tshell_hcrtest -D _NAND2,HCR_INCLUDE_VARIANT_TEST_DRIVERS
-	oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fne1_tb -b urel -i armv5 -x armv5smp --zip --symbol --name=FNE1_TBARMV5SMPD-TSHELL_NAND2.IMG    --type=tshell_hcrtest -D _NAND2,HCR_INCLUDE_VARIANT_TEST_DRIVERS
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fne1_tb -b urel -i armv5 --zip --symbol --name=FNE1_TBARMV5D-NAND2LDR.IMG        --type=nandloader_hcrtest -D _NAND2
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fne1_tb -b urel -i armv5 --zip --symbol --name=FNE1_TBARMV5D-TSHELL_NAND2.IMG    --type=tshell_hcrtest -D _NAND2,HCR_INCLUDE_VARIANT_TEST_DRIVERS
+	oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fne1_tb -b urel -i armv5 -x armv5smp --zip --symbol --name=FNE1_TBARMV5SMPD-TSHELL_NAND2.IMG    --type=tshell_hcrtest -D _NAND2,HCR_INCLUDE_VARIANT_TEST_DRIVERS
 	// OneNAND support -- -D _ONENANDE not supported on NE1
 #endif
 
 
 // Direct/Single Memory model - unicore - udeb
 //
-// oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v sne1_tb -b udeb -i armv5 --zip --symbol --name=SNE1_TBARMV5D-TSHELL-D.IMG   --type=tshell_hcrtest
+// oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v sne1_tb -b udeb -i armv5 --zip --symbol --name=SNE1_TBARMV5D-TSHELL-D.IMG   --type=tshell_hcrtest
 
 // Multiple Memory Model - unicore - udeb
 //
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v ne1_tb -b udeb -i armv5 --zip --symbol --name=NE1_TBARMV5D-TSHELL-D.IMG        --type=tshell_hcrtest -D HCR_INCLUDE_VARIANT_TEST_DRIVERS
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v ne1_tb -b udeb -i armv5 --zip --symbol --name=NE1_TBARMV5D-BOOTLDR-D.IMG       --type=ubootldr
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v ne1_tb -b udeb -i armv5 --zip --symbol --name=NE1_TBARMV5D-BOOTLDR-FAT32-D.IMG --type=ubootldr -D WITH_FAT32
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v ne1_tb -b udeb -i armv5 --zip --symbol --name=NE1_TBARMV5D-TSHELL-D.IMG        --type=tshell_hcrtest -D HCR_INCLUDE_VARIANT_TEST_DRIVERS
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v ne1_tb -b udeb -i armv5 --zip --symbol --name=NE1_TBARMV5D-BOOTLDR-D.IMG       --type=ubootldr
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v ne1_tb -b udeb -i armv5 --zip --symbol --name=NE1_TBARMV5D-BOOTLDR-FAT32-D.IMG --type=ubootldr -D WITH_FAT32
 // Large block NAND support
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v ne1_tb -b udeb -i armv5 --zip --symbol --name=NE1_TBARMV5D-NAND2LDR-D.IMG        --type=nandloader_hcrtest -D _NAND2
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v ne1_tb -b udeb -i armv5 --zip --symbol --name=NE1_TBARMV5D-TSHELL_NAND2-D.IMG    --type=tshell_hcrtest -D _NAND2,HCR_INCLUDE_VARIANT_TEST_DRIVERS
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v ne1_tb -b udeb -i armv5 --zip --symbol --name=NE1_TBARMV5D-NAND2LDR-D.IMG        --type=nandloader_hcrtest -D _NAND2
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v ne1_tb -b udeb -i armv5 --zip --symbol --name=NE1_TBARMV5D-TSHELL_NAND2-D.IMG    --type=tshell_hcrtest -D _NAND2,HCR_INCLUDE_VARIANT_TEST_DRIVERS
 
 // OneNAND support -- -D _ONENANDE not supported on NE1
 
 
 // Flexible Memory model - unicore & SMP - udeb
 //
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fne1_tb -b udeb -i armv5 --zip --symbol --name=FNE1_TBARMV5D-TSHELL-D.IMG   --type=tshell_hcrtest -D HCR_INCLUDE_VARIANT_TEST_DRIVERS
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fne1_tb -b udeb -i armv5 -x armv5smp --zip --symbol --name=FNE1_TBARMV5SMPD-TSHELL-D.IMG   --type=tshell_hcrtest -D HCR_INCLUDE_VARIANT_TEST_DRIVERS
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fne1_tb -b udeb -i armv5 --zip --symbol --name=FNE1_TBARMV5D-TSHELL-D.IMG   --type=tshell_hcrtest -D HCR_INCLUDE_VARIANT_TEST_DRIVERS
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fne1_tb -b udeb -i armv5 -x armv5smp --zip --symbol --name=FNE1_TBARMV5SMPD-TSHELL-D.IMG   --type=tshell_hcrtest -D HCR_INCLUDE_VARIANT_TEST_DRIVERS
 
 // Large block NAND support
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fne1_tb -b udeb -i armv5 --zip --symbol --name=FNE1_TBARMV5D-NAND2LDR-D.IMG        --type=nandloader_hcrtest -D _NAND2
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fne1_tb -b udeb -i armv5 --zip --symbol --name=FNE1_TBARMV5D-TSHELL_NAND2-D.IMG    --type=tshell_hcrtest -D _NAND2,HCR_INCLUDE_VARIANT_TEST_DRIVERS
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fne1_tb -b udeb -i armv5 -x armv5smp --zip --symbol --name=FNE1_TBARMV5SMPD-TSHELL_NAND2-D.IMG    --type=tshell_hcrtest -D _NAND2,HCR_INCLUDE_VARIANT_TEST_DRIVERS
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fne1_tb -b udeb -i armv5 --zip --symbol --name=FNE1_TBARMV5D-NAND2LDR-D.IMG        --type=nandloader_hcrtest -D _NAND2
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fne1_tb -b udeb -i armv5 --zip --symbol --name=FNE1_TBARMV5D-TSHELL_NAND2-D.IMG    --type=tshell_hcrtest -D _NAND2,HCR_INCLUDE_VARIANT_TEST_DRIVERS
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fne1_tb -b udeb -i armv5 -x armv5smp --zip --symbol --name=FNE1_TBARMV5SMPD-TSHELL_NAND2-D.IMG    --type=tshell_hcrtest -D _NAND2,HCR_INCLUDE_VARIANT_TEST_DRIVERS
 // OneNAND support -- -D _ONENANDE not supported on NE1
 
 // Large block NAND support + WDP
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fne1_tb -b udeb -i armv5 --zip --symbol --name=FNE1_TBARMV5D-TSHELL_NAND2-WDP-D.IMG    --type=tshell_hcrtest -D _NAND2,PAGED_ROM,PAGED_CODE,PAGED_DATA,DATAPAGINGWARNINGS,WITH_FAT32,FULL_NAND_TEST,HCR_INCLUDE_VARIANT_TEST_DRIVERS
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fne1_tb -b udeb -i armv5 --zip --symbol --name=FNE1_TBARMV5D-NAND2LDR-WDP-D.IMG        --type=nandloader_hcrtest -D _NAND2,_CREATE_NE1_TB_NAND_SWAP 
-oneoff \os\kernelhwsrv\kernel\eka\rombuild rom -v fne1_tb -b udeb -i armv5 -x armv5smp --zip --symbol --name=FNE1_TBARMV5SMPD-TSHELL_NAND2-WDP-D.IMG    --type=tshell_hcrtest -D  _NAND2,PAGED_ROM,PAGED_CODE,PAGED_DATA,DATAPAGINGWARNINGS,WITH_FAT32,FULL_NAND_TEST,HCR_INCLUDE_VARIANT_TEST_DRIVERS
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fne1_tb -b udeb -i armv5 --zip --symbol --name=FNE1_TBARMV5D-TSHELL_NAND2-WDP-D.IMG    --type=tshell_hcrtest -D _NAND2,PAGED_ROM,PAGED_CODE,PAGED_DATA,DATAPAGINGWARNINGS,WITH_FAT32,FULL_NAND_TEST,HCR_INCLUDE_VARIANT_TEST_DRIVERS
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fne1_tb -b udeb -i armv5 --zip --symbol --name=FNE1_TBARMV5D-NAND2LDR-WDP-D.IMG        --type=nandloader_hcrtest -D _NAND2,_CREATE_NE1_TB_NAND_SWAP 
+oneoff . \os\kernelhwsrv\kernel\eka\rombuild\rom -v fne1_tb -b udeb -i armv5 -x armv5smp --zip --symbol --name=FNE1_TBARMV5SMPD-TSHELL_NAND2-WDP-D.IMG    --type=tshell_hcrtest -D  _NAND2,PAGED_ROM,PAGED_CODE,PAGED_DATA,DATAPAGINGWARNINGS,WITH_FAT32,FULL_NAND_TEST,HCR_INCLUDE_VARIANT_TEST_DRIVERS
 
 
 
--- a/kerneltest/e32test/locl/t_lat1.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/locl/t_lat1.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,7 +1,7 @@
 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
+// under the terms of the License "Eclipse Public License v1.0"
 // which accompanies this distribution, and is available
 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 //
--- a/kerneltest/e32test/mediaext/d_nfe.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/mediaext/d_nfe.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,7 +21,7 @@
 #include "nfe.h"
 
 #if defined(_DEBUG)
-	#define TRACE_ENABLED
+//	#define TRACE_ENABLED
 #else
 #endif
 
@@ -782,7 +782,6 @@
 			break;
 
 		case DLocalDrive::EWrite:
-			WriteEncryptionStatusToBootSector(di, EFalse);	// a write to the drive clears the finalised state
 			r=HandleWrite(aReq);
 			break;
 
@@ -1471,8 +1470,7 @@
 	if (!aDi.IsUDADrive())
 		return KErrNone;
 
-	if (aDi.iDriveFinalised == aFinalised)
-		return KErrNone;
+	aDi.iDriveFinalised = aFinalised;
 
 	TNfeDiskStatus status = aDi.Status();
 
--- a/kerneltest/e32test/misc/d_testkerncorestats.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/misc/d_testkerncorestats.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,7 +1,7 @@
 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
+// under the terms of the License "Eclipse Public License v1.0"
 // which accompanies this distribution, and is available
 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 //
--- a/kerneltest/e32test/misc/d_testkerncorestats.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/misc/d_testkerncorestats.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,7 +1,7 @@
 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
+// under the terms of the License "Eclipse Public License v1.0"
 // which accompanies this distribution, and is available
 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 //
--- a/kerneltest/e32test/misc/inflate.c	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/misc/inflate.c	Thu Jul 22 16:46:39 2010 +0100
@@ -1,19 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
 /* inflate.c -- Not copyrighted 1992 by Mark Adler
    version c10p1, 10 January 1993 */
 
--- a/kerneltest/e32test/misc/t_cputime.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/misc/t_cputime.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -262,6 +262,7 @@
 	test(100*us >= 98*KShortWait); // left limit
 	test(us - KShortWait <= user_after_tolerance); // right limit
 
+	FailIfError(thread.GetCpuTime(time));
 	User::After(KLongWait);
 	FailIfError(thread.GetCpuTime(time2));
 	us = time2.Int64() - time.Int64();
--- a/kerneltest/e32test/misc/t_kerncorestats.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/misc/t_kerncorestats.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,7 +1,7 @@
 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
+// under the terms of the License "Eclipse Public License v1.0"
 // which accompanies this distribution, and is available
 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 //
--- a/kerneltest/e32test/mmu/t_cachechunk.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/mmu/t_cachechunk.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -87,8 +87,9 @@
 #include "d_gobble.h"
 #include <dptest.h>
 #include "freeram.h"
+#include "..\demandpaging\t_dpcmn.h"
 
-LOCAL_D RTest test(_L("T_CACHECHUNK"));
+RTest test(_L("T_CACHECHUNK"));
 
 RMemoryTestLdd MemoryTest;
 
@@ -98,7 +99,7 @@
 TInt PageSize;
 TInt NoFreeRam;
 RTimer Timer;
-
+TBool gFmm;
 
 
 void FillPage(TUint aOffset)
@@ -308,18 +309,44 @@
 	test_KErrNone(r);
 
 	test.Next(_L("Check Decommit on unlocked pages"));
+	// Get orignal page cache size
+	TUint minCache = 0;
+	TUint maxCache = 0;
+	TUint oldCache = 0;
+	TUint newCache = 0;
+	if (gFmm)
+		{
+		r = DPTest::CacheSize(minCache, maxCache, oldCache);
+		test_KErrNone(r);
+		}
 	r = TestChunk.Unlock(aOffset,PageSize*4);
 	test_KErrNone(r);
+
+	TUint spareCache = maxCache - oldCache;
+	if (gFmm && spareCache)
+		{// Cache wasn't at maximum so should have grown when unlocked pages were added.
+		r = DPTest::CacheSize(minCache, maxCache, newCache);
+		test_KErrNone(r);
+		TUint extraCache = (spareCache > (TUint)PageSize*4)? PageSize*4 : spareCache;
+		test_Equal(oldCache + extraCache, newCache);
+		}
 	test(FreeRam() >= NoFreeRam+PageSize*4);
 	r=TestChunk.Decommit(aOffset, PageSize*4);
 	test_KErrNone(r);
 	freeRam = FreeRam();
 	test_Compare(freeRam, >=, NoFreeRam+PageSize*4);
 	test_Equal(origChunkSize - PageSize*4, TestChunk.Size());
+
+	if (gFmm)
+		{// Cache should have shrunk after pages were decommited.
+		r = DPTest::CacheSize(minCache, maxCache, newCache);
+		test_KErrNone(r);
+		test_Equal(oldCache, newCache);
+		}
 	// Restore chunk back to original state
 	r = TestChunk.Commit(aOffset, PageSize*4);
 	test_KErrNone(r);
-	test(FreeRam() == NoFreeRam);
+	test_Equal(NoFreeRam, FreeRam());
 
 	test.Next(_L("Check Decommit on unlocked and reclaimed pages"));
 	r = TestChunk.Unlock(aOffset,PageSize*4);
@@ -351,6 +378,44 @@
 	test(freeRam==NoFreeRam);
 	test_Equal(origChunkSize, TestChunk.Size());
 
+	test.Next(_L("Check Decommit on a mixture of locked and unlocked pages"));
+	// Get orignal page cache size
+	if (gFmm)
+		{
+		r = DPTest::CacheSize(minCache, maxCache, oldCache);
+		test_KErrNone(r);
+		}
+	r = TestChunk.Unlock(aOffset,PageSize);
+	test_KErrNone(r);
+	r = TestChunk.Unlock(aOffset + PageSize*2, PageSize);
+	test_KErrNone(r);
+
+	spareCache = maxCache - oldCache;
+	if (gFmm && spareCache)
+		{// Cache wasn't at maximum so should have grown when unlocked pages were added.
+		r = DPTest::CacheSize(minCache, maxCache, newCache);
+		test_KErrNone(r);
+		TUint extraCache = (spareCache > (TUint)PageSize*2)? PageSize*2 : spareCache;
+		test_Equal(oldCache + extraCache, newCache);
+		}
+	test(FreeRam() >= NoFreeRam+PageSize*2);
+	r=TestChunk.Decommit(aOffset, PageSize*4);
+	test_KErrNone(r);
+	freeRam = FreeRam();
+	test_Compare(freeRam, >=, NoFreeRam+PageSize*4);
+	test_Equal(origChunkSize - PageSize*4, TestChunk.Size());
+
+	if (gFmm)
+		{// Cache should have shrunk after pages were decommited.
+		r = DPTest::CacheSize(minCache, maxCache, newCache);
+		test_KErrNone(r);
+		test_Equal(oldCache, newCache);
+		}
+	// Restore chunk back to original state
+	r = TestChunk.Commit(aOffset, PageSize*4);
+	test_KErrNone(r);
+	test_Equal(NoFreeRam, FreeRam());
+
 	test.End();
 	}
 
@@ -440,6 +505,175 @@
 	}
 
 
+TBool StopCacheThreads;
+
+TInt CacheThreadFunc(TAny* aMax)
+	{
+	RThread::Rendezvous(KErrNone);
+	while (!StopCacheThreads)
+		{
+		TInt maxSize = (TInt)aMax;
+		TInt minSize;
+		TInt r = KErrNone;
+		for (minSize = PageSize << 4; r == KErrNone && !StopCacheThreads; minSize += PageSize)
+			{
+			r = UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)minSize,(TAny*)maxSize);
+			User::After(minSize/PageSize);
+			}
+		for (minSize -= PageSize; 
+			minSize > PageSize << 4 && r == KErrNone  && !StopCacheThreads;
+			minSize -= PageSize)
+			{
+			r = UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)minSize,(TAny*)maxSize);
+			User::After(minSize/PageSize);
+			}
+		}
+	return KErrNone;
+	}
+
+
+TInt DonateThreadFunc(TAny*)
+	{
+	TChunkCreateInfo createInfo;
+	createInfo.SetCache(100 * PageSize);
+	RChunk chunk;
+	TInt r = chunk.Create(createInfo);
+	if (r != KErrNone)
+		{
+		RDebug::Printf("DonateThreadFunc: Failed to create cache chunk %d", r);
+		return r;
+		}
+	TUint chunkEnd = 0;
+	while (chunk.Commit(chunkEnd, PageSize) == KErrNone)
+		chunkEnd += PageSize;
+
+	RThread::Rendezvous(KErrNone);
+	while (!StopCacheThreads)
+		{
+		for (TUint i = PageSize; i <= chunkEnd && !StopCacheThreads; i += PageSize)
+			{
+			chunk.Unlock(0, i);
+			if (chunk.Lock(0, i) != KErrNone)
+				{// Recommit as many pages as possible.
+				while (chunk.Commit(0, chunkEnd) != KErrNone && !StopCacheThreads)
+					chunkEnd -= PageSize;
+				i = 0;
+				}
+			User::After(i/PageSize);
+			}
+		}
+	CLOSE_AND_WAIT(chunk);
+	return KErrNone;
+	}
+
+
+TInt DirtyThreadFunc(TAny*)
+	{
+	RThread::Rendezvous(KErrNone);
+
+	RChunk chunk;
+	TChunkCreateInfo createInfo;
+	createInfo.SetNormal(PageSize * 100, PageSize *100);
+	createInfo.SetPaging(TChunkCreateInfo::EPaged);
+	TInt r = chunk.Create(createInfo);
+	if (r != KErrNone)
+		{
+		RDebug::Printf("Failed to create a cache chunk %d", r);
+		return r;
+		}
+	TUint8* base = chunk.Base();
+	// Dirty each page in the chunk so that there are dirty pages in the live 
+	// list while it is being resized and pages are being unlocked.
+	while (!StopCacheThreads)
+		{
+		TUint8* p = base;
+		TUint8* pEnd = base + chunk.Size();
+		for (; p < pEnd && !StopCacheThreads; p += PageSize)
+			{
+			*p = (TUint8)(pEnd - p);
+			User::After((TUint8)(pEnd - p));
+			}
+		}
+	CLOSE_AND_WAIT(chunk);
+	return KErrNone;
+	}
+
+
+void TestResizeExcess()
+	{
+	test.Printf(_L("Commit all of memory again leaving 100 free pages\n"));
+	CommitEnd = 0;
+	TInt r;
+	while(KErrNone==(r=TestChunk.Commit(CommitEnd,PageSize)))
+		{
+		CommitEnd += PageSize;
+		}
+	test(r==KErrNoMemory);
+	test_KErrNone(TestChunk.Unlock(0, 100 * PageSize));
+
+	SVMCacheInfo info;
+	test_KErrNone(UserSvr::HalFunction(EHalGroupVM, EVMHalGetCacheSize, &info, 0));
+
+	StopCacheThreads = EFalse;
+	RThread cacheThread;
+	r = cacheThread.Create(	KNullDesC, CacheThreadFunc, KDefaultStackSize, PageSize,
+							PageSize, (TAny*)info.iMaxSize);
+	test_KErrNone(r);
+	TRequestStatus threadStarted;
+	cacheThread.Rendezvous(threadStarted);
+	TRequestStatus cacheStatus;
+	cacheThread.Logon(cacheStatus);
+	cacheThread.Resume();
+	User::WaitForRequest(threadStarted);
+	test_KErrNone(threadStarted.Int());
+
+	// Create the dirty thread before the donate thread as the donate thread may
+	// consume all the free ram periodically.
+	RThread dirtyThread;
+	r = dirtyThread.Create(KNullDesC, DirtyThreadFunc, KDefaultStackSize, PageSize, PageSize, NULL);
+	test_KErrNone(r);
+	dirtyThread.Rendezvous(threadStarted);
+	TRequestStatus dirtyStatus;
+	dirtyThread.Logon(dirtyStatus);
+	dirtyThread.Resume();
+	User::WaitForRequest(threadStarted);
+	test_KErrNone(threadStarted.Int());
+
+	RThread donateThread;
+	r = donateThread.Create(KNullDesC, DonateThreadFunc, KDefaultStackSize, PageSize, PageSize, NULL);
+	test_KErrNone(r);
+	donateThread.Rendezvous(threadStarted);
+	TRequestStatus donateStatus;
+	donateThread.Logon(donateStatus);
+	donateThread.Resume();
+	User::WaitForRequest(threadStarted);
+	test_KErrNone(threadStarted.Int());
+
+	// Run test for 10 secs.
+	User::After(10000000);
+
+	// End the test.
+	StopCacheThreads = ETrue;
+	User::WaitForRequest(donateStatus);
+	test_Equal(EExitKill, donateThread.ExitType());
+	test_KErrNone(donateThread.ExitReason());
+	User::WaitForRequest(dirtyStatus);
+	test_Equal(EExitKill, dirtyThread.ExitType());
+	test_KErrNone(dirtyThread.ExitReason());
+	User::WaitForRequest(cacheStatus);
+	test_Equal(EExitKill, cacheThread.ExitType());
+	test_KErrNone(cacheThread.ExitReason());
+
+	CLOSE_AND_WAIT(donateThread);
+	CLOSE_AND_WAIT(cacheThread);
+	CLOSE_AND_WAIT(dirtyThread);
+
+	test_KErrNone(UserSvr::HalFunction(	EHalGroupVM,
+										EVMHalSetCacheSize,
+										(TAny*)info.iMinSize,
+										(TAny*)info.iMaxSize));
+	}
+
 
 TInt E32Main()
 	{
@@ -450,6 +684,10 @@
 		test.Printf(_L("This test requires an MMU\n"));
 		return KErrNone;
 		}
+	// See if were running on the Flexible Memory Model or newer.
+  	TUint32 memModelAttrib = (TUint32)UserSvr::HalFunction(EHalGroupKernel, EKernelHalMemModelInfo, NULL, NULL);	
+	gFmm = (memModelAttrib & EMemModelTypeMask) >= EMemModelTypeFlexible;
+
 	test.Start(_L("Initialise test"));
 	test.Next(_L("Load gobbler LDD"));
 	TInt r = User::LoadLogicalDevice(KGobblerLddFileName);
@@ -568,6 +806,16 @@
 	if (resizeCache)
 		test_KErrNone(DPTest::SetCacheSize(originalMin, originalMax));
 
+	test_KErrNone(GetGlobalPolicies());
+	if (gDataPagingSupported)
+		{
+		test.Next(_L("Test interactions of chunk unlocking and page cache resizing"));
+		// Do this after the live list limit is restored.
+		test_KErrNone(TestChunk.Create(createInfo));
+		TestResizeExcess();
+		TestChunk.Close();
+		}
+
 	// end...
 	test.End();
 	MemoryTest.Close();
--- a/kerneltest/e32test/mmu/t_chunk.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/mmu/t_chunk.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -51,6 +51,7 @@
 #include <e32test.h>
 #include <e32panic.h>
 #include <e32svr.h>
+#include <hal.h>
 #include "mmudetect.h"
 #include "d_gobble.h"
 #include "freeram.h"
@@ -820,29 +821,31 @@
 	{
 	RGobbler gobbler;
 	TInt r = gobbler.Open();
-	test(r==KErrNone);
+	test_KErrNone(r);
 	TUint32 taken = gobbler.GobbleRAM(128*1024*1024);
 	test.Printf(_L("Gobbled: %dK\n"), taken/1024);
 	test.Printf(_L("Free RAM 0x%08X bytes\n"),FreeRam());
 
 	test.Next(_L("Create thread"));
 	r=NtfThrd.Create(KNotifierThreadName,NotifierThread,KDefaultStackSize,NULL,NULL);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	NtfThrd.SetPriority(EPriorityMore);
 	NtfThrd.Resume();
 	test.Next(_L("Check for initial notifier"));
 	CheckNotifierCount(1,1);
 	TInt free=FreeRam();
 	test.Printf(_L("Free RAM: %dK\n"),free/1024);
-	test(free>=1048576);
+	test_Value(free, free >= 1048576);
 	test.Next(_L("Set thresholds"));
 	r=UserSvr::SetMemoryThresholds(65536,524288);	// low=64K good=512K
-	test(r==KErrNone);
+	test_KErrNone(r);
 	test.Next(_L("Create chunk"));
 	// Chunk must not be paged otherwise it will not effect the amount 
 	// of free ram reported plus on h4 swap size is less than the total ram.
+	TInt totalRam;
+	test_KErrNone(HAL::Get(HAL::EMemoryRAM, totalRam));
 	TChunkCreateInfo createInfo;
-	createInfo.SetNormal(0, free+2097152);
+	createInfo.SetNormal(0, totalRam);
 	createInfo.SetPaging(TChunkCreateInfo::EUnpaged);
 	RChunk c;
 	test_KErrNone(c.Create(createInfo));
@@ -858,31 +861,31 @@
 	TInt free3=free-(KBufferSpace-free2);	// this accounts for space used by page tables
 	test.Next(_L("Leave 32K"));
 	r=c.Adjust(free3-32768);		// leave 32K
-	test(r==KErrNone);
+	test_KErrNone(r);
 	CheckNotifierCount(2,1);		// should get notifier
 	test.Next(_L("Leave 28K"));
 	r=c.Adjust(free3-28672);		// leave 28K
-	test(r==KErrNone);
+	test_KErrNone(r);
 	CheckNotifierCount(2,1);		// shouldn't get another notifier
 	test.Next(_L("Ask for too much"));
-	r=c.Adjust(free3+4096);			// try to get more than available
-	test(r==KErrNoMemory);
+	r=c.Adjust(totalRam);			// try to get more than available
+	test_Equal(KErrNoMemory, r);
 	CheckNotifierCount(2,2);		// should get another notifier
 	test.Next(_L("Leave 128K"));
 	r=c.Adjust(free3-131072);		// leave 128K
-	test(r==KErrNone);
+	test_KErrNone(r);;
 	CheckNotifierCount(2,2);		// shouldn't get another notifier
 	test.Next(_L("Leave 640K"));
 	r=c.Adjust(free3-655360);		// leave 640K
-	test(r==KErrNone);
+	test_KErrNone(r);
 	CheckNotifierCount(3,2);		// should get another notifier
 	test.Next(_L("Leave 1M"));
 	r=c.Adjust(free3-1048576);		// leave 1M
-	test(r==KErrNone);
+	test_KErrNone(r);
 	CheckNotifierCount(3,2);		// shouldn't get another notifier
 	test.Next(_L("Ask for too much"));
-	r=c.Adjust(free3+4096);			// try to get more than available
-	test(r==KErrNoMemory);
+	r=c.Adjust(totalRam);			// try to get more than available
+	test_Equal(KErrNoMemory, r);
 
 	TInt notifierCount = 3;
 	if(MemModel==EMemModelTypeFlexible)
@@ -897,7 +900,7 @@
 	CheckNotifierCount(notifierCount,3);		// should get another notifier
 	test.Next(_L("Leave 1M"));
 	r=c.Adjust(free3-1048576);					// leave 1M
-	test(r==KErrNone);
+	test_KErrNone(r);
 	CheckNotifierCount(notifierCount,3);		// shouldn't get another notifier
 
 	c.Close();
--- a/kerneltest/e32test/mmu/t_demandpaging.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/mmu/t_demandpaging.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -121,15 +121,18 @@
 
 #define READ(a) ReadByte((volatile TUint8*)(a))
 
-void ThrashPaging(TUint aMaxBytes=KMaxTUint)
+void ThrashPaging(TUint aBytes)
 	{
 	TUint size = LargeBufferSize;
-	if(size>aMaxBytes)
-		size = aMaxBytes;
+	if(size > aBytes)
+		size = aBytes;
 
-	// read all ROM pages about 10 times each in a random order...
+	TUint readCount = 5 * size/PageSize;
+	
+	test.Printf(_L("ThrashPaging %u %u\n"), size, readCount);
+	
 	TUint32 random=1;
-	for(TInt i=size/(PageSize/10); i>0; --i)
+	for(TUint i = 0 ; i < readCount ; ++i)
 		{
 		READ(LargeBuffer+((TInt64(random)*TInt64(size))>>32));
 		random = random*69069+1;
@@ -207,8 +210,51 @@
 	}
 
 
+TInt SetCacheSize(TUint aNewMin, TUint aNewMax)
+	{
+	// set cache size and test 'get' function returns expected values
+	TInt r = DPTest::SetCacheSize(aNewMin, aNewMax);
+	if (r == KErrNone)
+		{
+		TUint min, max, current;
+		test_KErrNone(DPTest::CacheSize(min,max,current));
+		test_Equal(aNewMin, min);
+		test_Equal(aNewMax, max);
+		test(current >= min && current <= max);
+		}
+	return r;
+	}
+
+void DoResizeCache(TUint min, TUint max, TInt result, TUint& sizeMin, TUint& sizeMax, TUint originalMin, TUint originalMax)
+	{
+	test.Printf(_L("DPTest::SetCacheSize min=%u, max=%u, expected result=%d\n"),min/PageSize,max/PageSize,result);
+	TInt r=SetCacheSize(min,max);
+	test_Equal(result, r);
+	if(r==KErrNone)
+		{
+		// we've successfully changed the cache size...
+		if(max)
+			{
+			sizeMin = min;
+			sizeMax = max;
+			}
+		else
+			{
+			sizeMin = originalMin;
+			sizeMax = originalMax;
+			}
+		}
+	else if(r==KErrNoMemory)
+		{
+		// cache size after OOM is unpredictable, so reset our values
+		test_KErrNone(SetCacheSize(sizeMin,sizeMax));
+		}
+	}
+
+
 void TestResizeVMCache()
 	{
+	test.Start(_L("Test resizing VM cache"));
 	TInt r = DPTest::SetCacheSize(0,0); // restore cache size to defaults
 	test(r==KErrNone);
 	TUint sizeMin = 0;
@@ -217,10 +263,42 @@
 	DPTest::CacheSize(sizeMin,sizeMax,currentSize);
 	TUint originalMin = sizeMin;
 	TUint originalMax = sizeMax;
-	test.Printf(_L("original min=%u, original max=%u, current=%u\n"),originalMin/PageSize,originalMax/PageSize,currentSize/PageSize);
+	test.Printf(_L("original min=%u, original max=%u, current=%u\n"),
+				originalMin/PageSize,originalMax/PageSize,currentSize/PageSize);
 
 	int K = currentSize/PageSize+4;
 
+	// Exercise the cache reszing code by testing all valid combinations of the relationships
+	// between the current min size, current max size, new min size and new max size.
+	//
+	// This can be done using four cache size values.  Every assignment of these four values to the
+	// four variables is generated, and invalid combinations rejected.  This repeats some
+	// relationships but is simpler than calculating the minimum set of combinations exactly.
+
+	const TUint combinations = 256;  // 4 ^ 4
+	const TUint sizes[] = { K, K + 4, K + 8, K + 12, K + 16 };
+	for (TUint perm = 0 ; perm < combinations ; ++perm)
+		{
+		TUint vars[4] = { sizes[ perm & 3 ],
+						  sizes[ (perm >> 2) & 3 ],
+						  sizes[ (perm >> 4) & 3 ],
+						  sizes[ (perm >> 6) & 3 ]};
+		if ((vars[0] == vars[2] && vars[1] == vars[3]) || // ensure current != new
+			vars[0] > vars[1] ||                          // ensure current min <= current max
+			vars[2] > vars[3])                            // ensure new min <= new max
+			continue;
+		
+		test.Printf(_L("Test changing cache sizes from %u, %u to %u %u\n"),
+					vars[0], vars[1], vars[2], vars[3]);
+		
+		test_KErrNone(SetCacheSize(PageSize * vars[0], PageSize * vars[1]));
+		ThrashPaging(PageSize * vars[1]);
+		test_KErrNone(SetCacheSize(PageSize * vars[2], PageSize * vars[3]));
+		}
+	test_KErrNone(SetCacheSize(originalMin, originalMax));
+
+	// Now test some more specific resizings
+	
 	struct
 		{
 		TUint iMinPages;
@@ -240,22 +318,20 @@
 			{	K,		K,		KErrNone},
 			{	K+1,	K,		KErrArgument},
 			{	K,		K-1,	KErrArgument},
+			{	K,		K,		KErrNone},
 			{	KMaxTInt,	KMaxTInt,	KErrNoMemory},
 			{	K,		K,		KErrNone},
 
-			{	0,		0,		KErrNone}, // restore defaults
 			{	0,		0,		KMaxTInt} // list end marker
 		};
 
 	for(TInt j=0; j<2; ++j)
 		{
 		if(!j)
-			{
-			test.Start(_L("Changing size of flushed VM cache"));
-			test.Printf(_L("Original cache size min == %u, max == %u\n"),originalMin/PageSize,originalMax/PageSize);
-			}
+			test.Next(_L("Changing size of empty VM cache"));
 		else
 			test.Next(_L("Changing size of full VM cache"));
+		
 		TInt i=0;
 		while(testArgs[i].iResult!=KMaxTInt)
 			{
@@ -263,54 +339,21 @@
 			TUint max=testArgs[i].iMaxPages*PageSize;
 			TInt result=testArgs[i].iResult;
 
-			ThrashPaging(max*2);
 			if(!j)
 				DPTest::FlushCache();
+			else
+				ThrashPaging(max);
 
-			test.Printf(_L("DPTest::SetCacheSize min=%u, max=%u, expected result=%d\n"),min/PageSize,max/PageSize,result);
-			TInt r=DPTest::SetCacheSize(min,max);
-			if(r!=result)
-				{
-				test.Printf(_L("result=%d\n"),r);
-				test(0);
-				}
-			if(r==KErrNone)
-				{
-				// we've successfully changed the cache size...
-				if(max)
-					{
-					sizeMin = min;
-					sizeMax = max;
-					}
-				else
-					{
-					sizeMin = originalMin;
-					sizeMax = originalMax;
-					}
-				}
-			if(r==KErrNoMemory)
-				{
-				// cache size after OOM is unpredictable, so reset our values
-				DPTest::SetCacheSize(sizeMin,sizeMax);
-				}
-			else
-				{
-				// test 'get' function returns expected cache size
-				r=DPTest::CacheSize(min,max,currentSize);
-				test.Printf(_L("DPTest::CacheSize result=%d min=%u max=%u current=%u\n"),r,min/PageSize,max/PageSize,currentSize/PageSize);
-				if(r!=KErrNone || min!=sizeMin || max!=sizeMax)
-					test(0);
-				test(currentSize >= min && currentSize <= max);
-				}
+			DoResizeCache(min, max, result, sizeMin, sizeMax, originalMin, originalMax);
+			
 			++i;
 			}
 		}
-
+	
+	test_KErrNone(SetCacheSize(originalMin, originalMax));
 	test.End();
 	}
 
-
-
 void TestResizeVMCache2()
 	{
 	TUint originalMin = 0;
@@ -1240,6 +1283,8 @@
 	test.Title();
 	
 	test_KErrNone(UserSvr::HalFunction(EHalGroupKernel,EKernelHalPageSizeInBytes,&PageSize,0));
+
+	test.Start(_L("Initialisation"));
 	
 	if (DPTest::Attributes() & DPTest::ERomPaging)
 		test.Printf(_L("Rom paging supported\n"));
@@ -1258,9 +1303,6 @@
 		test(DataPagedChunk.IsPaged()); // this is only ever called if data paging is supported
 		DataPagedBuffer = (TUint8*)DataPagedChunk.Base();
 		}
-		
-	test.Start(_L("Test HAL interface"));
-	TestHAL();
 
 	if (DPTest::Attributes() & DPTest::ERomPaging)
 		{
@@ -1302,6 +1344,9 @@
 		test.End();
 		return 0;
 		}
+		
+	test.Next(_L("Test HAL interface"));
+	TestHAL();
 	
 	test(LargeBufferSize >= KMinBufferSize);
 	SmallBuffer = LargeBuffer;
--- a/kerneltest/e32test/mmu/t_ramall.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/mmu/t_ramall.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -19,10 +19,13 @@
 
 #include <e32test.h>
 #include <e32uid.h>
+#include <hal.h>
 #include <e32hal.h>
+#include <dptest.h>
 #include "d_shadow.h"
 #include "mmudetect.h"
 #include "freeram.h"
+#include "d_gobble.h"
 
 LOCAL_D RTest test(_L("T_RAMALL"));
 
@@ -31,7 +34,43 @@
 TInt PageSize;
 TInt PageShift;
 RShadow Shadow;
-TInt InitFreeRam;
+TInt TotalRam;
+RChunk Chunk;
+TUint ChunkCommitEnd;
+RThread TouchThread;
+TRequestStatus TouchStatus;
+TBool TouchDataStop;
+RThread FragThread;
+TRequestStatus FragStatus;
+TBool FragThreadStop;
+TBool ManualTest;
+TBool CacheSizeAdjustable;
+TUint OrigMinCacheSize;
+TUint OrigMaxCacheSize;
+
+//
+// Random number generation
+//
+
+TUint32 RandomSeed;
+
+TUint32 Random()
+	{
+	RandomSeed = RandomSeed*69069+1;
+	return RandomSeed;
+	}
+
+TUint32 Random(TUint32 aRange)
+	{
+	return (TUint32)((TUint64(Random())*TUint64(aRange))>>32);
+	}
+
+void RandomInit(TUint32 aSeed)
+	{
+	RandomSeed = aSeed+(aSeed<<8)+(aSeed<<16)+(aSeed<<24);
+	Random();
+	Random();
+	}
 
 TInt AllocPhysicalRam(TUint32& aAddr, TInt aSize, TInt aAlign)
 	{
@@ -118,6 +157,356 @@
 	
 	}
 
+
+struct SPhysAllocData
+	{
+	TUint iSize;
+	TUint iAlign;
+	TBool iCheckMaxAllocs;
+	TBool iCheckFreeRam;
+	};
+
+
+TInt FillPhysicalRam(TAny* aArgs)
+	{
+	SPhysAllocData allocData = *((SPhysAllocData*)aArgs);
+	TUint maxAllocs = FreeRam() / allocData.iSize;
+	TUint32* physAddrs = new TUint32[maxAllocs + 1];
+	if (!physAddrs)
+		return KErrNoMemory;
+	TUint32* pa = physAddrs;
+	TUint32 alignMask = (1 << allocData.iAlign) - 1;
+	TUint initialFreeRam = FreeRam();
+	TInt r = KErrNone;
+	TUint allocations = 0;
+	for(; allocations <= maxAllocs; ++allocations)
+		{
+		TUint freeRam = FreeRam();			
+		r = AllocPhysicalRam(*pa, allocData.iSize, allocData.iAlign);
+		if (r != KErrNone)
+			break;
+		if (*pa++ & alignMask)
+			{
+			r = KErrGeneral;
+			RDebug::Printf("Error alignment phys addr 0x%08x", *(pa - 1));
+			break;
+			}
+		TUint newFreeRam = FreeRam();
+		if (allocData.iCheckFreeRam && freeRam - allocData.iSize != newFreeRam)
+			{
+			r = KErrGeneral;
+			RDebug::Printf("Error in free ram 0x%08x orig 0x%08x", newFreeRam, freeRam);
+			break;
+			}
+		}
+
+	TUint32* physEnd = pa;
+	TBool failFrees = EFalse;
+	for (pa = physAddrs; pa < physEnd; pa++)
+		{
+		if (FreePhysicalRam(*pa, allocData.iSize) != KErrNone)
+			failFrees = ETrue;
+		}
+	if (failFrees)
+		r = KErrNotFound;
+	if (allocData.iCheckMaxAllocs && allocations > maxAllocs)
+		{
+		r = KErrOverflow;
+		RDebug::Printf("Error able to allocate too many pages");
+		}
+	TUint finalFreeRam = FreeRam();
+	if (allocData.iCheckFreeRam && initialFreeRam != finalFreeRam)
+		{
+		r = KErrGeneral;
+		RDebug::Printf("Error in free ram 0x%08x initial 0x%08x", finalFreeRam, initialFreeRam);
+		}
+	delete[] physAddrs;
+	if (r != KErrNone && r != KErrNoMemory)
+		return r;
+	TUint possibleAllocs = initialFreeRam / allocData.iSize;
+	if (allocData.iCheckMaxAllocs && possibleAllocs != allocations)
+		{
+		RDebug::Printf("Error in number of allocations possibleAllocs %d allocations %d", possibleAllocs, allocations);
+		return KErrGeneral;
+		}
+	return allocations;
+	}
+
+
+void TestMultipleContiguousAllocations(TUint aNumThreads, TUint aSize, TUint aAlign)
+	{
+	test.Printf(_L("TestMultiContig threads %d size 0x%x, align %d\n"), aNumThreads, aSize, aAlign);
+	SPhysAllocData allocData;
+	allocData.iSize = aSize;
+	allocData.iAlign = aAlign;
+	allocData.iCheckMaxAllocs = EFalse;
+	allocData.iCheckFreeRam = EFalse;
+	// Start several threads all contiguous allocating memory.
+	RThread* threads = new RThread[aNumThreads];
+	TRequestStatus* status = new TRequestStatus[aNumThreads];
+	TUint i = 0;
+	for (; i < aNumThreads; i++)
+		{// Need enough heap to store addr of every possible allocation + 1.
+		TUint requiredHeapMax = Max(PageSize, ((TotalRam / aSize) * sizeof(TUint32)) + sizeof(TUint32));
+		TInt r = threads[i].Create(KNullDesC, FillPhysicalRam, KDefaultStackSize, PageSize, requiredHeapMax, (TAny*)&allocData);
+		if (r != KErrNone)
+			break;			
+		threads[i].Logon(status[i]);
+		}
+	TUint totalThreads = i;
+	for (i = 0; i < totalThreads; i++)
+		{
+		threads[i].Resume();
+		}
+	for (i = 0; i < totalThreads; i++)
+		{
+		User::WaitForRequest(status[i]);
+		test_Equal(EExitKill, threads[i].ExitType());
+		TInt exitReason = threads[i].ExitReason();
+		test_Value(exitReason, exitReason >= 0 || exitReason == KErrNoMemory);
+		threads[i].Close();
+		}
+	delete[] status;
+	delete[] threads;
+	}
+
+struct STouchData
+	{
+	TUint iSize;
+	TUint iFrequency;
+	}TouchData;
+
+
+TInt TouchMemory(TAny*)
+	{
+	RThread::Rendezvous(KErrNone);	// Signal that this thread has started running.
+	RandomInit(TouchData.iSize);
+	while (!TouchDataStop)
+		{
+		TUint8* p = Chunk.Base();
+		TUint8* pEnd = p + ChunkCommitEnd;
+		TUint8* fragPEnd = p + TouchData.iFrequency;
+		for (TUint8* fragP = p + TouchData.iSize; fragPEnd < pEnd && !TouchDataStop;)
+			{
+			TUint8* data = fragP;
+			for (; data < fragPEnd && !TouchDataStop; data += PageSize)
+				{
+				*data = (TUint8)(data - fragP);
+				TUint random = Random();
+				if (random & 0x8484)
+					User::After(random & 0xFFFF);
+				}
+			for (data = fragP; data < fragPEnd && !TouchDataStop; data += PageSize)
+				{
+				if (*data != (TUint8)(data - fragP))
+					{
+					RDebug::Printf("Error unexpected data 0x%x read from 0x%08x", *data, data);
+					return KErrGeneral;
+					}
+				TUint random = Random();
+				if (random & 0x8484)
+					User::After(random & 0xFFFF);
+				}
+			fragP = fragPEnd + TouchData.iSize;
+			fragPEnd += TouchData.iFrequency;
+			}
+		}
+	return KErrNone;
+	}
+
+struct SFragData
+	{
+	TUint iSize;
+	TUint iFrequency;
+	TUint iDiscard;
+	TBool iFragThread;
+	}FragData;
+
+void FragmentMemoryFunc()
+	{
+	ChunkCommitEnd = 0;
+	TInt r;
+	while(KErrNone == (r = Chunk.Commit(ChunkCommitEnd,PageSize)) && !FragThreadStop)
+		{
+		ChunkCommitEnd += PageSize;
+		}
+	if (FragThreadStop)
+		return;
+	test_Equal(KErrNoMemory, r);
+	TUint freeBlocks = 0;
+	for (	TUint offset = 0; 
+			(offset + FragData.iSize) < ChunkCommitEnd; 
+			offset += FragData.iFrequency, freeBlocks++)
+		{
+		test_KErrNone(Chunk.Decommit(offset, FragData.iSize));
+		}
+
+	if (FragData.iDiscard && CacheSizeAdjustable && !FragThreadStop)
+		{
+		TUint minCacheSize = FreeRam();
+		TUint maxCacheSize = minCacheSize;
+		DPTest::SetCacheSize(minCacheSize, maxCacheSize);
+		if (OrigMinCacheSize <= maxCacheSize)
+			DPTest::SetCacheSize(OrigMinCacheSize, maxCacheSize);
+		}
+	}
+
+
+void UnfragmentMemoryFunc()
+	{
+	if (FragData.iDiscard && CacheSizeAdjustable)
+		DPTest::SetCacheSize(OrigMinCacheSize, OrigMaxCacheSize);
+	Chunk.Decommit(0, Chunk.MaxSize());
+	}
+
+
+TInt FragmentMemoryThreadFunc(TAny*)
+	{
+	RThread::Rendezvous(KErrNone);	// Signal that this thread has started running.
+	while (!FragThreadStop)
+		{
+		FragmentMemoryFunc();
+		UnfragmentMemoryFunc();
+		}
+	return KErrNone;
+	}
+
+
+void FragmentMemory(TUint aSize, TUint aFrequency, TBool aDiscard, TBool aTouchMemory, TBool aFragThread)
+	{
+	test_Value(aTouchMemory, !aTouchMemory || !aFragThread);
+	test_Value(aSize, aSize < aFrequency);
+	FragData.iSize = aSize;
+	FragData.iFrequency = aFrequency;
+	FragData.iDiscard = aDiscard;
+	FragData.iFragThread = aFragThread;
+
+	TChunkCreateInfo chunkInfo;
+	chunkInfo.SetDisconnected(0, 0, TotalRam);
+	chunkInfo.SetPaging(TChunkCreateInfo::EUnpaged);
+	chunkInfo.SetClearByte(0x19);
+	test_KErrNone(Chunk.Create(chunkInfo));
+
+	if (aFragThread)
+		{
+		TInt r = FragThread.Create(_L("FragThread"), FragmentMemoryThreadFunc, KDefaultStackSize, PageSize, PageSize, NULL);
+		test_KErrNone(r);
+		FragThread.Logon(FragStatus);
+		FragThreadStop = EFalse;
+		TRequestStatus threadInitialised;
+		FragThread.Rendezvous(threadInitialised);
+		FragThread.Resume();
+		User::WaitForRequest(threadInitialised);
+		test_KErrNone(threadInitialised.Int());
+		}
+	else
+		{
+		FragmentMemoryFunc();
+		}
+	if (aTouchMemory && !ManualTest)
+		{
+		TouchData.iSize = aSize;
+		TouchData.iFrequency = aFrequency;
+		TInt r = TouchThread.Create(_L("TouchThread"), TouchMemory, KDefaultStackSize, PageSize, PageSize, NULL);
+		test_KErrNone(r);
+		TouchThread.Logon(TouchStatus);
+		TouchDataStop = EFalse;
+		TRequestStatus threadInitialised;
+		TouchThread.Rendezvous(threadInitialised);
+		TouchThread.Resume();
+		User::WaitForRequest(threadInitialised);
+		test_KErrNone(threadInitialised.Int());
+		}
+	}
+
+
+void UnfragmentMemory(TBool aDiscard, TBool aTouchMemory, TBool aFragThread)
+	{
+	test_Value(aTouchMemory, !aTouchMemory || !aFragThread);
+	if (aTouchMemory && !ManualTest)
+		{
+		TouchDataStop = ETrue;
+		User::WaitForRequest(TouchStatus);
+		test_Equal(EExitKill, TouchThread.ExitType());
+		test_KErrNone(TouchThread.ExitReason());
+		CLOSE_AND_WAIT(TouchThread);
+		}
+	if (aFragThread)
+		{
+		FragThreadStop = ETrue;
+		User::WaitForRequest(FragStatus);
+		test_Equal(EExitKill, FragThread.ExitType());
+		test_KErrNone(FragThread.ExitReason());
+		CLOSE_AND_WAIT(FragThread);
+		}
+	else
+		UnfragmentMemoryFunc();
+	if (CacheSizeAdjustable)
+		test_KErrNone(DPTest::SetCacheSize(OrigMinCacheSize, OrigMaxCacheSize));
+	CLOSE_AND_WAIT(Chunk);
+	}
+
+
+void TestFillPhysicalRam(TUint aFragSize, TUint aFragFreq, TUint aAllocSize, TUint aAllocAlign, TBool aDiscard, TBool aTouchMemory)
+	{
+	test.Printf(_L("TestFillPhysicalRam aFragSize 0x%x aFragFreq 0x%x aAllocSize 0x%x aAllocAlign %d dis %d touch %d\n"),
+				aFragSize, aFragFreq, aAllocSize, aAllocAlign, aDiscard, aTouchMemory);
+	FragmentMemory(aFragSize, aFragFreq, aDiscard, aTouchMemory, EFalse);
+	SPhysAllocData allocData;
+	// Only check free all ram could be allocated in manual tests as fixed pages may be fragmented.
+	allocData.iCheckMaxAllocs = (ManualTest && !aTouchMemory && !aAllocAlign);
+	allocData.iCheckFreeRam = ETrue;
+	allocData.iSize = aAllocSize;
+	allocData.iAlign = aAllocAlign;
+	TInt r = FillPhysicalRam(&allocData);
+	test_Value(r, r >= 0);
+	UnfragmentMemory(aDiscard, aTouchMemory, EFalse);
+	}
+
+
+void TestFragmentedAllocation()
+	{
+	// Test every other page free.
+	TestFillPhysicalRam(PageSize, PageSize * 2, PageSize, 0, EFalse, EFalse);
+	if (ManualTest)
+		{
+		TestFillPhysicalRam(PageSize, PageSize * 2, PageSize * 2, 0, EFalse, EFalse);
+		TestFillPhysicalRam(PageSize, PageSize * 2, PageSize, 0, EFalse, ETrue);
+		}
+	TestFillPhysicalRam(PageSize, PageSize * 2, PageSize * 2, 0, EFalse, ETrue);
+	// Test every 2 pages free.
+	TestFillPhysicalRam(PageSize * 2, PageSize * 4, PageSize * 8, 0, EFalse, EFalse);
+	if (ManualTest)
+		TestFillPhysicalRam(PageSize * 2, PageSize * 4, PageSize * 8, 0, EFalse, ETrue);
+	// Test 10 pages free then 20 pages allocated, allocate 256 pages (1MB in most cases).
+	if (ManualTest)
+		TestFillPhysicalRam(PageSize * 10, PageSize * 30, PageSize * 256, 0, EFalse, EFalse);
+	TestFillPhysicalRam(PageSize * 10, PageSize * 30, PageSize * 256, 0, EFalse, ETrue);
+
+	if (CacheSizeAdjustable)
+		{// It is possible to adjust the cache size so test phyiscally contiguous 
+		// allocations discard and move pages when required.
+		test.Next(_L("TestFragmentedAllocations with discardable data no true free memory"));
+		// Test every other page free.
+		TestFillPhysicalRam(PageSize, PageSize * 2, PageSize, 0, ETrue, EFalse);
+		if (ManualTest)
+			{
+			TestFillPhysicalRam(PageSize, PageSize * 2, PageSize, 0, ETrue, ETrue);
+			TestFillPhysicalRam(PageSize, PageSize * 2, PageSize * 2, 0, ETrue, EFalse);
+			}
+		TestFillPhysicalRam(PageSize, PageSize * 2, PageSize * 2, 0, ETrue, ETrue);
+		// Test every 2 pages free.
+		TestFillPhysicalRam(PageSize * 2, PageSize * 4, PageSize * 8, 0, ETrue, EFalse);
+		if (ManualTest)
+			TestFillPhysicalRam(PageSize * 2, PageSize * 4, PageSize * 8, 0, ETrue, ETrue);
+		// Test 10 pages free then 20 pages allocated, allocate 256 pages (1MB in most cases).
+		if (ManualTest)
+			TestFillPhysicalRam(PageSize * 10, PageSize * 30, PageSize * 256, 0, ETrue, EFalse);
+		TestFillPhysicalRam(PageSize * 10, PageSize * 30, PageSize * 256, 0, ETrue, ETrue);
+		}
+	}
+
+
 GLDEF_C TInt E32Main()
 //
 // Test RAM allocation
@@ -135,8 +524,33 @@
 	PageShift=-1;
 	for (; psz; psz>>=1, ++PageShift);
 
-	InitFreeRam=FreeRam();
-	test.Printf(_L("Free RAM=%08x, Page size=%x, Page shift=%d\n"),InitFreeRam,PageSize,PageShift);
+	TUint currentCacheSize;
+	CacheSizeAdjustable = DPTest::CacheSize(OrigMinCacheSize, OrigMaxCacheSize, currentCacheSize) == KErrNone;
+
+	TUint memodel = UserSvr::HalFunction(EHalGroupKernel, EKernelHalMemModelInfo, NULL, NULL) & EMemModelTypeMask;
+
+	TInt cmdLineLen = User::CommandLineLength();
+	if(cmdLineLen)
+		{
+		_LIT(KManual, "manual");
+		RBuf cmdLine;
+		test_KErrNone(cmdLine.Create(cmdLineLen));
+		User::CommandLine(cmdLine);
+		cmdLine.LowerCase();
+		ManualTest = cmdLine.Find(KManual) != KErrNotFound;
+		}
+
+	// Turn off lazy dll unloading and ensure any supervisor clean up has completed 
+	// so the free ram checking isn't affected.
+	RLoader l;
+	test(l.Connect()==KErrNone);
+	test(l.CancelLazyDllUnload()==KErrNone);
+	l.Close();
+	UserSvr::HalFunction(EHalGroupKernel, EKernelHalSupervisorBarrier, 0, 0);
+
+	test_KErrNone(HAL::Get(HAL::EMemoryRAM, TotalRam));
+
+	test.Printf(_L("Free RAM=%08x, Page size=%x, Page shift=%d\n"),FreeRam(),PageSize,PageShift);
 
 	test.Next(_L("Open test LDD"));
 	r=Shadow.Open();
@@ -148,8 +562,72 @@
 	test.Next(_L("TestClaimPhys"));
 	TestClaimPhys();
 
+	if (memodel >= EMemModelTypeFlexible)
+		{
+		// To stop these tests taking too long leave only 8MB of RAM free.
+		const TUint KFreePages = 2048;
+		test.Next(_L("Load gobbler LDD"));
+		TInt r = User::LoadLogicalDevice(KGobblerLddFileName);
+		test_Value(r, r == KErrNone || r == KErrAlreadyExists);
+		RGobbler gobbler;
+		r = gobbler.Open();
+		test_KErrNone(r);
+		TUint32 taken = gobbler.GobbleRAM(KFreePages * PageSize);
+		test.Printf(_L("Gobbled: %dK\n"), taken/1024);
+		test.Printf(_L("Free RAM 0x%08X bytes\n"),FreeRam());
+
+		test.Next(_L("TestFragmentedAllocation"));
+		TestFragmentedAllocation();
+
+		test.Next(_L("TestMultipleContiguousAllocations"));
+		TestMultipleContiguousAllocations(20, PageSize * 16, 0);
+		TestMultipleContiguousAllocations(20, PageSize * 16, PageShift + 1);
+		TestMultipleContiguousAllocations(20, PageSize * 128, PageShift + 2);
+
+		FragmentMemory(PageSize, PageSize * 2, EFalse, EFalse, EFalse);
+		TestMultipleContiguousAllocations(20, PageSize * 128, PageShift + 2);
+		UnfragmentMemory(EFalse, EFalse, EFalse);
+
+		test.Next(_L("TestMultipleContiguousAllocations while accessing memory"));
+		FragmentMemory(PageSize, PageSize * 2, EFalse, ETrue, EFalse);
+		TestMultipleContiguousAllocations(20, PageSize * 128, PageShift + 2);
+		UnfragmentMemory(EFalse, ETrue, EFalse);
+		FragmentMemory(PageSize, PageSize * 2, ETrue, ETrue, EFalse);
+		TestMultipleContiguousAllocations(50, PageSize * 256, PageShift + 5);
+		UnfragmentMemory(ETrue, ETrue, EFalse);
+		FragmentMemory(PageSize * 16, PageSize * 32, ETrue, ETrue, EFalse);
+		TestMultipleContiguousAllocations(10, PageSize * 512, PageShift + 8);
+		UnfragmentMemory(ETrue, ETrue, EFalse);
+		FragmentMemory(PageSize * 32, PageSize * 64, ETrue, ETrue, EFalse);
+		TestMultipleContiguousAllocations(10, PageSize * 1024, PageShift + 10);
+		UnfragmentMemory(ETrue, ETrue, EFalse);
+
+		test.Next(_L("TestMultipleContiguousAllocations with repeated movable and discardable allocations"));
+		FragmentMemory(PageSize, PageSize * 2, EFalse, EFalse, ETrue);
+		TestMultipleContiguousAllocations(20, PageSize * 2, PageShift);
+		UnfragmentMemory(EFalse, EFalse, ETrue);
+		FragmentMemory(PageSize, PageSize * 2, EFalse, EFalse, ETrue);
+		TestMultipleContiguousAllocations(20, PageSize * 128, PageShift + 2);
+		UnfragmentMemory(EFalse, EFalse, ETrue);
+		FragmentMemory(PageSize, PageSize * 2, ETrue, EFalse, ETrue);
+		TestMultipleContiguousAllocations(50, PageSize * 256, PageShift + 5);
+		UnfragmentMemory(ETrue, EFalse, ETrue);
+		FragmentMemory(PageSize * 16, PageSize * 32, ETrue, EFalse, ETrue);
+		TestMultipleContiguousAllocations(20, PageSize * 512, PageShift + 8);
+		UnfragmentMemory(ETrue, EFalse, ETrue);
+		FragmentMemory(PageSize * 32, PageSize * 64, ETrue, EFalse, ETrue);
+		TestMultipleContiguousAllocations(20, PageSize * 1024, PageShift + 10);
+		UnfragmentMemory(ETrue, EFalse, ETrue);
+
+		gobbler.Close();
+		r = User::FreeLogicalDevice(KGobblerLddFileName);
+		test_KErrNone(r);
+		}
+
 	Shadow.Close();
+	r = User::FreeLogicalDevice(KLddFileName);
+	test_KErrNone(r);
+	test.Printf(_L("Free RAM=%08x at end of test\n"),FreeRam());
 	test.End();
 	return(KErrNone);
     }
-
--- a/kerneltest/e32test/mmu/t_shbuf.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/mmu/t_shbuf.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -624,12 +624,14 @@
 		{
 		RShBuf buf;
 		r = buf.Alloc(aPool);
+		RDebug::Printf("alloc buf %d returned %d", bufarray.Count(), r);
 		if (r==KErrNoMemory && KTestPoolSizeInBufs>bufarray.Count())
 			{
 			// try again after a delay, to allow for background resource allocation
 			
 			User::After(1000000);
 			r = buf.Alloc(aPool);
+			RDebug::Printf("re-alloc buf %d returned %d", bufarray.Count(), r);
 			}
 		if (!r)
 			{
@@ -647,6 +649,7 @@
 		{
 		bufarray[--n].Close();
 		}
+	RDebug::Printf("closed bufs");
 
 	User::After(500000);
 
@@ -655,11 +658,13 @@
 	while (n<bufarray.Count())
 		{
 		r = bufarray[n].Alloc(aPool);
+		RDebug::Printf("alloc buf %d returned %d", n, r);
 		if (r==KErrNoMemory)
 			{
 			// try again after a delay, to allow for background resource allocation
 			User::After(1000000);
 			r = bufarray[n].Alloc(aPool);
+			RDebug::Printf("re-alloc buf %d returned %d", n, r);
 			}
 		test_Assert(r == KErrNone, test.Printf(_L("n=%d r=%d\n"), n, r));
 		if(aligned)
@@ -669,12 +674,14 @@
 
 	RShBuf extrabuf;
 	r = extrabuf.Alloc(aPool);
+	RDebug::Printf("alloc extra buf returned %d", r);
 	test_Equal(KErrNoMemory, r);
 
 	while (n)
 		{
 		bufarray[--n].Close();
 		}
+	RDebug::Printf("closed bufs");
 
 	bufarray.Close();
 	}
--- a/kerneltest/e32test/mmu/t_wsd_tst.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/mmu/t_wsd_tst.h	Thu Jul 22 16:46:39 2010 +0100
@@ -47,7 +47,7 @@
 // Exports of DLL1
 #ifdef	T_WSD_DL1
 #else
-IMPORT_D TInt32 ExportedData;
+IMPORT_D extern TInt32 ExportedData;
 IMPORT_C TInt CheckExportedDataAddress(void *aDataAddr);
 #endif	// T_WSD_DL1
 
@@ -65,10 +65,10 @@
 #ifdef	T_WSD_DL3
 #else
 IMPORT_C void** GetAddressOfData(TInt& aSize, void*& aCodeAddr, void*& aDataAddr);
-IMPORT_D TInt32 TestDataSize;
-IMPORT_D void* WritableTestData[1 /* refer TestDataSize */];
-IMPORT_D const void* const* PointerToStaticData;
-IMPORT_D void** PointerToWritableData;
+IMPORT_D extern TInt32 TestDataSize;
+IMPORT_D extern void* WritableTestData[1 /* refer TestDataSize */];
+IMPORT_D extern const void* const* PointerToStaticData;
+IMPORT_D extern void** PointerToWritableData;
 #endif	// T_WSD_DL3
 
 #endif	// __T_WSD_TST_H__
--- a/kerneltest/e32test/multimedia/t_sound2.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/multimedia/t_sound2.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -2379,10 +2379,6 @@
 	Test.Title();
 
 	Test.Start(_L("Load"));
-	// --- TEMPORARILY DISABLING T_SOUND2
-	Test.Printf(_L("T_SOUND2 DISABLED UNTIL DEF144934 IS FIXED\n"));
-	CHECK(0);
-	// --- TEMPORARILY DISABLING T_SOUND2
 	if (Load()==KErrNotFound)
 		{
 		Test.Printf(_L("Shared chunk sound driver not supported - test skipped\r\n"));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/power/d_frqchg.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,421 @@
+// Copyright (c) 2010-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32test\power\d_frqchg.cpp
+// LDD for testing frequency changing
+// 
+//
+
+#include <kernel/kernel.h>
+#include "d_frqchg.h"
+
+#if defined(__EPOC32__) && defined(__SMP__) && defined(__MARM__)
+#define __SUPPORT_LOCAL_TIMER_PRESCALE__
+
+#include <nk_priv.h>
+#include <arm_tmr.h>
+#endif
+
+
+#ifdef __PLATFORM_SUPPORTS_DVFS__
+/**
+  Baseport needs to supply this function to disable DVFS whilst test is running. 
+  The test relies on changing prescalers in local and global timer directly rather than
+  actually changing frequency. Consequently DVFS must be disabled when the test is running
+
+  This function when driver is loaded. 
+  @return KErrNone if succesful
+ */
+extern TInt DisableDvfs();
+
+/**
+   if plaftorm supports DVFS this function will be called when the driver is unloaded
+ */
+extern void RestoreDvfs();
+#endif
+
+
+
+#if defined(__SUPPORT_LOCAL_TIMER_PRESCALE__)
+TInt Multiply(SRatio& aDest, const SRatio& aSrc)
+	{
+	TUint64 x = aDest.iM;
+	TUint64 y = aSrc.iM;
+	x *= y;
+	if (x==0)
+		{
+		aDest.iM = 0;
+		aDest.iX = 0;
+		return KErrNone;
+		}
+	TInt exp = aDest.iX + aSrc.iX + 32;
+	if (TInt64(x) >= 0)
+		x<<=1, --exp;
+	aDest.iM = I64HIGH(x);
+	if (I64LOW(x) & 0x80000000u)
+		{
+		if (++aDest.iM == 0)
+			aDest.iM = 0x80000000u, ++exp;
+		}
+	if (exp > 32767)
+		{
+		aDest.iM = 0xffffffffu;
+		aDest.iX = 32767;
+		return KErrOverflow;
+		}
+	if (exp < -32768)
+		{
+		aDest.iM = 0;
+		aDest.iX = 0;
+		return KErrUnderflow;
+		}
+	aDest.iX = (TInt16)exp;
+	return KErrNone;
+	}
+
+// Calculate frequency ratio for specified prescale value
+// Ratio = (default+1)/(current+1)
+void PrescaleRatio(SRatio& aR, TInt aDefault, TInt aCurrent)
+	{
+	SRatio df;
+	df.Set(TUint32(aDefault+1));
+	aR.Set(TUint32(aCurrent+1));
+	aR.Reciprocal();
+	Multiply(aR, df);
+	}
+#endif
+
+class DFrqChgFactory : public DLogicalDevice
+//
+// Test LDD factory
+//
+	{
+public:
+	DFrqChgFactory();
+	virtual ~DFrqChgFactory();
+	virtual TInt Install(); 					//overriding pure virtual
+	virtual void GetCaps(TDes8& aDes) const;	//overriding pure virtual
+	virtual TInt Create(DLogicalChannelBase*& aChannel); 	//overriding pure virtual
+	};
+
+class DFrqChg : public DLogicalChannelBase
+//
+// Test logical channel
+//
+	{
+public:
+	virtual ~DFrqChg();
+protected:
+	virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
+	virtual TInt Request(TInt aReqNo, TAny* a1, TAny* a2);
+#if defined(__SUPPORT_LOCAL_TIMER_PRESCALE__)
+	void PopulateDefaultPrescaleList();
+	void SetLocalTimerPrescaler(TUint32 aCpus, TInt aPrescale);
+	TScheduler* iS;
+	TInt iDefaultPrescale[KMaxCpus];
+#if defined(__CPU_ARM_HAS_GLOBAL_TIMER_BLOCK) && defined( __NKERN_TIMESTAMP_USE_SCU_GLOBAL_TIMER__)
+	void SetGlobalTimerPrescaler(TInt aPrescale);
+	TInt iDefaultGTPrescale;
+#endif
+#endif
+
+	};
+
+
+
+DECLARE_STANDARD_LDD()
+	{
+	return new DFrqChgFactory;
+	}
+
+//
+// Constructor
+//
+DFrqChgFactory::DFrqChgFactory()
+	{
+	}
+
+//
+// Destructor, called on unload
+//
+DFrqChgFactory::~DFrqChgFactory()
+	{
+#ifdef __PLATFORM_SUPPORTS_DVFS__
+	RestoreDvfs();
+#endif
+	}
+
+
+
+//
+// Create new channel
+//
+TInt DFrqChgFactory::Create(DLogicalChannelBase*& aChannel)
+	{
+	aChannel=new DFrqChg;
+	return aChannel?KErrNone:KErrNoMemory;
+	}
+
+
+//
+// Install the LDD - overriding pure virtual
+//
+TInt DFrqChgFactory::Install()
+	{
+#ifdef __PLATFORM_SUPPORTS_DVFS__
+	TInt r = DisableDvfs();
+	if (KErrNone != r) return r;
+#endif
+	return SetName(&KLddName);
+	}
+
+
+//
+// Get capabilities - overriding pure virtual
+//
+void DFrqChgFactory::GetCaps(TDes8& /*aDes*/) const
+	{
+	}
+
+
+//
+// Create channel
+//
+TInt DFrqChg::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& /*aVer*/)
+	{
+#if defined(__SUPPORT_LOCAL_TIMER_PRESCALE__)
+	iS = (TScheduler*)TScheduler::Ptr();
+	PopulateDefaultPrescaleList();
+#endif
+	return KErrNone;
+	}
+
+
+//
+// Destructor
+//
+DFrqChg::~DFrqChg()
+	{
+#if defined(__SUPPORT_LOCAL_TIMER_PRESCALE__)
+	// restore prescalers
+	SetLocalTimerPrescaler((TUint32) -1, -1);
+#if defined(__CPU_ARM_HAS_GLOBAL_TIMER_BLOCK) && defined( __NKERN_TIMESTAMP_USE_SCU_GLOBAL_TIMER__)
+	SetGlobalTimerPrescaler(-1);
+#endif
+#endif
+	}
+
+
+TInt DFrqChg::Request(TInt aReqNo, TAny* a1, TAny* a2)
+	{
+	SRatioInv ri;
+	TInt r = KErrNone;
+	switch (aReqNo)
+		{
+		case RFrqChg::EControl_RatioSet:
+			{
+			kumemget32(&ri.iR, a1, sizeof(SRatio));
+			ri.iR.Set(ri.iR.iM, (TUint32)a2);
+			kumemput32(a1, &ri.iR, sizeof(SRatio));
+			break;
+			}
+		case RFrqChg::EControl_RatioReciprocal:
+			{
+			kumemget32(&ri.iR, a1, sizeof(SRatio));
+			r = ri.iR.Reciprocal();
+			kumemput32(a1, &ri.iR, sizeof(SRatio));
+			break;
+			}
+		case RFrqChg::EControl_RatioMult:
+			{
+			kumemget32(&ri.iR, a1, sizeof(SRatio));
+			kumemget32(&ri.iI.iM, a2, sizeof(TUint32));
+			r = ri.iR.Mult(ri.iI.iM);
+			kumemput32(a2, &ri.iI.iM, sizeof(TUint32));
+			break;
+			}
+		case RFrqChg::EControl_RatioInvSet:
+			{
+			SRatio ratio;
+			const SRatio* p = 0;
+			if (a2)
+				{
+				kumemget32(&ratio, a2, sizeof(SRatio));
+				p = &ratio;
+				}
+			ri.Set(p);
+			kumemput32(a1, &ri, sizeof(SRatioInv));
+			break;
+			}
+#if defined(__EPOC32__) && defined(__SMP__) && defined(__MARM__)
+		case RFrqChg::EControl_FrqChgTestPresent:
+			break;
+		case RFrqChg::EControl_SetCurrentThreadPriority:
+			NKern::ThreadSetPriority(NKern::CurrentThread(), (TInt)a1);
+			break;
+		case RFrqChg::EControl_SetCurrentThreadCpu:
+			{
+			TUint32 old = 0;
+			old =  NKern::ThreadSetCpuAffinity(NKern::CurrentThread(), (TUint32)a1);
+			if (a2) 
+				{
+				kumemput32(a2, &old, sizeof(TUint32));
+				}
+			
+			old =  NKern::ThreadSetCpuAffinity(NKern::CurrentThread(), (TUint32)a1);
+			}
+			
+			break;
+		case RFrqChg::EControl_SetCurrentThreadTimeslice:
+			{
+			TInt ts = NKern::TimesliceTicks((TUint32)a1);
+			NKern::ThreadSetTimeslice(NKern::CurrentThread(), ts);
+			NKern::YieldTimeslice();
+			break;
+			}
+#endif
+#if defined(__SUPPORT_LOCAL_TIMER_PRESCALE__)
+		case RFrqChg::EControl_SetLocalTimerPrescaler:
+			{
+			TUint32 cpus = (TUint32)a1;
+			TInt prescale = (TInt)a2;
+			SetLocalTimerPrescaler(cpus, prescale);
+			break;
+			}
+#if defined(__CPU_ARM_HAS_GLOBAL_TIMER_BLOCK) && defined( __NKERN_TIMESTAMP_USE_SCU_GLOBAL_TIMER__)
+	case RFrqChg::EControl_ReadGlobalTimerAndTimestamp:
+		    {
+			ArmGlobalTimer* tmr = iS->iSX.iGlobalTimerAddr;
+			TUint32 highlow[2];
+			do
+				{
+				highlow[1] = tmr->iTimerCountHigh;
+				highlow[0] = tmr->iTimerCountLow;
+				} while(highlow[1]!=tmr->iTimerCountHigh);
+			TUint64 ts = NKern::Timestamp();
+			kumemput32(a1,&highlow[0],sizeof(TUint64));
+			kumemput32(a2,&ts,sizeof(TUint64));
+			break;
+		 }
+	case RFrqChg::EControl_SetGlobalTimerPrescaler:
+		    {
+			SetGlobalTimerPrescaler((TInt)a1);
+			break;
+		 }
+#endif
+#endif
+		default:
+			r = KErrNotSupported;
+			break;
+		}
+	return r;
+	}
+
+
+#if defined(__SUPPORT_LOCAL_TIMER_PRESCALE__)
+void DFrqChg::PopulateDefaultPrescaleList()
+	{
+	TInt nc = NKern::NumberOfCpus();
+	NThread* nt = NKern::CurrentThread();
+	TUint32 aff0 = NKern::ThreadSetCpuAffinity(nt, 0);
+	TInt i;
+	for (i=0; i<nc; ++i)
+		{
+		NKern::ThreadSetCpuAffinity(nt, i);
+		ArmLocalTimer* tmr = (ArmLocalTimer*)iS->iSX.iLocalTimerAddr;
+		TInt pv = (tmr->iTimerCtrl & E_ArmTmrCtrl_PrescaleMask) >> E_ArmTmrCtrl_PrescaleShift;
+		iDefaultPrescale[i] = pv;
+		}
+	NKern::ThreadSetCpuAffinity(nt, aff0);
+#if defined(__CPU_ARM_HAS_GLOBAL_TIMER_BLOCK) && defined( __NKERN_TIMESTAMP_USE_SCU_GLOBAL_TIMER__)
+	ArmGlobalTimer* tmr = iS->iSX.iGlobalTimerAddr;
+	TInt pv = (tmr->iTimerCtrl & E_ArmGTmrCtrl_PrescaleMask) >> E_ArmGTmrCtrl_PrescaleShift;
+	iDefaultGTPrescale = pv;
+#endif
+	}
+
+void DFrqChg::SetLocalTimerPrescaler(TUint32 aCpus, TInt aPrescale)
+	{
+	TInt nc = NKern::NumberOfCpus();
+	NThread* nt = NKern::CurrentThread();
+	TUint32 aff0 = NKern::ThreadSetCpuAffinity(nt, 0);
+	TInt i;
+	for (i=0; i<nc; ++i)
+		{
+		NKern::ThreadSetCpuAffinity(nt, i);
+		}
+	for (i=0; i<nc; ++i)
+		{
+		NKern::ThreadSetCpuAffinity(nt, i);
+		TInt pv = aPrescale;
+		if (pv < 0)
+			pv = iDefaultPrescale[i];
+		if (aCpus & (1u<<i))
+			{
+			TInt irq = NKern::DisableAllInterrupts();
+			ArmLocalTimer* tmr = (ArmLocalTimer*)iS->iSX.iLocalTimerAddr;
+			tmr->iTimerCtrl = (tmr->iTimerCtrl &~ E_ArmTmrCtrl_PrescaleMask) | ((pv << E_ArmTmrCtrl_PrescaleShift) & E_ArmTmrCtrl_PrescaleMask);
+			__e32_io_completion_barrier();
+			NKern::RestoreInterrupts(irq);
+			}
+		}
+	NKern::ThreadSetCpuAffinity(nt, aff0);
+	if (aCpus & 0x80000000u)
+		{
+		// notify nanokernel of frequency changes
+		SVariantInterfaceBlock* vib = iS->iVIB;
+		SRatio ratio[KMaxCpus];
+		for (i=0; i<nc; ++i)
+			{
+			if (aCpus & (1u<<i))
+				{
+				if (aPrescale<0)
+					ratio[i].Set(1);
+				else
+					PrescaleRatio(ratio[i], iDefaultPrescale[i], aPrescale);
+				vib->iTimerFreqR[i] = &ratio[i];
+				}
+			}
+		(*vib->iFrqChgFn)();
+		}
+	}
+
+#if defined(__CPU_ARM_HAS_GLOBAL_TIMER_BLOCK) && defined( __NKERN_TIMESTAMP_USE_SCU_GLOBAL_TIMER__)
+void DFrqChg::SetGlobalTimerPrescaler(TInt aPrescale)
+	{
+	TInt pv = aPrescale;
+	if (pv <= 0)
+		pv = iDefaultGTPrescale;
+
+	ArmGlobalTimer* tmr = iS->iSX.iGlobalTimerAddr;
+	// TInt irq = NKern::DisableAllInterrupts(); 
+	tmr->iTimerCtrl = (tmr->iTimerCtrl &~ E_ArmGTmrCtrl_PrescaleMask) | ((pv << E_ArmGTmrCtrl_PrescaleShift) & E_ArmGTmrCtrl_PrescaleMask);
+	__e32_io_completion_barrier();
+	// NKern::RestoreInterrupts(irq);
+
+	// notify nanokernel of frequency changes
+	SVariantInterfaceBlock* vib = iS->iVIB;
+	SRatio ratio;
+	
+	if (aPrescale<=0)
+		ratio.Set(1);
+	else
+		PrescaleRatio(ratio, iDefaultGTPrescale, aPrescale);
+
+	vib->iGTimerFreqR = &ratio;
+	(*vib->iFrqChgFn)();
+	}
+
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/power/d_frqchg.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,107 @@
+// Copyright (c) 2010-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32test\power\d_frqchg.h
+// 
+//
+
+#if !defined(__D_FRQCHG_H__)
+#define __D_FRQCHG_H__
+
+#include <e32cmn.h>
+
+struct SRatio;
+struct SRatioInv;
+
+#ifndef __KERNEL_MODE__
+#include <e32std.h>
+
+struct SRatio
+	{
+	TUint32		iM;		// mantissa, normalised so bit 31=1
+	TInt16		iX;		// -exponent.
+	TUint8		iSpare1;
+	TUint8		iSpare2;
+	};
+
+struct SRatioInv
+	{
+	SRatio		iR;
+	SRatio		iI;
+	};
+#endif
+
+_LIT(KLddName,"D_FRQCHG.LDD");
+
+class RFrqChg : public RBusLogicalChannel
+	{
+public:
+	enum TControl
+		{
+		EControl_RatioSet,
+		EControl_RatioReciprocal,
+		EControl_RatioMult,
+		EControl_RatioInvSet,
+		EControl_FrqChgTestPresent,
+		EControl_SetCurrentThreadPriority,
+		EControl_SetCurrentThreadCpu,
+		EControl_SetCurrentThreadTimeslice,
+		EControl_SetLocalTimerPrescaler,
+		EControl_ReadGlobalTimerAndTimestamp,
+		EControl_SetGlobalTimerPrescaler,
+		ENumControls
+		};
+
+public:
+	inline TInt Open();
+	inline TInt RatioSet(SRatio& aRatio, TUint32 aInt, TInt aDivisorExp=0);
+	inline TInt RatioReciprocal(SRatio& aRatio);
+	inline TInt RatioMult(SRatio& aRatio, TUint32& aInt32);
+	inline TInt RatioInvSet(SRatioInv& aRI, const SRatio* aR);
+	inline TInt FrqChgTestPresent();
+	inline TInt SetCurrentThreadPriority(TInt aPri);
+	inline TInt SetCurrentThreadCpu(TUint32 aCpu, TUint32* aOldAffinity = NULL);
+	inline TInt SetCurrentThreadTimeslice(TInt aSlice);
+	inline TInt SetLocalTimerPrescaler(TUint32 aCpus, TInt aPrescale);
+	inline TInt ReadGlobalTimerAndTimestamp(TUint64& aTimerValue, TUint64& aTimestamp);
+	inline TInt SetGlobalTimerPrescaler(TInt aPrescale);
+	};
+
+#ifndef __KERNEL_MODE__
+inline TInt RFrqChg::Open()
+	{ return DoCreate(KLddName,TVersion(0,1,1),KNullUnit,NULL,NULL); }
+inline TInt RFrqChg::RatioSet(SRatio& aR, TUint32 aInt, TInt aDivisorExp)
+	{ aR.iM=aInt; return DoControl(EControl_RatioSet, (TAny*)&aR, (TAny*)aDivisorExp); }
+inline TInt RFrqChg::RatioReciprocal(SRatio& aR)
+	{ return DoControl(EControl_RatioReciprocal, (TAny*)&aR); }
+inline TInt RFrqChg::RatioMult(SRatio& aR, TUint32& aInt32)
+	{ return DoControl(EControl_RatioMult, (TAny*)&aR, (TAny*)&aInt32); }
+inline TInt RFrqChg::RatioInvSet(SRatioInv& aRI, const SRatio* aR)
+	{ return DoControl(EControl_RatioInvSet, (TAny*)&aRI, (TAny*)aR); }
+inline TInt RFrqChg::FrqChgTestPresent()
+	{ return DoControl(EControl_FrqChgTestPresent); }
+inline TInt RFrqChg::SetCurrentThreadPriority(TInt aPri)
+	{ return DoControl(EControl_SetCurrentThreadPriority, (TAny*)aPri); }
+inline TInt RFrqChg::SetCurrentThreadCpu(TUint32 aCpu, TUint32* aOldAffinity)
+	{ return DoControl(EControl_SetCurrentThreadCpu, (TAny*)aCpu, (TAny*) aOldAffinity); }
+inline TInt RFrqChg::SetCurrentThreadTimeslice(TInt aSlice)
+	{ return DoControl(EControl_SetCurrentThreadTimeslice, (TAny*)aSlice); }
+inline TInt RFrqChg::SetLocalTimerPrescaler(TUint32 aCpus, TInt aPrescale)
+	{ return DoControl(EControl_SetLocalTimerPrescaler, (TAny*)aCpus, (TAny*)aPrescale); }
+inline TInt RFrqChg::ReadGlobalTimerAndTimestamp(TUint64& aTimerValue, TUint64& aTimestamp)
+	{ return DoControl(EControl_ReadGlobalTimerAndTimestamp, (TAny*)&aTimerValue, (TAny*) &aTimestamp); }
+inline TInt RFrqChg::SetGlobalTimerPrescaler(TInt aPrescale)
+	{ return DoControl(EControl_SetGlobalTimerPrescaler, (TAny*)aPrescale); }
+#endif
+
+#endif   //__D_FRQCHG_H__
--- a/kerneltest/e32test/power/t_domain.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/power/t_domain.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -2050,7 +2050,6 @@
 	TInt r = manager.Connect(KDmHierarchyIdTest);
 	test (r == KErrNone);
 	manager.RequestDomainTransition(KDmIdRoot, EStartupCriticalStatic, ETraverseDefault, status);
-	test(status.Int() == KRequestPending);
 	User::WaitForRequest(status);
 	test(status.Int() == KErrNone);
 	manager.Close();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/power/t_frqchg.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,775 @@
+// Copyright (c) 2010-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32test\power\t_frqchg.cpp
+//
+//
+
+#define __E32TEST_EXTENSION__
+#include <e32test.h>
+#include <e32math.h>
+#include <e32atomics.h>
+#include <hal.h>
+#include "d_frqchg.h"
+#include <e32svr.h>
+#include "u32std.h"
+
+RFrqChg Driver;
+RTest test(_L("T_FRQCHG"));
+
+// test will fail if slice is > (expected+KSliceDeltaPercent%of expexted) 
+// or < (expected-KSliceDeltaPercent%expected)
+const TInt KSliceDeltaPercent = 5;   
+// test will fail for global timer based timestamps if interval measured 
+// is > (expected+KTimeStampDeltaPercent%of expexted) 
+// or < (expected-KTimeStampDeltaPercent%expected)
+const TInt KTimeStampDeltaPercent = 5;
+
+TInt RealToRatio(SRatio& aRatio, const TRealX& aReal)
+	{
+	aRatio.iSpare1 = 0;
+	aRatio.iSpare2 = 0;
+	if (aReal.iSign || aReal.IsZero() || aReal.IsNaN())
+		{
+		aRatio.iM = 0;
+		aRatio.iX = 0;
+		return (aReal.IsZero()) ? KErrNone : KErrNotSupported;
+		}
+	TRealX rx(aReal);
+	TRealX rr(rx);
+	rr.iExp -= 32;
+	rr.iMantLo = 0;
+	rr.iMantHi = 0x80000000u;
+	rx += rr;	// rounding
+	TInt exp = rx.iExp - 32767 - 31;
+	if (exp < -32768)
+		{
+		aRatio.iM = 0;
+		aRatio.iX = 0;
+		return KErrUnderflow;
+		}
+	if (exp > 32767)
+		{
+		aRatio.iM = 0xffffffffu;
+		aRatio.iX = 32767;
+		return KErrOverflow;
+		}
+	aRatio.iM = rx.iMantHi;
+	aRatio.iX = (TInt16)exp;
+	return KErrNone;
+	}
+
+TInt RatioToReal(TRealX& a, const SRatio& aRatio)
+	{
+	a.iSign = 0;
+	a.iFlag = 0;
+	a.iMantLo = 0;
+	a.iMantHi = aRatio.iM;
+	if (!aRatio.iM)
+		{
+		a.SetZero();
+		return KErrNone;
+		}
+	TInt exp = aRatio.iX + 31 + 32767;
+	if (exp > 65534)
+		{
+		a.SetInfinite(EFalse);
+		}
+	else
+		{
+		a.iExp = (TUint16)exp;
+		}
+	return KErrNone;
+	}
+
+TInt RatioSetValue(TRealX& a, TUint32 aInt, TInt aDivisorExp)
+	{
+	a.Set(TUint(aInt));
+	TInt exp = a.iExp;
+	exp -= aDivisorExp;
+	if (exp<1)
+		{
+		a.SetZero();
+		return KErrUnderflow;
+		}
+	if (exp>65534)
+		{
+		a.SetInfinite(EFalse);
+		return KErrOverflow;
+		}
+	a.iExp = (TInt16)exp;
+	return KErrNone;
+	}
+
+TInt RatioReciprocal(SRatio& aRatio)
+	{
+	TRealX rx;
+	TInt r = RatioToReal(rx, aRatio);
+	if (r != KErrNone)
+		return r;
+	rx = TRealX(1) / rx;
+	return RealToRatio(aRatio, rx);
+	}
+
+TInt RatioMult(const SRatio& aRatio, TUint32& aInt32)
+	{
+	TRealX rx;
+	TInt r = RatioToReal(rx, aRatio);
+	if (r != KErrNone)
+		return r;
+	r = rx.MultEq(TRealX((TUint)aInt32));
+	if (r != KErrNone)
+		return r;
+	if (rx.IsZero())
+		{
+		aInt32 = 0;
+		return KErrNone;
+		}
+	rx.AddEq(TRealX(0.5));
+	if (rx<TRealX(1))
+		{
+		aInt32 = 0;
+		return KErrUnderflow;
+		}
+	if (rx.iExp > 32767+31)
+		{
+		aInt32 = ~0u;
+		return KErrOverflow;
+		}
+	aInt32 = rx.operator TUint();
+	return KErrNone;
+	}
+
+void RatioPrint(const char* aTitle, const SRatio& aRatio)
+	{
+	TPtrC8 t8((const TUint8*)aTitle);
+	TBuf<256> t16;
+	t16.Copy(t8);
+	test.Printf(_L("%S: %08x %04x\n"), &t16, aRatio.iM, TUint16(aRatio.iX));
+	}
+
+void RatioPrint2(const char* aTitle, const SRatio& aR1, const SRatio& aR2)
+	{
+	TPtrC8 t8((const TUint8*)aTitle);
+	TBuf<256> t16;
+	t16.Copy(t8);
+	test.Printf(_L("%S: %08x %04x   %08x %04x\n"), &t16, aR1.iM, TUint16(aR1.iX), aR2.iM, TUint16(aR2.iX));
+	}
+
+void TestEqual(const SRatio& aActual, const SRatio& aExpected)
+	{
+	if (aActual.iM==aExpected.iM && aActual.iX==aExpected.iX)
+		return;
+	RatioPrint("Actual", aActual);
+	RatioPrint("Expected", aExpected);
+	test(0);
+	}
+
+const TUint32 MultTestIntegers[] =
+	{
+	0u, 1u, 2u, 3u, 5u, 7u, 11u, 13u, 17u, 19u, 23u, 29u, 31u, 37u, 41u, 43u, 47u,
+	50u, 51u, 53u, 59u, 61u, 63u, 67u, 71u, 72u, 81u, 100u, 127u, 133u, 187u, 200u,
+	4u, 8u, 16u, 32u, 64u, 128u, 256u, 512u, 1024u, 2048u, 4096u, 8192u, 16384u,
+	32768u, 65536u, 131072u, 262144u, 524288u, 1048576u, 2097152u, 4194304u, 8388608u,
+	16777216u, 33554432u, 67108864u, 134217728u, 268435456u, 536870912u, 1073741824u,
+	2147483648u, 4294967295u,
+	9u, 27u, 243u, 729u, 2187u, 6561u, 19683u, 59049u, 177147u, 531441u, 1594323u,
+	4782969u, 14348907u, 43046721u, 129140163u, 387420489u, 1162261467u, 3486784401u,
+	25u, 125u, 625u, 3125u, 15625u, 78125u, 390625u, 1953125u, 9765625u,
+	48828125u, 244140625u, 1220703125u,
+	49u, 343u, 2401u, 16807u, 117649u, 823543u, 5764801u, 40353607u, 282475249u, 1977326743u
+	};
+
+void Test1M(const SRatio& aRatio)
+	{
+	SRatio ratio = aRatio;
+	const TInt N = sizeof(MultTestIntegers)/sizeof(MultTestIntegers[0]);
+	test.Printf(_L("Testing %d integers\n"), N);
+	TInt i;
+	for (i=0; i<N; ++i)
+		{
+		TUint32 I = MultTestIntegers[i];
+		TUint32 I0 = I;
+		TUint32 I1 = I;
+		TInt r0 = RatioMult(aRatio, I0);
+		TInt r1 = Driver.RatioMult(ratio, I1);
+		if (r0!=KErrNone || r1!=KErrNone)
+			{
+			if (r0!=r1)
+				{
+				test.Printf(_L("Return code mismatch r0=%d r1=%d (I=%08x I0=%08x I1=%08x)\n"), r0, r1, I, I0, I1);
+				test(0);
+				}
+			}
+		else if (I0!=I1)
+			{
+			test.Printf(_L("Result mismatch I=%08x I0=%08x I1=%08x\n"), I, I0, I1);
+			}
+		}
+	}
+
+void Test1(TUint32 aInt, TInt aDivisorExp)
+	{
+	TRealX realx;
+	SRatio r0x;
+	SRatio r0;
+	SRatio r1x;
+	SRatio r1;
+	TInt r;
+	test.Printf(_L("Test1 %08x %d\n"), aInt, aDivisorExp);
+	r = RatioSetValue(realx, aInt, aDivisorExp);
+	test_KErrNone(r);
+	r = RealToRatio(r0x, realx);
+	test_KErrNone(r);
+	r = Driver.RatioSet(r0, aInt, aDivisorExp);
+	RatioPrint2("R0X,R0", r0x, r0);
+	TestEqual(r0, r0x);
+	Test1M(r0);
+	r1x = r0x;
+	r = RatioReciprocal(r1x);
+	test_KErrNone(r);
+	r1 = r0;
+	r = Driver.RatioReciprocal(r1);
+	test_KErrNone(r);
+	RatioPrint2("R1X,R1", r1x, r1);
+	TestEqual(r1, r1x);
+	Test1M(r1);
+	}
+
+void TestRatios()
+	{
+	Test1(1,0);
+	Test1(3,0);
+	Test1(0xb504f334u,32);
+	Test1(0xc90fdaa2u,30);
+	Test1(10,0);
+	Test1(0xcccccccd,35);
+	Test1(100,0);
+	Test1(0xa3d70a3d,38);
+	}
+
+class CircBuf
+	{
+public:
+	static CircBuf* New(TInt aSlots);
+	CircBuf();
+	~CircBuf();
+	TInt TryPut(TUint32 aIn);
+	void Reset();
+public:
+	volatile TUint32* iBufBase;
+	TUint32 iSlotCount;
+	volatile TUint32 iPutIndex;
+	};
+
+CircBuf* CircBuf::New(TInt aSlots)
+	{
+	test(TUint32(aSlots-1)<65536);
+	CircBuf* p = new CircBuf();
+	p->iSlotCount = aSlots;
+	p->iPutIndex = 0;
+	p->iBufBase = (TUint32*)User::Alloc(aSlots*sizeof(TUint32));
+	if (!p->iBufBase)
+		{
+		delete p;
+		p = 0;
+		}
+	__e32_memory_barrier();
+	return p;
+	}
+
+CircBuf::CircBuf()
+	{
+	iBufBase = 0;
+	}
+
+CircBuf::~CircBuf()
+	{
+	User::Free((TAny*)iBufBase);
+	}
+
+TInt CircBuf::TryPut(TUint32 aIn)
+	{
+	TUint32 orig = __e32_atomic_tau_rlx32(&iPutIndex, iSlotCount, 0, 1);
+	if (orig == iSlotCount)
+		return KErrOverflow;
+	iBufBase[orig] = aIn;
+	return KErrNone;
+	}
+
+void CircBuf::Reset()
+	{
+	__e32_atomic_store_ord32(&iPutIndex, 0);
+	}
+
+
+
+class CTimesliceTestThread : public CBase
+	{
+public:
+	CTimesliceTestThread();
+	~CTimesliceTestThread();
+	static CTimesliceTestThread* New(TUint32 aId, TInt aCpu, TInt aSlice, CircBuf* aBuf);
+	void Start();
+	void Wait();
+	TBool Finished();
+	TInt Construct(TUint32 aId, TInt aCpu, TInt aSlice, CircBuf* aBuf);
+	static TInt ThreadFunc(TAny*);
+public:
+	RThread	iThread;
+	TRequestStatus iExitStatus;
+	TUint32 iId;
+	CircBuf* iBuf;
+	TUint32 iFreq;
+	TUint32 iThresh;
+	TUint32 iThresh2;
+	TInt iCpu;
+	TInt iSlice;
+	};
+
+CTimesliceTestThread::CTimesliceTestThread()
+	{
+	iThread.SetHandle(0);
+	}
+
+CTimesliceTestThread::~CTimesliceTestThread()
+	{
+	if (iThread.Handle())
+		{
+		if (iThread.ExitType() == EExitPending)
+			{
+			iThread.Kill(0);
+			Wait();
+			}
+		CLOSE_AND_WAIT(iThread);
+		}
+	}
+
+TInt CTimesliceTestThread::Construct(TUint32 aId, TInt aCpu, TInt aSlice, CircBuf* aBuf)
+	{
+	iId = aId;
+	iCpu = aCpu;
+	iSlice = aSlice;
+	iBuf = aBuf;
+
+	TInt r = HAL::Get(HAL::EFastCounterFrequency, (TInt&)iFreq);
+	if (r!=KErrNone)
+		return r;
+	iThresh = iFreq / 3000;
+	if (iThresh < 10)
+		iThresh = 10;
+	iThresh2 = iFreq;
+	TBuf<16> name = _L("TSThrd");
+	name.AppendNum(iId);
+	r = iThread.Create(name, &ThreadFunc, 0x1000, NULL, this);
+	if (r!=KErrNone)
+		return r;
+	iThread.Logon(iExitStatus);
+	if (iExitStatus != KRequestPending)
+		{
+		iThread.Kill(0);
+		iThread.Close();
+		iThread.SetHandle(0);
+		return iExitStatus.Int();
+		}
+	return KErrNone;
+	}
+
+CTimesliceTestThread* CTimesliceTestThread::New(TUint32 aId, TInt aCpu, TInt aSlice, CircBuf* aBuf)
+	{
+	CTimesliceTestThread* p = new CTimesliceTestThread;
+	if (p)
+		{
+		TInt r = p->Construct(aId, aCpu, aSlice, aBuf);
+		if (r != KErrNone)
+			{
+			delete p;
+			p = 0;
+			}
+		}
+	return p;
+	}
+
+void CTimesliceTestThread::Start()
+	{
+	iThread.Resume();
+	}
+
+TBool CTimesliceTestThread::Finished()
+	{
+	return (KRequestPending!=iExitStatus.Int());
+	}
+
+void CTimesliceTestThread::Wait()
+	{
+	User::WaitForRequest(iExitStatus);
+	}
+
+TInt CTimesliceTestThread::ThreadFunc(TAny* aPtr)
+	{
+	CTimesliceTestThread& a = *(CTimesliceTestThread*)aPtr;
+	Driver.SetCurrentThreadCpu(a.iCpu);
+	Driver.SetCurrentThreadPriority(63);
+	Driver.SetCurrentThreadTimeslice(a.iSlice);
+	User::AfterHighRes(100000);
+	TUint id = a.iId;
+	TUint32 last_interval_begin = User::FastCounter();
+	TUint32 last_seen_time = User::FastCounter();
+	FOREVER
+		{
+		TUint32 nfc = User::FastCounter();
+		TUint32 delta = nfc - last_seen_time;
+		TUint32 interval_length = last_seen_time - last_interval_begin;
+		if (delta > a.iThresh || interval_length > a.iThresh2)
+			{
+			last_interval_begin = nfc;
+			TUint32 x = (id<<30) | (interval_length&0x3fffffffu);
+			TInt r = a.iBuf->TryPut(x);
+			if (r != KErrNone)
+				break;
+			}
+		last_seen_time = nfc;
+		}
+	return KErrNone;
+	}
+
+CircBuf* RunTimesliceTest(TInt aCpu, TInt aSlice, TInt aCount, TInt aInterfere = 0)
+ 	{
+	TUint32 oldaff = 0;
+	TUint32 interfereAffinity = 0; 
+	TUint tellKernel = 0x80000000u;
+	
+	CircBuf* buf = CircBuf::New(aCount);
+	test(buf != 0);
+	CTimesliceTestThread* t0 = CTimesliceTestThread::New(0, aCpu, aSlice, buf);
+	test(t0 != 0);
+	CTimesliceTestThread* t1 = CTimesliceTestThread::New(1, aCpu, aSlice, buf);
+	test(t1 != 0);
+
+	if (aInterfere) 
+		{
+		if (aInterfere < 0) 
+			{
+			tellKernel = 0;
+			}
+		TInt r = UserSvr::HalFunction(EHalGroupKernel, EKernelHalNumLogicalCpus, 0, 0);
+		test(r>0);
+		interfereAffinity = (0x80000000 | ((0x1<<r)-1)) & ~0x2; // all except core 1
+		if (0x80000001 == interfereAffinity) 
+			{
+			interfereAffinity = 0;   // dual core system (not doing this fails affinity check later)
+			}
+		
+		Driver.SetCurrentThreadCpu(interfereAffinity , &oldaff);   // move away from core 1 (doesn't hurt though not much difference gained)
+		Driver.SetCurrentThreadPriority(63);                       // changing prescaler requires running on core 1 so priority needs to 
+		}                                                          // match test threads
+
+
+	t0->Start();
+	t1->Start();
+	if (aInterfere) 
+		{
+		TInt prescale = 1;
+		while (!t0->Finished() || !t1->Finished()) 
+			{
+			User::AfterHighRes(23000);
+			Driver.SetLocalTimerPrescaler((1u<<1)|tellKernel, prescale);
+			prescale++;
+			if (prescale >  4) 
+				{
+				prescale = 0;
+				}
+			}
+		}
+
+	t0->Wait();
+	t1->Wait();
+	
+	delete t0;
+	delete t1;
+	if (aInterfere) 
+		{
+		TUint32 aff;
+		Driver.SetLocalTimerPrescaler((1u<<1)|0x80000000u, -1);
+		RThread().SetPriority(EPriorityNormal);
+		Driver.SetCurrentThreadCpu(oldaff,&aff);
+		test_Equal(aff,interfereAffinity);
+		}
+	return buf;
+	}
+
+TUint32 ticks_to_us(TUint32 aTicks, TUint32 aF)
+	{
+	TUint64 x = TUint64(aTicks) * TUint64(1000000);
+	TUint64 f64 = aF;
+	x += (f64>>1);
+	x /= f64;
+	return I64LOW(x);
+	}
+
+void DisplayBuffer(CircBuf* aBuf, TUint32 aSlice )
+	{
+	TUint32 f;
+	TInt r = HAL::Get(HAL::EFastCounterFrequency, (TInt&)f);
+	test_KErrNone(r);
+	TUint32* p = (TUint32*)aBuf->iBufBase;
+	TInt c = aBuf->iSlotCount;
+	TInt i;
+	TInt lid = -1;
+	TUint32 min = ~0u;
+	TUint32 max = 0;
+	TUint32 totivus = 0;
+	TBool firstchg = ETrue;
+	for (i=0; i<c; ++i)
+		{
+		TUint32 x = p[i];
+		TUint32 id = x>>30;
+		TUint32 iv = (x<<2)>>2;
+		TUint32 ivus = ticks_to_us(iv,f);
+		if (lid >= 0)
+			{
+			if (lid == (TInt)id)
+				totivus += ivus;
+			else
+				{
+				if (!firstchg)
+					{
+					if (totivus < min)
+						min = totivus;
+					if (totivus > max)
+						max = totivus;
+					}
+				else
+					firstchg = EFalse;
+				totivus = ivus;
+				}
+			}
+		lid = (TInt)id;
+		test.Printf(_L("ID: %1d IV: %10d (=%10dus) TIV %10dus\n"), id, iv, ivus, totivus);
+		}
+
+	if (aSlice > 0)
+		{
+		// check timeslices where within acceptable ranges
+		TUint32 sliceError = KSliceDeltaPercent*aSlice/100;
+		test_Compare(max,<,aSlice+sliceError);  
+		test_Compare(min,>,aSlice-sliceError);  
+		}
+	test.Printf(_L("RANGE %d-%dus (%dus)\n"), min, max, max-min);
+	}
+
+void TT()
+	{
+	test.Printf(_L("Timeslicing test ...\n"));
+	CircBuf* b = RunTimesliceTest(1, 50000, 100);
+	test.Next(_L("Baseline - expecting normal"));
+	DisplayBuffer(b,50000u);
+	delete b;
+
+	Driver.SetLocalTimerPrescaler(1u<<1, 1);
+	b = RunTimesliceTest(1, 50000, 100);
+	test.Next(_L("expecting double"));
+	DisplayBuffer(b,100000u);
+	delete b;
+
+	Driver.SetLocalTimerPrescaler(1u<<1|0x80000000u, 1);
+	test.Next(_L("expecting normal again"));
+	b = RunTimesliceTest(1, 50000, 100);
+	DisplayBuffer(b,50000u);
+	delete b;
+
+	test.Next(_L("expecting half"));
+	Driver.SetLocalTimerPrescaler(1u<<1, -1);
+	b = RunTimesliceTest(1, 50000, 100);
+	DisplayBuffer(b,25000u);
+	delete b;
+
+	Driver.SetLocalTimerPrescaler(1u<<1|0x80000000u, -1);
+	test.Next(_L("expecting normal again"));
+	b = RunTimesliceTest(1, 50000, 100);
+	DisplayBuffer(b,50000u);
+	delete b;
+
+	b = RunTimesliceTest(1, 50000, 200 ,-1);
+	test.Next(_L("expecting random"));
+	DisplayBuffer(b,0u);  // timeslices should be fairly random on this run
+
+	b = RunTimesliceTest(1, 50000, 200 ,1);
+	test.Next(_L("expecting normal again"));
+	DisplayBuffer(b,50000u);
+	delete b;
+	}
+
+struct SGTRecord
+	{
+	TUint64 iTSInterval;
+	TUint64 iGTInterval;
+	};
+
+
+SGTRecord* RunGTTest(TInt aCount, TInt aWait)
+	{
+	TUint64 lastgt,lastts,gt,ts;
+
+	SGTRecord* res = new SGTRecord[aCount];
+	test(res!=0);
+
+
+	TInt r = Driver.ReadGlobalTimerAndTimestamp(lastgt,lastts);
+	test_Equal(r,KErrNone);
+
+	for (TInt i = 0; i < aCount; i++) 
+		{
+		User::AfterHighRes(aWait);
+		
+		TInt r = Driver.ReadGlobalTimerAndTimestamp(gt,ts);
+		test_Equal(r,KErrNone);
+		res[i].iGTInterval = gt-lastgt;
+		lastgt = gt;
+		res[i].iTSInterval = ts-lastts;
+		lastts = ts;
+		}
+
+	return res;
+	}
+
+void DisplayGTResults(SGTRecord* aRec, TInt aCount, TUint32 aFreq, TUint64 aExpectedTSInterval, TUint64 aExpectedGTInterval)
+	{
+	SGTRecord max = { 0ul , 0ul };
+	SGTRecord min = { KMaxTUint64 , KMaxTUint64 };
+	
+	TUint64 errgt = (aExpectedGTInterval*KTimeStampDeltaPercent)/100;
+	TUint64 errts = (aExpectedTSInterval*KTimeStampDeltaPercent)/100;
+
+	
+	for (TInt i = 0 ; i < aCount; i++) 
+		{
+		test.Printf(_L("gt interval : %Lu (gtticks) %Lu (us)\n"),
+					aRec[i].iGTInterval,
+					aRec[i].iTSInterval*1000000u/TUint64(aFreq));
+		
+		if (max.iTSInterval < aRec[i].iTSInterval) 
+			{
+			max.iTSInterval = aRec[i].iTSInterval;
+			}
+		if (max.iGTInterval < aRec[i].iGTInterval) 
+			{
+			max.iGTInterval = aRec[i].iGTInterval;
+			}
+		
+		if (min.iTSInterval > aRec[i].iTSInterval) 
+			{
+			min.iTSInterval = aRec[i].iTSInterval;
+			}
+		if (min.iGTInterval > aRec[i].iGTInterval) 
+			{
+			min.iGTInterval = aRec[i].iGTInterval;
+			}
+		}
+	
+	test.Printf(_L("RANGE Global Timer %Lu-%Lu ticks (%Lu ticks)\n"),
+				min.iGTInterval, max.iGTInterval, max.iGTInterval-min.iGTInterval);
+	
+	test.Printf(_L("RANGE Timestamp %Lu-%Lu us (%Lu us)\n"),
+				(1000000u*min.iGTInterval)/TUint64(aFreq), (1000000u*max.iGTInterval)/TUint64(aFreq),
+				(1000000u*max.iGTInterval)/TUint64(aFreq) - (1000000u*min.iGTInterval)/TUint64(aFreq));
+	
+	if (errts) 
+		{
+		test_Compare(max.iTSInterval,<,aExpectedTSInterval+errts);  
+		test_Compare(min.iTSInterval,>,aExpectedTSInterval);  
+		}
+	
+	if (errgt) 
+		{
+		test_Compare(max.iGTInterval,<,aExpectedGTInterval+errgt);  
+		test_Compare(min.iGTInterval,>,aExpectedGTInterval);  
+		}
+	
+	}
+
+void GTT()
+	{
+	test.Printf(_L("Global timer tests ...\n"));
+	TUint64 gt,ts;
+
+	TInt r = Driver.ReadGlobalTimerAndTimestamp(gt,ts);
+	if (KErrNotSupported == r ) 
+		{
+		test.Printf(_L("Global timer not supported in this plaform, skipping GT tests\n"));
+		return;
+		}
+
+	TUint32 f;
+	r = HAL::Get(HAL::EFastCounterFrequency, (TInt&)f);
+	test_KErrNone(r);
+	TInt wait = 100000; // 100ms
+	TInt count = 10;
+	
+	TUint64 expectedTs = (TUint64(f)*TUint64(wait))/1000000u;
+	TUint64 expectedGtOrig = expectedTs;
+	
+	SGTRecord* rec;
+	for (TInt i = 0; i < 10; i++)
+		{
+		TUint64 expectedGt = expectedGtOrig/(i+1);
+		r = Driver.SetGlobalTimerPrescaler(i);
+		test_KErrNone(r);
+		rec = RunGTTest(count, wait);
+		test.Printf(_L("expectedTS %Lu expectedGT %Lu\n"),expectedTs,expectedGt);
+		DisplayGTResults(rec,count, f, expectedTs , expectedGt);
+		delete rec;
+		}
+
+	r = Driver.SetGlobalTimerPrescaler(-1); // back to default
+	test_KErrNone(r);
+	}
+
+void RunTests()
+	{
+	TestRatios();
+	if (Driver.FrqChgTestPresent()!=KErrNone)
+		{
+		test.Printf(_L("Frequency Change not supported on this platform\n"));
+		return;
+		}
+	TT();
+	GTT();
+	}
+
+GLDEF_C TInt E32Main()
+	{
+	test.Title();
+	test.Start(_L("Testing"));
+	TInt r = User::LoadLogicalDevice(KLddName);
+	if (r==KErrNotFound)
+		{
+		test.Printf(_L("Test not supported on this platform\n"));
+		}
+	else 
+		{
+		if (r!=KErrNone)
+			{
+			test_Equal(KErrAlreadyExists, r);
+			}
+		r = Driver.Open();
+		test_KErrNone(r);
+		RunTests();
+		Driver.Close();
+		}
+
+	test.End();
+	r = User::FreeLogicalDevice(KLddName);
+	test_KErrNone(r);
+	return KErrNone;
+	}
--- a/kerneltest/e32test/prime/t_semutx.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/prime/t_semutx.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -38,7 +38,12 @@
 // 
 //
 
+#define __E32TEST_EXTENSION__
 #include <e32test.h>
+#include <hal.h>
+#include <e32atomics.h>
+#include <u32hal.h>
+#include <e32svr.h>
 
 const TInt KMaxBufferSize=10;
 const TInt KMaxArraySize=10;
@@ -48,13 +53,352 @@
 
 RTest test(_L("T_SEMUTX"));
 RMutex mutex;
-RCriticalSection criticalSn;	
+RCriticalSection criticalSn;
 TInt thread1Count,thread2Count;
 TInt arrayIndex;
-TInt array[KMaxArraySize];  
+TInt array[KMaxArraySize];
 TInt consumerArray[KNumProducerItems];
-RSemaphore slotAvailable,itemAvailable;  
+RSemaphore slotAvailable,itemAvailable;
+TBool doCpuLocking = EFalse;
+
+// return num of cpus in system
+TInt NumCpus()
+	{
+	TInt r = UserSvr::HalFunction(EHalGroupKernel, EKernelHalNumLogicalCpus, 0, 0);
+	return r;
+	}
+
+
+TInt LockCurrentThreadToCpu0(TBool aCallingIsMainTestThread = EFalse)
+	{
+	if (aCallingIsMainTestThread) 
+		{
+		if (NumCpus() > 1) 
+			{
+			doCpuLocking = ETrue;
+			return UserSvr::HalFunction(EHalGroupKernel, EKernelHalLockThreadToCpu, 0, 0); 
+			}
+		else
+			{
+			return KErrNone;
+			}
+		}
+	return UserSvr::HalFunction(EHalGroupKernel, EKernelHalLockThreadToCpu, 0, 0); 
+	}
+
+TInt UnlockCurrentThreadToCpu0(TBool aCallingIsMainTestThread = EFalse)
+	{
+	if (aCallingIsMainTestThread) 
+		{
+		if (NumCpus() > 1) 
+			{
+			doCpuLocking = EFalse;
+			return UserSvr::HalFunction(EHalGroupKernel, EKernelHalLockThreadToCpu, (TAny*) 0xffffffffu, 0); 
+			}
+		else
+			{
+			return KErrNone;
+			}
+		}
+	return UserSvr::HalFunction(EHalGroupKernel, EKernelHalLockThreadToCpu, (TAny*) 0xffffffffu, 0); 
+	}
+
+
+/******************************************************************************
+ * Random Number Generation
+ ******************************************************************************/
+void Random(TUint64& a)
+	{
+	TInt i;
+	for (i=64; i>0; --i)
+		{
+		TUint64 x = a<<1;
+		TUint64 y = x<<1;
+		x^=y;
+		a = (y>>1) | (x>>63);
+		}
+	}
+
+// Returns 256*log2(a/2^64)
+TInt Log2(TUint64 a)
+	{
+	const TUint64 KBit63 = UI64LIT(0x8000000000000000);
+	TInt n = __e32_find_ms1_64(a);
+	a <<= (63-n);
+	n -= 64;
+	TInt i;
+	for (i=0; i<8; ++i)
+		{
+		a >>= 32;
+		a *= a;
+		n <<= 1;
+		if (a & KBit63)
+			{
+			++n;
+			}
+		else
+			{
+			a <<= 1;
+			}
+		}
+	return n;
+	}
+
+TUint32 ExpRV(TUint64 aU, TUint32 aMean, TUint32 aTick)
+	{
+	TInt n = -Log2(aU);
+	TUint64 x = TUint64(n) * TUint64(aMean);
+	x *= TUint64(22713);	// 2^15 * ln2
+	TUint64 p(aTick);
+	p <<= 22;
+	x += p;
+	p += p;
+	x /= p;
+	return I64LOW(x);
+	}
+
+
+
+/*----------------------------------------------------------------------------*/
+class MLock
+	{
+public:
+	enum {EPollable=1, ETimeoutAvail=2, ENestable=4, ELimit1=8, ELooseTimeout=16};
+public:
+	virtual TInt Flags()=0;
+	virtual void Release()=0;
+	virtual void Wait()=0;
+	virtual void Signal()=0;
+	virtual TInt Wait(TInt aTimeout);
+	virtual TInt Poll();
+	};
+
+TInt MLock::Wait(TInt)
+	{ return KErrNotSupported; }
+TInt MLock::Poll()
+	{ return KErrNotSupported; }
+
+/*----------------------------------------------------------------------------*/
+class LockS : public MLock
+	{
+public:
+	LockS();
+	virtual TInt Flags();
+	virtual void Release();
+	virtual void Wait();
+	virtual void Signal();
+	virtual TInt Wait(TInt aTimeout);
+	virtual TInt Poll();
+public:
+	RSemaphore	iT;
+	};
+
+LockS::LockS()
+	{ test_KErrNone(iT.CreateLocal(1)); }
+TInt LockS::Flags()
+	{ return EPollable|ETimeoutAvail; }
+void LockS::Release()
+	{ iT.Close(); }
+void LockS::Wait()
+	{ iT.Wait(); }
+void LockS::Signal()
+	{ iT.Signal(); }
+TInt LockS::Wait(TInt aTimeout)
+	{ return iT.Wait(aTimeout); }
+TInt LockS::Poll()
+	{ return iT.Poll(); }
+
+/*----------------------------------------------------------------------------*/
+class LockM : public MLock
+	{
+public:
+	LockM();
+	virtual TInt Flags();
+	virtual void Release();
+	virtual void Wait();
+	virtual void Signal();
+	virtual TInt Wait(TInt aTimeout);
+	virtual TInt Poll();
+public:
+	RMutex		iT;
+	};
+
+LockM::LockM()
+	{ test_KErrNone(iT.CreateLocal()); }
+TInt LockM::Flags()
+	{ return EPollable|ETimeoutAvail|ENestable|ELimit1; }
+void LockM::Release()
+	{ iT.Close(); }
+void LockM::Wait()
+	{ iT.Wait(); }
+void LockM::Signal()
+	{ iT.Signal(); }
+TInt LockM::Wait(TInt aTimeout)
+	{ return iT.Wait(aTimeout); }
+TInt LockM::Poll()
+	{ return iT.Poll(); }
+
+/*----------------------------------------------------------------------------*/
+
+class LockFL : public MLock
+	{
+public:
+	LockFL();
+	virtual TInt Flags();
+	virtual void Release();
+	virtual void Wait();
+	virtual void Signal();
+	virtual TInt Wait(TInt aTimeout);
+	virtual TInt Poll();
+public:
+	RFastLock	iT;
+	};
+
+LockFL::LockFL()
+	{ test_KErrNone(iT.CreateLocal()); }
+TInt LockFL::Flags()
+	{ return ETimeoutAvail|EPollable|ELimit1|ELooseTimeout; }
+void LockFL::Release()
+	{ iT.Close(); }
+void LockFL::Wait()
+	{ iT.Wait(); }
+void LockFL::Signal()
+	{ iT.Signal(); }
+TInt LockFL::Wait(TInt aTimeout)
+	{ return iT.Wait(aTimeout); }
+TInt LockFL::Poll()
+	{ return iT.Poll(); }
+
+/*----------------------------------------------------------------------------*/
+class LockCS : public MLock
+	{
+public:
+	LockCS();
+	virtual TInt Flags();
+	virtual void Release();
+	virtual void Wait();
+	virtual void Signal();
+public:
+	RCriticalSection iT;
+	};
+
+LockCS::LockCS()
+	{ test_KErrNone(iT.CreateLocal()); }
+TInt LockCS::Flags()
+	{ return ELimit1; }
+void LockCS::Release()
+	{ iT.Close(); }
+void LockCS::Wait()
+	{ iT.Wait(); }
+void LockCS::Signal()
+	{ iT.Signal(); }
+
+
 			 
+/*----------------------------------------------------------------------------*/
+class LFSR
+	{
+public:
+	LFSR(TInt aBits, TInt aTap2, TInt aTap3=0, TInt aTap4=0);
+	~LFSR();
+	void Step();
+	void Step(TInt aSteps);
+	TBool operator==(const LFSR& a) const;
+public:
+	TUint32* iData;
+	TInt iBits;
+	TInt iTap2;
+	TInt iTap3;
+	TInt iTap4;
+	TInt iNW;
+	TInt iSh1;
+	TInt iIx2;
+	TInt iSh2;
+	TInt iIx3;
+	TInt iSh3;
+	TInt iIx4;
+	TInt iSh4;
+	};
+
+LFSR::LFSR(TInt aBits, TInt aTap2, TInt aTap3, TInt aTap4)
+	{
+	iBits = aBits;
+	iTap2 = aTap2;
+	iTap3 = aTap3;
+	iTap4 = aTap4;
+	iNW = (aBits + 31) >> 5;
+	iData = (TUint32*)User::AllocZ(iNW*sizeof(TUint32));
+	test(iData!=0);
+	iData[0] = 1;
+	iSh1 = (aBits-1)&31;
+	iIx2 = (iTap2-1)>>5;
+	iSh2 = (iTap2-1)&31;
+	if (iTap3)
+		{
+		iIx3 = (iTap3-1)>>5;
+		iSh3 = (iTap3-1)&31;
+		}
+	else
+		{
+		iIx3 = -1;
+		iSh3 = 0;
+		}
+	if (iTap4)
+		{
+		iIx4 = (iTap4-1)>>5;
+		iSh4 = (iTap4-1)&31;
+		}
+	else
+		{
+		iIx4 = -1;
+		iSh4 = 0;
+		}
+	}
+
+LFSR::~LFSR()
+	{
+	User::Free(iData);
+	}
+
+void LFSR::Step(TInt aSteps)
+	{
+	while (aSteps--)
+		Step();
+	}
+
+void LFSR::Step()
+	{
+	TUint32 b = iData[iNW-1]>>iSh1;
+	b ^= (iData[iIx2]>>iSh2);
+	if (iIx3>=0)
+		b ^= (iData[iIx3]>>iSh3);
+	if (iIx4>=0)
+		b ^= (iData[iIx4]>>iSh4);
+	b &= 1;
+	TInt i;
+	for (i=0; i<iNW; ++i)
+		{
+		TUint32 bb = iData[i] >> 31;
+		iData[i] = (iData[i]<<1)|b;
+		b = bb;
+		}
+	iData[iNW-1] &= ((2u<<iSh1)-1u);
+	}
+
+TBool LFSR::operator==(const LFSR& a) const
+	{
+	if (iBits!=a.iBits || iTap2!=a.iTap2 || iTap3!=a.iTap3 || iTap4!=a.iTap4 || iNW!=a.iNW)
+		return EFalse;
+	if (iData==a.iData)
+		return ETrue;
+	if (memcompare((const TUint8*)iData, iNW, (const TUint8*)a.iData, a.iNW))
+		return EFalse;
+	return ETrue;
+	}
+
+
+
+/*----------------------------------------------------------------------------*/
 class CStack
 	{
 public:	   
@@ -115,6 +459,7 @@
 // Mutex test thread 1
 //
 	{	
+	TInt n = NumCpus();
 
 	thread1Count=0;
 	TBool running=ETrue;
@@ -130,6 +475,16 @@
 		else
 			running=EFalse;
 		mutex.Signal();
+
+		if (n > 1) 
+			{
+			// when the mutex is singaled, due to priority balancing, the other
+			// thread will be scheduled to run on a CPU other than this one. The delay
+			// in getting that thread to run means that this one can manage to re-claim the 
+			// mutex before the other thread gets to run. So we add a small delay here 
+			User::After(100); 
+			}
+
 		} while (running);
 	return(KErrNone);
 	}
@@ -139,6 +494,7 @@
 // Mutex test thread 2
 //
 	{
+	TInt n = NumCpus();
 
 	thread2Count=0;
 	TBool running=ETrue;
@@ -154,6 +510,17 @@
 		else
 			running=EFalse;
 		mutex.Signal();
+
+		if (n > 1) 
+			{
+			// when the mutex is singaled, due to priority balancing, the other
+			// thread will be scheduled to run on a CPU other than this one. The delay
+			// in getting that thread to run means that this one can manage to re-claim the 
+			// mutex before the other thread gets to run. So we add a small delay here 
+			User::After(100); 
+			}
+		
+
 		} while (running);
 	return(KErrNone);
 	}
@@ -206,63 +573,151 @@
 	return(KErrNone);
 	}
 
-struct SWaitSem
+
+/*----------------------------------------------------------------------------*/
+struct SWaitLock
 	{
-	RSemaphore iSem;
+	enum {EDummy=-2, EPoll=-1, EInfinite=0};
+
+	static TInt WaitLockThread(TAny*);
+	void Start(RThread& aT, TThreadPriority aP=EPriorityLess);
+	void Wait(RThread& aT, TInt aResult);
+	TInt DoTest2(RThread& aT, TInt aTimeout, TInt aResult, TThreadPriority aP=EPriorityLess);
+	void Test2();
+	void TestSignalled();
+	void TestNotSignalled();
+	void TestState();
+
+
+	MLock* iLock;
 	TInt iTimeout;
 	};
 
-TInt WaitSemThread(TAny* a)
+TInt SWaitLock::WaitLockThread(TAny* a)
 	{
-	SWaitSem& ws = *(SWaitSem*)a;
-	return ws.iSem.Wait(ws.iTimeout);
+	
+	if (doCpuLocking)
+		{
+		TInt r = LockCurrentThreadToCpu0();
+		if (KErrNone!=r) return r;
+		// Rendevous was requested
+		RThread::Rendezvous(KErrNone);
+		}
+	
+	SWaitLock& w = *(SWaitLock*)a;
+	TInt lfl = w.iLock->Flags();
+	TBool limit1 = lfl & MLock::ELimit1;
+	TInt r;
+	switch (w.iTimeout)
+		{
+		case EDummy:
+			return KErrNone;
+		case EPoll:
+			r = w.iLock->Poll();
+			break;
+		case EInfinite:
+			w.iLock->Wait();
+			r = KErrNone;
+			break;
+		default:
+			r = w.iLock->Wait(w.iTimeout);
+			break;
+		}
+	if (limit1 && r==KErrNone)
+		w.iLock->Signal();
+	return r;
 	}
 
-void StartWaitSemThread(RThread& aT, SWaitSem& aW, TThreadPriority aP=EPriorityLess)
+void SWaitLock::Start(RThread& aT, TThreadPriority aP)
 	{
-	TInt r = aT.Create(KNullDesC, &WaitSemThread, 0x1000, 0x1000, 0x1000, &aW);
-	test(r==KErrNone);
+	TRequestStatus st;
+	TInt r = aT.Create(KNullDesC, &WaitLockThread, 0x1000, 0x1000, 0x1000, this);
+	test_KErrNone(r);
 	aT.SetPriority(aP);
+	if (doCpuLocking) 
+		{
+		aT.Rendezvous(st);
+		}
 	aT.Resume();
+	if (doCpuLocking) 
+		{
+		User::WaitForRequest(st);
+		test_KErrNone(st.Int());
+		}
 	}
 
-void WaitForWaitSemThread(RThread& aT, TInt aResult)
+void SWaitLock::Wait(RThread& aT, TInt aResult)
 	{
 	TRequestStatus s;
 	aT.Logon(s);
 	User::WaitForRequest(s);
-	test(aT.ExitType()==EExitKill);
-	test(aT.ExitReason()==aResult);
-	test(s.Int()==aResult);
+	test_Equal(EExitKill, aT.ExitType());
+	test_Equal(aResult, aT.ExitReason());
+	test_Equal(aResult, s.Int());
 	CLOSE_AND_WAIT(aT);
 	}
 
-TInt DummyThread(TAny*)
+TInt SWaitLock::DoTest2(RThread& aT, TInt aTimeout, TInt aResult, TThreadPriority aP)
 	{
-	return 0;
+	TTime initial;
+	TTime final;
+	iTimeout = aTimeout;
+	initial.HomeTime();
+	Start(aT, aP);
+	Wait(aT, aResult);
+	final.HomeTime();
+	TInt elapsed = I64INT(final.Int64()-initial.Int64());
+	return elapsed;
+	}
+
+void SWaitLock::TestSignalled()
+	{
+	TInt r = iLock->Poll();
+	if (r == KErrNotSupported)
+		r = iLock->Wait(1);
+	test_KErrNone(r);
 	}
 
-void TestSemaphore2()
+void SWaitLock::TestNotSignalled()
+	{
+	TInt r = iLock->Poll();
+	if (r == KErrNotSupported)
+		r = iLock->Wait(1);
+	test_Equal(KErrTimedOut, r);
+	}
+
+void SWaitLock::TestState()
 	{
-	test.Start(_L("Test semaphore wait with timeout"));
-	SWaitSem ws;
+	if (iLock->Flags() & MLock::ELimit1)
+		TestSignalled();	// not signalled afterwards
+	else
+		TestNotSignalled();
+	}
+
+void SWaitLock::Test2()
+	{
+	test.Start(_L("SWaitLock::Test2"));
 	RThread t;
+	RThread t2;
 	TTime initial;
 	TTime final;
-	TInt elapsed=0;
-	TInt r = ws.iSem.CreateLocal(0);
-	test(r==KErrNone);
+	TInt elapsed = 0;
+	TInt r = 0;
+	TInt lfl = iLock->Flags();
+	TBool nestable = lfl & MLock::ENestable;
+	TBool limit1 = lfl & MLock::ELimit1;
+	TBool pollable = lfl & MLock::EPollable;
+	TBool to = lfl & MLock::ETimeoutAvail;
+	TBool lto = lfl & MLock::ELooseTimeout;
 
 	RThread().SetPriority(EPriorityAbsoluteVeryLow);
 	TInt threadcount=0;
+	iTimeout = EDummy;
 	initial.HomeTime();
 	while (elapsed<1000000)
 		{
-		r = t.Create(KNullDesC, &DummyThread, 0x1000, NULL, NULL);
-		test(r==KErrNone);
-		t.SetPriority(EPriorityMore);
-		t.Resume();
-		t.Close();
+		Start(t, EPriorityMore);
+		Wait(t, KErrNone);
 		++threadcount;
 		final.HomeTime();
 		elapsed = I64INT(final.Int64()-initial.Int64());
@@ -272,125 +727,735 @@
 	TInt overhead = 1000000/threadcount;
 	test.Printf(_L("overhead = %dus\n"),overhead);
 
-	ws.iTimeout=1000000;
-	initial.HomeTime();
-	StartWaitSemThread(t, ws);
-	WaitForWaitSemThread(t, KErrTimedOut);
-	final.HomeTime();
-	elapsed = I64INT(final.Int64()-initial.Int64());
-	test.Printf(_L("Time taken = %dus\n"), elapsed);
-	test(elapsed>=900000+overhead && elapsed<1500000+overhead);
+	iLock->Wait();
 
-	ws.iTimeout=-1;
-	initial.HomeTime();
-	StartWaitSemThread(t, ws);
-	WaitForWaitSemThread(t, KErrArgument);
-	final.HomeTime();
-	elapsed = I64INT(final.Int64()-initial.Int64());
-	test.Printf(_L("Time taken = %dus\n"), elapsed);
+	if (to)
+		{
+		elapsed = DoTest2(t, 1000000, KErrTimedOut);
+		test.Printf(_L("Time taken = %dus\n"), elapsed);
+		test(elapsed>=900000+overhead && elapsed<1500000+overhead);
+		elapsed = DoTest2(t, -99, KErrArgument);
+		test.Printf(_L("Time taken = %dus\n"), elapsed);
+		}
 
-	ws.iTimeout=2000000;
-	initial.HomeTime();
-	StartWaitSemThread(t, ws);
-	User::After(1000000);
-	ws.iSem.Signal();
-	WaitForWaitSemThread(t, KErrNone);
-	final.HomeTime();
-	elapsed = I64INT(final.Int64()-initial.Int64());
-	test.Printf(_L("Time taken = %dus\n"), elapsed);
-	test(elapsed>=900000+overhead && elapsed<1500000+overhead);
+	if (pollable)
+		{
+		test.Printf(_L("Testing Poll() function\n"));
+		r = iLock->Poll();
+		test_Equal((nestable ? KErrNone : KErrTimedOut), r);
+		if (nestable)
+			{
+			iTimeout=EPoll;
+			r = iLock->Poll();
+			test_KErrNone(r);
+			iLock->Signal();
+			Start(t, EPriorityMore);
+			Wait(t, KErrTimedOut);
+			}
+		iLock->Signal();
+		if (nestable)
+			{
+			iTimeout=EPoll;
+			r = iLock->Poll();
+			test_KErrNone(r);
+			iLock->Signal();
+			Start(t, EPriorityMore);
+			Wait(t, KErrTimedOut);
+			iLock->Signal();
+			Start(t, EPriorityMore);
+			Wait(t, KErrNone);
+			}
+		r = iLock->Poll();
+		test_KErrNone(r);
+		if (!nestable)
+			{
+			r = iLock->Poll();
+			test_Equal(KErrTimedOut, r);
+			iLock->Signal();
+			if (!limit1)
+				{
+				iLock->Signal();
+				r = iLock->Poll();
+				test_KErrNone(r);
+				}
+			r = iLock->Poll();
+			test_KErrNone(r);
+			r = iLock->Poll();
+			test_Equal(KErrTimedOut, r);
+			}
+		elapsed = DoTest2(t, EPoll, KErrTimedOut);
+		test.Printf(_L("Time taken = %dus\n"), elapsed);
+		test(elapsed<=50000+3*overhead);
+		iLock->Signal();
+		elapsed = DoTest2(t, EPoll, KErrNone);
+		test.Printf(_L("Time taken = %dus\n"), elapsed);
+		test(elapsed<=50000+3*overhead);
+		TestState();
+		iLock->Signal();
+		r = LockCurrentThreadToCpu0(ETrue);
+		test_KErrNone(r);
+		Start(t, EPriorityMuchMore);
+		Start(t2, EPriorityMore);
+		test_Equal(EExitKill, t2.ExitType());
+		test_Equal(EExitKill, t.ExitType());
+		Wait(t2, limit1 ? KErrNone : KErrTimedOut);
+		Wait(t, KErrNone);
+		r = UnlockCurrentThreadToCpu0(ETrue);
+		test_KErrNone(r);
+		TestState();
+		}
+	else
+		{
+		test.Printf(_L("Poll() function not supported\n"));
+		}
 
-	ws.iTimeout=100000;
-	StartWaitSemThread(t, ws, EPriorityMore);
-	t.Suspend();
-	ws.iSem.Signal();
-	User::After(200000);
-	t.Resume();
-	WaitForWaitSemThread(t, KErrTimedOut);
-	test(ws.iSem.Wait(1)==KErrNone);
+	if (to)
+		{
+		iTimeout=2000000;
+		initial.HomeTime();
+		Start(t);
+		User::After(1000000);
+		iLock->Signal();
+		Wait(t, KErrNone);
+		final.HomeTime();
+		elapsed = I64INT(final.Int64()-initial.Int64());
+		test.Printf(_L("Time taken = %dus\n"), elapsed);
+		test(elapsed>=900000+overhead && elapsed<1500000+overhead);
+		TestState();
 
-	ws.iTimeout=100000;
-	StartWaitSemThread(t, ws, EPriorityMore);
-	t.Suspend();
-	ws.iSem.Signal();
-	User::After(50000);
-	t.Resume();
-	WaitForWaitSemThread(t, KErrNone);
-	test(ws.iSem.Wait(1)==KErrTimedOut);
+		r = LockCurrentThreadToCpu0(ETrue);
+		test_KErrNone(r);
 
-	RThread t2;
-	ws.iTimeout=100000;
-	StartWaitSemThread(t, ws, EPriorityMuchMore);
-	StartWaitSemThread(t2, ws, EPriorityMore);
-	t.Suspend();
-	ws.iSem.Signal();
-	test(t2.ExitType()==EExitKill);
-	test(t.ExitType()==EExitPending);
-	t.Resume();
-	WaitForWaitSemThread(t, KErrTimedOut);
-	WaitForWaitSemThread(t2, KErrNone);
-	test(ws.iSem.Wait(1)==KErrTimedOut);
+		if (!lto)
+			{
+			iTimeout=100000;
+			Start(t, EPriorityMore);
+			t.Suspend();
+			iLock->Signal();
+			User::After(200000);
+			t.Resume();
+			Wait(t, KErrTimedOut);
+			TestSignalled();
 
-	ws.iTimeout=1000000;
-	initial.HomeTime();
-	StartWaitSemThread(t2, ws, EPriorityMore);
-	StartWaitSemThread(t, ws, EPriorityMuchMore);
-	ws.iSem.Signal();
-	WaitForWaitSemThread(t, KErrNone);
-	final.HomeTime();
-	elapsed = I64INT(final.Int64()-initial.Int64());
-	test.Printf(_L("Time taken = %dus\n"), elapsed);
-	WaitForWaitSemThread(t2, KErrTimedOut);
-	final.HomeTime();
-	elapsed = I64INT(final.Int64()-initial.Int64());
-	test.Printf(_L("Time taken = %dus\n"), elapsed);
-	test(elapsed>=900000+2*overhead && elapsed<1500000+2*overhead);
+			iTimeout=100000;
+			Start(t, EPriorityMore);
+			t.Suspend();
+			iLock->Signal();
+			User::After(50000);
+			t.Resume();
+			Wait(t, KErrNone);
+			TestState();
+
+			iTimeout=100000;
+			Start(t, EPriorityMuchMore);
+			Start(t2, EPriorityMore);
+			t.Suspend();
+			iLock->Signal();
+			test_Equal(EExitKill, t2.ExitType());
+			test_Equal(EExitPending, t.ExitType());
+			t.Resume();
+			Wait(t, limit1 ? KErrNone : KErrTimedOut);
+			Wait(t2, KErrNone);
+			TestState();
+			}
 
-	ws.iTimeout=1000000;
-	initial.HomeTime();
-	StartWaitSemThread(t2, ws, EPriorityMore);
-	StartWaitSemThread(t, ws, EPriorityMuchMore);
-	WaitForWaitSemThread(t, KErrTimedOut);
-	final.HomeTime();
-	elapsed = I64INT(final.Int64()-initial.Int64());
-	test.Printf(_L("Time taken = %dus\n"), elapsed);
-	WaitForWaitSemThread(t2, KErrTimedOut);
-	final.HomeTime();
-	elapsed = I64INT(final.Int64()-initial.Int64());
-	test.Printf(_L("Time taken = %dus\n"), elapsed);
-	test(elapsed>=900000+2*overhead && elapsed<1500000+2*overhead);
+		iTimeout=1000000;
+		initial.HomeTime();
+		Start(t2, EPriorityMore);
+		Start(t, EPriorityMuchMore);
+		iLock->Signal();
+		Wait(t, KErrNone);
+		final.HomeTime();
+		elapsed = I64INT(final.Int64()-initial.Int64());
+		test.Printf(_L("Time taken = %dus\n"), elapsed);
+		Wait(t2, limit1 ? KErrNone : KErrTimedOut);
+		final.HomeTime();
+		elapsed = I64INT(final.Int64()-initial.Int64());
+		test.Printf(_L("Time taken = %dus\n"), elapsed);
+		if (!limit1)
+			{
+			test(elapsed>=900000+2*overhead && elapsed<1500000+2*overhead);
+			}
+		TestState();
+
+		iTimeout=1000000;
+		initial.HomeTime();
+		Start(t2, EPriorityMore);
+		Start(t, EPriorityMuchMore);
+		Wait(t, KErrTimedOut);
+		final.HomeTime();
+		elapsed = I64INT(final.Int64()-initial.Int64());
+		test.Printf(_L("Time taken = %dus\n"), elapsed);
+		Wait(t2, KErrTimedOut);
+		final.HomeTime();
+		elapsed = I64INT(final.Int64()-initial.Int64());
+		test.Printf(_L("Time taken = %dus\n"), elapsed);
+		test(elapsed>=900000+2*overhead && elapsed<1500000+2*overhead);
 
-	ws.iTimeout=1000000;
-	initial.HomeTime();
-	StartWaitSemThread(t2, ws, EPriorityMore);
-	StartWaitSemThread(t, ws, EPriorityMuchMore);
-	t.Kill(299792458);
-	WaitForWaitSemThread(t2, KErrTimedOut);
-	WaitForWaitSemThread(t, 299792458);
-	final.HomeTime();
-	elapsed = I64INT(final.Int64()-initial.Int64());
-	test.Printf(_L("Time taken = %dus\n"), elapsed);
-	test(elapsed>=900000+2*overhead && elapsed<1500000+2*overhead);
+		iTimeout=1000000;
+		initial.HomeTime();
+		Start(t2, EPriorityMore);
+		Start(t, EPriorityMuchMore);
+		t.Kill(299792458);
+		Wait(t2, KErrTimedOut);
+		Wait(t, 299792458);
+		final.HomeTime();
+		elapsed = I64INT(final.Int64()-initial.Int64());
+		test.Printf(_L("Time taken = %dus\n"), elapsed);
+		test(elapsed>=900000+2*overhead && elapsed<1500000+2*overhead);
 
-	ws.iTimeout=1000000;
-	initial.HomeTime();
-	StartWaitSemThread(t, ws, EPriorityMore);
-	StartWaitSemThread(t2, ws, EPriorityMuchMore);
-	test(t.ExitType()==EExitPending);
-	test(t2.ExitType()==EExitPending);
-	ws.iSem.Close();
-	test(t.ExitType()==EExitKill);
-	test(t2.ExitType()==EExitKill);
-	WaitForWaitSemThread(t2, KErrGeneral);
-	WaitForWaitSemThread(t, KErrGeneral);
-	final.HomeTime();
-	elapsed = I64INT(final.Int64()-initial.Int64());
-	test.Printf(_L("Time taken = %dus\n"), elapsed);
-	test(elapsed<=50000+3*overhead);
-
+		iTimeout=1000000;
+		initial.HomeTime();
+		Start(t, EPriorityMore);
+		Start(t2, EPriorityMuchMore);
+		test_Equal(EExitPending, t.ExitType());
+		test_Equal(EExitPending, t2.ExitType());
+		iLock->Release();
+		test_Equal(EExitKill, t.ExitType());
+		test_Equal(EExitKill, t2.ExitType());
+		Wait(t2, KErrGeneral);
+		Wait(t, KErrGeneral);
+		final.HomeTime();
+		elapsed = I64INT(final.Int64()-initial.Int64());
+		test.Printf(_L("Time taken = %dus\n"), elapsed);
+		test(elapsed<=50000+3*overhead);
+		r = UnlockCurrentThreadToCpu0(ETrue);
+		test_KErrNone(r);
+		}
+	else
+		{
+		test.Printf(_L("Timed waits not supported\n"));
+		iLock->Release();
+		}
 	test.End();
 	}
 
+volatile TBool NoRepeat = EFalse;
+void TestPollTimeout()
+	{
+	SWaitLock w;
+	do	{
+		test.Printf(_L("TestPollTimeout - RSemaphore\n"));
+		LockS ls;
+		w.iLock = &ls;
+		w.Test2();	// Release()s ls
+		} while(NoRepeat);
+	do	{
+		test.Printf(_L("TestPollTimeout - RMutex\n"));
+		LockM lm;
+		w.iLock = &lm;
+		w.Test2();	// Release()s lm
+		} while(NoRepeat);
+	do	{
+		test.Printf(_L("TestPollTimeout - RFastLock\n"));
+		LockFL fl;
+		w.iLock = &fl;
+		w.Test2();	// Release()s fl
+		} while(NoRepeat);
+	}
+
+
+/*----------------------------------------------------------------------------*/
+class CMXThreadGrp;
+
+struct SStats
+	{
+	SStats();
+	void Add(TInt aValue);
+	void Add(const SStats& aS);
+	TInt Count() const {return iN;}
+	TInt Min() const;
+	TInt Max() const;
+	TInt Mean() const;
+
+	TInt64	iSum;
+	TInt	iMin;
+	TInt	iMax;
+	TInt	iN;
+	TInt	iSp;
+	};
+
+SStats::SStats()
+	{
+	iSum = 0;
+	iMax = KMinTInt;
+	iMin = ~iMax;
+	iN = 0;
+	iSp = 0;
+	}
+
+void SStats::Add(TInt aValue)
+	{
+	TInt64 v = aValue;
+	iSum += v;
+	++iN;
+	if (aValue > iMax)
+		iMax = aValue;
+	if (aValue < iMin)
+		iMin = aValue;
+	}
+
+void SStats::Add(const SStats& a)
+	{
+	iN += a.iN;
+	iSum += a.iSum;
+	if (a.iMax > iMax)
+		iMax = a.iMax;
+	if (a.iMin < iMin)
+		iMin = a.iMin;
+	}
+
+TInt SStats::Min() const
+	{return iN ? iMin : 0;}
+
+TInt SStats::Max() const
+	{return iN ? iMax : 0;}
+
+TInt SStats::Mean() const
+	{
+	if (iN==0)
+		return 0;
+	return (TInt)(iSum/TInt64(iN));
+	}
+
+TUint32 ticks_to_us(TUint32 aTicks, TUint32 aF)
+	{
+	TUint64 x = aTicks;
+	TUint64 f = aF;
+	x *= TUint64(1000000);
+	x += (f>>1);
+	x /= f;
+	return I64LOW(x);
+	}
+
+class CMXThread : public CBase
+	{
+private:
+	CMXThread();
+	~CMXThread();
+	static CMXThread* New(CMXThreadGrp* aG, TUint32 aId, TUint32 aL, TUint32 aD);
+	void Start();
+	void Wait();
+	TInt Construct(CMXThreadGrp* aG, TUint32 aId, TUint32 aL, TUint32 aD);
+	TInt Steps();
+	TInt Action();
+	TInt Run();
+	static TInt ThreadFunc(TAny*);
+	void PrintStats();
+private:
+	TUint64 iSeed;
+	RThread	iThread;
+	TRequestStatus iExitStatus;
+	CMXThreadGrp* iG;
+	LFSR* iDummyLfsr;
+	TUint32 iId;
+	TUint32 iLambda;
+	TUint32 iDummySteps;
+	TInt iTotalSteps;
+	TInt iIterations;
+	TInt iPolls;
+	TInt iPollFails;
+	SStats iStats;
+	SStats iTimeoutStats;
+private:
+	friend class CMXThreadGrp;
+	};
+
+class CMXThreadGrp : public CBase
+	{
+public:
+	static CMXThreadGrp* New(MLock* aLock, TInt aNThreads, TUint32 aLambda, TUint32 aDummySteps, TUint32 aTime);
+	CMXThreadGrp();
+	~CMXThreadGrp();
+	TBool Run();
+	void PrintStats();
+private:
+	TInt Construct(MLock* aLock, TInt aNThreads, TUint32 aLambda, TUint32 aDummySteps, TUint32 aTime);
+private:
+	TInt iNThreads;
+	CMXThread** iThreads;
+	MLock* iLock;
+	LFSR* iLfsr;
+	LFSR* iLfsr0;
+	TUint32 iNTickPeriod;
+	TUint32 iFCF;
+	TUint32 iNTicks;
+	TInt iTotalSteps;
+	TInt iIterations;
+	TInt iPolls;
+	TInt iPollFails;
+	SStats iStats;
+	SStats iTimeoutStats;
+private:
+	friend class CMXThread;
+	};
+
+CMXThread::CMXThread()
+	{
+	iThread.SetHandle(0);
+	}
+
+CMXThread::~CMXThread()
+	{
+	delete iDummyLfsr;
+	if (iThread.Handle())
+		{
+		if (iThread.ExitType() == EExitPending)
+			{
+			iThread.Kill(0);
+			Wait();
+			}
+		CLOSE_AND_WAIT(iThread);
+		}
+	}
+
+void CMXThread::PrintStats()
+	{
+	test.Printf(_L("Thread %d:\n"), iId);
+	test.Printf(_L(" ST:%10d IT:%10d P:%10d PF:%10d TO:%10d\n"), iTotalSteps, iIterations, iPolls, iPollFails, iTimeoutStats.Count());
+	TUint32 min, max, mean;
+	min = ticks_to_us(iStats.Min(), iG->iFCF);
+	max = ticks_to_us(iStats.Max(), iG->iFCF);
+	mean = ticks_to_us(iStats.Mean(), iG->iFCF);
+	test.Printf(_L(" Lock acquire times MIN %10d MAX %10d AVG %10d\n"), min, max, mean);
+	min = ticks_to_us(iTimeoutStats.Min(), iG->iFCF);
+	max = ticks_to_us(iTimeoutStats.Max(), iG->iFCF);
+	mean = ticks_to_us(iTimeoutStats.Mean(), iG->iFCF);
+	test.Printf(_L(" Lock timeout times MIN %10d MAX %10d AVG %10d\n"), min, max, mean);
+	}
+
+TInt CMXThread::Construct(CMXThreadGrp* aG, TUint32 aId, TUint32 aL, TUint32 aD)
+	{
+	iG = aG;
+	iId = aId;
+	iLambda = aL;
+	iDummySteps = aD;
+	iSeed = iId + 1;
+	iDummyLfsr = new LFSR(785,693);
+	if (!iDummyLfsr)
+		return KErrNoMemory;
+	TBuf<16> name = _L("TSThrd");
+	name.AppendNum(iId);
+	TInt r = iThread.Create(name, &ThreadFunc, 0x1000, NULL, this);
+	if (r!=KErrNone)
+		return r;
+	iThread.Logon(iExitStatus);
+	if (iExitStatus != KRequestPending)
+		{
+		iThread.Kill(0);
+		iThread.Close();
+		iThread.SetHandle(0);
+		return iExitStatus.Int();
+		}
+	iThread.SetPriority(EPriorityLess);
+	return KErrNone;
+	}
+
+CMXThread* CMXThread::New(CMXThreadGrp* aG, TUint32 aId, TUint32 aL, TUint32 aD)
+	{
+	CMXThread* p = new CMXThread;
+	if (p)
+		{
+		TInt r = p->Construct(aG, aId, aL, aD);
+		if (r != KErrNone)
+			{
+			delete p;
+			p = 0;
+			}
+		}
+	return p;
+	}
+
+void CMXThread::Start()
+	{
+	iThread.Resume();
+	}
+
+void CMXThread::Wait()
+	{
+	User::WaitForRequest(iExitStatus);
+	}
+
+TInt CMXThread::ThreadFunc(TAny* aPtr)
+	{
+	CMXThread& a = *(CMXThread*)aPtr;
+	return a.Run();
+	}
+
+TInt CMXThread::Steps()
+	{
+	Random(iSeed);
+	return ExpRV(iSeed, iLambda, 1);
+	}
+
+TInt CMXThread::Action()
+	{
+	Random(iSeed);
+	return I64LOW(iSeed)%3;
+	}
+
+TInt CMXThread::Run()
+	{
+	MLock* lock = iG->iLock;
+	LFSR* lfsr = iG->iLfsr;
+	TInt lfl = lock->Flags();
+	TBool pollable = lfl & MLock::EPollable;
+	TBool to = lfl & MLock::ETimeoutAvail;
+	TUint32 start_time = User::NTickCount();
+	TInt r;
+
+	FOREVER
+		{
+		TUint32 now = User::NTickCount();
+		if (now - start_time >= iG->iNTicks)
+			break;
+		++iIterations;
+		iDummyLfsr->Step(iDummySteps);
+		TInt action = Action();
+		TInt steps = Steps();
+		TUint32 initial = User::FastCounter();
+		if (action==2 && to)
+			{
+			r = lock->Wait(1000);
+			if (r!=KErrNone)
+				{
+				TUint32 final = User::FastCounter();
+				TInt elapsed = TInt(final - initial);
+				iTimeoutStats.Add(elapsed);
+				}
+			}
+		else if (action==1 && pollable)
+			{
+			++iPolls;
+			r = lock->Poll();
+			if (r!=KErrNone)
+				++iPollFails;
+			}
+		else
+			{
+			lock->Wait();
+			r = KErrNone;
+			}
+		if (r == KErrNone)
+			{
+			TUint32 final = User::FastCounter();
+			lfsr->Step(steps);
+			lock->Signal();
+			TInt elapsed = TInt(final - initial);
+			iTotalSteps += steps;
+			iStats.Add(elapsed);
+			}
+		}
+
+	return KErrNone;
+	}
+
+CMXThreadGrp* CMXThreadGrp::New(MLock* aLock, TInt aNThreads, TUint32 aLambda, TUint32 aDummySteps, TUint32 aTime)
+	{
+	CMXThreadGrp* p = new CMXThreadGrp;
+	if (p)
+		{
+		TInt r = p->Construct(aLock, aNThreads, aLambda, aDummySteps, aTime);
+		if (r != KErrNone)
+			{
+			delete p;
+			p = 0;
+			}
+		}
+	return p;
+	}
+
+CMXThreadGrp::CMXThreadGrp()
+	{
+	}
+
+TInt CMXThreadGrp::Construct(MLock* aLock, TInt aNThreads, TUint32 aLambda, TUint32 aDummySteps, TUint32 aTime)
+	{
+	iNThreads = aNThreads;
+	iLock = aLock;
+	TInt r = HAL::Get(HAL::EFastCounterFrequency, (TInt&)iFCF);
+	if (r!=KErrNone)
+		return r;
+	r = HAL::Get(HAL::ENanoTickPeriod, (TInt&)iNTickPeriod);
+	if (r!=KErrNone)
+		return r;
+	iNTicks = (aTime+iNTickPeriod-1)/iNTickPeriod;
+	iLfsr = new LFSR(785,693);
+	iLfsr0 = new LFSR(785,693);
+	if (!iLfsr || !iLfsr0)
+		return KErrNoMemory;
+	iThreads = (CMXThread**)User::AllocZ(iNThreads*sizeof(CMXThread*));
+	if (!iThreads)
+		return KErrNoMemory;
+	TInt i;
+	for (i=0; i<iNThreads; ++i)
+		{
+		iThreads[i] = CMXThread::New(this, i, aLambda, aDummySteps);
+		if (!iThreads[i])
+			return KErrNoMemory;
+		}
+	return KErrNone;
+	}
+
+CMXThreadGrp::~CMXThreadGrp()
+	{
+	delete iLfsr;
+	delete iLfsr0;
+	if (iThreads)
+		{
+		TInt i;
+		for (i=0; i<iNThreads; ++i)
+			delete iThreads[i];
+		}
+	User::Free(iThreads);
+	}
+
+TBool CMXThreadGrp::Run()
+	{
+	TInt i;
+	test.Printf(_L("Starting test with N=%d L=%d D=%d T=%d\n"), iNThreads, iThreads[0]->iLambda, iThreads[0]->iDummySteps, iNTicks);
+	for (i=0; i<iNThreads; ++i)
+		iThreads[i]->Start();
+	for (i=0; i<iNThreads; ++i)
+		iThreads[i]->Wait();
+	for (i=0; i<iNThreads; ++i)
+		{
+		iTotalSteps += iThreads[i]->iTotalSteps;
+		iIterations += iThreads[i]->iIterations;
+		iPolls += iThreads[i]->iPolls;
+		iPollFails += iThreads[i]->iPollFails;
+		iStats.Add(iThreads[i]->iStats);
+		iTimeoutStats.Add(iThreads[i]->iTimeoutStats);
+		}
+	test.Printf(_L("Total LFSR steps %d\n"), iTotalSteps);
+	iLfsr0->Step(iTotalSteps);
+	TBool ok = (*iLfsr == *iLfsr0);
+	return ok;
+	}
+
+void CMXThreadGrp::PrintStats()
+	{
+	TInt i;
+	for (i=0; i<iNThreads; ++i)
+		{
+		iThreads[i]->PrintStats();
+		}
+	test.Printf(_L("TOTALS:\n"));
+	test.Printf(_L(" ST:%10d IT:%10d P:%10d PF:%10d TO:%10d\n"), iTotalSteps, iIterations, iPolls, iPollFails, iTimeoutStats.Count());
+	TUint32 min, max, mean;
+	min = ticks_to_us(iStats.Min(), iFCF);
+	max = ticks_to_us(iStats.Max(), iFCF);
+	mean = ticks_to_us(iStats.Mean(), iFCF);
+	test.Printf(_L(" Lock acquire times MIN %10d MAX %10d AVG %10d\n"), min, max, mean);
+	min = ticks_to_us(iTimeoutStats.Min(), iFCF);
+	max = ticks_to_us(iTimeoutStats.Max(), iFCF);
+	mean = ticks_to_us(iTimeoutStats.Mean(), iFCF);
+	test.Printf(_L(" Lock timeout times MIN %10d MAX %10d AVG %10d\n"), min, max, mean);
+	}
+
+TUint32 Calibrate()
+	{
+	TUint32 fcf;
+	TInt r = HAL::Get(HAL::EFastCounterFrequency, (TInt&)fcf);
+	test_KErrNone(r);
+	LFSR* d = new LFSR(785,693);
+	test(d!=0);
+	TInt steps = 2;
+	TUint32 ticks = fcf/10;
+	TUint32 elapsed;
+	FOREVER
+		{
+		TUint32 h0 = User::FastCounter();
+		d->Step(steps);
+		TUint32 h1 = User::FastCounter();
+		elapsed = h1 - h0;
+		if (elapsed > ticks)
+			break;
+		steps *= 2;
+		}
+	delete d;
+	test.Printf(_L("%d steps in %d fast ticks\n"), steps, elapsed);
+	TUint64 x = elapsed;
+	TUint64 s = steps;
+	TUint64 y = fcf;
+	y /= x;
+	s *= y;	// steps per second
+	TUint32 res = I64LOW(s);
+	test.Printf(_L("%d steps per second\n"), res);
+	return res;
+	}
+
+void DoTMX(MLock* aLock, TInt aNThreads, TUint32 aLambda, TUint32 aDummySteps, TUint32 aTime, TBool aShouldFail=EFalse)
+	{
+	CMXThreadGrp* g = CMXThreadGrp::New(aLock, aNThreads, aLambda, aDummySteps, aTime);
+	test(g!=0);
+	TBool ok = g->Run();
+	if (aShouldFail)
+		{
+		test(!ok);
+		}
+	else
+		{
+		test(ok);
+		}
+	g->PrintStats();
+	delete g;
+	}
+
+void DoTMX(MLock* aLock, TUint32 aLambda, TUint32 aDummySteps, TUint32 aTime)
+	{
+	TInt n;
+	for (n=1; n<=4; ++n)
+		{
+		TUint32 l = (n<2) ? aLambda : (aLambda/(n-1));
+		DoTMX(aLock, n, l, aDummySteps, aTime);
+		}
+	aLock->Release();
+	}
+
+
+void TestMutualExclusion()
+	{
+	TInt ntp;
+	TInt r = HAL::Get(HAL::ENanoTickPeriod, ntp);
+	test_KErrNone(r);
+	test.Printf(_L("Nanokernel tick period = %dus\n"), ntp);
+	TUint32 sps = Calibrate();
+	TUint32 lambda = sps/2000;
+	TUint32 dummy = sps/2000;
+	TUint32 time = 5000000;
+	do	{
+		test.Printf(_L("TestMutualExclusion - RSemaphore\n"));
+		LockS ls;
+		DoTMX(&ls, lambda, dummy, time);
+		} while(NoRepeat);
+	do	{
+		test.Printf(_L("TestMutualExclusion - RSemaphore init=2\n"));
+		LockS ls2;
+		ls2.Signal();	// count=2
+		DoTMX(&ls2, 4, lambda, dummy, time, ETrue);
+		} while(NoRepeat);
+	do	{
+		test.Printf(_L("TestMutualExclusion - RMutex\n"));
+		LockM lm;
+		DoTMX(&lm, lambda, dummy, time);
+		} while(NoRepeat);
+	do	{
+		test.Printf(_L("TestMutualExclusion - RFastLock\n"));
+		LockFL fl;
+		DoTMX(&fl, lambda, dummy, time);
+		} while(NoRepeat);
+	do	{
+		test.Printf(_L("TestMutualExclusion - RCriticalSection\n"));
+		LockCS cs;
+		DoTMX(&cs, lambda, dummy, time);
+		} while(NoRepeat);
+	}
+
+
+
+
+/*----------------------------------------------------------------------------*/
 void TestSemaphore()
 	{
 /*********** TO DO ************/
@@ -501,7 +1566,7 @@
 			thread2ActualCount++;
 		ii++;
 		}
-	test.Printf(_L("T1 %d T1ACT %d T2 %d T2ACT %d"),thread1Count,thread1ActualCount,thread2Count,thread2ActualCount);
+	test.Printf(_L("T1 %d T1ACT %d T2 %d T2ACT %d\n"),thread1Count,thread1ActualCount,thread2Count,thread2ActualCount);
 	test(thread1ActualCount==thread1Count);
 	test(thread2ActualCount==thread2Count);
 	test(thread1Count==thread2Count);
@@ -550,6 +1615,7 @@
 // threads think.
 //
 	arrayIndex=0;
+
 	RThread thread1,thread2;	
 	test(thread1.Create(_L("Thread1"),CriticalSnThreadEntryPoint1,KDefaultStackSize,0x2000,0x2000,NULL)==KErrNone);
 	test(thread2.Create(_L("Thread2"),CriticalSnThreadEntryPoint2,KDefaultStackSize,0x2000,0x2000,NULL)==KErrNone);			 
@@ -593,9 +1659,10 @@
 
 	test.Title();
  	__UHEAP_MARK;
+	TestMutualExclusion();
+	TestPollTimeout();
 	test.Start(_L("Test RSemaphore"));
 	TestSemaphore();
-	TestSemaphore2();
 	test.Next(_L("Test RMutex"));
 	TestMutex();
 	TestMutex2();
--- a/kerneltest/e32test/prime/t_semutx2.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/prime/t_semutx2.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -37,7 +37,10 @@
 // 
 //
 
+#define __E32TEST_EXTENSION__
 #include <e32test.h>
+#include <u32std.h>
+#include <e32svr.h>
 
 RMutex M1;
 RMutex M2;
@@ -62,8 +65,8 @@
 //#define MCOUNT(m,c)	test((m).Count() ==(c))
 // mutex count value is not visible for user any more
 #define MCOUNT(m,c) (void)(1)
-#define IDCHECK(x) test(GetNextId()==(x))
-#define NUMCHECK(x)	test(NumIdsPending()==(x))
+#define IDCHECK(x) test_Equal((x), GetNextId())
+#define NUMCHECK(x)	test_Equal((x), NumIdsPending())
 
 #define id0		id[0]
 #define id1		id[1]
@@ -153,38 +156,38 @@
 	TInt count=0;
 	TRequestStatus s;
 	TInt r=t.Create(_L("Test0"),Test0Thread,0x1000,NULL,&count);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	t.Logon(s);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	User::After(10000);		// make sure we have a full timeslice
 	t.Resume();
 
-	test(count==0);			// t shouldn't have run yet
+	test_Equal(0, count);			// t shouldn't have run yet
 	RThread().SetPriority(EPriorityMuchMore);	// shouldn't reschedule (priority unchanged)
-	test(count==0);
+	test_Equal(0, count);
 	RThread().SetPriority(EPriorityMore);	// shouldn't reschedule (priority decreasing, but not enough)
-	test(count==0);
+	test_Equal(0, count);
 	RThread().SetPriority(EPriorityMuchMore);	// shouldn't reschedule (priority increasing)
-	test(count==0);
+	test_Equal(0, count);
 	RThread().SetPriority(EPriorityNormal);	// should reschedule (we go behind t)
-	test(count==1);
+	test_Equal(1, count);
 	RThread().SetPriority(EPriorityLess);	// should reschedule (priority decreasing to below t)
-	test(count==2);
+	test_Equal(2, count);
 	t.SetPriority(EPriorityMuchMore);		// shouldn't reschedule (round-robin, timeslice not expired)
-	test(count==2);
+	test_Equal(2, count);
 	t.SetPriority(EPriorityNormal);			// shouldn't reschedule (t's priority decreasing)
-	test(count==2);
+	test_Equal(2, count);
 	t.SetPriority(EPriorityNormal);			// shouldn't reschedule (t's priority unchanged)
-	test(count==2);
+	test_Equal(2, count);
 	BusyWait(100000);		// use up our timeslice
 	t.SetPriority(EPriorityMuchMore);		// should reschedule (round-robin, timeslice expired)
-	test(count==3);
-	test(s==KRequestPending);
-	test(t.ExitType()==EExitPending);
+	test_Equal(3, count);
+	test_Equal(KRequestPending, s.Int());
+	test_Equal(EExitPending, t.ExitType());
 	t.SetPriority(EPriorityRealTime);		// should reschedule (t increases above current)
-	test(count==4);
-	test(s==KErrNone);						// t should have exited
-	test(t.ExitType()==EExitKill);
+	test_Equal(4, count);
+	test_KErrNone(s.Int());						// t should have exited
+	test_Equal(EExitKill, t.ExitType());
 	User::WaitForRequest(s);
 	RThread().SetPriority(EPriorityMuchMore);
 	t.Close();
@@ -201,11 +204,11 @@
 	{
 	test.Start(_L("Test signalling from wrong thread"));
 	TInt r=M1.CreateLocal();
-	test(r==KErrNone);
+	test_KErrNone(r);
 	M1.Wait();
 	RThread t;
 	r=t.Create(_L("Test1"),Test1Thread,0x1000,NULL,NULL);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	TRequestStatus s;
 	t.Logon(s);
 	t.Resume();
@@ -213,9 +216,9 @@
 	User::SetJustInTime(EFalse);
 	User::WaitForRequest(s);
 	User::SetJustInTime(jit);
-	test(s==EAccessDenied);
-	test(t.ExitType()==EExitPanic);
-	test(t.ExitReason()==EAccessDenied);
+	test_Equal(EAccessDenied, s.Int());
+	test_Equal(EExitPanic, t.ExitType());
+	test_Equal(EAccessDenied, t.ExitReason());
 	test(t.ExitCategory()==_L("KERN-EXEC"));
 	t.Close();
 	M1.Close();
@@ -273,13 +276,13 @@
 
 	test.Next(_L("Create mutex"));
 	TInt r=M1.CreateLocal();
-	test(r==KErrNone);
+	test_KErrNone(r);
 
 	test.Next(_L("Create low priority thread"));
 	TInt lowcount=0;
 	RThread low;
 	r=low.Create(_L("low"),LowThread,0x1000,NULL,&lowcount);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	low.SetPriority(EPriorityMuchLess);
 	test(Exists(_L("low")));
 
@@ -287,42 +290,42 @@
 	TInt medcount=0;
 	RThread med;
 	r=med.Create(_L("med"),MedThread,0x1000,NULL,&medcount);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	med.SetPriority(EPriorityNormal);
 	test(Exists(_L("med")));
 
 	test.Next(_L("Start low priority thread"));
 	low.Resume();
 	User::AfterHighRes(KTestDelay/10);
-	test(lowcount==1);
+	test_Equal(1, lowcount);
 //	MCOUNT(M1,0);
 
 	test.Next(_L("Start medium priority thread"));
 	med.Resume();
 	User::AfterHighRes(KTestDelay/10);
-	test(medcount==1);
+	test_Equal(1, medcount);
 	Kick(med);
 	User::AfterHighRes(KTestDelay/10);
-	test(medcount==2);
+	test_Equal(2, medcount);
 	Kick(med);
 
 	M1.Wait();
-	test(lowcount==1);
-	test(medcount==2);
+	test_Equal(1, lowcount);
+	test_Equal(2, medcount);
 	test.Next(_L("Wait, check medium runs"));
 	User::AfterHighRes(KTestDelay/10);
-	test(medcount==3);
+	test_Equal(3, medcount);
 	M1.Signal();
 
 	test.Next(_L("Create mutex 2"));
 	r=M2.CreateLocal();
-	test(r==KErrNone);
+	test_KErrNone(r);
 
 	test.Next(_L("Create high priority thread"));
 	TInt highcount=0;
 	RThread high;
 	r=high.Create(_L("high"),HighThread,0x1000,NULL,&highcount);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	high.SetPriority(EPriorityMore);
 	test(Exists(_L("high")));
 
@@ -336,15 +339,15 @@
 	User::AfterHighRes(KTestDelay/10);
 //	MCOUNT(M2,0);
 //	MCOUNT(M1,-1);
-	test(highcount==1);
+	test_Equal(1, highcount);
 
 	M2.Wait();
-	test(lowcount==2);
-	test(medcount==3);
-	test(highcount==2);
+	test_Equal(2, lowcount);
+	test_Equal(3, medcount);
+	test_Equal(2, highcount);
 	test.Next(_L("Wait, check medium runs"));
 	User::AfterHighRes(KTestDelay/10);
-	test(medcount==4);
+	test_Equal(4, medcount);
 	M2.Signal();
 
 	test.Next(_L("Kill threads"));
@@ -401,7 +404,7 @@
 	TBuf<4> b;
 	b.Num(n);
 	TInt r=t.Create(b,ThreadFunction,0x1000,NULL,aPtr);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	t.Resume();
 	TUint id=t.Id();
 	test.Printf(_L("id=%d\n"),id);
@@ -516,7 +519,7 @@
 	Count=0;
 	test.Next(_L("Create mutex"));
 	TInt r=M1.CreateLocal();
-	test(r==KErrNone);
+	test_KErrNone(r);
 	MCOUNT(M1,1);
 	MutexWait();
 	MCOUNT(M1,0);
@@ -624,7 +627,7 @@
 	User::After(50000);		// let threads claim mutex
 	MutexWait();
 	MCOUNT(M1,0);			// check no threads waiting
-	test(t[2].ExitType()==EExitKill);	// check t2 has exited
+	test_Equal(EExitKill, t[2].ExitType());	// check t2 has exited
 	t[2].Close();
 	test(!Exists(2));
 	IDCHECK(id2);			// check they ran in order t2,t3,t4,t5,t1
@@ -942,12 +945,12 @@
 		{
 		if (i==3 || i==6 || i==7)
 			{
-			test(t[i].ExitType()==EExitPending);
+			test_Equal(EExitPending, t[i].ExitType());
 			}
 		else
 			{
-			test(t[i].ExitType()==EExitPanic);
-			test(t[i].ExitReason()==EBadHandle);
+			test_Equal(EExitPanic, t[i].ExitType());
+			test_Equal(EBadHandle, t[i].ExitReason());
 			test(t[i].ExitCategory()==_L("KERN-EXEC"));
 			t[i].Close();
 			test(!Exists(i));
@@ -963,8 +966,8 @@
 		{
 		if (i==3 || i==6 || i==7)
 			{
-			test(t[i].ExitType()==EExitPanic);
-			test(t[i].ExitReason()==EBadHandle);
+			test_Equal(EExitPanic, t[i].ExitType());
+			test_Equal(EBadHandle, t[i].ExitReason());
 			test(t[i].ExitCategory()==_L("KERN-EXEC"));
 			t[i].Close();
 			test(!Exists(i));
@@ -1008,11 +1011,11 @@
 	test.Start(_L("Test mutex speed"));
 	TInt count=0;
 	TInt r=M1.CreateLocal();
-	test(r==KErrNone);
+	test_KErrNone(r);
 
 	RThread t;
 	r=t.Create(_L("Speed"),MutexSpeed,0x1000,NULL,&count);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	t.SetPriority(EPriorityRealTime);
 	t.Resume();
 	User::AfterHighRes(1000000);
@@ -1023,7 +1026,7 @@
 
 	TInt count2=0;
 	r=t.Create(_L("Speed2"),MutexSpeed2,0x1000,NULL,&count2);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	t.SetPriority(EPriorityRealTime);
 	t.Resume();
 	User::AfterHighRes(1000000);
@@ -1074,7 +1077,7 @@
 	TBuf<4> b;
 	b.Num(n);
 	TInt r=t.Create(b,SemThreadFunction,0x1000,NULL,aPtr);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	t.Resume();
 	TUint id=t.Id();
 	return id;
@@ -1147,7 +1150,7 @@
 	Count=0;
 	test.Next(_L("Create semaphore"));
 	TInt r=S.CreateLocal(2);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	MCOUNT(S,2);
 	SemWait();
 	MCOUNT(S,1);
@@ -1312,20 +1315,20 @@
 		{
 		if (i==3 || i==7 || i==10)
 			{
-			test(t[i].ExitType()==EExitPending);
+			test_Equal(EExitPending, t[i].ExitType());
 			}
 		else if (i!=5)
 			{
-			test(t[i].ExitType()==EExitPanic);
-			test(t[i].ExitReason()==EBadHandle);
+			test_Equal(EExitPanic, t[i].ExitType());
+			test_Equal(EBadHandle, t[i].ExitReason());
 			test(t[i].ExitCategory()==_L("KERN-EXEC"));
 			t[i].Close();
 			test(!Exists(i));
 			}
 		else
 			{
-			test(t[i].ExitType()==EExitKill);
-			test(t[i].ExitReason()==0);
+			test_Equal(EExitKill, t[i].ExitType());
+			test_Equal(0, t[i].ExitReason());
 			t[i].Close();
 			test(!Exists(i));
 			}
@@ -1340,8 +1343,8 @@
 		{
 		if (i==3 || i==7 || i==10)
 			{
-			test(t[i].ExitType()==EExitPanic);
-			test(t[i].ExitReason()==EBadHandle);
+			test_Equal(EExitPanic, t[i].ExitType());
+			test_Equal(EBadHandle, t[i].ExitReason());
 			test(t[i].ExitCategory()==_L("KERN-EXEC"));
 			t[i].Close();
 			test(!Exists(i));
@@ -1371,11 +1374,11 @@
 	test.Start(_L("Test semaphore speed"));
 	TInt count=0;
 	TInt r=S.CreateLocal(1);
-	test(r==KErrNone);
+	test_KErrNone(r);
 
 	RThread t;
 	r=t.Create(_L("SemSpeed"),SemSpeed,0x1000,NULL,&count);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	t.SetPriority(EPriorityRealTime);
 	t.Resume();
 	User::AfterHighRes(1000000);
@@ -1391,12 +1394,22 @@
 
 GLDEF_C TInt E32Main()
 	{
+	TInt cpus = UserSvr::HalFunction(EHalGroupKernel, EKernelHalNumLogicalCpus, 0, 0);
+	if (cpus != 1)
+		{
+		test(cpus>1);
+		// This test will require compatibility mode (and probably other changes)
+		// to work on SMP - it depends on explicit scheduling order.
+		test.Printf(_L("T_SEMUTX2 skipped, does not work on SMP\n"));
+		return KErrNone;
+		}	
+	
 	test.Title();
 
 	test.Start(_L("Test mutexes and semaphores"));
 	RThread().SetPriority(EPriorityMuchMore);
 	TInt r=Main.Duplicate(RThread());
-	test(r==KErrNone);
+	test_KErrNone(r);
 
 	Test0();
 	Test1();
--- a/kerneltest/e32test/prime/t_timer.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/prime/t_timer.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -606,7 +606,7 @@
 #if !(defined(__EPOC32__) && defined(__X86__))
 	TInt muid = 0;
 	HAL::Get(HAL::EMachineUid, muid);
-	if(muid!=HAL::EMachineUid_Lubbock && muid!=HAL::EMachineUid_NE1_TB && muid!=HAL::EMachineUid_STE8500)
+	if(muid==HAL::EMachineUid_OmapH2 || muid==HAL::EMachineUid_OmapH4 || muid==HAL::EMachineUid_OmapH6)
 		{
 		test.Next(_L("Test sequential locks fail over on/off"));
 		RTimer tat;
--- a/kerneltest/e32test/realtime/d_latncy.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/realtime/d_latncy.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -87,6 +87,9 @@
 #elif defined(__NE1_TB__)
 const TInt KTickPeriodMs=1;
 const TInt KTicksPerMillisecond=66667;
+#elif defined(__MRAP__)
+const TInt KTickPeriodMs=1;
+const TInt KTicksPerMillisecond=1000;
 #endif
 
 #ifdef _DEBUG
--- a/kerneltest/e32test/resourceman/t_rescontrolcli.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/resourceman/t_rescontrolcli.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -28,6 +28,9 @@
 #include <e32def_private.h>
 #include "d_rescontrolcli.h"
 
+#include <drivers/resourcecontrol_clientsettings.h>
+#include <drivers/resourcecontrol_settings.h>
+
 #define MAX_STATIC_RESOURCE_NUM 24 //Maximum number of static resources in simulated PSL
 #define MAX_STATIC_DEPENDENCY_RESOURCE_NUM 7 //Maximum number of static dependency resources in simulated PSL
 #define DEPENDENCY_RESOURCE_BIT_MASK 0x00010000
@@ -4237,10 +4240,87 @@
 	Clients.Close();
 	}
 
+void TestClientSettings(TInt aClientToken, TUint aExpectedBase)
+	{
+	TUint clientBase = ElementId_ClientSettingBase(aClientToken);
+	test(clientBase == aExpectedBase);
+
+	HCR::TElementId Id;
+
+	Id = ElementId_ClientName(aClientToken);
+	test(Id == aExpectedBase);
+
+	Id = ElementId_ClientPropertyFlag(aClientToken);
+	test(Id == (aExpectedBase + 1));
+
+	Id = ElementId_ClientPreallocation(aClientToken);
+	test(Id == (aExpectedBase + 2));
+
+	TInt firstResource = 0;
+	Id = ElementId_ClientStaticResource(aClientToken, firstResource);
+	test(Id == (aExpectedBase + 3));
+	
+	TInt thirdResource = 2;
+	Id = ElementId_ClientStaticResource(aClientToken, thirdResource);
+	test(Id == (aExpectedBase + 5));
+	}
+	
+void TestDynamicResourceSettings(TInt aDynamicResource,  TUint aExpectedBase)
+	{
+	TUint dynamicResourceBase = ElementId_DynamicResourceBase(aDynamicResource);
+	test(dynamicResourceBase == aExpectedBase);
+	
+	HCR::TElementId Id;	
+	
+	Id = ElementId_DynamicResourceName(aDynamicResource);
+	test(Id == aExpectedBase);
+
+	Id = ElementId_DynamicResourcePropertyFlag(aDynamicResource);
+	test(Id == (aExpectedBase + 1));
+
+	Id = ElementId_DynamicResourceMaxLevel(aDynamicResource);
+	test(Id == (aExpectedBase + 2));
+	
+	Id = ElementId_DynamicResourceMinLevel(aDynamicResource);
+	test(Id == (aExpectedBase + 3));
+
+	Id = ElementId_DynamicResourceDefaultLevel(aDynamicResource);
+	test(Id == (aExpectedBase + 4));
+
+	Id = ElementId_DynamicResourceDependencyMask1(aDynamicResource);
+	test(Id == (aExpectedBase + 5));
+
+	Id = ElementId_DynamicResourceDependencyMask2(aDynamicResource);
+	test(Id == (aExpectedBase + 6));
+
+	Id = ElementId_DynamicResourceDependencyMask3(aDynamicResource);
+	test(Id == (aExpectedBase + 7));
+	}
+	
+void TestClientHCRSettingMacros()
+	{
+	TInt clientToken = 2; // Random token number
+	TUint expectedBase = 80; // refer resourcecontrol_clientsettings.h for calculations
+	TestClientSettings(clientToken, expectedBase);
+	
+	clientToken = 0;
+	expectedBase = 16; // refer resourcecontrol_clientsettings.h for calculations
+	TestClientSettings(clientToken, expectedBase);
+
+	// Dynamic Resource settings
+	TUint dynamicResource = 3; // Random token number
+	expectedBase = 131168; // refer resourcecontrol_clientsettings.h for calculations
+	TestDynamicResourceSettings(dynamicResource, expectedBase);
+	
+	test.Printf(_L("Testing HCR client setting Macro's for Resource Manager successful \n"));
+	}
+	
 GLDEF_C TInt E32Main()
 	{
 	test.Title();
 	test.Start(_L("Testing Resource Manager...\n"));
+	test.Printf(_L("Testing HCR client setting Macro's for Resource Manager \n"));
+	TestClientHCRSettingMacros();
 	//
 	test.Printf(_L("TEST SKIPPED UNTIL FIX FOR DEF145087 IS AVAILABLE TO PREVENT CRASHING\n"));
 	test(0);
--- a/kerneltest/e32test/secure/t_suser.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/secure/t_suser.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -42,6 +42,8 @@
 #include <e32test.h>
 #include <e32svr.h>
 #include <nkern/nk_trace.h>
+#include <e32hal.h>
+#include <hal.h>
 
 LOCAL_D RTest test(_L("T_SUSER"));
 
@@ -946,21 +948,26 @@
 	test(logonStatus==KErrPermissionDenied);
 	CLOSE_AND_WAIT(process);
 
-	test.Next(_L("Calling UserSvr::AddEvent(ESwitchOff) with ECapabilityPowerMgmt & ECapabilitySwEvent"));
-	TRequestStatus absstatus;
-	RTimer abstimer;
-	TInt r = abstimer.CreateLocal();
-	test (r == KErrNone);
-	SetAbsoluteTimeout(abstimer, 5000000, absstatus); // 5 sec
-	process.Create((1u<<ECapabilitySwEvent)|(1u<<ECapabilityPowerMgmt),ETestProcessAddEventESwitchOff);
-	process.Logon(logonStatus);
-	process.Resume();
-	User::WaitForRequest(absstatus);
-	abstimer.Close();
-	User::WaitForRequest(logonStatus);
-	test(process.ExitType()==EExitKill);
-	test(logonStatus==KErrNone);
-	CLOSE_AND_WAIT(process);
+	TInt muid = 0;
+	HAL::Get(HAL::EMachineUid, muid);
+	if(muid==HAL::EMachineUid_OmapH2 || muid==HAL::EMachineUid_OmapH4 || muid==HAL::EMachineUid_OmapH6 || muid==HAL::EMachineUid_NE1_TB || muid==HAL::EMachineUid_X86PC || muid==HAL::EMachineUid_Win32Emulator)
+		{
+		test.Next(_L("Calling UserSvr::AddEvent(ESwitchOff) with ECapabilityPowerMgmt & ECapabilitySwEvent"));
+		TRequestStatus absstatus;
+		RTimer abstimer;
+		TInt r = abstimer.CreateLocal();
+		test (r == KErrNone);
+		SetAbsoluteTimeout(abstimer, 5000000, absstatus); // 5 sec
+		process.Create((1u<<ECapabilitySwEvent)|(1u<<ECapabilityPowerMgmt),ETestProcessAddEventESwitchOff);
+		process.Logon(logonStatus);
+		process.Resume();
+		User::WaitForRequest(absstatus);
+		abstimer.Close();
+		User::WaitForRequest(logonStatus);
+		test(process.ExitType()==EExitKill);
+		test(logonStatus==KErrNone);
+		CLOSE_AND_WAIT(process);
+		}
 
 	test.End();
 	}
--- a/kerneltest/e32test/smr/d_smr.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/smr/d_smr.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -19,7 +19,7 @@
 
 #include "d_trace.h"
 
-#include <memmodel\epoc\platform.h>
+#include <memmodel/epoc/platform.h>
 #include <bootdefs.h>
 #include <kernel/kernboot.h>
 #include <kernel/kern_priv.h>
--- a/kerneltest/e32test/system/d_mstim.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/system/d_mstim.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -41,6 +41,8 @@
 #include <rvemuboard.h>
 #elif defined(__NE1_TB__)
 #include <upd35001_timer.h>
+#elif defined(__MRAP__)
+#include <rap.h>
 #endif
 #include "d_mstim.h"
 #include "../misc/prbs.h"
@@ -93,6 +95,11 @@
 inline TCounter TIMER()
 	{ return NETimer::Timer(5).iTimerCount; }
 #endif
+#ifdef __MRAP__
+inline TCounter TIMER()
+	{ TRap::SetRegister32(1, KRapRegRTC001_TRIGGER);
+	return  TRap::Register32(KRapRegRTC001_LONGCOUNT); }
+#endif
 #if defined(__EPOC32__) && defined(__CPU_X86)
 TCounter TIMER();
 void SetUpTimerChannel2();
@@ -137,6 +144,10 @@
 inline TDelta TimeDelta(TCounter initial, TCounter final)
 	{ return final - initial; }
 #endif
+#if defined(__MRAP__)
+inline TDelta TimeDelta(TCounter initial, TCounter final)
+	{ return final-initial; }				// RAP RTC timer counts up
+#endif
 #ifdef __WINS__
 inline TDelta TimeDelta(TCounter initial, TCounter final)
 	{ return final-initial; }		// counts up
@@ -197,6 +208,15 @@
 	x /= TInt64(f);
 	return (TInt)x;
 #endif
+#if defined(__MRAP__)
+    // RTC runs with 32.768 kHz -> one tick is 
+    const TUint KRTCClockHz = 32768;
+    Int64 ticks(aTicks);
+    ticks*=(1000000);
+	ticks+=KRTCClockHz/2;		// 32.768 kHz tick
+	ticks/=KRTCClockHz;
+	return (TInt)ticks;
+#endif
 #if defined(__EPOC32__) && defined(__CPU_X86)
 	TInt x = aTicks;
 	TInt y = x;
--- a/kerneltest/e32test/system/d_tick.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/system/d_tick.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -37,6 +37,8 @@
 #include <rvemuboard.h>
 #elif defined(__NE1_TB__)
 #include <upd35001_timer.h>
+#elif defined(__MRAP__)
+#include <rap.h>
 #endif
 #include <kernel/kern_priv.h>
 #include "d_tick.h"
@@ -78,6 +80,11 @@
 inline TCounter TIMER()
 	{ return NETimer::Timer(2).iTimerCount; }
 #endif
+#ifdef __MRAP__
+inline TCounter TIMER()
+	{ TRap::SetRegister32(1, KRapRegRTC001_TRIGGER);
+	return  TRap::Register32(KRapRegRTC001_LONGCOUNT); }
+#endif
 #if defined(__EPOC32__) && defined(__CPU_X86)
 TCounter TIMER();
 void SetUpTimerChannel2();
@@ -90,6 +97,12 @@
 	return c.QuadPart;
 	}
 #endif
+#if defined(__MRAP__)
+inline TDelta TimeDelta(TCounter initial, TCounter final)
+	{ return final-initial; }				// RAP RTC timer counts up
+inline TInt LongTimeDelta(TCounter initial, TCounter final, TUint, TUint)
+	{ return final-initial; }				// RAP RTC timer counts up
+#endif
 
 #if defined(__MISA__) || defined(__MCOT__)
 inline TDelta TimeDelta(TCounter initial, TCounter final)
@@ -211,6 +224,15 @@
 	x /= TUint64(f);
 	return (TUint)x;
 #endif
+#if defined(__MRAP__)
+    // RTC runs with 32.768 kHz -> one tick is 
+    const TUint KRTCClockHz = 32768;
+    Int64 ticks(aTicks);
+    ticks*=(1000000);
+	ticks+=KRTCClockHz/2;		// 32.768 kHz tick
+	ticks/=KRTCClockHz;
+	return (TInt)ticks;
+#endif
 #if defined(__MAWD__) || defined(__MEIG__)
 	return aTicks*500;					// 2kHz tick
 #endif
@@ -589,6 +611,9 @@
 #if defined(__NE1_TB__)
 	// nothing to do since we use fast counter
 #endif
+#if defined(__MRAP__)
+	// nothing to do here RTC runs with 32.768 kHz
+#endif
 #ifdef __MAWD__
 	// Set up timer 1 as free running 2kHz clock
 	TWind::SetBuzzerControl(0);		// disable buzzer
--- a/kerneltest/e32test/system/t_condvar.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/system/t_condvar.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -56,6 +56,7 @@
 #include <e32ldr.h>
 #include <e32def.h>
 #include <e32def_private.h>
+#include <u32std.h>
 
 RTest test(_L("T_CONDVAR"));
 RMutex M1;
@@ -527,6 +528,16 @@
 
 TInt E32Main()
 	{
+	TInt cpus = UserSvr::HalFunction(EHalGroupKernel, EKernelHalNumLogicalCpus, 0, 0);
+	if (cpus != 1)
+		{
+		test(cpus>1);
+		// This test will require compatibility mode (and probably other changes)
+		// to work on SMP - it depends on explicit scheduling order.
+		test.Printf(_L("T_CONDVAR skipped, does not work on SMP\n"));
+		return KErrNone;
+		}	
+	
 	__KHEAP_MARK;
 	__UHEAP_MARK;
 
--- a/kerneltest/e32test/timestamp/d_timestamp.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/timestamp/d_timestamp.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,20 +1,18 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// d_timestamp.cpp
+//
 
 #include <kern_priv.h>
 #include <kernel.h>
--- a/kerneltest/e32test/timestamp/d_timestamp.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/timestamp/d_timestamp.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,20 +1,18 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// d_timestamp.h
+//
 
 
 #ifndef __TIMESTAMPTEST_H__
--- a/kerneltest/e32test/timestamp/d_timestamp_dev.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/timestamp/d_timestamp_dev.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,20 +1,18 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// d_timestamp_dev.h
+//
 
 #ifndef __D_TIMERSTAMP_DEV_H__
 #define __D_TIMERSTAMP_DEV_H__
--- a/kerneltest/e32test/usb/t_usb_win/scripts/massstorage/bmwritelargefile.pl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/usb/t_usb_win/scripts/massstorage/bmwritelargefile.pl	Thu Jul 22 16:46:39 2010 +0100
@@ -2,7 +2,7 @@
 # Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
+# under the terms of the License "Eclipse Public License v1.0"
 # which accompanies this distribution, and is available
 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
 #
@@ -287,8 +287,4 @@
 free space for the file that is going to be created. The default size is 400
 MB.
 
-=head1 COPYRIGHT
-
-Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
-
 =cut
--- a/kerneltest/e32test/usb/t_usb_win/scripts/massstorage/bmwritemanyfiles.pl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/usb/t_usb_win/scripts/massstorage/bmwritemanyfiles.pl	Thu Jul 22 16:46:39 2010 +0100
@@ -2,7 +2,7 @@
 # Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
+# under the terms of the License "Eclipse Public License v1.0"
 # which accompanies this distribution, and is available
 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
 #
@@ -300,8 +300,4 @@
 free space for the file that is going to be created. The default size is 400
 MB.
 
-=head1 COPYRIGHT
-
-Copyright (c) 2006-2008 Symbian Software Ltd. All rights reserved. All rights reserved.
-
 =cut
--- a/kerneltest/e32test/usb/t_usb_win/scripts/massstorage/createfilesanddirs.pl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/usb/t_usb_win/scripts/massstorage/createfilesanddirs.pl	Thu Jul 22 16:46:39 2010 +0100
@@ -2,7 +2,7 @@
 # Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
+# under the terms of the License "Eclipse Public License v1.0"
 # which accompanies this distribution, and is available
 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
 #
@@ -397,8 +397,4 @@
  TestExpectedResults:  
 	Read data from files should match with written.
 
-=head1 COPYRIGHT
-
-Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
-
 =cut
--- a/kerneltest/e32test/usb/t_usb_win/scripts/massstorage/createlargefile.pl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32test/usb/t_usb_win/scripts/massstorage/createlargefile.pl	Thu Jul 22 16:46:39 2010 +0100
@@ -2,7 +2,7 @@
 # Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
+# under the terms of the License "Eclipse Public License v1.0"
 # which accompanies this distribution, and is available
 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
 #
@@ -248,8 +248,4 @@
  with written.  Sum of file size and free space should be close to
  drive size.
 
-=head1 COPYRIGHT
-
-Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
-
 =cut
--- a/kerneltest/e32utils/analyse/profiler.rtf	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3017 +0,0 @@
-{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang2057\deflangfe2057{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}
-{\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f3\froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f10\fnil\fcharset2\fprq2{\*\panose 05000000000000000000}Wingdings;}
-{\f35\fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma;}{\f36\fmodern\fcharset0\fprq1{\*\panose 020b0609040504020204}Lucida Console;}{\f37\froman\fcharset238\fprq2 Times New Roman CE;}{\f38\froman\fcharset204\fprq2 Times New Roman Cyr;}
-{\f40\froman\fcharset161\fprq2 Times New Roman Greek;}{\f41\froman\fcharset162\fprq2 Times New Roman Tur;}{\f42\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f43\froman\fcharset178\fprq2 Times New Roman (Arabic);}
-{\f44\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f45\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f47\fswiss\fcharset238\fprq2 Arial CE;}{\f48\fswiss\fcharset204\fprq2 Arial Cyr;}{\f50\fswiss\fcharset161\fprq2 Arial Greek;}
-{\f51\fswiss\fcharset162\fprq2 Arial Tur;}{\f52\fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f53\fswiss\fcharset178\fprq2 Arial (Arabic);}{\f54\fswiss\fcharset186\fprq2 Arial Baltic;}{\f55\fswiss\fcharset163\fprq2 Arial (Vietnamese);}
-{\f57\fmodern\fcharset238\fprq1 Courier New CE;}{\f58\fmodern\fcharset204\fprq1 Courier New Cyr;}{\f60\fmodern\fcharset161\fprq1 Courier New Greek;}{\f61\fmodern\fcharset162\fprq1 Courier New Tur;}{\f62\fmodern\fcharset177\fprq1 Courier New (Hebrew);}
-{\f63\fmodern\fcharset178\fprq1 Courier New (Arabic);}{\f64\fmodern\fcharset186\fprq1 Courier New Baltic;}{\f65\fmodern\fcharset163\fprq1 Courier New (Vietnamese);}{\f387\fswiss\fcharset238\fprq2 Tahoma CE;}{\f388\fswiss\fcharset204\fprq2 Tahoma Cyr;}
-{\f390\fswiss\fcharset161\fprq2 Tahoma Greek;}{\f391\fswiss\fcharset162\fprq2 Tahoma Tur;}{\f392\fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f393\fswiss\fcharset178\fprq2 Tahoma (Arabic);}{\f394\fswiss\fcharset186\fprq2 Tahoma Baltic;}
-{\f395\fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}{\f396\fswiss\fcharset222\fprq2 Tahoma (Thai);}{\f397\fmodern\fcharset238\fprq1 Lucida Console CE;}{\f398\fmodern\fcharset204\fprq1 Lucida Console Cyr;}
-{\f400\fmodern\fcharset161\fprq1 Lucida Console Greek;}{\f401\fmodern\fcharset162\fprq1 Lucida Console Tur;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;
-\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red255\green255\blue255;
-}{\stylesheet{\ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \snext0 Normal;}{\s1\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 
-\b\f1\fs24\lang2057\langfe2057\kerning28\cgrid\langnp2057\langfenp2057 \sbasedon0 \snext0 heading 1;}{\s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 
-\b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \sbasedon0 \snext0 heading 2;}{\s3\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel2\rin0\lin0\itap0 \f1\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 
-\sbasedon0 \snext0 heading 3;}{\s4\ql \li0\ri0\sb240\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel3\rin0\lin0\itap0 \b\f1\fs24\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \sbasedon0 \snext0 heading 4;}{
-\s9\ql \li0\ri0\sb240\sa60\widctlpar\wrapdefault\faauto\outlinelevel8\rin0\lin0\itap0 \b\i\f1\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \sbasedon0 \snext0 heading 9;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\*
-\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv 
-\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\s15\ql \li0\ri0\sb60\sa60\widctlpar\brdrb\brdrs\brdrw15\brsp20 
-\tqc\tx4153\tqr\tx9639\wrapdefault\faauto\rin0\lin0\itap0 \f1\fs16\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \sbasedon0 \snext15 header;}{\s16\ql \li0\ri0\sb60\sa60\widctlpar\brdrt\brdrs\brdrw15\brsp20 
-\tqc\tx4153\tqr\tx9639\wrapdefault\faauto\rin0\lin0\rtlgutter\itap0 \f1\fs16\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \sbasedon0 \snext16 footer;}{\s17\ql \li0\ri0\sb60\sa120\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 
-\fs22\lang2057\langfe2057\kerning28\cgrid\langnp2057\langfenp2057 \sbasedon0 \snext17 DocumentSubTitle;}{\s18\ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \b\fs21\cf8\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 
-\sbasedon0 \snext18 Tabletitle;}{\*\cs19 \additive \f1 \sbasedon10 Filename;}{\*\cs20 \additive \b\f36 \sbasedon10 Syntax Literal;}{\*\cs21 \additive \i \sbasedon10 Syntax Element;}{\s22\ql \li851\ri851\sb60\sa240\keep\widctlpar\brdrt
-\brdrs\brdrw15\brsp20 \brdrb\brdrs\brdrw15\brsp20 \wrapdefault\faauto\rin851\lin851\rtlgutter\itap0 \fs24\lang1033\langfe2057\cgrid\langnp1033\langfenp2057 \sbasedon0 \snext0 Syntax;}{
-\s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \sbasedon0 \snext23 Comamnd;}{\s24\ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 
-\f35\fs16\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \sbasedon0 \snext24 \ssemihidden \styrsid6372845 Balloon Text;}{\*\ts25\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 
-\trbrdrv\brdrs\brdrw10 \trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype0\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv 
-\ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \sbasedon11 \snext25 \styrsid678217 Table Grid;}{
-\s26\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \f2\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext26 \styrsid8592727 Body Text;}{\*\cs27 \additive \sbasedon10 \styrsid11890070 f40;}}
-{\*\listtable{\list\listtemplateid-1714398180\listsimple{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat0\levelspace0\levelindent0{\leveltext\'01*;}{\levelnumbers;}\hres0\chhres0 }{\listname ;}\listid-2}
-{\list\listtemplateid1604386730\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid134807553\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0\hres0\chhres0 \fi-360\li720
-\jclisttab\tx720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid134807555\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li1440
-\jclisttab\tx1440\lin1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid134807557\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li2160
-\jclisttab\tx2160\lin2160 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid134807553\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0\hres0\chhres0 \fi-360\li2880
-\jclisttab\tx2880\lin2880 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid134807555\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li3600
-\jclisttab\tx3600\lin3600 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid134807557\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li4320
-\jclisttab\tx4320\lin4320 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid134807553\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0\hres0\chhres0 \fi-360\li5040
-\jclisttab\tx5040\lin5040 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid134807555\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li5760
-\jclisttab\tx5760\lin5760 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid134807557\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li6480
-\jclisttab\tx6480\lin6480 }{\listname ;}\listid227346643}{\list\listtemplateid597999524\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698689
-\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0\hres0\chhres0 \fi-360\li720\jclisttab\tx720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698691
-\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li1440\jclisttab\tx1440\lin1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698693
-\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li2160\jclisttab\tx2160\lin2160 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698689
-\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0\hres0\chhres0 \fi-360\li2880\jclisttab\tx2880\lin2880 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698691
-\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li3600\jclisttab\tx3600\lin3600 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698693
-\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li4320\jclisttab\tx4320\lin4320 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698689
-\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0\hres0\chhres0 \fi-360\li5040\jclisttab\tx5040\lin5040 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698691
-\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li5760\jclisttab\tx5760\lin5760 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698693
-\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li6480\jclisttab\tx6480\lin6480 }{\listname ;}\listid607854900}{\list\listtemplateid-2132086688\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat0
-\levelspace45\levelindent0{\leveltext\leveltemplateid-1068182316\'01-;}{\levelnumbers;}\loch\af0\hich\af0\dbch\af0\fbias0\hres0\chhres0 \fi-360\li450\jclisttab\tx450\lin450 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1
-\levelspace45\levelindent0{\leveltext\leveltemplateid134807555\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li1485\jclisttab\tx1485\lin1485 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace45
-\levelindent0{\leveltext\leveltemplateid134807557\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li2205\jclisttab\tx2205\lin2205 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace45\levelindent0
-{\leveltext\leveltemplateid134807553\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0\hres0\chhres0 \fi-360\li2925\jclisttab\tx2925\lin2925 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace45\levelindent0{\leveltext
-\leveltemplateid134807555\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li3645\jclisttab\tx3645\lin3645 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace45\levelindent0{\leveltext
-\leveltemplateid134807557\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li4365\jclisttab\tx4365\lin4365 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace45\levelindent0{\leveltext
-\leveltemplateid134807553\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0\hres0\chhres0 \fi-360\li5085\jclisttab\tx5085\lin5085 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace45\levelindent0{\leveltext
-\leveltemplateid134807555\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li5805\jclisttab\tx5805\lin5805 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace45\levelindent0{\leveltext
-\leveltemplateid134807557\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li6525\jclisttab\tx6525\lin6525 }{\listname ;}\listid1202405001}{\list\listtemplateid1624279010\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0
-\levelfollow0\levelstartat0\levelspace0\levelindent0{\leveltext\leveltemplateid-1068182316\'01-;}{\levelnumbers;}\loch\af0\hich\af0\dbch\af0\fbias0\hres0\chhres0 \fi-360\li405\jclisttab\tx405\lin405 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0
-\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\leveltemplateid134807555\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li1125\jclisttab\tx1125\lin1125 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0
-\levelstartat1\levelspace0\levelindent0{\leveltext\leveltemplateid134807557\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li1845\jclisttab\tx1845\lin1845 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1
-\levelspace0\levelindent0{\leveltext\leveltemplateid134807553\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0\hres0\chhres0 \fi-360\li2565\jclisttab\tx2565\lin2565 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0
-\levelindent0{\leveltext\leveltemplateid134807555\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li3285\jclisttab\tx3285\lin3285 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext
-\leveltemplateid134807557\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li4005\jclisttab\tx4005\lin4005 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext
-\leveltemplateid134807553\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0\hres0\chhres0 \fi-360\li4725\jclisttab\tx4725\lin4725 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext
-\leveltemplateid134807555\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li5445\jclisttab\tx5445\lin5445 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\leveltemplateid134807557
-\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li6165\jclisttab\tx6165\lin6165 }{\listname ;}\listid1562641293}{\list\listtemplateid1239692824\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat0
-\levelspace45\levelindent0{\leveltext\leveltemplateid-1068182316\'01-;}{\levelnumbers;}\loch\af0\hich\af0\dbch\af0\fbias0\hres0\chhres0 \fi-360\li405\jclisttab\tx405\lin405 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1
-\levelspace45\levelindent0{\leveltext\leveltemplateid134807555\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li1440\jclisttab\tx1440\lin1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace45
-\levelindent0{\leveltext\leveltemplateid134807557\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li2160\jclisttab\tx2160\lin2160 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace45\levelindent0
-{\leveltext\leveltemplateid134807553\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0\hres0\chhres0 \fi-360\li2880\jclisttab\tx2880\lin2880 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace45\levelindent0{\leveltext
-\leveltemplateid134807555\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li3600\jclisttab\tx3600\lin3600 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace45\levelindent0{\leveltext
-\leveltemplateid134807557\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li4320\jclisttab\tx4320\lin4320 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace45\levelindent0{\leveltext
-\leveltemplateid134807553\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0\hres0\chhres0 \fi-360\li5040\jclisttab\tx5040\lin5040 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace45\levelindent0{\leveltext
-\leveltemplateid134807555\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li5760\jclisttab\tx5760\lin5760 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace45\levelindent0{\leveltext
-\leveltemplateid134807557\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li6480\jclisttab\tx6480\lin6480 }{\listname ;}\listid1755588230}}{\*\listoverridetable{\listoverride\listid-2\listoverridecount1{\lfolevel\listoverrideformat
-{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelold\levelspace0\levelindent283{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0\hres0\chhres0 \fi-283\li283\lin283 }}\ls1}{\listoverride\listid607854900
-\listoverridecount0\ls2}{\listoverride\listid227346643\listoverridecount0\ls3}{\listoverride\listid1562641293\listoverridecount0\ls4}{\listoverride\listid1202405001\listoverridecount0\ls5}{\listoverride\listid1755588230\listoverridecount0\ls6}}
-{\*\rsidtbl \rsid212434\rsid335316\rsid481371\rsid678217\rsid735290\rsid1653898\rsid2495527\rsid3154883\rsid3544718\rsid3948828\rsid4207626\rsid4285936\rsid4540351\rsid5055728\rsid5070621\rsid5196648\rsid5403878\rsid5454414\rsid6226036\rsid6254420
-\rsid6307333\rsid6310753\rsid6358148\rsid6372845\rsid6816192\rsid6890489\rsid7406415\rsid7810845\rsid8289572\rsid8334973\rsid8592727\rsid9066106\rsid9120167\rsid10028869\rsid10304687\rsid10551457\rsid10961137\rsid11476477\rsid11748829\rsid11890070
-\rsid12218284\rsid12285517\rsid12334294\rsid12336355\rsid12536172\rsid13524902\rsid14296482\rsid15020123\rsid15342006\rsid15867397\rsid16414626\rsid16604991}{\*\generator Microsoft Word 10.0.6818;}{\info{\title Standard:_}{\author Andrew Thoelke}
-{\operator lukaszforynski}{\creatim\yr2000\mo9\dy26\hr14\min25}{\revtim\yr2007\mo7\dy9\hr14\min59}{\printim\yr2000\mo9\dy27\hr13\min29}{\version26}{\edmins1541}{\nofpages14}{\nofwords3744}{\nofchars21344}{\*\company Symbian}{\nofcharsws25038}
-{\vern16393}{\*\password 00000000}}{\*\xmlnstbl {\xmlns1 urn:schemas-microsoft-com:office:smarttags}}\paperw11907\paperh16840\margl1134\margr1134\margt1134\margb1134\gutter0 
-\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\formshade\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\nolnhtadjtbl\rsidroot6254420 \fet0
-{\*\wgrffmtfilter 013f}\sectd \psz9\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl\sftnbj {\headerr \pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\pvpara\phmrg\posxr\posy0\dxfrtext181\dfrmtxtx181\dfrmtxty0\nowrap\faauto\rin0\lin0\itap0 
-\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid4207626 {\*\shppict{\pict{\*\picprop\shplid1026{\sp{\sn shapeType}{\sv 75}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 0}}{\sp{\sn fLine}{\sv 0}}{\sp{\sn fLayoutInCell}{\sv 1}}
-{\sp{\sn fLayoutInCell}{\sv 1}}}\picscalex17\picscaley17\piccropl0\piccropr0\piccropt0\piccropb0\picw23813\pich6615\picwgoal13500\pichgoal3750\pngblip\bliptag1016976793{\*\blipuid 3c9dd5997eca05e5285611ada434fb29}
-89504e470d0a1a0a0000000d4948445200000384000000fa0803000000ce507925000000017352474200aece1ce900000300504c5445ffffffffffccffff99ff
-ff66ffff33ffff00ffccffffccccffcc99ffcc66ffcc33ffcc00ff99ffff99ccff9999ff9966ff9933ff9900ff66ffff66ccff6699ff6666ff6633ff6600ff33
-ffff33ccff3399ff3366ff3333ff3300ff00ffff00ccff0099ff0066ff0033ff0000ccffffccffccccff99ccff66ccff33ccff00ccccffcccccccccc99cccc66
-cccc33cccc00cc99ffcc99cccc9999cc9966cc9933cc9900cc66ffcc66cccc6699cc6666cc6633cc6600cc33ffcc33cccc3399cc3366cc3333cc3300cc00ffcc
-00cccc0099cc0066cc0033cc000099ffff99ffcc99ff9999ff6699ff3399ff0099ccff99cccc99cc9999cc6699cc3399cc009999ff9999cc9999999999669999
-339999009966ff9966cc9966999966669966339966009933ff9933cc9933999933669933339933009900ff9900cc99009999006699003399000066ffff66ffcc
-66ff9966ff6666ff3366ff0066ccff66cccc66cc9966cc6666cc3366cc006699ff6699cc6699996699666699336699006666ff6666cc66669966666666663366
-66006633ff6633cc6633996633666633336633006600ff6600cc66009966006666003366000033ffff33ffcc33ff9933ff6633ff3333ff0033ccff33cccc33cc
-9933cc6633cc3333cc003399ff3399cc3399993399663399333399003366ff3366cc3366993366663366333366003333ff3333cc333399333366333333333300
-3300ff3300cc33009933006633003333000000ffff00ffcc00ff9900ff6600ff3300ff0000ccff00cccc00cc9900cc6600cc3300cc000099ff0099cc00999900
-99660099330099000066ff0066cc0066990066660066330066000033ff0033cc0033990033660033330033000000ff0000cc0000990000660000330000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000199e9ab4000000097048
-597300000ec300000ec301c76fa8640000207149444154785eed9dd981ebb80e446f3e9d4fe7d3f9389f4967b478d142f214b899b6d05ff3de9548a050058094
-4cfdfbe77f8e8023e00838027d10f8f9fdbbfdf499ca6771041c8123029300ff9bff5c84ce0d47e00d084c057011e0fcf7fb86f9a7297f5f7fef31c0677504de
-85c0dc813e0538ffc7df3b2cd94870fecf7798e0733a02ef40e024c03789f0204197e13bc8e073f647e0e750009fd5f0d6db9680045d86bd83e0f3f546e0d881
-eedad1de228c68d07bd2deacf0f97a2110ec40df29c2a8065d85bd38e1f37445e07727b7c8ffe86b514284be3fd335143e591f047e4613614a825e0afb90c267
-e98cc06789d04b61677af8743d10d83f120c4bb2871df739d285d01f18760c854fd50d81f5cdb4f45fc7f7d65c84dd22ef130d83c05822440d7a3f3a0c73dc90
-6a0828dba3fd2a218bd055582df43ed0280828dba32ec251a2e5767c2702b420ecf95b26a1107a25fc4e1a5edb2b17e1b5e3efde0f80c0a789d04be100a47113
-ea22203c28ecb62654da511761ddf8fb6803202088b0dbaf7a5d840310c24de88f80f0a0d045d83f2c3ee39510f834115e2936eeeb451070115e24d0eee6b808
-8c24c2ed096bb1f5e1b848ba658e4026022ec24ce0fc3647a01602c2cba3dd3666844a58cb6d1fc711180701e1e5d17e2264158e039c5be208d442c045580b49
-1fc711c844602c115229cc74d26f73044646e0a3443832906e9b23908bc060224c97c25c27fd3e476064044613614a8523e3e8b63902d9080c27c2b80ab37df4
-1b1d81a111184f8431150e0da31be708e42330a008771f087dbcbe96efa1dfe9080c8ec090223c15c3c14174f31c811204c614e1e4917f2ebb24ac7eef272130
-ac083f0944b7d5112841c04558829edfeb085440c0455801441fc2112841c04558829edfeb085440c0455801441fc2112841c04558829edfeb085440c0455801
-441fc2112841c04558829edfeb085440c0455801441fc2112841c04558829edfeb085440c0455801441fc2112841c04558829edfeb085440c0455801441fc211
-2841c04558829edfeb085440c0455801441fc2112841606c1176fb487009847eaf235086c0c022fcf99bff5c8765017edcfdb3c0795bfe56607f1cda3ad0168f
-922dc229868fbf62234203ac12fc1215be95ef1392d18fa24f7a7cab6d4da8b30efaf30b83cff4fd5d92514136ba0ff25b36c87ff8777466b2fc18d4399675f1
-7c6ab0fac8a1d2b0568709c9ba4eaca32d706923cf215decd02e676bcfa10a85fb561ebda5d0de2647d9a61e572c7ec75538fdf39ec253fc49b347b343329846
-c9899c5009b7c3fefc4693ea7f763f12e178d4c106b570e64bd28b1c1c23ae3cf1a24f5b9d439a19d08d21bfc2c7279f9acc13e2524b7684b672b9be245f1c0d
-8efd130dfe4d575002da0c1998449850e03d98e67c1289c15683356b61207d054a43068e213f766528a1ec042df24b944981e6e82d892c98c928dbc44527a50c
-4890537c37f13cdb12877abd4de22f436b0c9b41841248931f150ac95e837ff981dd859cc1db06b02ca59fa21df3818cba6539cfe932b20a49b3f05cf8cec364
-97b67877f29ae4961afdd47b1faffe11287ca3b80b634cf6e2305b4764116a73afe9a454869b05e15d8ed9917dae00336899ed475058e1dd275c91e7e06988d5
-79fe445f2a8d9b1b7c818989655e789db413d48fa2f2593f290f240816500d32145c9f6d521d78f435b99158997a2c84c50d6986025720ed7e441b9e7386d541
-355543e10be820fd187fa4914db66e57b04a3e0ac663df836e87d9d8a2833d559158ce9700782db355f66822d4f5ffb0203714b3fbe74258d49052c3970cbe4d
-86a9a98e88585891dae93b10c6366cccf74813ace824d931263a1aa54e055895deff7dce67637038ea7668451508229c2a9302fee11a1b7b77c13917c2fc5248
-2b71f64c04724a1d40a39d8fcaf264679b68464ea8c218849a71697435ffef052910f1948a527bf5ab53775becf209ac0c25e70f586a51137cffa7e4a8402035
-03ceb9315408334ba199ea213e4ae944c0711bd78c802a66d8c9964a4267194aed18ed6c84aba134f4fe56e196958319689f5ad24c68a5be80c913de89e60a32
-ada8f2b6534285304b84b92bc1936f0aad18905752ca0c28961881956ce6f68a93f095dbf392af2294e3c86ccd424165e8f350fbc9b2a15544c022644fe35720
-6d42320d8bd03c541ef491d68cd3094ff70c075f1a411430c8264a22c407194aa63358812b149a1d93a1608d794ff165c75685c24cd1e535c3d15684893787a2
-a685bb516329acd2876e60e5ec2e28607539b30c6e973861ec0a889250c05ef88297864d24ebdee8d16f81bc3fc23531ef5f41cf5c90ad0333770a6c54725786
-0ac385d0b435535b820a9202900b9fcba492c8aa65033311d7a995a033ebce6e28d69fc7e5bbf88a8447f7ca5b923625150adc51708f5fa3aca7b631891542bd
-143690a0a242ce9693084be3195f6114b14d5f5048d3700376ba4221d9b91b970ab33274aaff2f97082da5ca67201f8d2a2c16a14413323af0efe407cffb5758
-0653599567cf7039d04a49b427d29d45aa0c1b4a40594e196e9af3a6e1f2c8a5b43953610a32d2169258372af6a38dc838fb58bc2d420f1209c8e5dfc3562824
-96863f5c749e4d19c5de8f2a610b8dcaed87626ffc9a5b0d0d22753a8890d8bbcb8bf142a8f4a3d51e4a84c202f9ac07929359412b5acd1de0bd2217cafce74a
-a84825947e146b94b1a3d7d4996000ea58625222c2d20517450b1ad2d659f96e5e888bada60ecc25d55c5bf3a3b57c411649d6505c3bfc7b1a90563974e798a1
-3d8977a3d88fb60f487ac3a14ed244466456271c37704190f7ca40b47e3e02a940171cb30b7d158fe19ab402fa78a107656811a6a1549854219ee703249ac530
-98bf15370d5977d1a352c9c3c5a406a01dc6483783cd02b8f74ced4f52dd282e0a955096019e2c85ed2bf16afc29a3b5f23bcc1c8931b68714ca90115db7f2bd
-8c27e7bb930250fcaf6090ba2c2c12617b5f9215bdfdf46b208e5836137f84380aeff5d6477d812132a252972bf0b778882198234625d58de2a2b0c26338003b
-9d4b8a23250e7028338a28c4917797c59c55786feb47150f22b5553126c7f9daf72401e995bec5a3f0ca4428bd5455046fb2ab50b85434fbfde67d42eb5d08a5
-27676ae7b3be4d2b801223f1a788300988028080115f22e5c674378a8bc27fcd08f9f02f59d07b89700fa571d6fbf9dbd349abd9559fee9c0756370166112a51
-8b01df8dbfccf0f415a955723f2794b0948a50da662b813399d07a65e59d1196001e8f724c1e00198f97e2a79473efc454441de3b0c5fd92c017df9ba27f3f27
-94b0a4bb51ae8452675384672aa129e42c9afc71f3d6087dd2c8f14d91435a12e946e18ca11f55868b9247b9b90ae6a5838c2142a54321117235d53999876aca
-02a5adca9bf570d75684f280894e3a743c4eca51a57471a81e5e28b0c54793fd7ff385a9854c462679ac2aac5e09a5b05c8496bd99f51345b838daf999722203
-4b2b86ebf51b4aaa73d20935c7df7f15f7dde276f8a444216f26acb123f8fabe40fcac441e75fd928c76a2fb3c5a4de26cbf78c1875ded7dc127b8b42414fa51
-69953f7f3663975bf553116b62c9918e5cb1b15d60f03c88d21deede7e2f7eae25a4dc3b1f0418128309776f2f397e6f22eb7de3fdf9c8da10f588733a7f4b33
-e08e02c6a58608796f26fce59c1a6c361262bdfc9910f0ccc4e7f01b85289de1be762652e1ab1c8268955931e5de2f28eb462d9d4ff86c78c5975d60cf6b6b85
-3b2944d576265a51150cef3e603aa66e54a984b03713ffd68288448a5b76111e12b308e6269b69539a7b43b841619d3aa730568a381a00cb5591cf1a18469873
-6668792a0c514784b15585a118525c5884ca723f1ed5f4e7013415d614e199159a0d2f116ad763f63b6eb7d20dcab4d8f7e8dd688a3772218bae8ac5ccb7b62d
-d9bfa9ae22c204a6320e14973a228c3104bfef2245a39e0883f64836bc7014cac8441d4a7e079f7ef95b2642c849c8866e3485b960c9229f0406421dbb5f121d
-8487a821c2a47ed884fb15b04ea823c2f0761b4a70b24d0968e9d6fd03ab5862566c78055413a1d23fa84bb8f53a655e6d5661a424f714bce0d841c184b59d8d
-63c4565410613a972add09a5a3f91d421621d5d215a63324da7d4a19aa24c228a00a96af8072f067dc6d0253ae56acd4eaaf90c0cbdf154c9ba2841dfa0941c7
-a90d310104ee67041b2897d414e191224a155c3012c0a822c2544e10746514a1d8182ae27b5e63b23231b22280a4618a215093958c025fc913dc281521e73401
-8a85e0493cab55c27db7244b50ea476b883089a790d05eaa12b286f690d0a440b11f55c614bc4d7731cc3cce41028ad04a093a2e14216b507b444e5b044237aa
-b595dbc714f4aac80e1b8112e522048b84a43a800805d649fb41ac21188607e0b5298f41bc13e02814a192d1d80fee47151132a2fb8d0321816cdc1304502cc2
-0af1348ab0c19a506a1ac8d37905c245a8f8bd01a60c92b74631ed204281bed88f5614e17d6f46a0c10e1b8113a52264932cbce46be72b98864a9edd5f23340d
-82f8855100301490e03d5af1212254f634880f354538cbc9d489ae146352178a50a8cc6c83b512b2f0ed2214f295d08fb28448433c02a7a0af11213ab2722bf9
-831a45852a5dfe844f529dc76201148a50309f69651521115930ea7c099bc91110944c4588cdb89008c57e34919495cd51e9edd185303f8c7d807b5f2a426272
-8e0a85ac8bd30aa4a1d6611011b2191dd6844a2737333cf5836da510b6e8ac36f030961f5909b926d965285431acc00c778521381b633ec16c22bc6cd5458402
-a0e92785752ba19d55f31decc4678a50fa41a11132c68a1685828e91fe6cc5954488e9646df5e290b80857153090c6376670356e54dffd72a197040909235037
-5a98365757d00e4c0582195d2a2173079e144adde805da5106d2fa02f7aa42fe6d844d8c421d838714ec293fe5a85109d1938f11217ab25221ae224d84dc5cd8
-a8b4bfba2ca47c3793ca5609051a6ff69af6c73294e0b4dc2bb89b2e64bc0dc639978d60c62075bf4d84717f5c84f676141ba923cf8f67ac942851983c2922e1
-7eec46854c7025110a0fba174644c3ee22b48b107378a0d81c4fb9cad6a132796a70a18cb36d5e097718311c2ec2daeda89af94e05317ed60ef3fe798510f154
-19aad18d7a25b4aea7d2dba35e09ed9550d84a8d52fd7828be417dfafe68a21f15ba51ee245d8459228cb6f91d45381fdafaf7773ef8b730b50bb70b4ce72e6d
-b3ae16989c2a38654214fad1c49686c9cf286e8c392b19fdf8988d193529c772a3f698d0f00bdd60dce62393396e09deb67f586f2227f2877bbe823d5301c938
-5e6c19ef8d2a5bb42ec233d285225402134e9bfa91e5297a0c2642a11d63b24f0f8ef627920bf55a7bca9d78635fa8e12c1f17e121549cc1d767c691088b9530
-4f84255f1dd8937834110a5c5654389f04ae707e1f3ca10e473b39a60b3781d2c34a760bdd604bb8274824369c3ff550613f2ea3fa2611eae7cb0b741d4d84b9
-fba32157ed3a64ee45f783f9567e48e8223c4a7b5011eebe7322a80c2e194e8422eca2e7c67228d4e1889484eccf25cc45f809223c7ef14ba4e2e76ccc48c7b4
-98bc36bd622a4829b27ee0dcc13de0cc402ea8ac65f4824d6133866a4763fd498335617d09a6cf6be148547f583f8596e96c12a1ed58906c97f946a91b751166
-ad09bb89b08504471421e671a306a7cbf5a654e847839548305adba265317b250c10a0d3ee68f502b1ba32dc9ab041299cdcd4ca90d40c07fb5116afb80dee22
-dce949657d17111a3ed8662b14038a5068c96c3ece578b1a10e60e2ea8583b621ae0812e550939b9ad54e82142d5163b394714a1d0dbd91de5cd08f5797d0032
-c162ad1b1592c0a5442800db4b846a51b65373c47654389f21c351f1581a21ea819ac649b25e257611be654dc82d4a0e29875d13b6d8219d9dd56a21831dd013
-dfc4d2594b658d91309130126c469f4714e8ca9df9addb51d58e3c218ed88e4e887269c97097b9a7cd7c8e381a234ded223c21ab92bfb10855339007e10b0615
-611b152a3da180f7a91fe594a1ccec95f02c25211a3dd684dc1864ca6fe476748a860abfc97b450b0cf869145eb3abdda8b7a37b21727aebb13bca9430b1f074
-f1a895b0d1c250108310f763c6c610c8dda88b70c0376638c72201d2170c2cc2262da9f0a480113d80c6b2151f12fac6cc313c2aff5bae0939bccc98cf15618b
-9767848694037f18846f100af09d46dcf9f058d8c973616633faec8e32b4cddb5144b3548243beb6b60d6ffd378598c39cf90e2446c60aca7f388d63e1276584
-e5f4d789b0e52febd53c50a0c591dbd1f51516a6a5c97d26a0f0bbe21d6a9c2af56ed4d784596bc28622e4e89ae817bc7878114e89bdae0c59119cfb766370e5
-1416a25e098320712816563714615df27dd673c25d48aafe8a8b4b21ab6ad75f22510cdda857c2ac4ad8eeb435e6c24957b7e9f8d19fe9efee89504a3fa012ae
-5d29525dee0a7855c8436da9825773ed7d0dc78997cdc7b0731e623386da9869274206621bfe497d275c301ac36fccec3669a6335691f0c2055c9858f01b5d31
-c8866ed42be158959083fb225ce4530cc2109f52091fb1293eed78020d45c13dc846c8a85816fdc6204e335e09cf89368649f1193318dca72dd1d31bbe50842b
-5fcb0e3e661a633ddd3474281b9ece4518cb8b08ee1aa966224422dc2fb8c583cc197dccdf1362a92a532297264e802fd0294ebc00dbbacbac634d63ee6593d8
-8c3e6b42b663813f664c69251404b4cc9f621473e99345f85022a9e0bc7d852267f09f8b42643c4bde45180d481f1146f39a20a0995dc99d37618c4f5b1386c2
-65de394511f2f3faa7b450af5cb95c8485226cf6b96c2dbfa7d3ec4544383fc11053667a09f1e20222f78c3b5dc9addf8e81ec078b1a8b33dbc466f469474b55
-50f67d420472310fd024822496b433c61c09de68545ec2664e70e932bd57c30feeb0be3dfb78a209cfe5228c8797d05dff3d5e8aca44c82cc06654e1ffc7af09
-37f1d320a375f47d408cfe5d5c982c85fce1ed68746305c3b05c106f0eca442814312c84ca89f2dfb0267c841005f108a9b05782f8dfc720e50b5379258c262a
-31a2f144572642a115e4136d91491ff5c68c505324d43879cd8b4cccc1ab3904b1b11b159600575a1372146051a68930c62ce440ba0c6b0cf9a635e1e2b19839
-95452806601503c95ec81c5e09a320518aa325e13fed4161910829c2820fdfd48e4a054cd8cf924adcfde11068d5da8da2a8d3bdcb4a084c459c8428b724dffd
-c3f927d088baebbfb319b033522442c50fda1be55ee9eb2aa1183626a1d08f2efaa23859bb518176576a47b11d817d99b24a48c1859dd97b9eb95e2514d672fc
-6467450f09305f448b162de16faee2dc7f21114a2a481765695118891205d74558d2c72b9510b75c968d714873e66ed42be136ae920a922f6e16b5a3420de3cd
-51a208eded7056565a7b7645d2845a5304a3b98f578adcb22884d9b86a1ddd62f3794c2c200c389b918a073611e29a90a9830fcb954a1843549a1ef3ac30ca97
-6dcc606d5af8c12454fad119fe3459b579767466f65f48840c06d5917fcd4588e1701186733266af4517881e2e1ccddb32a46ae4dc62f8db2ba1201ea5b1413f
-848cda5c841863018c112b21fa958a204a678a9c26425c91fc10dd314b9e1de190f1a0485eaed06c46610c14112aa1a42fa13717217289a11cf1ddd1dfff12bf
-53c6e0299113554e4b9b5f2896cc7517612a9e027de121dbd415082a8cd9a0508913bae0c5809570b63a5f8682cfc221d6523ffa072214b5fe7d6b422cc5d2c6
-0c76224237fa19222ccc44589884a5d5619fe48e7df4e01c98b2a208894b37d89711c0395dc2e67f403bcacf58956d758602f7463b54426c77d88de4107cbb82
-2517f5bd11cf59b1db0e919c84b3644f551d04407ab22cfb69ca4f786d4d49bcdc256885906229b4a385875b109938a249a2f0ed0481b4c9b8af845bec3368cc
-9257f76526db8907e9c9986781f831e69f5009093865738c9198f3295284d7845140a5849e3e60069f6261311760a034a0ecf4ef45b89fd4dc94d2660a3abdf3
-08464b032460f3a51b33c23b7f281f259be2b6cc4c3ffc2b1421a501565132adf2edf52be12987da6428858e6bc9431cd27011a55270c21a65ccd97acce0b88e
-a13781b0a557804b6ebe09b5547bed0235188f13e2b846be7493221d0d260419606f470373def4be4e828d29f884551a2f2242ddea6d1419f38f10a1a6a138ff
-b5fbe921e10c2c2f0ae32252da2a2ce918d174b6c6db310b98451806ffa6964309354b89122088cc6990fa178a5028a54b218b642aa5906a85b0488462f493a5
-90d3493aab0a3608eb1e065439533ef2b58dddfce2870cb994bc46650863bab7487de30563cee663fde604c16640e439ea2b702119eaa02bdd06f5a3093c4527
-52a1665f20181c89daed68d264d22172ef1e762171bc2e916a6be822d64ad00ec69c0746203a88507854f8406d1f57cbb728d90f61672681272b68f5213e8430
-02241226446d11d28c291d8a690bb794f7da50473dea50e2c7d73ea29036c53790dde60f6bce7f44803dcc4a21c4edd18408319bddcd89065b600f11454044a8
-2a6cc8d30e216ffc770b0b916779c44f307973891a87a308257e7cb308c5556176a731b7b2522869672635886a5dd81269794444e92e4261c27521317f8ff805
-def4a134152ddccb3a8544b5e96001378d5ffd8862724ec9a87ad8f23bfe1211cabc0aa950ba191389c03f2117b12d0f43ac55e7b6fed9222958bcdfedb10d4f
-0d0a4dcfdeb0bc11478cbc50c6c811e5a79159d03e6f52b7bed23b334938f544727ae8297e1d05a3c984a8bb2614e62b0bdb743755ff33b7b2acb24f739f9867
-c3b0d1af1c953e8ecd6011622e280c265bb05e512042c3f6d27fdbc7683feae296130947a2aa085b076d6964d5c8bdaed3b3e18654f669be4f848d1b5239cfa5
-45988e14b771dbeda57991f463f98ab440c7ce2214a62bcc9dca4f10aa94424e70b1d833081f5309951f53e407548738bd284c8bb07161e0580a0b839a95b0b1
-bf4bb8f5c86d6263ca862babe42c9db10fc48143243901732e906a3d0f93ab4276e16560aa14129aed3c1069221820848239bc022acc961bb1c77d96c86d3cb3
-4f2bc012b9845120da0c70d0d3d3374c077668ef77300a754498b51811bd924a0213a262256c17af172496c895944209ddb00a19737602a1e464c4666879064d
-11f97abcccd46aa4fa51748391c87441dc9f10e6471f9485c1c20961b25c6f1ff7317d23ee5827ce9e4881810747e6f71361a3cd195b962b1261b352c841501b
-c46a2244e2588570bede943d778e7147bd9b4d8437881de7a2cf12611315da34987a48c160b6aa0e2a499810f5da5161ae42195a23b7d588cdbab633316f30a1
-3101d86121fdae97d42f256cfec1b8f8ce8ce005a299c54bd9078e443511b6f1740b4f89328c446299c463cf98f3e808263380cd10e87bbfa4b60ad9faa36df1
-7e54f1a2b6fdb66d7a8e443511fe13dff2c9ca3a650f0dd4cefc699a9d241b2a30e61f27427e83c714d51c7863a590b19c43635c8d08de1856464c887a229cda
-16613ac1bff02506af83c9118bcb66daa2b91804260e1acb3c6633941af2bc86879323cbb6072c8b9542d1898ae62f7e72085f8609730b5e701e79e0da4e8616
-afc32eb1174f1a154dc698f3f0e389b05e31c95b554444c850dec9c051919388f5d54961eaaa229c1e330b531adcbd5f9a953c8f9ec9d3e6d1e4311d03c0cc19
-5084b5229b0b6eb81f6528ef614144657698dfa66242d46c47577f2da71b889ee7066e2f4379795ed48d0a1be2cc1ca40c67250ebd907ef797187a896860b3b1
-0d9742830f0c88c646f5c8324b272fb8c1e0ef39515986f99f9639f8c67eac611020495cc2c1fe54119617c39250864a212369da31135498e1011342611c93f7
-94982b2e0eb373e75928021c531c0aeb2e4fc2d419b3124e8096c5b508d95029b4a54be631a9d07080eefb366636a0542a8745713bc608b9bd04a150f55f2dc2
-12199afbb8632373aa859ccdf643146e58dcf2c8c88468540917e72d07c784735069dcb254684bafa7ab1973e60e668bb7ac091f7b1c591525a38f3b407b2e85
-f6486599be7233ab0ace1632215a8ab054877989271919211796ceca987fb808a7bd3773575a259b1e2ba15d83f9bbf7050e30211a8b305f877450704e04e67b
-3017b244d25333e63cc3d0957071dfa2c36aa1dcab90610c062a639d945d0417039810ed4538474c3d35e7d194de7e331116a4092ae4464f98e31a97fc0a618d
-1c329b07d0be21cd1bc34cc7965ccc7621f34625626bef5d2d71861321ec809576a399f07cea6d894391a6b3656be7d2ad0a8b1013cb42632e16b9907b331e63
-3539ddae04ae56533bda7afe5cec86beefe7675fa47eb7273bd7b4fc354df1a844c60e5c2cf6217b80f944b9bfc381bff3970c9acb6fb5183a74ef46b303dbe7
-c6755d582b55ce4a3c32622663ab24d207a3d167a177d70a1f128eeefe37d83795ddfa6e4c83ce7ff507f611cf08d0569563e60838026d11a0bd7fdf96698bbf
-8fee08e0b68c77a34e1247a02d02540895a7a66d2df4d11d812f47809e4f7837fae50470f7de8e001642df1d7b7b8cdc802f47800aa13f24fc7202b87b6f4700
-0ba16fcbbc3d466ec0972340cf087d5be6cb09e0eebd1d017a59a6f45c8bb73be8063802832380cda8e944d7c19d75f31c811111c066d4b765460c9bdbf44508
-60335a7ac0d31761e5ae38022d10e066d4b7655ae0ee633a024f04b019f56d19678b23d01401d6a06fcb340d800f7e7904e85599f273b72f0fb103e008241110
-34e885d039e408344440d1a0ff7ea261007ce8cb23a068d00be1e569e200b4434038f87e3eecb49d013eb223707104f819fd7218b0ff90f0e23c71f79b21a095
-c1e24f1236b3df0776043e1c0155825e083f3cd06efea808183edfe55ba3a306d1edfa64040c122cfd48fd27c3e4b63b028d10307e22d84fb56814071ff6aa08
-983f02e98f27ae4a15f7bb0902c61ae88f279a44c107bd2e02390af4c713d7e58b7bde0001e1f74ae7cff47a33da20123ee46511107e3d7f16a1bf2b7359beb8
-e32d10c82885be33da22103ee67511b097427f4c7f5db6b8e76d10b09642d7609b38f8a81746c0580a7d53e6c25c71d75b2120fd80f7b13be31a6c15061ff7ca
-08584aa1f7a257668afbde0e01bd14ba06db45c147be34027229f4671397e6893bdf1201ad14defc197dcb20f8d81747e0fc52ccf9fff156f4e22471f7db22c0
-a5f0e6ad68db10f8e89747804aa197c1cb53c401688d40ba14fef96ab075007c7c47e05fe2e535df90717e38023d10881ef8eb55b007fc3e87233021102e852e
-41278723d00d814029fcf31dd16ef0fb448ec0b914ba029d158e406f0436a5f0e60aec8dbecfe708cc08acab4217a0b3c111781b023f7f7f3ffe40f06df0fbc4ef40e07fe66a76e6cc5765320000000049454e44ae426082}}{\nonshppict
-{\pict\picscalex17\picscaley17\piccropl0\piccropr0\piccropt0\piccropb0\picw23816\pich6616\picwgoal13502\pichgoal3751\wmetafile8\bliptag1016976793\blipupi95{\*\blipuid 3c9dd5997eca05e5285611ada434fb29}
-0100090000031add00000000f5dc000000000400000003010800050000000b0200000000050000000c02fb008503030000001e000400000007010400f5dc0000
-410b2000cc00fa00840300000000fa008403000000002800000084030000fa000000010004000000000000000000000000000000000000000000000000000000
-0000ffffff00fefefe00cccccc009999990066666600333333000000000000000000000000000000000000000000000000000000000000000000000000002222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222355332222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-02022222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222226000006542222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222020222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222400000000006542222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222220202222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222226000000000000005422222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222202022222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222400000000000000000054222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222020222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222226000000000000000000000532222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222220202222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222400000000000000000000000053222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222202022222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222226000000000000000000000000006322222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222020222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222500000000000000000000000000000532222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222220202222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000052222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222202022222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222500000000000000000000000000000000064222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222020222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000
-00522222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222220202222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222500000000000000000000000000
-00000000000632222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222202022222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222230000000000000000000
-00000000000000000000042222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222020222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222500000000000
-00000000000000000000000000000052222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222220202222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222230000
-00000000000000000000000000000000000000052222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222202022222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22250000000000000000000000000000000000000000000062222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-02022222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222223000000000000000000000000000000000000000000000062222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222020222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222260000000000000000000000000000000000000000000000052222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222220202222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222223000000000000000000000000000000000000000000000000052222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222202022222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222260000000000000000000000000000000000000000000000000042222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222020222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222223000000000000000000000000000000000000000000000000000032222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222220202222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222260000000000000000000000000000000000000000000000000000622222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222202022222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222450000000000000000000000000000000000000000000000000000522222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222020222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222224500000000000000000000000000000000000000000000000000322222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222220202222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222235000000000000000000000000000000000000000000000006
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222202022222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222450000000000000000000000000000000000000
-00000000422222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222020222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222224600000000000000000000000000
-00000000000000000222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222220202222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222460000000000000000
-00000000000000000000000005222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222202022222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222236000000
-00000000000000000000000000000000003222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222020222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22360000000000000000000000000000000000000052222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222220202222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222240000000000000000000000000000000000000032222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222202022222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222236000000000000000000000000000000000000622222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-02022222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222225000000000000000000000000000000000000322222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222020222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222225000000000000000000000000000000000005222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222220202222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222225000000000000000000000000000000000003222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222202022222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222225000000000000000000000000000000000052222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222020222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222226000000000000000000000000000000000032222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222220202222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222226000000000000000000000000000000000522222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222202022222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222230000000000000000000000000000000000222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222020222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222240000000000000000000000000000000004
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222220202222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222260000000000000000000000000
-00000006222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222202022222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222300000000000000000
-00000000000000003222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222020222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222400000000
-00000000000000000000000052222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222220202222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-60000000000000000000000000000000022222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222202022222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222300000000000000000000000000000000422222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222020222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222500000000000000000000000000000006222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222220202222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222223000000000000000000000000000000003222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222202022222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222225000000000000000000000000000000052222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-02022222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222230000000000000000000000000000000022222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222020222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222250000000000000000000000000000000422222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222220202222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222300000000000000000000000000000005222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222202022222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222600000000000000000000000000000002222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222020222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222224000000000000000000000000000000042222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222233322222222222222222222222222222222222222222222222222222222222222222222222222222222223333333222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222220202222222222222222222222222222222222222222222334556600000000000006655432222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222226000000000000000000000000000000622222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222255555532222222222222222222222222222222222222222222222222222222222222222222222234566000000000000000665533222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222202022222222222222222222222222222222222222345600000000000000000000000000000654322
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222250000000000000000000000000000000322
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222333555555555555543322222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222235555555552222222222222222222222222222222222222222222222222222222222222222234560000000000000000000000
-00000065432222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222020222222222222222222222222222222222245600000000000000000000000000000000
-00000065422222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222300000000000000000000000000
-00000522222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222223456000000000000000000000006554322222222222222222222222222222222222222222222
-22222222222222222222222222222222223555555555552222222222222222222222222222222222222222222222222222222222222356000000000000000000
-00000000000000000065422222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222220202222222222222222222222222222223560000000000000000000000000000
-00000000000000000064322222222222222222222222222222222222222222222222222222222222222222222222222222222222222222500000000000000000
-00000000000006222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222456000000000000000000000000000000000654222222222222222222222222222222222
-22222222222222222222222222222222222222222355555555555552222222222222222222222222222222222222222222222222222222223560000000000000
-00000000000000000000000000000064322222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222202022222222222222222222222222245000000000000000000000000
-00000000000000000000000000000542222222222222222222222222222222222222222222222222222222222222222222222222222222222222250000000000
-00000000000000000000003222222222222222222222222222222222222222222222222222222222222222600000000000000000000000000000000032222222
-22222222222222222222222222300000000000000000000000000000000622222222222222222222222222222222260000000000000000000000000000000002
-22222222222222222222222222222222222222222222222222222222222234600000000000000000000000000000000000000000542222222222222222222222
-22222222222222222222222222222222222222222222222225555555555555532222222222222222222222222222222222222222222222222222223500000000
-00000000000000000000000000000000000000000642222222222222222222222222222222222222222222222222222222222226000000000000000000000000
-00000000002222222222222222222222222222222222250000000000000000000000000000000006020222222222222222222222222450000000000000000000
-00000000000000000000000000000000000000005222222222222222222222222222222222222222222222222222222222222222222222222222222222236000
-00000000000000000000000000000052222222222222222222222222222222222222222222222222222222222222226000000000000000000000000000000000
-32222222222222222222222222222222223000000000000000000000000000000006222222222222222222222222222222222600000000000000000000000000
-00000002222222222222222222222222222222222222222222222222222222222346000000000000000000000000000000000000000000000005322222222222
-22222222222222222222222222222222222222222222222222222222555555555555555522222222222222222222222222222222222222222222222222223600
-00000000000000000000000000000000000000000000000000005322222222222222222222222222222222222222222222222222222222260000000000000000
-00000000000000000022222222222222222222222222222222222500000000000000000000000000000000060202222222222222222222224500000000000000
-00000000000000000000000000000000000000000000000000532222222222222222222222222222222222222222222222222222222222222222222222222222
-22300000000000000000000000000000000000022222222222222222222222222222222222222222222222222222222222222260000000000000000000000000
-00000000322222222222222222222222222222222230000000000000000000000000000000062222222222222222222222222222222226000000000000000000
-00000000000000022222222222222222222222222222222222222222222222222222222350000000000000000000000000000000000000000000000000000632
-22222222222222222222222222222222222222222222222222222222222222235555555555555555522222222222222222222222222222222222222222222222
-22250000000000000000000000000000000000000000000000000000000000642222222222222222222222222222222222222222222222222222222600000000
-00000000000000000000000000222222222222222222222222222222222225000000000000000000000000000000000602022222222222222222235000000000
-00000000000000000000000000000000000000000000000000000000000052222222222222222222222222222222222222222222222222222222222222222222
-22222222230000000000000000000000000000000000000422222222222222222222222222222222222222222222222222222222222222600000000000000000
-00000000000000003222222222222222222222222222222222300000000000000000000000000000000622222222222222222222222222222222260000000000
-00000000000000000000000222222222222222222222222222222222222222222222222222222460000000000000000000000000000000000000000000000000
-00000005322222222222222222222222222222222222222222222222222222222222222555555555555555555322222222222222222222222222222222222222
-22222222236000000000000000000000000000000000000000000000000000000000000065222222222222222222222222222222222222222222222222222226
-00000000000000000000000000000000002222222222222222222222222222222222250000000000000000000000000000000006020222222222222222246000
-00000000000000000000000000000000000000000000000000000000000000000000004222222222222222222222222222222222222222222222222222222222
-22222222222222222600000000000000000000000000000000000005222222222222222222222222222222222222222222222222222222222222226000000000
-00000000000000000000000032222222222222222222222222222222223000000000000000000000000000000006222222222222222222222222222222222600
-00000000000000000000000000000002222222222222222222222222222222222222222222222222222460000000000000000000000000000000000000000000
-00000000000000000522222222222222222222222222222222222222222222222222222222222235555555555555555555222222222222222222222222222222
-22222222222222225000000000000000000000000000000000000000000000000000000000000000006422222222222222222222222222222222222222222222
-22222226000000000000000000000000000000000022222222222222222222222222222222222500000000000000000000000000000000060202222222222222
-35000000000000000000000000000000000000000000000000000000000000000000000000000006322222222222222222222222222222222222222222222222
-22222222222222222222222250000000000000000000000000000000000000002222222222222222222222222222222222222222222222222222222222222260
-00000000000000000000000000000000322222222222222222222222222222222230000000000000000000000000000000062222222222222222222222222222
-22222600000000000000000000000000000000022222222222222222222222222222222222222222222222222360000000000000000000000000000000000000
-00000000000000000000000000632222222222222222222222222222222222222222222222222222222222555555555555555555553222222222222222222222
-22222222222222222222222600000000000000000000000000000000000000000000000000000000000000000000632222222222222222222222222222222222
-22222222222222260000000000000000000000000000000000222222222222222222222222222222222225000000000000000000000000000000000602022222
-22222235000000000000000000000000000000000000000000000000000000000000000000000000000000000522222222222222222222222222222222222222
-22222222222222222222222222222224000000000000000000000000000000000000000042222222222222222222222222222222222222222222222222222222
-22222260000000000000000000000000000000003222222222222222222222222222222222300000000000000000000000000000000622222222222222222222
-22222222222226000000000000000000000000000000000222222222222222222222222222222222222222222222222250000000000000000000000000000000
-00000000000000000000000000000000000042222222222222222222222222222222222222222222222222222222235555555555555555555552222222222222
-22222222222222222222222222222260000000000000000000000000000000000000000000000000000000000000000000000053222222222222222222222222
-22222222222222222222222600000000000000000000000000000000002222222222222222222222222222222222250000000000000000000000000000000006
-02022222222236000000000000000000000000000000000000000000000000000000000000000000000000000000000000622222222222222222222222222222
-22222222222222222222222222222222222222200000000000000000000000000000000000000000522222222222222222222222222222222222222222222222
-22222222222222600000000000000000000000000000000032222222222222222222222222222222223000000000000000000000000000000006222222222222
-22222222222222222222260000000000000000000000000000000002222222222222222222222222222222222222222222222236000000000000000000000000
-00000000000000000000000000000000000000000000052222222222222222222222222222222222222222222222222222222555555555555555555555532222
-22222222222222222222222222222222222230000000000000000000000000000000000000000000000000000000000000000000000000004222222222222222
-22222222222222222222222222222226000000000000000000000000000000000022222222222222222222222222222222222500000000000000000000000000
-00000006020222222246000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032222222222222222222
-22222222222222222222222222222222222222222222225000000000000000000000000000000000000000000322222222222222222222222222222222222222
-22222222222222222222226000000000000000000000000000000000322222222222222222222222222222222230000000000000000000000000000000062222
-22222222222222222222222222222600000000000000000000000000000000022222222222222222222222222222222222222222222225000000000000000000
-00000000000000000000000000000000000000000000000000000052222222222222222222222222222222222222222222222222222235555555555555555555
-55532222222222222222222222222222222222222222600000000000000000000000000000000000000000000000000000000000000000000000000006222222
-22222222222222222222222222222222222222260000000000000000000000000000000000222222222222222222222222222222222225000000000000000000
-00000000000000060202222246000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042222222222
-22222222222222222222222222222222222222222222222222222300000000000000000000000000000000000000000004222222222222222222222222222222
-22222222222222222222222222222260000000000000000000000000000000003222222222222222222222222222222222300000000000000000000000000000
-00062222222222222222222222222222222226000000000000000000000000000000000222222222222222222222222222222222222222222222600000000000
-00000000000000000000000000000000000000000000000000000000000000062222222222222222222222222222222222222222222222222222355555555555
-55555555555522222222222222222222222222222222222222260000000000000000000000000000000000000000000000000000000000000000000000000000
-00032222222222222222222222222222222222222222222600000000000000000000000000000000002222222222222222222222222222222222250000000000
-00000000000000000000000602022246000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042
-22222222222222222222222222222222222222222222222222222222222226000000000000000000000000000000000000000000062222222222222222222222
-22222222222222222222222222222222222222600000000000000000000000000000000032222222222222222222222222222222223000000000000000000000
-00000000000622222222222222222222222222222222260000000000000000000000000000000002222222222222222222222222222222222222222222300000
-00000000000000000000000000000000000000000000000000000000000000000000000062222222222222222222222222222222222222222222222222225555
-55555555555555555555322222222222222222222222222222222222225000000000000000000000000000000000000000000000000000000000000000000000
-00000000000042222222222222222222222222222222222222222226000000000000000000000000000000000022222222222222222222222222222222222500
-00000000000000000000000000000006020223000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00000005222222222222222222222222222222222222222222222222222222222222400000000000000000000000000000000000000000000032222222222222
-22222222222222222222222222222222222222222222226000000000000000000000000000000000322222222222222222222222222222222230000000000000
-00000000000000000006222222222222222222222222222222222600000000000000000000000000000000022222222222222222222222222222222222222222
-24000000000000000000000000000000000000000000000000000000000000000000000000000000062222222222222222222222222222222222222222222222
-22235555555555555555555555555222222222222222222222222222222222222400000000000000000000000000000000000000000000000000000000000000
-00000000000000000000052222222222222222222222222222222222222222260000000000000000000000000000000000222222222222222222222222222222
-22222500000000000000000000000000000000060202226000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000005222222222222222222222222222222222222222222222222222222222226000000000000000000000000000000000000000000000522222
-22222222222222222222222222222222222222222222222222222260000000000000000000000000000000003222222222222222222222222222222222300000
-00000000000000000000000000062222222222222222222222222222222226000000000000000000000000000000000222222222222222222222222222222222
-22222222400000000000000000000000000000000000000000000000000000000000000000000000000000000062222222222222222222222222222222222222
-22222222222555555555555555555555555552222222222222222222222222222222222230000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000062222222222222222222222222222222222222222600000000000000000000000000000000002222222222222222222222
-22222222222225000000000000000000000000000000000602022230000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000004222222222222222222222222222222222222222222222222222222222500000000000000000000000000000000000000000000
-00622222222222222222222222222222222222222222222222222222222222600000000000000000000000000000000032222222222222222222222222222222
-22300000000000000000000000000000000622222222222222222222222222222222260000000000000000000000000000000002222222222222222222222222
-22222222222222240000000000000000000000000000000000000000000000000000000000000000000000000000000000052222222222222222222222222222
-22222222222222222225555555555555555555555555532222222222222222222222222222222222600000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000062222222222222222222222222222222222222226000000000000000000000000000000000022222222222222
-22222222222222222222250000000000000000000000000000000006020222260000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000003222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000
-00000000000322222222222222222222222222222222222222222222222222222222226000000000000000000000000000000000322222222222222222222222
-22222222223000000000000000000000000000000006222222222222222222222222222222222600000000000000000000000000000000022222222222222222
-22222222222222222222224000000000000000000000000000000000000000000000000000000000000000000000000000000000000052222222222222222222
-22222222222222222222222222355555555555555555555555555522222222222222222222222222222222240000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000062222222222222222222222222222222222222260000000000000000000000000000000000222222
-22222222222222222222222222222500000000000000000000000000000000060202222300000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000003222222222222222222222222222222222222222222222222222222500000000000000000000000000000
-00000000000000000005222222222222222222222222222222222222222222222222222222222260000000000000000000000000000000003222222222222222
-22222222222222222230000000000000000000000000000000062222222222222222222222222222222226000000000000000000000000000000000222222222
-22222222222222222222222222222300000000000000000000000000000000000000000000000000000000000000000000000000000000000000042222222222
-22222222222222222222222222222222223555555555555555555555555555222222222222222222222222222222222600000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000062222222222222222222222222222222222222600000000000000000000000000000000
-00222222222222222222222222222222222225000000000000000000000000000000000602022222600000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000062222222222222222222222222222222222222222222222222222220000000000000000000000
-00000000000000000000000000002222222222222222222222222222222222222222222222222222222222600000000000000000000000000000000032222222
-22222222222222222222222222300000000000000000000000000000000622222222222222222222222222222222260000000000000000000000000000000002
-22222222222222222222222222222222222230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032
-22222222222222222222222222222222222222222255555555555555555555555555553222222222222222222222222222222240000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000052222222222222222222222222222222222226000000000000000000000000
-00000000002222222222222222222222222222222222250000000000000000000000000000000006020222223000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000052222222222222222222222222222222222222222222222222222500000000000000
-00000000000000000000000000000000000042222222222222222222222222222222222222222222222222222222226000000000000000000000000000000000
-32222222222222222222222222222222223000000000000000000000000000000006222222222222222222222222222222222600000000000000000000000000
-00000002222222222222222222222222222222222222600000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00000062222222222222222222222222222222222222222222555555555555555555555555555532222222222222222222222222222222600000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000042222222222222222222222222222222222260000000000000000
-00000000000000000022222222222222222222222222222222222500000000000000000000000000000000060202222226000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000032222222222222222222222222222222222222222222222222226000000
-00000000000000000000000000000000000000000000522222222222222222222222222222222222222222222222222222222260000000000000000000000000
-00000000322222222222222222222222222222222230000000000000000000000000000000062222222222222222222222222222222226000000000000000000
-00000000000000022222222222222222222222222222222222250000000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000052222222222222222222222222222222222222222235555555555555555555555555555522222222222222222222222222222230000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000032222222222222222222222222222222222600000000
-00000000000000000000000000222222222222222222222222222222222225000000000000000000000000000000000602022222230000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000622222222222222222222222222222222222222222222222222
-40000000000000000000000000000000000000000000000000000222222222222222222222222222222222222222222222222222222222600000000000000000
-00000000000000003222222222222222222222222222222222300000000000000000000000000000000622222222222222222222222222222222260000000000
-00000000000000000000000222222222222222222222222222222222224000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000042222222222222222222222222222222222222222555555555555555555555555555555222222222222222222222222222222500
-00000000000000000000000000000000000000000065332334560000000000000000000000000000000000000000622222222222222222222222222222222226
-00000000000000000000000000000000002222222222222222222222222222222222250000000000000000000000000000000006020222222260000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000422222222222222222222222222222222222222222
-22222222600000000000000000000000000000000000000000000000000004222222222222222222222222222222222222222222222222222222226000000000
-00000000000000000000000032222222222222222222222222222222223000000000000000000000000000000006222222222222222222222222222222222600
-00000000000000000000000000000002222222222222222222222222222222222300000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000022222222222222222222222222222222222222225555555555555555555555555555553222222222222222222222222
-22222000000000000000000000000000000000000000000053222222222235600000000000000000000000000000000000000522222222222222222222222222
-22222226000000000000000000000000000000000022222222222222222222222222222222222500000000000000000000000000000000060202222222300000
-00000000000000000000000000000000000000000066666660000000000000000000000000000000000000000000000222222222222222222222222222222222
-22222222222222230000000000000000000000000000000000000000000000000000062222222222222222222222222222222222222222222222222222222260
-00000000000000000000000000000000322222222222222222222222222222222230000000000000000000000000000000062222222222222222222222222222
-22222600000000000000000000000000000000022222222222222222222222222222222226000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000522222222222222222222222222222222222222255555555555555555555555555555532222222222222222
-22222222222240000000000000000000000000000000000000000063222222222222222460000000000000000000000000000000000000322222222222222222
-22222222222222260000000000000000000000000000000000222222222222222222222222222222222225000000000000000000000000000000000602022222
-22260000000000000000000000000000000000000006553322222222223450000000000000000000000000000000000000000005222222222222222222222222
-22222222222222222222222600000000000000000000000000000000000000000000000000000032222222222222222222222222222222222222222222222222
-22222260000000000000000000000000000000003222222222222222222222222222222222300000000000000000000000000000000622222222222222222222
-22222222222226000000000000000000000000000000000222222222222222222222222222222222400000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000322222222222222222222222222222222222223555555555555555555555555555555522222222
-22222222222222222222500000000000000000000000000000000000000006222222222222222222250000000000000000000000000000000000006222222222
-22222222222222222222222600000000000000000000000000000000002222222222222222222222222222222222250000000000000000000000000000000006
-02022222222400000000000000000000000000000000000654222222222222222222225000000000000000000000000000000000000000002222222222222222
-22222222222222222222222222222230000000000000000000000000000000000000000000000000000000422222222222222222222222222222222222222222
-22222222222222600000000000000000000000000000000032222222222222222222222222222222223000000000000000000000000000000006222222222222
-22222222222222222222260000000000000000000000000000000002222222222222222222222222222222226000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000006222222222222222222222222222222222222235555555555555555555555555555555
-22222222222222222222222222220000000000000000000000000000000000000000622222222222222222222236000000000000000000000000000000000004
-22222222222222222222222222222226000000000000000000000000000000000022222222222222222222222222222222222500000000000000000000000000
-00000006060022222222600000000000000000000000000000005422222222222222222222222222500000000000000000000000000000000000000042222222
-22222222222222222222222222222222222222500000000000000000000000000000000000000000000000000000006222222222222222222222222222222222
-22222222222222222222226000000000000000000000000000000000322222222222222222222222222222222230000000000000000000000000000000062222
-22222222222222222222222222222600000000000000000000000000000000022222222222222222222222222222222500000000000000000000000000000000
-00000000000066555555560000000000000000000000000000000000000000000004222222222222222222222222222222222222555555555555555555555555
-55555555322222222222222222222222222300000000000000000000000000000000000000062222222222222222222222225000000000000000000000000000
-00000006222222222222222222222222222222260000000000000000000000000000000000222222222222222222222222222222222225000000000000000000
-00000000000000060202222222224000000000000000000000000000054222222222222222222222222222222300000000000000000000000000000000000000
-62222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000003222222222222222222222222
-22222222222222222222222222222260000000000000000000000000000000003222222222222222222222222222222222300000000000000000000000000000
-00062222222222222222222222222222222226000000000000000000000000000000000222222222222222222222222222222220000000000000000000000000
-00000000000000000542222222222223500000000000000000000000000000000000000000062222222222222222222222222222222222225555555555555555
-55555555555555553222222222222222222222222224000000000000000000000000000000000000000322222222222222222222222224000000000000000000
-00000000000000004222222222222222222222222222222600000000000000000000000000000000002222222222222222222222222222222222250000000000
-00000000000000000000000600002222222226000000000000000000000000542222222222222222222222222222222222360000000000000000000000000000
-00000000032222222222222222222222222222222222222222222400000000000000000000000000000000000000000000000000000000052222222222222222
-22222222222222222222222222222222222222600000000000000000000000000000000032222222222222222222222222222222223000000000000000000000
-00000000000622222222222222222222222222222222260000000000000000000000000000000002222222222222222222222222222222500000000000000000
-00000000000000000000006422222222222222222240000000000000000000000000000000000000000042222222222222222222222222222222222255555555
-55555555555555555555555532222222222222222222222222250000000000000000000000000000000000000052222222222222222222222222224000000000
-00000000000000000000000062222222222222222222222222222226000000000000000000000000000000000022222222222222222222222222222222222500
-00000000000000000000000000000006020222222222240000000000000000000006532222222222222222222222222222222222222200000000000000000000
-00000000000000000522222222222222222222222222222222222222222226000000000000000000000000000000000000000000000000000000000622222222
-22222222222222222222222222222222222222222222226000000000000000000000000000000000322222222222222222222222222222222230000000000000
-00000000000000000006222222222222222222222222222222222600000000000000000000000000000000022222222222222222222222222222226000000000
-00000000000000000000000000006422222222222222222222225000000000000000000000000000000000000000622222222222222222222222222222222223
-55555555555555555555555555555555522222222222222222222222222600000000000000000000000000000000000000222222222222222222222222222224
-00000000000000000000000000000000032222222222222222222222222222260000000000000000000000000000000000222222222222222222222222222222
-22222500000000000000000000000000000000060000222222222260000000000000000006422222222222222222222222222222222222222222300000000000
-00000000000000000000000006222222222222222222222222222222222222222222300000000000000000000000000000000000000000000000000000000000
-42222222222222222222222222222222222222222222222222222260000000000000000000000000000000003222222222222222222222222222222222300000
-00000000000000000000000000062222222222222222222222222222222226000000000000000000000000000000000222222222222222222222222222222400
-00000000000000000000000000000000000522222222222222222222222224000000000000000000000000000000000000000422222222222222222222222222
-22222223555555555555555555555555555555555222222222222222222222222220000000000000000000000000000000000000052222222222222222222222
-22222222600000000000000000000000000000000522222222222222222222222222222600000000000000000000000000000000002222222222222222222222
-22222222222225000000000000000000000000000000000602022222222222400000000000000005322222222222222222222222222222222222222222222500
-00000000000000000000000000000000003222222222222222222222222222222222222222225000000000000000000000000000000000000000000000000000
-00000000522222222222222222222222222222222222222222222222222222600000000000000000000000000000000032222222222222222222222222222222
-22300000000000000000000000000000000622222222222222222222222222222222260000000000000000000000000000000002222222222222222222222222
-22222500000000000000000000000000000000000632222222222222222222222222224000000000000000000000000000000000000006222222222222222222
-22222222222222255555555555555555555555555555555552222222222222222222222222300000000000000000000000000000000000000222222222222222
-22222222222222226000000000000000000000000000000006222222222222222222222222222226000000000000000000000000000000000022222222222222
-22222222222222222222250000000000000000000000000000000006000022222222222600000000000005322222222222222222222222222222222222222222
-22222200000000000000000000000000000000000042222222222222222222222222222222222222222200000000000000000000000000000006000000000000
-00000000000000000222222222222222222222222222222222222222222222222222226000000000000000000000000000000000322222222222222222222222
-22222222223000000000000000000000000000000006222222222222222222222222222222222600000000000000000000000000000000022222222222222222
-22222222222220000000000000000000000000000000000052222222222222222222222222222225000000000000000000000000000000000000003222222222
-22222222222222222222222555555555555555555555555555555555532222222222222222222222223000000000000000000000000000000000000052222222
-22222222222222222222222260000000000000000000000000000000003222222222222222222222222222260000000000000000000000000000000000222222
-22222222222222222222222222222500000000000000000000000000000000060202222222222224000000000005222222222222222222222222222222222222
-22222222222222500000000000000000000000000000000000522222222222222222222222222222222222222224000000000000000000000000000000050000
-00000000000000000000000004222222222222222222222222222222222222222222222222222260000000000000000000000000000000003222222222222222
-22222222222222222230000000000000000000000000000000062222222222222222222222222222222226000000000000000000000000000000000222222222
-22222222222222222222400000000000000000000000000000000005222222222222222222222222222222226000000000000000000000000000000000000052
-22222222222222222222222222222225555555555555555555555555555555555322222222222222222222222230000000000000000000000000000000000000
-42222222222222222222222222222222600000000000000000000000000000000042222222222222222222222222222600000000000000000000000000000000
-00222222222222222222222222222222222225000000000000000000000000000000000600002222222222226000000005222222222222222222222222222222
-22222222222222222222223000000000000000000000000000000000000222222222222222222222222222222222222222260000000000000000000000000000
-00030000000000000000000000000000052222222222222222222222222222222222222222222222222222600000000000000000000000000000000032222222
-22222222222222222222222222300000000000000000000000000000000622222222222222222222222222222222260000000000000000000000000000000002
-22222222222222222222222222225000000000000000000000000000000000422222222222222222222222222222222240000000000000000000000000000000
-00000002222222222222222222222222222222355555555555555555555555555555555553222222222222222222222222500000000000000000000000000000
-00000000222222222222222222222222222222226000000000000000000000000000000000522222222222222222222222222226000000000000000000000000
-00000000002222222222222222222222222222222222250000000000000000000000000000000006020222222222222240000005322222222222222222222222
-22222222222222222222222222222226000000000000000000000000000000000003222222222222222222222222222222222222223000000000000000000000
-00000000006260000000000000000000000000000022222222222222222222222222222222222222222222222222226000000000000000000000000000000000
-32222222222222222222222222222222223000000000000000000000000000000006222222222222222222222222222222222600000000000000000000000000
-00000002222222222222222222222222222200000000000000000000000000000000002222222222222222222222222222222222260000000000000000000000
-00000000000000042222222222222222222222222222223555555555555555555555555555555555552222222222222222222222225000000000000000000000
-00000000000000062222222222222222222222222222222260000000000000000000000000000000006222222222222222222222222222260000000000000000
-00000000000000000022222222222222222222222222222222222500000000000000000000000000000000060000222222222222260006322222222222222222
-22222222222222222222222222222222222222260000000000000000000000000000000000032222222222222222222222222222222222222250000000000000
-00000000000000000052500000000000000000000000000000422222222222222222222222222222222222222222222222222260000000000000000000000000
-00000000322222222222222222222222222222222230000000000000000000000000000000062222222222222222222222222222222226000000000000000000
-00000000000000022222222222222222222222222223000000000000000000000000000000000022222222222222222222222222222222222400000000000000
-00000000000000000000000622222222222222222222222222222235555555555555555555555555555555555522222222222222222222222250000000000000
-00000000000000000000000522222222222222222222222222222222600000000000000000000000000000000002222222222222222222222222222600000000
-00000000000000000000000000222222222222222222222222222222222225000000000000000000000000000000000602022222222222222406322222222222
-22222222222222222222222222222222222222222222222500000000000000000000000000000000000422222222222222222222222222222222222222000000
-00000000000000000000000000425000000000000000000000000000006222222222222222222222222222222222222222222222222222600000000000000000
-00000000000000003222222222222222222222222222222222300000000000000000000000000000000622222222222222222222222222222222260000000000
-00000000000000000000000222222222222222222222222222250000000000000000000000000000000000222222222222222222222222222222222222600000
-00000000000000000000000000000000322222222222222222222222222222355555555555555555555555555555555555222222222222222222222222500000
-00000000000000000000000000000005222222222222222222222222222222226000000000000000000000000000000000032222222222222222222222222226
-00000000000000000000000000000000002222222222222222222222222222222222250000000000000000000000000000000006000022222222222222422222
-22222222222222222222222222222222222222222222222222222225000000000000000000000000000000000005222222222222222222222222222222222222
-24000000000000000000000000000000003230000000000000000000000000000003222222222222222222222222222222222222222222222222226000000000
-00000000000000000000000032222222222222222222222222222222223000000000000000000000000000000006222222222222222222222222222222222600
-00000000000000000000000000000002222222222222222222222222222500000000000000000000000000000000002222222222222222222222222222222222
-22500000000000000000000000000000000000004222222222222222222222222222225555555555555555555555555555555555553222222222222222222222
-22500000000000000000000000000000000000052222222222222222222222222222222260000000000000000000000000000000000322222222222222222222
-22222226000000000000000000000000000000000022222222222222222222222222222222222500000000000000000000000000000000060202222222222222
-22222222222222222222222222222222222222222222222222222222222222250000000000000000000000000000000000052222222222222222222222222222
-22222222250000000000000000000000000000000022200000000000000000000000000000042222222222222222222222222222222222222222222222222260
-00000000000000000000000000000000322222222222222222222222222222222230000000000000000000000000000000062222222222222222222222222222
-22222600000000000000000000000000000000022222222222222222222222222226000000000000000000000000000000000022222222222222222222222222
-22222222223000000000000000000000000000000000000062222222222222222222222222222255555555555555555555555555555555555532222222222222
-22222222225000000000000000000000000000000000000422222222222222222222222222222222600000000000000000000000000000000003222222222222
-22222222222222260000000000000000000000000000000000222222222222222222222222222222222225000000000000000000000000000000000600002222
-22222222222222222222222222222222222222222222222222222222222222222222222500000000000000000000000000000000000622222222222222222222
-22222222222222222000000000000000000000000000000005222600000000000000000000000000000622222222222222222222222222222222222222222222
-22222260000000000000000000000000000000003222222222222222222222222222222222300000000000000000000000000000000622222222222222222222
-22222222222226000000000000000000000000000000000222222222222222222222222222200000000000000000000000000000000000222222222222222222
-22222222222222222226000000000000000000000000000000000000032222222222222222222222222222555555555555555555555555555555555555322222
-22222222222222222250000000000000000000000000000000000003222222222222222222222222222222225000000000000000000000000000000000032222
-22222222222222222222222600000000000000000000000000000000002222222222222222222222222222222222250000000000000000000000000000000006
-02022222222222222222222222222222222222222222222222222222222222222222222222222226000000000000000000000000000000000006222222222222
-22222222222222222222222240000000000000000000000000000000042226000000000000000000000000000000322222222222222222222222222222222222
-22222222222222600000000000000000000000000000000032222222222222222222222222222222223000000000000000000000000000000006222222222222
-22222222222222222222260000000000000000000000000000000002222222222222222222222222222000000000000000000000000000000000002222222222
-22222222222222222222222222250000000000000000000000000000000000000422222222222222222222222222225555555555555555555555555555555555
-55322222222222222222222222500000000000000000000000000000000000052222222222222222222222222222222250000000000000000000000000000000
-00032222222222222222222222222226000000000000000000000000000000000022222222222222222222222222222222222500000000000000000000000000
-00000006000022222222222222222222222222222222222222222222222222222222222222222222222222200000000000000000000000000000000000062222
-22222222222222222222222222222222500000000000000000000000000000000322250000000000000000000000000000005222222222222222222222222222
-22222222222222222222226000000000000000000000000000000000322222222222222222222222222222222230000000000000000000000000000000062222
-22222222222222222222222222222600000000000000000000000000000000022222222222222222222222222230000000000000000000000000000000000022
-22222222222222222222222222222222222400000000000000000000000000000000000005222222222222222222222222222355555555555555555555555555
-55555555555222222222222222222222225000000000000000000000000000000000000522222222222222222222222222222222500000000000000000000000
-00000000000322222222222222222222222222260000000000000000000000000000000000222222222222222222222222222222222225000000000000000000
-00000000000000060202222222222222222222222222222222222222222222222222222222222222222222222222224000000000000000000000000000000000
-00062222222222222222222222222222222222220000000000000000000000000000000002222400000000000000000000000000000002222222222222222222
-22222222222222222222222222222260000000000000000000000000000000003222222222222222222222222222222222300000000000000000000000000000
-00062222222222222222222222222222222226000000000000000000000000000000000222222222222222222222222222300000000000000000000000000000
-00000022222222222222222222222222222222222223000000000000000000000000000000000000002222222222222222222222222223555555555555555555
-55555555555555555552222222222222222222222240000000000000000000000000000000000005222222222222222222222222222222225000000000000000
-00000000000000000003222222222222222222222222222600000000000000000000000000000000002222222222222222222222222222222222250000000000
-00000000000000000000000600042222222222222222222222222222222222222222222222222222222222222222222222222260000000000000000000000000
-00000000000622222222222222222222222222222222222400000000000000000000000000000000522223000000000000000000000000000000042222222222
-22222222222222222222222222222222222222600000000000000000000000000000000032222222222222222222222222222222223000000000000000000000
-00000000000622222222222222222222222222222222260000000000000000000000000000000002222222222222222222222222223000000000000000000000
-00000000000000222222222222222222222222222222222222220000000000000000000000000000000000000032222222222222222222222222235555555555
-55555555555555555555555555522222222222222222222222300000000000000000000000000000000000052222222222222222222222222222222250000000
-00000000000000000000000000032222222222222222222222222226000000000000000000000000000000000022222222222222222222222222222222222500
-00000000000000000000000000000006020222222222222222222222222222222222222222222222222222222222222222222222222224000000000000000000
-00000000000000000006222222222222222222222222222222222225000000000000000000000000000000004222220000000000000000000000000000000522
-22222222222222222222222222222222222222222222226000000000000000000000000000000000322222222222222222222222222222222230000000000000
-00000000000000000006222222222222222222222222222222222600000000000000000000000000000000022222222222222222222222222230000000000000
-00000000000000000000002222222222222222222222222222222222222260000000000000000000000000000000000000422222222222222222222222222355
-55555555555555555555555555555555555222222222222222222222223000000000000000000000000000000000000622222222222222222222222222222222
-50000000000000000000000000000000000322222222222222222222222222260000000000000000000000000000000000222222222222222222222222222222
-22222500000000000000000000000000000000060202222222222222222222222222222222222222222222222222222222222222222222222222300000000000
-00000000000000000000000000062222222222222222222222222222222222200000000000000000000000000000000032222260000000000000000000000000
-00000022222222222222222222222222222222222222222222222260000000000000000000000000000000003222222222222222222222222222222222300000
-00000000000000000000000000062222222222222222222222222222222226000000000000000000000000000000000222222222222222222222222222300000
-00000000000000000000000000000022222222222222222222222222222222222222500000000000000000000000000000000000005222222222222222222222
-22222355555555555555555555555555555555555552222222222222222222222220000000000000000000000000000000000000222222222222222222222222
-22222222500000000000000000000000000000000003222222222222222222222222222600000000000000000000000000000000002222222222222222222222
-22222222222225000000000000000000000000000000000602022222222222222222222222222222222222222222222222222222222222222222222222226000
-00000000000000000000000000000000000622222222222222222222222222222222224000000000000000000000000000000000222222500000000000000000
-00000000000000422222222222222222222222222222222222222222222222600000000000000000000000000000000032222222222222222222222222222222
-22300000000000000000000000000000000622222222222222222222222222222222260000000000000000000000000000000002222222222222222222222222
-22300000000000000000000000000000000000222222222222222222222222222222222222224000000000000000000000000000000000000062222222222222
-22222222222225555555555555555555555555555555555555522222222222222222222222200000000000000000000000000000000000003222222222222222
-22222222222222225000000000000000000000000000000000032222222222222222222222222226000000000000000000000000000000000022222222222222
-22222222222222222222250000000000000000000000000000000006020222222222222222222222222222222222222222222222222222222222222222222222
-22300000000000000000000000000000000000000005222222222222222222222222222222222250000000000000000000000000000000052222224000000000
-00000000000000000000005222222222222222222222222222222222222222222222226000000000000000000000000000000000322222222222222222222222
-22222222223000000000000000000000000000000006222222222222222222222222222222222600000000000000000000000000000000022222222222222222
-22222222223000000000000000000000000000000000002222222222222222222222222222222222222230000000000000000000000000000000000000022222
-22222222222222222222255555555555555555555555555555555555555322222222222222222222222600000000000000000000000000000000000052222222
-22222222222222222222222250000000000000000000000000000000000322222222222222222222222222260000000000000000000000000000000000222222
-22222222222222222222222222222500000000000000000000000000000000060202222222222222222222222222222222222222222222222222222222222222
-22222222240000000000000000000000000000000000000000052222222222222222222222222222222222000000000000000000000000000000000422222230
-00000000000000000000000000000002222222222222222222222222222222222222222222222260000000000000000000000000000000003222222222222222
-22222222222222222230000000000000000000000000000000062222222222222222222222222222222226000000000000000000000000000000000222222222
-22222222222222222230000000000000000000000000000000000022222222222222222222222222222222222222300000000000000000000000000000000000
-00032222222222222222222222222555555555555555555555555555555555555553222222222222222222222225000000000000000000000000000000000000
-62222222222222222222222222222222500000000000000000000000000000000003222222222222222222222222222600000000000000000000000000000000
-00222222222222222222222222222222222225000000000000000000000000000000000602022222222222222222222222222222222222222222222222222222
-22222222222222236000000000000000000000000000000000000000000422222222222222222222222222222222240000000000000000000000000000000003
-22222220000000000000000000000000000000042222222222222222222222222222222222222222222222600000000000000000000000000000000032222222
-22222222222222222222222222300000000000000000000000000000000622222222222222222222222222222222260000000000000000000000000000000002
-22222222222222222222222222300000000000000000000000000000000000222222222222222222222222222222222222222000000000000000000000000000
-00000000000522222222222222222222222225555555555555555555555555555555555555532222222222222222222222240000000000000000000000000000
-00000000042222222222222222222222222222225000000000000000000000000000000000032222222222222222222222222226000000000000000000000000
-00000000002222222222222222222222222222222222250000000000000000000000000000000006020222222222222222222222222222222222222222222222
-22222222222222222222246000000000000000000000000000000000000000000003222222222222222222222222222222222500000000000000000000000000
-00000062222222250000000000000000000000000000000622222222222222222222222222222222222222222222226000000000000000000000000000000000
-32222222222222222222222222222222223000000000000000000000000000000006222222222222222222222222222222222600000000000000000000000000
-00000002222222222222222222222222223000000000000000000000000000000000002222222222222222222222222222222222222220000000000000000000
-00000000000000000005222222222222222222222222255555555555555555555555555555555555555322222222222222222222222300000000000000000000
-00000000000000000622222222222222222222222222222250000000000000000000000000000000000322222222222222222222222222260000000000000000
-00000000000000000022222222222222222222222222222222222500000000000000000000000000000000060202222222222222222222222222222222222222
-22222222222222222222222222450000000000000000000000000000000000000000000000022222222222222222222222222222222220000000000000000000
-00000000000000522222222400000000000000000000000000000000322222222222222222222222222222222222222222222260000000000000000000000000
-00000000322222222222222222222222222222222230000000000000000000000000000000062222222222222222222222222222222226000000000000000000
-00000000000000022222222222222222222222222230000000000000000000000000000000000022222222222222222222222222222222222222260000000000
-00000000000000000000000000062222222222222222222222222555555555555555555555555555555555555553222222222222222222222222000000000000
-00000000000000000000000000522222222222222222222222222222500000000000000000000000000000000003222222222222222222222222222600000000
-00000000000000000000000000222222222222222222222222222222222225000000000000000000000000000000000602022222222222222222222222222222
-22222222222222222222222222222234500000000000000000000000000000000000000000000000006222222222222222222222222222222222400000000000
-00000000000000000000004222222223000000000000000000000000000000005222222222222222222222222222222222222222222222600000000000000000
-00000000000000003222222222222222222222222222222222300000000000000000000000000000000622222222222222222222222222222222260000000000
-00000000000000000000000222222222222222222222222222300000000000000000000000000000000000222222222222222222222222222222222222222600
-00000000000000000000000000000000000022222222222222222222222235555555555555555555555555555555555555532222222222222222222222225000
-00000000000000000000000000000000000422222222222222222222222222225000000000000000000000000000000000032222222222222222222222222226
-00000000000000000000000000000000002222222222222222222222222222222222250000000000000000000000000000000006020222222222222222222222
-22222222222222222222222222222222234560000000000000000000000000000000000000000000000000000052222222222222222222222222222222225000
-00000000000000000000000000000032222222220000000000000000000000000000000062222222222222222222222222222222222222222222226000000000
-00000000000000000000000032222222222222222222222222222222223000000000000000000000000000000006222222222222222222222222222222222600
-00000000000000000000000000000002222222222222222222222222223000000000000000000000000000000000002222222222222222222222222222222222
-22222600000000000000000000000000000000000000222222222222222222222222355555555555555555555555555555555555555522222222222222222222
-22224000000000000000000000000000000000000000522222222222222222222222222250000000000000000000000000000000000322222222222222222222
-22222226000000000000000000000000000000000022222222222222222222222222222222222500000000000000000000000000000000060202222222222222
-22222222222222222222222222222222222234560000000000000000000000000000000000000000000000000000000000322222222222222222222222222222
-22220000000000000000000000000000000006222222222260000000000000000000000000000000032222222222222222222222222222222222222222222260
-00000000000000000000000000000000322222222222222222222222222222222230000000000000000000000000000000062222222222222222222222222222
-22222600000000000000000000000000000000022222222222222222222222222230000000000000000000000000000000000022222222222222222222222222
-22222222222226000000000000000000000000000000000000003222222222222222222222223555555555555555555555555555555555555555222222222222
-22222222222220000000000000000000000000000000000000000632222222222222222222222222400000000000000000000000000000000003222222222222
-22222222222222260000000000000000000000000000000000222222222222222222222222222222222225000000000000000000000000000000000602022222
-22222222222222222222222222222222222222345660000000000000000000000000000000000000000000000000000000000000002222222222222222222222
-22222222222400000000000000000000000000000000052222222222500000000000000000000000000000000522222222222222222222222222222222222222
-22222260000000000000000000000000000000003222222222222222222222222222222222300000000000000000000000000000000622222222222222222222
-22222222222226000000000000000000000000000000000222222222222222222222222222300000000000000000000000000000000000222222222222222222
-22222222222222222222250000000000000000000000000000000000000032222222222222222222222235555555555555555555555555555555555555552222
-22222222222222222222250000000000000000000000000000000000000000053222222222222222222222223000000000000000000000000000000000032222
-22222222222222222222222600000000000000000000000000000000002222222222222222222222222222222222250000000000000000000000000000000006
-02022222222222222222222222222222222222222345600000000000000000000000000000000000000000000000000000000000000000000522222222222222
-22222222222222222225000000000000000000000000000000000422222222223000000000000000000000000000000000222222222222222222222222222222
-22222222222222600000000000000000000000000000000032222222222222222222222222222222223000000000000000000000000000000006222222222222
-22222222222222222222260000000000000000000000000000000002222222222222222222222222223000000000000000000000000000000000002222222222
-22222222222222222222222222222500000000000000000000000000000000000000522222222222222222222222355555555555555555555555555555555555
-55552222222222222222222222222300000000000000000000000000000000000000000005422222222222222222222230000000000000000000000000000000
-00032222222222222222222222222226000000000000000000000000000000000022222222222222222222222222222222222500000000000000000000000000
-00000006020222222222222222222222222222222222224500000000000000000000000000000000000000000000000000000000000000000000000003222222
-22222222222222222222222222200000000000000000000000000000000002222222222220000000000000000000000000000000004222222222222222222222
-22222222222222222222226000000000000000000000000000000000322222222222222222222222222222222230000000000000000000000000000000062222
-22222222222222222222222222222600000000000000000000000000000000022222222222222222222222222230000000000000000000000000000000000022
-22222222222222222222222222222222222225000000000000000000000000000000000000005222222222222222222222223555555555555555555555555555
-55555555555522222222222222222222222222600000000000000000000000000000000000000000000055322222222222222222300000000000000000000000
-00000000000322222222222222222222222222260000000000000000000000000000000000222222222222222222222222222222222225000000000000000000
-00000000000000060202222222222222222222222222222222235000000000000000000000000000000000000000000000000000000000000000000000000000
-62222222222222222222222222222222224000000000000000000000000000000000522222222222250000000000000000000000000000000052222222222222
-22222222222222222222222222222260000000000000000000000000000000003222222222222222222222222222222222300000000000000000000000000000
-00062222222222222222222222222222222226000000000000000000000000000000000222222222222222222222222222300000000000000000000000000000
-00000022222222222222222222222222222222222222250000000000000000000000000000000000000052222222222222222222222235555555555555555555
-55555555555555555555222222222222222222222222224000000000000000000000000000000000000000000000000006555333322222223000000000000000
-00000000000000000003222222222222222222222222222600000000000000000000000000000000002222222222222222222222222222222222250000000000
-00000000000000000000000602022222222222222222222222222222236000000000000000000000000000000000000000000000000000000000000000000000
-00000000422222222222222222222222222222222250000000000000000000000000000000004222222222222400000000000000000000000000000000022222
-22222222222222222222222222222222222222600000000000000000000000000000000032222222222222222222222222222222223000000000000000000000
-00000000000622222222222222222222222222222222260000000000000000000000000000000002222222222222222222222222223000000000000000000000
-00000000000000222222222222222222222222222222222222222500000000000000000000000000000000000000622222222222222222222222355555555555
-55555555555555555555555555552222222222222222222222222226000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000032222222222222222222222222226000000000000000000000000000000000022222222222222222222222222222222222500
-00000000000000000000000000000006030522222222222222222222222222246000000000000000000000000000000000000000000000000000000000000000
-00000000000000062222222222222222222222222222222222000000000000000000000000000000000032222222222223000000000000000000000000000000
-00042222222222222222222222222222222222222222226000000000000000000000000000000000322222222222222222222222222222222230000000000000
-00000000000000000006222222222222222222222222222222222600000000000000000000000000000000022222222222222222222222222230000000000000
-00000000000000000000002222222222222222222222222222222222222225000000000000000000000000000000000000006222222222222222222222223555
-55555555555555555555555555555555555522222222222222222222222222230000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000322222222222222222222222222260000000000000000000000000000000000222222222222222222222222222222
-22222500000000000000000000000000000000060202222222222222222222222222236000000000000000000000000000000000000000000000000000000000
-00000000000000000000000322222222222222222222222222222222240000000000000000000000000000000006222222222222226000000000000000000000
-00000000000522222222222222222222222222222222222222222260000000000000000000000000000000003222222222222222222222222222222222300000
-00000000000000000000000000062222222222222222222222222222222226000000000000000000000000000000000222222222222222222222222222300000
-00000000000000000000000000000022222222222222222222222222222222222222250000000000000000000000000000000000000062222222222222222222
-22223555555555555555555555555555555555555555222222222222222222222222222250000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000003222222222222222222222222222600000000000000000000000000000000002222222222222222222222
-22222222222225000000000000000000000000000000000600002222222222222222222222225000000000000000000000000000000000000000000000000000
-00000000000000000000000000000052222222222222222222222222222222222500000000000000000000000000000000052222222222222250000000000000
-00000000000000000000322222222222222222222222222222222222222222600000000000000000000000000000000032222222222222222222222222222222
-22300000000000000000000000000000000622222222222222222222222222222222260000000000000000000000000000000002222222222222222222222222
-22300000000000000000000000000000000000222222222222222222222222222222222222222500000000000000000000000000000000000000022222222222
-22222222222235555555555555555555555555555555555555552222222222222222222222222222300000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000032222222222222222222222222226000000000000000000000000000000000022222222222222
-22222222222222222222250000000000000000000000000000000006020222222222222222222222224000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000222222222222222222222222222222222220000000000000000000000000000000000322222222222222400000
-00000000000000000000000000004222222222222222222222222222222222222222226000000000000000000000000000000000322222222222222222222222
-22222222223000000000000000000000000000000006222222222222222222222222222222222600000000000000000000000000000000022222222222222222
-22222222223000000000000000000000000000000000002222222222222222222222222222222222222225000000000000000000000000000000000000000222
-22222222222222222222355555555555555555555555555555555555555522222222222222222222222222222400000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000322222222222222222222222222260000000000000000000000000000000000222222
-22222222222222222222222222222500000000000000000000000000000000060000222222222222222222222500000000000000000000000000000000000000
-00000000000000000000000000000000000000000000032222222222222222222222222222222222400000000000000000000000000000000002222222222222
-22200000000000000000000000000000000062222222222222222222222222222222222222222260000000000000000000000000000000003222222222222222
-22222222222222222230000000000000000000000000000000062222222222222222222222222222222226000000000000000000000000000000000222222222
-22222222222222222230000000000000000000000000000000000022222222222222222222222222222222222222250000000000000000000000000000000000
-00000222222222222222222222223555555555555555555555555555555555555555222222222222222222222222222222500000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000003222222222222222222222222222600000000000000000000000000000000
-00222222222222222222222222222222222225000000000000000000000000000000000602022222222222222222222300000000000000000000000000000000
-00000000000000000000000000000000000000000000000000005222222222222222222222222222222222226000000000000000000000000000000000522222
-22222222222500000000000000000000000000000000032222222222222222222222222222222222222222600000000000000000000000000000000032222222
-22222222222222222222222222300000000000000000000000000000000622222222222222222222222222222222260000000000000000000000000000000002
-22222222222222222222222222300000000000000000000000000000000000222222222222222222222222222222222222222400000000000000000000000000
-00000000000002222222222222222222222235555555555555555555555555555555555555552222222222222222222222222222222600000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000032222222222222222222222222226000000000000000000000000
-00000000002222222222222222222222222222222222250000000000000000000000000000000006000022222222222222222240000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000522222222222222222222222222222222222300000000000000000000000000000000
-00422222222222222224000000000000000000000000000000000522222222222222222222222222222222222222226000000000000000000000000000000000
-32222222222222222222222222222222223000000000000000000000000000000006222222222222222222222222222222222600000000000000000000000000
-00000002222222222222222222222222223000000000000000000000000000000000002222222222222222222222222222222222222223000000000000000000
-00000000000000000000022222222222222222222222355555555555555555555555555555555555555522222222222222222222222222222222600000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000322222222222222222222222222260000000000000000
-00000000000000000022222222222222222222222222222222222500000000000000000000000000000000060202222222222222222224000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000062222222222222222222222222222222222224000000000000000000000000
-00000000002222222222222222220000000000000000000000000000000006222222222222222222222222222222222222222260000000000000000000000000
-00000000322222222222222222222222222222222230000000000000000000000000000000062222222222222222222222222222222226000000000000000000
-00000000000000022222222222222222222222222230000000000000000000000000000000000022222222222222222222222222222222222222230000000000
-00000000000000000000000000000222222222222222222222223555555555555555555555555555555555555555222222222222222222222222222222223000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003222222222222222222222222222600000000
-00000000000000000000000000222222222222222222222222222222222225000000000000000000000000000000000600002222222222222222500000000000
-00000000000000000000000000000000000000000000000000000000000000000000000006222222222222222222222222222222222222260000000000000000
-00000000000000000522222222222222222260000000000000000000000000000000003222222222222222222222222222222222222222600000000000000000
-00000000000000003222222222222222222222222222222222300000000000000000000000000000000622222222222222222222222222222222260000000000
-00000000000000000000000222222222222222222222222222300000000000000000000000000000000000222222222222222222222222222222222222222300
-00000000000000000000000000000000000002222222222222222222222235555555555555555555555555555555555555552222222222222222222222222222
-22222300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032222222222222222222222222226
-00000000000000000000000000000000002222222222222222222222222222222222250000000000000000000000000000000006020222222222222222240000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000622222222222222222222222222222222222223000000000
-00000000000000000000000004222222222222222222400000000000000000000000000000000052222222222222222222222222222222222222226000000000
-00000000000000000000000032222222222222222222222222222222223000000000000000000000000000000006222222222222222222222222222222222600
-00000000000000000000000000000002222222222222222222222222223000000000000000000000000000000000002222222222222222222222222222222222
-22222300000000000000000000000000000000000000022222222222222222222222355555555555555555555555555555555555555522222222222222222222
-22222222222222260000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000322222222222222222222
-22222226000000000000000000000000000000000022222222222222222222222222222222222500000000000000000000000000000000060000222222222222
-22300000000000000000000000000000000000000000000000000000000000000000000000000000000000062222222222222222222222222222222222222240
-00000000000000000000000000000000032222222222222222223000000000000000000000000000000000022222222222222222222222222222222222222260
-00000000000000000000000000000000322222222222222222222222222222222230000000000000000000000000000000062222222222222222222222222222
-22222600000000000000000000000000000000022222222222222222222222222230000000000000000000000000000000000022222222222222222222222222
-22222222222223000000000000000000000000000000000000000222222222222222222222223555555555555555555555555555555555555555222222222222
-22222222222222222222222250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003222222222222
-22222222222222260000000000000000000000000000000000222222222222222222222222222222222225000000000000000000000000000000000602022222
-22222222226000000000000000000000000000000000000000000000000000000000000000000000000000000000005222222222222222222222222222222222
-22222260000000000000000000000000000000006222222222222222222226000000000000000000000000000000000422222222222222222222222222222222
-22222260000000000000000000000000000000003222222222222222222222222222222222300000000000000000000000000000000622222222222222222222
-22222222222226000000000000000000000000000000000222222222222222222222222222300000000000000000000000000000000000222222222222222222
-22222222222222222222240000000000000000000000000000000000000002222222222222222222222235555555555555555555555555555555555555552222
-22222222222222222222222222222222240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032222
-22222222222222222222222600000000000000000000000000000000002222222222222222222222222222222222250000000000000000000000000000000006
-00002222222222222500000000000000000000000000000000000000000000000000000000000000000000000000000000000422222222222222222222222222
-22222222222223000000000000000000000000000000000052222222222222222222240000000000000000000000000000000005222222222222222222222222
-22222222222222600000000000000000000000000000000032222222222222222222222222222222223000000000000000000000000000000006222222222222
-22222222222222222222260000000000000000000000000000000002222222222222222222222222223000000000000000000000000000000000002222222222
-22222222222222222222222222222500000000000000000000000000000000000000022222222222222222222222355555555555555555555555555555555555
-55552222222222222222222222222222222222222236000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00032222222222222222222222222226000000000000000000000000000000000022222222222222222222222222222222222500000000000000000000000000
-00000006020222222222222230000000000000000000000000000000000000000000000000000000000000000000000000000000000532222222222222222222
-22222222222222222222240000000000000000000000000000000000322222222222222222222300000000000000000000000000000000002222222222222222
-22222222222222222222226000000000000000000000000000000000322222222222222222222222222222222230000000000000000000000000000000062222
-22222222222222222222222222222600000000000000000000000000000000022222222222222222222222222230000000000000000000000000000000000022
-22222222222222222222222222222222222225000000000000000000000000000000000000000222222222222222222222223555555555555555555555555555
-55555555555522222222222222222222222222222222222222225000000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000322222222222222222222222222260000000000000000000000000000000000222222222222222222222222222222222225000000000000000000
-00000000000000060000222222222222500000000000000000000000000000000000000000000000000000000000000000000000000000000632222222222222
-22222222222222222222222222222600000000000000000000000000000000002222222222222222222222600000000000000000000000000000000042222222
-22222222222222222222222222222260000000000000000000000000000000003222222222222222222222222222222222300000000000000000000000000000
-00062222222222222222222222222222222226000000000000000000000000000000000222222222222222222222222222300000000000000000000000000000
-00000022222222222222222222222222222222222222250000000000000000000000000000000000000002222222222222222222222235555555555555555555
-55555555555555555555222222222222222222222222222222222222222223500000000000000000000000000000000000000000000000000000000000000000
-00000000000000000003222222222222222222222222222600000000000000000000000000000000002222222222222222222222222222222222250000000000
-00000000000000000000000602022222222222230000000000000000000000000000000000000000000000000000000000000000000000000000000642222222
-22222222222222222222222222222222222230000000000000000000000000000000000522222222222222222222225000000000000000000000000000000000
-62222222222222222222222222222222222222600000000000000000000000000000000032222222222222222222222222222222223000000000000000000000
-00000000000622222222222222222222222222222222260000000000000000000000000000000002222222222222222222222222223000000000000000000000
-00000000000000222222222222222222222222222222222222222500000000000000000000000000000000000000022222222222222222222222355555555555
-55555555555555555555555555552222222222222222222222222222222222222222222350000000000000000000000000000000000000000000000000000000
-00000000000000000000000000032222222222222222222222222226000000000000000000000000000000000022222222222222222222222222222222222500
-00000000000000000000000000000006000022222222222500000000000000000000000000000000000000000000000000000000000000000000000000000532
-22222222222222222222222222222222222222222222400000000000000000000000000000000004222222222222222222222230000000000000000000000000
-00000000032222222222222222222222222222222222226000000000000000000000000000000000322222222222222222222222222222222230000000000000
-00000000000000000006222222222222222222222222222222222600000000000000000000000000000000022222222222222222222222222230000000000000
-00000000000000000000002222222222222222222222222222222222222225000000000000000000000000000000000000006222222222222222222222223555
-55555555555555555555555555555555555522222222222222222222222222222222222222222222235000000000000000000000000000000000000000000000
-00000000000000000000000000000000000322222222222222222222222222260000000000000000000000000000000000222222222222222222222222222222
-22222500000000000000000000000000000000060600222222222220000000000000000000000000000000000000000000000000000000000000000000000000
-00653222222222222222222222222222222222222222222222226000000000000000000000000000000000022222222222222222222222260000000000000000
-00000000000000000422222222222222222222222222222222222260000000000000000000000000000000003222222222222222222222222222222222300000
-00000000000000000000000000062222222222222222222222222222222226000000000000000000000000000000000222222222222222222222222222300000
-00000000000000000000000000000022222222222222222222222222222222222222250000000000000000000000000000000000000062222222222222222222
-22223555555555555555555555555555555555555555222222222222222222222222222222222222222222222222460000000000000000000000000000000000
-00000000000000000000000000000000000000000003222222222222222222222222222600000000000000000000000000000000002222222222222222222222
-22222222222225000000000000000000000000000000000600002222222222400000000000000000000000000000000000000000000000000000000000000000
-00000006532222222222222222222222222222222222222222222222222300000000000000000000000000000000006222222222222222222222222500000000
-00000000000000000000000006222222222222222222222222222222222222600000000000000000000000000000000032222222222222222222222222222222
-22300000000000000000000000000000000622222222222222222222222222222222260000000000000000000000000000000002222222222222222222222222
-22300000000000000000000000000000000000222222222222222222222222222222222222222500000000000000000000000000000000000000622222222222
-22222222222235555555555555555555555555555555555555552222222222222222222222222222222222222222222222222235600000000000000000000000
-00000000000000000000000000000000000000000000000000032222222222222222222222222226000000000000000000000000000000000022222222222222
-22222222222222222222250000000000000000000000000000000006000022222222226000000000000000000000000000000000000000000000000000000000
-00000000000054322222222222222222222222222222222222222222222222222224000000000000000000000000000000000042222222222222222222222224
-00000000000000000000000000000000003222222222222222222222222222222222226000000000000000000000000000000000322222222222222222222222
-22222222223000000000000000000000000000000006222222222222222222222222222222222600000000000000000000000000000000022222222222222222
-22222222223000000000000000000000000000000000002222222222222222222222222222222222222225000000000000000000000000000000000000006222
-22222222222222222222355555555555555555555555555555555555555522222222222222222222222222222222222222222222222222222345000000000000
-00000000000000000000000000000000000000000000000000000000000322222222222222222222222222260000000000000000000000000000000000222222
-22222222222222222222222222222500000000000000000000000000000000060000222222222300000000000000000000000000000000000000000000000000
-00000000000000006532222222222222222222222222222222222222222222222222222222260000000000000000000000000000000000322222222222222222
-22222222000000000000000000000000000000000052222222222222222222222222222222222260000000000000000000000000000000003222222222222222
-22222222222222222230000000000000000000000000000000062222222222222222222222222222222226000000000000000000000000000000000222222222
-22222222222222222230000000000000000000000000000000000022222222222222222222222222222222222222250000000000000000000000000000000000
-00005222222222222222222222223555555555555555555555555555555555555555222222222222222222222222222222222222222222222222222222222345
-60000000000000000000000000000000000000000000000000000000000000000003222222222222222222222222222600000000000000000000000000000000
-00222222222222222222222222222222222225000000000000000000000000000000000600002222222224000000000000000000000000000000000000000000
-00000000000000000000654222222222222222222222222222222222222222222222222222222222223000000000000000000000000000000000062222222222
-22222222222222225000000000000000000000000000000000622222222222222222222222222222222222600000000000000000000000000000000032222222
-22222222222222222222222222300000000000000000000000000000000622222222222222222222222222222222260000000000000000000000000000000002
-22222222222222222222222222300000000000000000000000000000000000222222222222222222222222222222222222222500000000000000000000000000
-00000000000052222222222222222222222235555555555555555555555555555555555555532222222222222222222222222222222222222222222222222222
-22222222223456600000000000000000000000000000000000000000000000000000000000032222222222222222222222222226000000000000000000000000
-00000000002222222222222222222222222222222222250000000000000000000000000000000006000022222222250000000000000000000000000000000000
-00000000000000000000000065422222222222222222222222222222222222222222222222222222222222222240000000000000000000000000000000000522
-22222222222222222222222240000000000000000000000000000000000322222222222222222222222222222222226000000000000000000000000000000000
-32222222222222222222222222222222223000000000000000000000000000000006222222222222222222222222222222222600000000000000000000000000
-00000002222222222222222222222222223000000000000000000000000000000000002222222222222222222222222222222222222226000000000000000000
-00000000000000000000422222222222222222222222255555555555555555555555555555555555555322222222222222222222222222222222222222222222
-22222222222222222222222233455566660000000000000060000000000000000000000000000000000322222222222222222222222222260000000000000000
-00000000000000000022222222222222222222222222222222222500000000000000000000000000000000060000222222222000000000000000000000000000
-00000000000000000000000000006542222222222222222222222222222222222222222222222222222222222222222222600000000000000000000000000000
-00000322222222222222222222222222200000000000000000000000000000000005222222222222222222222222222222222260000000000000000000000000
-00000000322222222222222222222222222222222230000000000000000000000000000000062222222222222222222222222222222226000000000000000000
-00000000000000022222222222222222222222222230000000000000000000000000000000000022222222222222222222222222222222222222260000000000
-00000000000000000000000000003222222222222222222222222555555555555555555555555555555555555553222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222260000000000000000000000000000000003222222222222222222222222222600000000
-00000000000000000000000000222222222222222222222222222222222225000000000000000000000000000000000600002222222230000000000000000000
-00000000000000000000000000000000654322222222222222222222222222222222222222222222222222222222222222222222230000000000000000000000
-00000000000002222222222222222222222222222500000000000000000000000000000000002222222222222222222222222222222222600000000000000000
-00000000000000003222222222222222222222222222222222300000000000000000000000000000000622222222222222222222222222222222260000000000
-00000000000000000000000222222222222222222222222222300000000000000000000000000000000000222222222222222222222222222222222222222600
-00000000000000000000000000000000000022222222222222222222222225555555555555555555555555555555555555532222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222600000000000000000000000000000000032222222222222222222222222226
-00000000000000000000000000000000002222222222222222222222222222222222250000000000000000000000000000000006000022222222400000000000
-00000000000000000000000000000000000006432222222222222222222222222222222222222222222222222222222222222222222222222400000000000000
-00000000000000000000522222222222222222222222222224000000000000000000000000000000000042222222222222222222222222222222226000000000
-00000000000000000000000032222222222222222222222222222222223000000000000000000000000000000006222222222222222222222222222222222600
-00000000000000000000000000000002222222222222222222222222223000000000000000000000000000000000002222222222222222222222222222222222
-22222000000000000000000000000000000000000000222222222222222222222222255555555555555555555555555555555555555322222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222226000000000000000000000000000000000322222222222222222222
-22222226000000000000000000000000000000000022222222222222222222222222222222222500000000000000000000000000000000060000222222225000
-00000000000000000000000000000000000000000065322222222222222222222222222222222222222222222222222222222222222222222222222226000000
-00000000000000000000000000004222222222222222222222222222220000000000000000000000000000000000522222222222222222222222222222222260
-00000000000000000000000000000000322222222222222222222222222222222230000000000000000000000000000000062222222222222222222222222222
-22222600000000000000000000000000000000022222222222222222222222222230000000000000000000000000000000000022222222222222222222222222
-22222222222230000000000000000000000000000000000000062222222222222222222222222555555555555555555555555555555555555553222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222260000000000000000000000000000000003222222222222
-22222222222222260000000000000000000000000000000000222222222222222222222222222222222225000000000000000000000000000000000600002222
-22225000000000000000000000000000000000000000000064222222222222222222222222222222222222222222222222222222222222222222222222222222
-30000000000000000000000000000000000022222222222222222222222222222250000000000000000000000000000000000222222222222222222222222222
-22222260000000000000000000000000000000003222222222222222222222222222222222300000000000000000000000000000000622222222222222222222
-22222222222226000000000000000000000000000000000222222222222222222222222222300000000000000000000000000000000000222222222222222222
-22222222222222222222300000000000000000000000000000000000000522222222222222222222222225555555555555555555555555555555555555532222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222600000000000000000000000000000000032222
-22222222222222222222222600000000000000000000000000000000002222222222222222222222222222222222250000000000000000000000000000000006
-00002222222260000000000000000000000000000000000000000004222222222222222222222222222222222222222222222222222222222222222222222222
-22222222400000000000000000000000000000000006222222222222222222222222222222400000000000000000000000000000000004222222222222222222
-22222222222222600000000000000000000000000000000032222222222222222222222222222222224000000000000000000000000000000006222222222222
-22222222222222222222260000000000000000000000000000000002222222222222222222222222223000000000000000000000000000000000002222222222
-22222222222222222222222222225000000000000000000000000000000000000005222222222222222222222222255555555555555555555555555555555555
-55522222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222226000000000000000000000000000000
-00032222222222222222222222222226000000000000000000000000000000000022222222222222222222222222222222222500000000000000000000000000
-00000006000022222222000000000000000000000000000000000000000006222222222222222222222222222222222222222222222222222222222222222222
-22222222222222226000000000000000000000000000000000042222222222222222222222222222223000000000000000000000000000000000062222222222
-22222222222222222222226000000000000000000000000000000000322222222222222222222222222222222250000000000000000000000000000000062222
-22222222222222222222222222222600000000000000000000000000000000022222222222222222222222222230000000000000000000000000000000000022
-22222222222222222222222222222222222250000000000000000000000000000000000000032222222222222222222222222355555555555555555555555555
-55555555555222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222260000000000000000000000
-00000000000322222222222222222222222222260000000000000000000000000000000000222222222222222222222222222222222225000000000000000000
-00000000000000060000222222220000000000000000000000000000000000000000522222222222222222222222222222222222222222222222222222222222
-22222222222222222222222300000000000000000000000000000000000322222222222222222222222222222226000000000000000000000000000000000032
-22222222222222222222222222222260000000000000000000000000000000003222222222222222222222222222222222500000000000000000000000000000
-00062222222222222222222222222222222226000000000000000000000000000000000222222222222222222222222222300000000000000000000000000000
-00000022222222222222222222222222222222222222600000000000000000000000000000000000000222222222222222222222222223555555555555555555
-55555555555555555552222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222600000000000000
-00000000000000000003222222222222222222222222222600000000000000000000000000000000002222222222222222222222222222222222260000000000
-00000000000000000000000600002222222200000000000000000000000000000000000000062222222222222222222222222222222222222222222222222222
-22222222222222222222222222222225000000000000000000000000000000000062222222222222222222222222222222240000000000000000000000000000
-00000042222222222222222222222222222222600000000000000000000000000000000032222222222222222222222222222222225000000000000000000000
-00000000000622222222222222222222222222222222260000000000000000000000000000000002222222222222222222222222223000000000000000000000
-00000000000000222222222222222222222222222222222222220000000000000000000000000000000000000062222222222222222222222222235555555555
-55555555555555555555555555522222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222226000000
-00000000000000000000000000032222222222222222222222222226000000000000000000000000000000000022222222222222222222222222222222222600
-00000000000000000000000000000006000022222222000000000000000000000000000000000000000322222222222222222222222222222222222222222222
-22222222222222222222222222222222222222260000000000000000000000000000000000522222222222222222222222222222222300000000000000000000
-00000000000000622222222222222222222222222222226000000000000000000000000000000000322222222222222222222222222222222250000000000000
-00000000000000000006222222222222222222222222222222222000000000000000000000000000000000022222222222222222222222222230000000000000
-00000000000000000000002222222222222222222222222222222222222400000000000000000000000000000000000000522222222222222222222222222355
-55555555555555555555555555555555555222222222222222222222222222222222222222233222222222222222222222222222222222222222222222222222
-20000000000000000000000000000000000322222222222222222222222222260000000000000000000000000000000000222222222222222222222222222222
-22222600000000000000000000000000000000060000222222220000000000000000000000000000000000000052222222222222222222222222222222222222
-22222222222222222222222222222222222222222222223000000000000000000000000000000000004222222222222222222222222222222222600000000000
-00000000000000000000000322222222222222222222222222222260000000000000000000000000000000003222222222222222222222222222222222500000
-00000000000000000000000000062222222222222222222222222222222220000000000000000000000000000000000222222222222222222222222222300000
-00000000000000000000000000000022222222222222222222222222222222222225000000000000000000000000000000000000004222222222222222222222
-22222355555555555555555555555555555555555552222222222222222222222222222222222222222505222222222222222222222222222222222222222222
-22222222200000000000000000000000000000000003222222222222222222222222222600000000000000000000000000000000002222222222222222222222
-22222222222226000000000000000000000000000000000600002222222200000000000000000000000000000000000000322222222222222222222222222222
-22222222222222222222222222222222222222222222222222222250000000000000000000000000000000000022222222222222222222222222222222225000
-00000000000000000000000000000005222222222222222222222222222222600000000000000000000000000000000032222222222222222222222222222222
-22500000000000000000000000000000000622222222222222222222222222222222200000000000000000000000000000000002222222222222222222222222
-22300000000000000000000000000000000000222222222222222222222222222222222222200000000000000000000000000000000000000032222222222222
-22222222222222555555555555555555555555555555555555322222222222222222222222222222222222222230006322222222222222222222222222222222
-22222222222222222000000000000000000000000000000000032222222222222222222222222226000000000000000000000000000000000042222222222222
-22222222222222222222200000000000000000000000000000000006020222222222000000000000000000000000000000000000002222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222600000000000000000000000000000000005222222222222222222222222222222
-22223000000000000000000000000000000000062222222222222222222222222222226000000000000000000000000000000000322222222222222222222222
-22222222226000000000000000000000000000000006222222222222222222222222222222222000000000000000000000000000000000022222222222222222
-22222222223000000000000000000000000000000000002222222222222222222222222222222222224000000000000000000000000000000000000000222222
-22222222222222222222225555555555555555555555555555555555553222222222222222222222222222222222222222600000522222222222222222222222
-22222222222222222222222230000000000000000000000000000000000322222222222222222222222222260000000000000000000000000000000000052222
-22222222222222222222222222222000000000000000000000000000000000060000222222220000000000000000000000000000000000000622222222222222
-22222222222222222222222222222222222222222222222222222222222222222222230000000000000000000000000000000000042222222222222222222222
-22222222222226000000000000000000000000000000000042222222222222222222222222222260000000000000000000000000000000003222222222222222
-22222222222222222260000000000000000000000000000000005222222222222222222222222222222230000000000000000000000000000000000222222222
-22222222222222222230000000000000000000000000000000000022222222222222222222222222222222222260000000000000000000000000000000000000
-05222222222222222222222222222255555555555555555555555555555555555532222222222222222222222222222222222222250000000042222222222222
-22222222222222222222222222222222400000000000000000000000000000000003222222222222222222222222222600000000000000000000000000000000
-00005222222222222222222222222222222230000000000000000000000000000000000602022222222200000000000000000000000000000000000006222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222500000000000000000000000000000000000222222222222222
-22222222222222222222250000000000000000000000000000000000522222222222222222222222222222600000000000000000000000000000000062222222
-22222222222222222222222222000000000000000000000000000000000005222222222222222222222222222222300000000000000000000000000000000002
-22222222222222222222222222300000000000000000000000000000000000422222222222222222222222222222222224000000000000000000000000000000
-00000000042222222222222222222222222222555555555555555555555555555555555555222222222222222222222222222222222222223000000000063222
-22222222222222222222222222222222222222225000000000000000000000000000000000032222222222222222222222222226000000000000000000000000
-00000000000006322222222222222222222222222222400000000000000000000000000000000006000022222222600000000000000000000000000000000000
-06222222222222222222222222222222222222222222222222222222222222222222222222222222222226000000000000000000000000000000000062222222
-22222222222222222222222222222400000000000000000000000000000000000222222222222222222222222222226000000000000000000000000000000000
-06322222222222222222222222222222230000000000000000000000000000000000006322222222222222222222222222224000000000000000000000000000
-00000002222222222222222222222222223000000000000000000000000000000000000422222222222222222222222222222222260000000000000000000000
-00000000000000000222222222222222222222222222223555555555555555555555555555555555552222222222222222222222222222222222222250000000
-00000532222222222222222222222222222222222222222260000000000000000000000000000000000322222222222222222222222222260000000000000000
-00000000000000000000000422222222222222222222222222225000000000000000000000000000000000060202222222226000000000000000000000000000
-00000000002222222222222222222222222222222222222222222222222222222222222222222222222222222222300000000000000000000000000000000000
-42222222222222222222222222222222222222000000000000000000000000000000000004222222222222222222222222222260000000000000000000000000
-00000000000422222222222222222222222222222400000000000000000000000000000000000000422222222222222222222222222250000000000000000000
-00000000000000022222222222222222222222222230000000000000000000000000000000000000422222222222222222222222222222225000000000000000
-00000000000000000000000052222222222222222222222222222235555555555555555555555555555555555522222222222222222222222222222222222223
-00000000000000053222222222222222222222222222222222222222000000000000000000000000000000000003222222222222222222222222222600000000
-00000000000000000000000000000000522222222222222222222222222260000000000000000000000000000000000602022222222250000000000000000000
-00000000000000000032222222222222222222222222222222222222222222222222222222222222222222222222222222225000000000000000000000000000
-00000000322222222222222222222222222222222222225000000000000000000000000000000000052222222222222222222222222222600000000000000000
-00000000000000000000522222222222222222222222222225000000000000000000000000000000000000000522222222222222222222222222600000000000
-00000000000000000000006222222222222222222222222222300000000000000000000000000000000000000422222222222222222222222222222300000000
-00000000000000000000000000000000422222222222222222222222222222355555555555555555555555555555555555222222222222222222222222222222
-22222226000000000000000005222222222222222222222222222222222222240000000000000000000000000000000000032222222222222222222222222226
-00000000000000000000000000000000000000000042222222222222222222222223000000000000000000000000000000000006020222222222500000000000
-00000000000000000000000000422222222222222222222222222222222222222222222224642222222222222222222222222222222260000000000000000000
-00000000000000062222222222222222222222222222222222222240000000000000000000000000000000000022222222222222222222222222226000000000
-00000000000000000000000000000042222222222222222222222222200000000000000000000000000000000000000000042222222222222222222222220000
-00000000000000000000000000000062222222222222222222222222223000000000000000000000000000000000000000522222222222222222222222222220
-00000000000000000000000000000000000000002222222222222222222222222222222555555555555555555555555555555555532222222222222222222222
-22222222222222500000000000000000000532222222222222222222222222222222222600000000000000000000000000000000000322222222222222222222
-22222226000000000000000000000000000000000000000000063222222222222222222222260000000000000000000000000000000000060202222222223000
-00000000000000000000000000000000006222222222222222222222222222222222222222222225000622222222222222222222222222222223000000000000
-00000000000000000000000522222222222222222222222222222222222222200000000000000000000000000000000000422222222222222222222222222260
-00000000000000000000000000000000000000063222222222222222222222224000000000000000000000000000000000000000000063222222222222222222
-22240000000000000000000000000000000000622222222222222222222222222230000000000000000000000000000000000000000522222222222222222222
-22222260000000000000000000000000000000000000000522222222222222222222222222222225555555555555555555555555555555555322222222222222
-22222222222222222222230000000000000000000000053222222222222222222222222222222240000000000000000000000000000000000002222222222222
-22222222222222200000000000000000000000000000000000000000000005322222222222222222224000000000000000000000000000000000000502022222
-22222000000000000000000000000000000000000004222222222222222222222222222222222222222225000000422222222222222222222222222222250000
-00000000000000000000000000000004222222222222222222222222222222222222222500000000000000000000000000000000006222222222222222222222
-22222200000000000000000000000000000000000000000005322222222222222222222200000000000000000000000000000000000000000000006322222222
-22222222222000000000000000000000000000000000006222222222222222222222222222300000000000000000000000000000000000000000632222222222
-22222222222236000000000000000000000000000000000000000004222222222222222222222222222222255555555555555555555555555555555553222222
-22222222222222222222222222222500000000000000000000000006422222222222222222222222222223000000000000000000000000000000000000022222
-22222222222222222222222000000000000000000000000000000000000000000000000532222222222222222300000000000000000000000000000000000005
-02022222222226000000000000000000000000000000000000003222222222222222222222222222222222222235000000006222222222222222222222222222
-22260000000000000000000000000000000000022222222222222222222222222222222222222224000000000000000000000000000000000003222222222222
-22222222222222000000000000000000000000000000000000000000000532222222222222222226000000000000000000000000000000000000000000000000
-64222222222222222250000000000000000000000000000000000062222222222222222222222222223000000000000000000000000000000000000000000052
-22222222222222222224000000000000000000000000000000000000000000622222222222222222222222222222222555555555555555555555555555555555
-52222222222222222222222222222222222230000000000000000000000000000054222222222222222222222222300000000000000000000000000000000000
-00022222222222222222222222222220000000000000000000000000000000000000000000000000064322222222222240000000000000000000000000000000
-00000005020222222222250000000000000000000000000000000000000062222222222222222222222222222222222246000000000004222222222222222222
-22222222223000000000000000000000000000000000005222222222222222222222222222222222222222220000000000000000000000000000000000052222
-22222222222222222222220000000000000000000000000000000000000000000000064322222222222223600000000000000000000000000000000000000000
-00000000006532222222222236000000000000000000000000000000000000522222222222222222222222222230000000000000000000000000000000000000
-00000000532222222222222223600000000000000000000000000000000000000000005222222222222222222222222222222223555555555555555555555555
-55555555522222222222222222222222222222222222600000000000000000000000000000000543222222222222222222250000000000000000000000000000
-00000000006222222222222222222222222222200000000000000000000000000000000000000000000000000000654322222356000000000000000000000000
-00000000000000040202222222222300000000000000000000000000000000000000063222222222222222222222222222222350000000000000062222222222
-22222222222222222250000000000000000000000000000000000042222222222222222222222222222222222222222250000000000000000000000000000000
-00062222222222222222222222222200000000000000000000000000000000000000000000000000654322222234500000000000000000000000000000000000
-00000000000000000000005533333456000000000000000000000000000000000000005222222222222222222222222222300000000000000000000000000000
-00000000000000000054322222222234600000000000000000000000000000000000000000000022222222222222222222222222222222235555555555555555
-55555555555555555222222222222222222222222222222222240000000000000000000000000000000000006543222222222222450000000000000000000000
-00000000000000000052222222222222222222222222223000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000302022222222222000000000000000000000000000000000000000004222222222222222222222222223560000000000000000032
-22222222222222222222222222600000000000000000000000000000000000322222222222222222222222222222222222222222400000000000000000000000
-00000000000032222222222222222222222222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000042222222222222222222222222223000000000000000000000
-00000000000000000000000000000665555560000000000000000000000000000000000000000000000005222222222222222222222222222222222255555555
-55555555555555555555555532222222222222222222222222222222222000000000000000000000000000000000000000000066666666000000000000000000
-00000000000000000000000000522222222222222222222222222230000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000003020222222222225000000000000000000000000000000000000000006422222222222222222222245600000000000000
-00000062222222222222222222222222230000000000000000000000000000000000062222222222222222222222222222222222222222223000000000000000
-00000000000000000000522222222222222222222222230000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000322222222222222222222222222230000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032222222222222222222222222222222222
-55555555555555555555555555555555322222222222222222222222222222222250000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000003222222222222222222222222222400000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000020202222222222230000000000000000000000000000000000000000000654222222222222234560000000000
-00000000000000032222222222222222222222222500000000000000000000000000000000000522222222222222222222222222222222222222222226000000
-00000000000000000000000000000222222222222222222222222300000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003222222222222222222222222222300000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005222222222222222222222222222
-22222222555555555555555555555555555555552222222222222222222222222222222223000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000022222222222222222222222222225000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000202022222222222260000000000000000000000000000000000000000000000665555566600000000
-00000000000000000000000622222222222222222222222226000000000000000000000000000000000003222222222222222222222222222222222222222222
-24000000000000000000000000000000000004222222222222222222222223000000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022222222222222222222222222
-22300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032222222222222222222
-22222222222222223555555555555555555555555555555522222222222222222222222222222222260000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000006222222222222222222222222222250000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000062030022222222222400000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000322222222222222222222222300000000000000000000000000000000000622222222222222222222222222222222222
-22222222230000000000000000000000000000000000052222222222222222222222250000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006222222222222222222
-22222222223000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005222222222222
-22222222222222222222222235555555555555555555555555555555222222222222222222222222222222224000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000042222222222222222222222222222600000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000520202222222222222600000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000006222222222222222222222225000000000000000000000000000000000005222222222222222222222222222
-22222222222222222260000000000000000000000000000000000022222222222222222222222500000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000052222222222
-22222222222222222230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022222
-22222222222222222222222222222222255555555555555555555555555555532222222222222222222222222222222200000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000322222222222222222222222222226000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000004200002222222222224000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000003222222222222222222222260000000000000000000000000000000000042222222222222222222
-22222222222222222222222222500000000000000000000000000000000000422222222222222222222225000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000422
-22222222222222222222222222300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00422222222222222222222222222222222222222555555555555555555555555555555322222222222222222222222222222225000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000062222222222222222222222222222200000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000022020222222222222226000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000062222222222222222222223000000000000000000000000000000000000222222222222
-22222222222222222222222222222222223000000000000000000000000000000000005222222222222222222222260000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00000322222222222222222222222222223000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00000000062222222222222222222222222222222222222223555555555555555555555555555552222222222222222222222222222222300000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000422222222222222222222222222223000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000006220000222222222222230000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000032222222222222222222250000000000000000000000000000000000052222
-22222222222222222222222222222222222222222226000000000000000000000000000000000003222222222222222222222000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000062222222222222222222222222222230000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000000322222222222222222222222222222222222222235555555555555555555555555555522222222222222222222222222222226000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000002222222222222222222222222222240000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042202062222222222222250000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000622222222222222222222000000000000000000000000000000000
-00042222222222222222222222222222222222222222222222250000000000000000000000000000000000042222222222222222222230000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000522222222222222222222222222222300000000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000042222222222222222222222222222222222222222255555555555555555555555555553222222222222222222222222222222400
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000522222222222222222222222222222500
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000222000022222222222222260000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000322222222222222222240000000000000000000000000
-00000000000322222222222222222222222222222222222222222222222300000000000000000000000000000000000622222222222222222222400000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000003222222222222222222222222222223000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000005222222222222222222222222222222222222222222555555555555555555555555555532222222222222222222222222
-22222400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002222222222222222222222222
-22222500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000052220000222222222222
-22230000000000000000000000000000000000000000000000000000000000000000000000000000000000000005222222222222222222500000000000000000
-00000000000000000062222222222222222222222222222222222222222222222222000000000000000000000000000000000000322222222222222222225000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000
-00000000000000000000000000000000000622222222222222222222222222222230000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000622222222222222222222222222222222222222222223555555555555555555555555555222222222222222222
-22222222222222360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000422222222222222222
-22222222222226000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000322200002222
-22222222222240000000000000000000000000000000000000000000000000000000000000000000000000000000000000003222222222222222220000000000
-00000000000000000000000000522222222222222222222222222222222222222222222222225000000000000000000000000000000000005222222222222222
-22226000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006230000000000000000000000000
-00000000000000000000000000000000000000000003222222222222222222222222222222300000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000003222222222222222222222222222222222222222222235555555555555555555555555552222222222
-22222222222222222222222246000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000062222222222
-22222222222222222222300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000062222
-00002222222222222222250000000000000000000000000000000000000000000000000000000000000000000000000000000000000052222222222222222400
-00000000000000000000000000000000003222222222222222222222222222222222222222222222222240000000000000000000000000000000000062222222
-22222222222200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032230000000000000000
-00000000000000000000000000000000000000000000000000622222222222222222222222222222223000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000322222222222222222222222222222222222222222222255555555555555555555555555322
-22222222222222222222222222222222225000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000322
-22222222222222222222222222224000000000000000000000000000000000560000000000000000000000000000000000000000000000000000000000000000
-00032222000022222222222222222250000000000000000000000000000000000000000000000000000000000000000000000000000000000000032222222222
-22222500000000000000000000000000000000000022222222222222222222222222222222222222222222222222200000000000000000000000000000000000
-03222222222222222224000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003222230000000
-00000000000000000000000000000000000000000000000000000000003222222222222222222222222222222230000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000042222222222222222222222222222222222222222222222355555555555555555555
-55555222222222222222222222222222222222222222500000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00004222222222222222222222222222222250000000000000000000000000000000005250000000000000000000000000000000000000000000000000000000
-00000000005222220000222222222222222222250000000000000000000000000000000000000000000000000000000000000000000000000000000000000522
-22222222222220000000000000000000000000000000000005222222222222222222222222222222222222222222222222222500000000000000000000000000
-00000000052222222222222222250000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000422222
-23600000000000000000000000000000000000000000000000000000000000000522222222222222222222222222222222300000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000004222222222222222222222222222222222222222222222223555555555555
-55555555555552222222222222222222222222222222222222222350000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000522222222222222222222222222222222600000000000000000000000000000000032236000000000000000000000000000000000000000000000
-00000000000000000622222200002222222222222222222250000000000000000000000000000000000000000000000000000000000000000000000000000000
-00000032222222222222400000000000000000000000000000000000042222222222222222222222222222222222222222222222222224000000000000000000
-00000000000000000022222222222222223000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000000
-05222222222600000000000000000000000000000000000000000000000000000000000052222222222222222222222222222222223000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000422222222222222222222222222222222222222222222222225555
-55555555555555555555322222222222222222222222222222222222222222235000000000000000000000000000000000000000000000000000000000000000
-00000000000000000052222222222222222222222222222222230000000000000000000000000000000000322225000000000000000000000000000000000000
-00000000000000000000000002222222000022222222222222222222240000000000000000000000000000000000000000000000000000000000000000000000
-00000000000006322222222222225000000000000000000000000000000000000222222222222222222222222222222222222222222222222222220000000000
-00000000000000000000000000422222222222222250000000000000000000000000000000000223600000000000000000000000000000000000000000000000
-00000000522222222222500000000000000000000000000000000000000000000000000000000006222222222222222222222222222222222230000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000042222222222222222222222222222222222222222222222
-22223555555555555555555555552222222222222222222222222222222222222222222223500000000000000000000000000000000000000000000000000000
-00000000000000000000000005222222222222222222222222222222222400000000000000000000000000000000002222223600000000000000000000000000
-00000000000000000000000000000000322222220000222222222222222222222240000000000000000000000000000000000000000000000000000000000000
-00000000000000000006322222222222222200000000000000000000000000000000000052222222222222222222222222222222222222222222222222222250
-00000000000000000000000000000000005222222222222222000000000000000000000000000000000062222500000000000000000000000000000000000000
-00000000000000052222222222222400000000000000000000000000000000000000000000000000000000622222222222222222222222222222222222300000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000003222222222222222222222222222222222222222
-22222222222225555555555555555555555322222222222222222222222222222222222222222222222250000000000000000000000000000000000000000000
-00000000000000000000000000000000522222222222222222222222222222222225000000000000000000000000000000000622222222500000000000000000
-00000000000000000000000000000000000000032222222200002222222222222222222222236000000000000000000000000000000000000000000000000000
-00000000000000000000000005322222222222222224000000000000000000000000000000000000422222222222222222222222222222222222222222222222
-22222240000000000000000000000000000000000002222222222222240000000000000000000000000000000000522222500000000000000000000000000000
-00000000000000000000005222222222222222360000000000000000000000000000000000000000000000000000062222222222222222222222222222222222
-22300000000000000000000000000000000066000000000000000000000000000000000000000000000000000000006222222222222222222222222222222222
-22222222222222222222255555555555555555555552222222222222222222222222222222222222222222222222224600000000000000000000000000000000
-00000000000000000000000000000000000000042222222222222222222222222222222222200000000000000000000000000000000005222222222360000000
-00000000000000000000000000000000000000000000003222222222000622222222222222222222222225000000000000000000000000000000000000000000
-00000000000000000000000000000005322222222222222222250000000000000000000000000000000000003222222222222222222222222222222222222222
-22222222222222300000000000000000000000000000000000042222222222222234600000000000000000000000000000003222222360000000000000000000
-00000000000000000000000000000422222222222222222250000000000000000000000000000000000000000000000000005222222222222222222222222222
-22222222223000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000522222222222222222222222222
-22222222222222222222222222222355555555555555555555522222222222222222222222222222222222222222222222222222350000000000000000000000
-00000000000000000000000000000000000000000000063222222222222222222222222222222222223000000000000000000000000000000000042222222222
-25000000000000000000000000000000000000000000000000006322222222220000222222222222222222222222223600000000000000000000000000000000
-00000000000000000000000000000000000065222222222222222222222000000000000000000000000000000000000622222222222222222222222222222222
-22222222222222222222222600000000000000000000000000000000000522222222222222222245600000000000000000000000000022222222250000000000
-00000000000000000000000000000000000632222222222222222222236000000000000000000000000000000000000000000000000522222222222222222222
-22222222222222222230000000000000000000000000000000000225000000000000000000000000000000000000000000000000000632222222222222222222
-22222222222222222222222222222222222222555555555555555555553222222222222222222222222222222222222222222222222222222235600000000000
-00000000000000000000000000000000000000000000000000005222222222222222222222222222222222222222356000000000000000000000000000000222
-22222222223500000000000000000000000000000000000000000000000522222222222202022222222222222222222222222222400000000000000000000000
-00000000000000000000000000000000000000000064222222222222222222222240000000000000000000000000000000000005222222222222222222222222
-22222222222222222222222222222224000000000000000000000000000000000000322222222222222222222345000000000000000000000005222222222236
-00000000000000000000000000000000000000000052222222222222222222222224000000000000000000000000000000000000000000000632222222222222
-22222222222222222222222222300000000000000000000000000000000003225000000000000000000000000000000000000000000000000052222222222222
-22222222222222222222222222222222222222222222223555555555555555555522222222222222222222222222222222222222222222222222222222222450
-00000000000000000000000000000000000000000000000000000000006322222222222222222222222222222222222222222222450000000000000000000000
-00005222222222222222360000000000000000000000000000000000000000000042222222222222000022222222222222222222222222222250000000000000
-00000000000000000000000000000000000000000000000653222222222222222222222222500000000000000000000000000000000000032222222222222222
-22222222222222222222222222222222222222230000000000000000000000000000000000004222222222222222222222222346000000000000000000042222
-22222222360000000000000000000000000000000000000063222222222222222222222222222500000000000000000000000000000000000000000642222222
-22222222222222222222222222222222223000000000000000000000000000000000032223600000000000000000000000000000000000000000000053222222
-22222222222222222222222222222222222222222222222222222225555555555555555553222222222222222222222222222222222222222222222222222222
-22222222460000000000000000000000000000000000000000000000000000006322222222222222222222222222222222222222222222222223560000000000
-00000000000042222222222222222236000000000000000000000000000000000000000052222222222222220202222222222222222222222222222222224600
-00000000000000000000000000000000000000000000000000000542222222222222222222222222222334556600000000000000000000000000000222222222
-22222222222222222222222222222222222222222222222260000000000000000000000000000000000062222222222222222222222222222456000000000000
-00622222222222222235000000000000000000000000000000000064222222222222222222222222222222250000000000000000000000000000000000000642
-22222222222222222222222222222222222222222230000000000000000000000000000000000322222500000000000000000000000000000000000000000053
-22222222222222222222222222222222222222222222222222222222222222235555555555555555522222222222222222222222222222222222222222222222
-22222222222222222234600000000000000000000000000000000000000000000000005322222222222222222222222222222222222222222222222222222224
-50000000000000000000222222222222222222223500000000000000000000000000000000000053222222222222222200002222222222222222222222222222
-22222245000000000000000000000000000000000000000000000000005422222222222222222222222222222222222222223355660000000000000000000052
-22222222222222222222222222222222222222222222222222222222500000000000000000000000000000000000032222222222222222222222222222223450
-00000000005222222222222222223560000000000000000000000000000054222222222222222222222222222222222224500000000000000000000000000000
-00053222222222222222222222222222222222222222222222300000000000000000000000000000000003222222250000000000000000000000000000000000
-00005322222222222222222222222222222222222222222222222222222222222222222255555555555555552222222222222222222222222222222222222222
-22222222222222222222222222222245000000000000000000000000000000000000000000054222222222222222222222222222222222222222222222222222
-22222222223560000000000000052222222222222222222222245000000000000000000000000000000652222222222222222222020222222222222222222222
-22222222222222222450000000000000000000000000000000000000000000653222222222222222222222222222222222222222222222222222334556600000
-00000042222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222346000000022222222222222222222235600000000000000000000000643222222222222222222222222222222222222222245000000000000000000
-00000006542222222222222222222222222222222222222222222222223000000000000000000000000000000000032222222224600000000000000000000000
-00000000054222222222222222222222222222222222222222222222222222222222222222222222255555555555555322222222222222222222222222222222
-22222222222222222222222222222222222222222345600000000000000000000000000000000006542222222222222222222222222222222222222222222222
-22222222222222222222224560000000000322222222222222222222222222356000000000000000000000006532222222222222222222220202222222222222
-22222222222222222222222222224560000000000000000000000000000000000065322222222222222222222222222222222222222222222222222222222222
-22222335556600222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222456004222222222222222222222222245660000000000000665422222222222222222222222222222222222222222222222345600000
-00000000006654322222222222222222222222222222222222222222222222222230000000000000000000000000000000000322222222222346000000000000
-00000000000006542222222222222222222222222222222222222222222222222222222222222222222222222255555555555532222222222222222222222222
-22222222222222222222222222222222222222222222222222222335560000000000000000000000000654322222222222222222222222222222222222222222
-22222222222222222222222222222222234600000052222222222222222222222222222222345600000000000000654322222222222222222222222202022222
-22222222222222222222222222222222222222223556000000000000000000000000655332222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222223422222222222222222222222222222223333455333322222222222222222222222222222222222222222222222222222
-22222333345543332222222222222222222222222222222222222222222222222222222222300000000000000000000000000000000004222222222222222345
-60000000000000006553222222222222222222222222222222222222222222222222222222222222222222222222222222355555555553222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222335555666666666555433222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222245600322222222222222222222222222222222222223333554333222222222222222222222222222222
-02022222222222222222222222222222222222222222222222222233555566666655555333222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222223000000000000000000000000000000000052222222222
-22222222222333333333332222222222222222222222222222222222222222222222222222222222222222222222222222222222222355555555322222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222332222222222222222222222222222222222222222222222222222222222222222222222
-22222222020222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222230000000000000000000000000000000000522
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222235555532222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222220202222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222300000000000000000000000000000
-00000522222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-32222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222202022222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223000000000000000000000
-00000000000005222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222020222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222230000000000000
-00000000000000000000052222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222220202222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222300000
-00000000000000000000000000000522222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222202022222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22300000000000000000000000000000000005222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222020222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222223000000000000000000000000000000000052222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222220202222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222230000000000000000000000000000000000522222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222200002222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222300000000000000000000000000000000005222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222020222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222223000000000000000000000000000000000052222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222220000222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222230000000000000000000000000000000000522222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222202022222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222300000000000000000000000000000000005222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222000022222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222223000000000000000000000000000000000052222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222220202222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222230000000000000000000000000000000000522222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222200002222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222300000000000000000000000000000000005222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-00002222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222223000000000000000000000000000000000052222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222000022222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222230000000000000000000000000000000000522
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222220000222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222300000000000000000000000000000
-00000522222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222244444
-44444422222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222200002222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223000000000000000000000
-00000000000005222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-44444444444444442222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222000022222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222230000000000000
-00000000000000000000052222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222224444444444444444444222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222220000222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222300000
-00000000000000000000000000000522222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222224444444444444444444444422222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222200002222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22300000000000000000000000000000000005222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222444444444444444444444444422222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222000022222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222223000000000000000000000000000000000052222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222244444444444444444444444444422222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222220000222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222230000000000000000000000000000000000522222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222224444444444444444444444444444422222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222200022222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222300000000000000000000000000000000005222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222444444444444444444444444444444222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222000022222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222223000000000000000000000000000000000052222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222224444444444444444444444444444444222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222220202222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222230000000000000000000000000000000000522222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222444444444444444444444444444444444222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222200002222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222300000000000000000000000000000000005222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222224444444444444444444444444444444442222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222020222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222224000000000000000000000000000000000052222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222444444444444444444444444444444444422222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222220000222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222250000000000000000000000000000000000522222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222224444444444444444444444444444444444422222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222202022222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222500000000000000000000000000000000005222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222244444444444444444444444444444444444222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-00062222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222225000000000000000000000000000000000052222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222224444444444444444444444444444444444
-44222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222020222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222250000000000000000000000000000000000522
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222244444444444444444444444444
-44444444442222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222220202222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222500000000000000000000000000000
-00000522222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222444444444444444444
-44444444444444444442222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222202022222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222226000000000000000000000
-00000000000005222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222224444444444
-44444444444444444444444444422222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222020222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222260000000000000
-00000000000000000000032222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222244
-44444444444444444444444444444444444222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222220202222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222000000
-00000000000000000000000000000322222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222244444444444444444444444444444444444442222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222202022222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22000000000000000000000000000000000003222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222444444444444444444444444444444444444222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222030022222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222220000000000000000000000000000000000032222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222224444444444444444444444444444444444442222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222220202222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222300000000000000000000000000000000000322222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222224444444444444444444444444444444444422222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222200002222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222224000000000000000000000000000000000003222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222244444444444444444444444444444444444222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222020222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222250000000000000000000000000000000000032222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222444444444444444444444444444444444422222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222220000222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222500000000000000000000000000000000000322222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222444444444444444444444444444444444222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222202022222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222226000000000000000000000000000000000002222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222224444444444444444444444444444444442222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222000022222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222200000000000000000000000000000000000022222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222224444444444444444444444444444444222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222220000222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222223000000000000000000000000000000000000222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222244444444444444444444444444444422222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222200002222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222240000000000000000000000000000000000002222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222244444444444444444444444444444222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-00002222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222223456000000000000000000000000000000622222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222244444444444444444444444444422
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222000022222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222456000000000000000000000000006222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222244444444444444444444
-44444222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222220000222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222356000000000000000000
-00006222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222244444444444
-44444444444422222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222200002222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222345600000
-00000000000052222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222224
-44444444444444444422222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222000022222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22234560000000000000522222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222244444444444444422222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222220000222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222224560000000004222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222224444444444422222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222200002222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222223450000032222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222000022222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222223456322222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222220000222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
-222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222220202040000002701ffff030000000000}}}{\insrsid2495527 
-
-\par }\pard\plain \s15\ql \li0\ri0\sb60\sa60\widctlpar\brdrb\brdrs\brdrw15\brsp20 \tqc\tx4153\tqr\tx9639\wrapdefault\faauto\rin0\lin0\itap0 \f1\fs16\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid2495527 \line \line \line \line }{\field{\*\fldinst 
-{\b\insrsid2495527  REF Doc_Issuing_Office \\* MERGEFORMAT}}{\fldrslt {\b\insrsid10304687\charrsid10304687 SLN}}}\sectd \linex0\endnhere\sectdefaultcl\sftnbj {\b\insrsid2495527 .}{\field{\*\fldinst {\b\insrsid2495527  REF Doc_Context_Project  \\
-* MERGEFORMAT }}{\fldrslt {\b\lang1024\langfe1024\noproof\insrsid10304687\charrsid10304687 AAA}}}\sectd \linex0\endnhere\sectdefaultcl\sftnbj {\field{\*\fldinst {\b\insrsid2495527  REF Doc_Context_Number  \\* MERGEFORMAT }}{\fldrslt {
-\b\lang1024\langfe1024\noproof\insrsid10304687\charrsid10304687 NNN}}}\sectd \linex0\endnhere\sectdefaultcl\sftnbj {\b\insrsid2495527 .}{\field{\*\fldinst {\b\insrsid2495527  REF Doc_Object_Number  \\* MERGEFORMAT }}{\fldrslt {
-\b\lang1024\langfe1024\noproof\insrsid10304687\charrsid10304687 NNNN}}}\sectd \linex0\endnhere\sectdefaultcl\sftnbj {\b\insrsid2495527 , Rev }{\field{\*\fldinst {\b\insrsid2495527  REF Doc_Version_Number  \\* MERGEFORMAT }}{\fldrslt {
-\b\lang1024\langfe1024\noproof\insrsid10304687\charrsid10304687 NNNN.NN}}}\sectd \linex0\endnhere\sectdefaultcl\sftnbj {\b\insrsid2495527 \tab \tab }{\field{\*\fldinst {\b\insrsid2495527  REF Doc_Title  \\* MERGEFORMAT }}{\fldrslt {
-\b\insrsid10304687\charrsid10304687 Sampling Profiler For}{\b\fs28\insrsid10304687  EPOC Devices}}}\sectd \linex0\endnhere\sectdefaultcl\sftnbj {\b\insrsid2495527 \line }{\field{\*\fldinst {\b\insrsid2495527  REF Doc_Status  \\* MERGEFORMAT }}{\fldrslt {
-\b\insrsid10304687\charrsid10304687 REVIEW}}}\sectd \linex0\endnhere\sectdefaultcl\sftnbj {\b\insrsid2495527 , }{\b\insrsid481371 {\*\xmlopen\xmlns1{\factoidname date}{\xmlattr\xmlattrns0{\xmlattrname Month}{\xmlattrvalue 7}}{\xmlattr\xmlattrns0
-{\xmlattrname Day}{\xmlattrvalue 9}}{\xmlattr\xmlattrns0{\xmlattrname Year}{\xmlattrvalue 2007}}}0}{\b\insrsid11890070 9}{\b\insrsid481371 /0}{\b\insrsid11890070 7}{\b\insrsid481371 /200}{\b\insrsid11890070 7}{\b\insrsid2495527 {\*\xmlclose}\tab \tab }
-{\field\fldedit{\*\fldinst {\b\insrsid2495527  REF Doc_Owner  \\* MERGEFORMAT }}{\fldrslt }}\sectd \linex0\endnhere\sectdefaultcl\sftnbj {\b\insrsid2495527  - }{\field{\*\fldinst {\b\insrsid2495527  REF Doc_Function  \\* MERGEFORMAT }}{\fldrslt {
-\b\insrsid10304687\charrsid10304687 Development}}}\sectd \linex0\endnhere\sectdefaultcl\sftnbj {\b\insrsid2495527 
-\par }}{\footerr \pard\plain \s16\ql \li0\ri0\sb60\sa60\widctlpar\brdrt\brdrs\brdrw15\brsp20 \tqc\tx4153\tqr\tx9639\wrapdefault\faauto\rin0\lin0\rtlgutter\itap0 \f1\fs16\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid2495527 \'a9 Symbian Ltd. }
-{\field{\*\fldinst {\insrsid2495527  SAVEDATE \\@ "yyyy" \\* MERGEFORMAT }}{\fldrslt {\lang1024\langfe1024\noproof\insrsid11890070 2007}}}\sectd \linex0\endnhere\sectdefaultcl\sftnbj {\insrsid2495527 \tab \tab Pg. }{\field{\*\fldinst {\insrsid2495527 
- PAGE  \\* MERGEFORMAT }}{\fldrslt {\lang1024\langfe1024\noproof\insrsid11890070 14}}}\sectd \linex0\endnhere\sectdefaultcl\sftnbj {\insrsid2495527  of }{\field{\*\fldinst {\insrsid2495527  NUMPAGES  \\* MERGEFORMAT }}{\fldrslt {
-\lang1024\langfe1024\noproof\insrsid11890070 14}}}\sectd \linex0\endnhere\sectdefaultcl\sftnbj {\insrsid2495527 
-\par }}{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}
-{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8
-\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\trowd \irow0\irowband0
-\ts11\trgaph108\trleft-108\trftsWidth1\trftsWidthA3\trwWidthA37\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil 
-\cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8043\clshdrawnil \cellx9744\pard\plain \ql \li0\ri0\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 
-\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\b\f1\fs28\insrsid6226036 Document:\cell {\*\bkmkstart Doc_Title}}{\field\fldedit{\*\fldinst {\b\f1\fs28\insrsid6226036  FORMTEXT }{\b\f1\fs28\insrsid11890070 {\*\datafield 
-800100000000000009446f635f5469746c6500104e616d65204f6620446f63756d656e74000a5469746c652063617365001f456e74657220746865206e616d65206f66207468697320646f63756d656e740021456e74657220746865207469746c65206f66207468697320646f63756d656e742e0000000000}
-{\*\formfield{\fftype0\ffownhelp\ffownstat\fftypetxt0{\*\ffname Doc_Title}{\*\ffdeftext Name Of Document}{\*\ffformat Title case}{\*\ffhelptext Enter the name of this document}{\*\ffstattext Enter the title of this document.}}}}}{\fldrslt {
-\b\f1\fs28\insrsid6226036 Sampling Profiler For EPOC Devices}}}\sectd \psz9\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl\sftnbj {\b\f1\fs28\insrsid6226036 {\*\bkmkend Doc_Title}\cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\b\f1\fs28\insrsid6226036 \trowd \irow0\irowband0
-\ts11\trgaph108\trleft-108\trftsWidth1\trftsWidthA3\trwWidthA37\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil 
-\cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8043\clshdrawnil \cellx9744\row }\trowd \irow1\irowband1
-\ts11\trgaph108\trleft-108\trftsWidth1\trftsWidthA3\trwWidthA38\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil 
-\cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4820\clshdrawnil \cellx6521\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1701\clshdrawnil \cellx8222\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1521\clshdrawnil \cellx9744\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\b\f1\insrsid6226036 Number:\cell {\*\bkmkstart Doc_Issuing_Office}}{\field\flddirty\fldpriv{\*\fldinst {\f1\insrsid6226036  FORMDROPDOWN }{\f1\insrsid11890070 {\*\datafield 
-8a8100000000000012446f635f49737375696e675f4f666669636500000000007f43686f6f7365207468652053796d6269616e2049737375696e67206f66666963653a20534342202d2043616d6272696467652c2053474c202d20476c6f62616c2c20534c4e202d204c6f6e646f6e2c20535259202d20526f6e6e6562792c
-20535346202d2053616e204672616e636973636f2c2053544f202d20546f6b796f003b456e746572207468652049737375696e67204f666669636520636f6465202d20463120666f72206578706c616e6174696f6e206f6620636f646573000000000024000600060000000a000c001000140018001c002000035343420353
-474c03534c4e03535259035353460353544f}{\*\formfield{\fftype2\ffres2\ffownhelp\ffownstat\fftypetxt0\ffhaslistbox{\*\ffname Doc_Issuing_Office}\ffdefres0{\*\ffhelptext 
-Choose the Symbian Issuing office: SCB - Cambridge, SGL - Global, SLN - London, SRY - Ronneby, SSF - San Francisco, STO - Tokyo}{\*\ffstattext Enter the Issuing Office code - F1 for explanation of codes}{\*\ffl SCB}{\*\ffl SGL}{\*\ffl SLN}{\*\ffl SRY}
-{\*\ffl SSF}{\*\ffl STO}}}}}{\fldrslt }}\sectd \psz9\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl\sftnbj {\f1\insrsid6226036 {\*\bkmkend Doc_Issuing_Office}.{\*\bkmkstart Doc_Context_Project}}{\field{\*\fldinst {\f1\insrsid6226036 
- FORMTEXT }{\f1\insrsid11890070 {\*\datafield 
-800103000000000013446f635f436f6e746578745f50726f6a656374000341414100095570706572636173650040456e7465722074686520646f63756d656e7420636f6e746578742070726f6a6563742067726f75702028746872656520746578742063686172616374657273290038456e7465722074686520646f63756d
-656e7420636f6e746578742070726f6a6563742067726f757072202d20463120666f722068656c702e0000000000}{\*\formfield{\fftype0\ffownhelp\ffownstat\fftypetxt0\ffmaxlen3{\*\ffname Doc_Context_Project}{\*\ffdeftext AAA}{\*\ffformat Uppercase}{\*\ffhelptext 
-Enter the document context project group (three text characters)}{\*\ffstattext Enter the document context project groupr - F1 for help.}}}}}{\fldrslt {\f1\lang1024\langfe1024\noproof\insrsid6226036 AAA}}}\sectd 
-\psz9\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl\sftnbj {\*\bkmkstart Doc_Context_Number}{\*\bkmkend Doc_Context_Project}{\field{\*\fldinst {\f1\insrsid6226036  FORMTEXT }{\f1\insrsid11890070 {\*\datafield 
-800103000000000012446f635f436f6e746578745f4e756d62657200034e4e4e00095570706572636173650041456e7465722074686520646f63756d656e7420636f6e746578742070726f6a6563742073657175656e6365206e756d6265722028746872656520646967697473290041456e7465722074686520646f63756d
-656e7420636f6e746578742070726f6a6563742073657175656e6365206e756d626572202d20463120666f722068656c702e0000000000}{\*\formfield{\fftype0\ffownhelp\ffownstat\fftypetxt0\ffmaxlen3{\*\ffname Doc_Context_Number}{\*\ffdeftext NNN}{\*\ffformat Uppercase}
-{\*\ffhelptext Enter the document context project sequence number (three digits)}{\*\ffstattext Enter the document context project sequence number - F1 for help.}}}}}{\fldrslt {\f1\lang1024\langfe1024\noproof\insrsid6226036 NNN}}}\sectd 
-\psz9\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl\sftnbj {\f1\insrsid6226036 {\*\bkmkend Doc_Context_Number}.{\*\bkmkstart Doc_Object_Number}}{\field{\*\fldinst {\f1\insrsid6226036  FORMTEXT }{\f1\insrsid11890070 {\*\datafield 
-800100000000000011446f635f4f626a6563745f4e756d62657200044e4e4e4e00095570706572636173650046456e7465722074686520646f63756d656e74206f626a6563742073657175656e6365206e756d6265722028756e6c696d69746564206e756d626572206f6620646967697473290038456e7465722074686520
-646f63756d656e74206f626a6563742073657175656e6365206e756d626572202d20463120666f722068656c702e0000000000}{\*\formfield{\fftype0\ffownhelp\ffownstat\fftypetxt0{\*\ffname Doc_Object_Number}{\*\ffdeftext NNNN}{\*\ffformat Uppercase}{\*\ffhelptext 
-Enter the document object sequence number (unlimited number of digits)}{\*\ffstattext Enter the document object sequence number - F1 for help.}}}}}{\fldrslt {\f1\lang1024\langfe1024\noproof\insrsid6226036 NNNN}}}\sectd 
-\psz9\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl\sftnbj {\f1\insrsid6226036 {\*\bkmkend Doc_Object_Number}/{\*\bkmkstart Doc_Version_Number}}{\field{\*\fldinst {\f1\insrsid6226036  FORMTEXT }{\f1\insrsid11890070 {\*\datafield 
-800100000000000012446f635f56657273696f6e5f4e756d62657200074e4e4e4e2e4e4e0009557070657263617365006c456e7465722074686520646f63756d656e742076657273696f6e206e756d62657220696e2074686520666f6c6c6f77696e6720666f726d3a206e6e6e6e2e6e6e2e20557064617465207468652044
-6f63756d656e7420486973746f7279207461626c652061732077656c6c2e0030456e7465722074686520646f63756d656e742076657273696f6e206e756d626572202d20463120666f722068656c702e0000000000}{\*\formfield{\fftype0\ffownhelp\ffownstat\fftypetxt0{\*\ffname Doc_Version_Number}
-{\*\ffdeftext NNNN.NN}{\*\ffformat Uppercase}{\*\ffhelptext Enter the document version number in the following form: nnnn.nn. Update the Document History table as well.}{\*\ffstattext Enter the document version number - F1 for help.}}}}}{\fldrslt {
-\f1\lang1024\langfe1024\noproof\insrsid6226036 NNNN.NN}}}\sectd \psz9\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl\sftnbj {\b\f1\insrsid6226036 {\*\bkmkend Doc_Version_Number}\cell Status:\cell {\*\bkmkstart Doc_Status}}
-{\field\flddirty\fldpriv{\*\fldinst {\f1\insrsid6226036  FORMDROPDOWN }{\f1\insrsid11890070 {\*\datafield 
-86810000000000000a446f635f53746174757300000000002143686f6f73652074686520737461747573206f662074686520646f63756d656e74003443686f6f7365207374617475732066726f6d207468652064726f7020646f776e206c697374202d20463120666f722068656c702e00000000001a000300030000000a00
-06000c0013000544524146540652455649455706495353554544}{\*\formfield{\fftype2\ffres1\ffownhelp\ffownstat\fftypetxt0\ffhaslistbox{\*\ffname Doc_Status}\ffdefres0{\*\ffhelptext Choose the status of the document}{\*\ffstattext 
-Choose status from the drop down list - F1 for help.}{\*\ffl DRAFT}{\*\ffl REVIEW}{\*\ffl ISSUED}}}}}{\fldrslt }}\sectd \psz9\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl\sftnbj {\b\f1\insrsid6226036 {\*\bkmkend Doc_Status}\cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\f1\insrsid6226036 \trowd \irow1\irowband1\ts11\trgaph108\trleft-108\trftsWidth1\trftsWidthA3\trwWidthA38\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 
-\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth4820\clshdrawnil \cellx6521\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1701\clshdrawnil \cellx8222\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb
-\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1521\clshdrawnil \cellx9744\row }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\b\f1\insrsid6226036 Owner:\cell }{\f1\insrsid6372845 Dennis May}{\b\f1\insrsid6226036 \cell 
-Last Revised:\cell }{\f1\insrsid9120167 {\*\xmlopen\xmlns1{\factoidname date}{\xmlattr\xmlattrns0{\xmlattrname Month}{\xmlattrvalue 7}}{\xmlattr\xmlattrns0{\xmlattrname Day}{\xmlattrvalue 9}}{\xmlattr\xmlattrns0{\xmlattrname Year}{\xmlattrvalue 2007}}}0}{
-\f1\insrsid11890070 9}{\f1\insrsid9120167 /0}{\f1\insrsid11890070 7}{\f1\insrsid8289572 /200}{\f1\insrsid11890070 7}{\b\f1\insrsid6226036 {\*\xmlclose}\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {
-\f1\insrsid6226036 \trowd \irow2\irowband2\ts11\trgaph108\trleft-108\trftsWidth1\trftsWidthA3\trwWidthA38\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4820\clshdrawnil \cellx6521\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb
-\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1701\clshdrawnil \cellx8222\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1521\clshdrawnil \cellx9744\row }\trowd \irow3\irowband3
-\ts11\trgaph108\trleft-108\trftsWidth1\trftsWidthA3\trwWidthA38\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil 
-\cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8042\clshdrawnil \cellx9744\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\b\f1\insrsid6226036 Function:\cell 
-{\*\bkmkstart Doc_Function}}{\field\flddirty\fldpriv{\*\fldinst {\f1\insrsid6226036  FORMDROPDOWN }{\f1\insrsid11890070 {\*\datafield 
-8a810000000000000c446f635f46756e6374696f6e00000000004743686f6f736520746865206e616d65206f6620746865206f7267616e69736174696f6e616c2066756e6374696f6e2074686174206f776e73207468697320646f63756d656e742e004743686f6f736520746865206e616d65206f6620746865206f726761
-6e69736174696f6e616c2066756e6374696f6e2074686174206f776e73207468697320646f63756d656e742e0000000000d9000c000c0000000a00180027003b00470052005a006e0080009700a900b400c4000e41646d696e697374726174696f6e1344657369676e202620546563686e6f6c6f67790b446576656c6f706d
-656e740a466163696c69746965730746696e616e636513496e666f726d6174696f6e20537570706f7274114d61726b6574696e6720262053616c6573164f7267616e69736174696f6e616c20537570706f7274114f7065726174696f6e616c20426f6172640a50726f6772616d6d65730f48756d616e205265736f75726365
-7314546563686e6963616c20436f6e73756c74696e67}{\*\formfield{\fftype2\ffres2\ffownhelp\ffownstat\fftypetxt0\ffhaslistbox{\*\ffname Doc_Function}\ffdefres0{\*\ffhelptext Choose the name of the organisational function that owns this document.}{\*\ffstattext 
-Choose the name of the organisational function that owns this document.}{\*\ffl Administration}{\*\ffl Design & Technology}{\*\ffl Development}{\*\ffl Facilities}{\*\ffl Finance}{\*\ffl Information Support}{\*\ffl Marketing & Sales}{\*\ffl 
-Organisational Support}{\*\ffl Operational Board}{\*\ffl Programmes}{\*\ffl Human Resources}{\*\ffl Technical Consulting}}}}}{\fldrslt }}\sectd \psz9\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl\sftnbj {\b\f1\insrsid6226036 
-{\*\bkmkend Doc_Function}\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\f1\insrsid6226036 \trowd \irow3\irowband3
-\ts11\trgaph108\trleft-108\trftsWidth1\trftsWidthA3\trwWidthA38\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil 
-\cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8042\clshdrawnil \cellx9744\row }\trowd \irow4\irowband4\ts11\trgaph108\trleft-108\trbrdrb\brdrs\brdrw15 
-\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl
-\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8080\clshdrawnil \cellx9782\pard\plain \s17\ql \li0\ri0\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 \fs22\lang2057\langfe2057\kerning28\cgrid\langnp2057\langfenp2057 {
-\b\f1\fs20\kerning0\insrsid6226036 Contributors:\cell {\*\bkmkstart Doc_Contributors}}{\field\fldedit{\*\fldinst {\f1\insrsid6226036  FORMTEXT }{\f1\insrsid11890070 {\*\datafield 
-800100000000000010446f635f436f6e7472696275746f727300144c697374204f6620436f6e7472696275746f7273000a5469746c6520636173650033456e7465722074686520746865206c697374206f6620636f6e7472696275746f727320746f2074686520646f63756d656e742e0033456e7465722074686520746865
-206c697374206f6620636f6e7472696275746f727320746f2074686520646f63756d656e742e0000000000}{\*\formfield{\fftype0\ffownhelp\ffownstat\fftypetxt0{\*\ffname Doc_Contributors}{\*\ffdeftext List Of Contributors}{\*\ffformat Title case}{\*\ffhelptext 
-Enter the the list of contributors to the document.}{\*\ffstattext Enter the the list of contributors to the document.}}}}}{\fldrslt {\f1\lang1024\langfe1024\noproof\insrsid6226036 Adam Stevenson}}}\sectd 
-\psz9\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl\sftnbj {\f1\insrsid6372845 {\*\bkmkend Doc_Contributors}, Djordje Kovacevic}{\f1\insrsid9120167 , Mark Tai}{\insrsid6226036 \cell }\pard\plain 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\b\insrsid6226036 \trowd \irow4\irowband4\ts11\trgaph108\trleft-108\trbrdrb\brdrs\brdrw15 
-\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl
-\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8080\clshdrawnil \cellx9782\row }\pard\plain \s17\ql \li0\ri0\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 \fs22\lang2057\langfe2057\kerning28\cgrid\langnp2057\langfenp2057 {
-\b\f1\fs20\kerning0\insrsid6226036 Key Reviewers:\cell {\*\bkmkstart Doc_Reviewers}}{\field\fldedit{\*\fldinst {\f1\insrsid6226036  FORMTEXT }{\f1\insrsid11890070 {\*\datafield 
-80010000000000000d446f635f52657669657765727300154c697374204f66204b657920526576696577657273000a5469746c6520636173650049456e74657220746865206c697374206f6620746865206b657920726576696577657273206f662074686520646f63756d656e742c2073657061726174656420627920636f
-6d6d61732e0030456e74657220746865206c697374206f66206b657920726576696577657273206f662074686520646f63756d656e742e0000000000}{\*\formfield{\fftype0\ffownhelp\ffownstat\fftypetxt0{\*\ffname Doc_Reviewers}{\*\ffdeftext List Of Key Reviewers}{\*\ffformat 
-Title case}{\*\ffhelptext Enter the list of the key reviewers of the document, separated by commas.}{\*\ffstattext Enter the list of key reviewers of the document.}}}}}{\fldrslt {\f1\insrsid6226036 \u8194\'20\u8194\'20\u8194\'20\u8194\'20\u8194\'20}}}
-\sectd \psz9\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl\sftnbj {\f1\insrsid6372845 {\*\bkmkend Doc_Reviewers}Oleg Isakov}{\insrsid6226036 \cell }\pard\plain 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\b\insrsid6226036 \trowd \irow5\irowband5\ts11\trgaph108\trleft-108\trbrdrb\brdrs\brdrw15 
-\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl
-\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8080\clshdrawnil \cellx9782\row }\pard\plain \s17\ql \li0\ri0\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 \fs22\lang2057\langfe2057\kerning28\cgrid\langnp2057\langfenp2057 {
-\b\f1\fs20\kerning0\insrsid6226036 Distribution\cell {\*\bkmkstart Doc_Distribution}}{\field\fldedit{\*\fldinst {\f1\insrsid6226036  FORMTEXT }{\f1\insrsid11890070 {\*\datafield 
-800100000000000010446f635f446973747269627574696f6e0011446973747269627574696f6e204c697374000a5469746c6520636173650069456e74657220746865206c697374206f66207468652070656f706c65206f72206a6f622066756e6374696f6e732074686520646f63756d656e742073686f756c6420626520
-646973747269627574656420746f2c2073657061726174656420627920636f6d6d61732e0069456e74657220746865206c697374206f66207468652070656f706c65206f72206a6f622066756e6374696f6e732074686520646f63756d656e742073686f756c6420626520646973747269627574656420746f2c2073657061
-726174656420627920636f6d6d61732e0000000000}{\*\formfield{\fftype0\ffownhelp\ffownstat\fftypetxt0{\*\ffname Doc_Distribution}{\*\ffdeftext Distribution List}{\*\ffformat Title case}{\*\ffhelptext 
-Enter the list of the people or job functions the document should be distributed to, separated by commas.}{\*\ffstattext Enter the list of the people or job functions the document should be distributed to, separated by commas.}}}}}{\fldrslt {
-\insrsid5055728 \u8194\'20\u8194\'20\u8194\'20\u8194\'20\u8194\'20}}}\sectd \psz9\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl\sftnbj {\insrsid6226036 {\*\bkmkend Doc_Distribution}\cell }\pard\plain 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\b\insrsid6226036 \trowd \irow6\irowband6\ts11\trgaph108\trleft-108\trbrdrb\brdrs\brdrw15 
-\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl
-\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8080\clshdrawnil \cellx9782\row }\trowd \irow7\irowband7\lastrow \ts11\trgaph108\trleft-108\trbrdrb\brdrs\brdrw15 
-\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl
-\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4820\clshdrawnil \cellx6521\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1701\clshdrawnil \cellx8222
-\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1559\clshdrawnil \cellx9782\pard\plain \s17\ql \li0\ri0\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 
-\fs22\lang2057\langfe2057\kerning28\cgrid\langnp2057\langfenp2057 {\b\f1\fs20\kerning0\insrsid6226036 Approved By:\cell {\*\bkmkstart Doc_Approval_Name}}{\field{\*\fldinst {\f1\insrsid6226036  FORMTEXT }{\f1\insrsid11890070 {\*\datafield 
-800100000000000011446f635f417070726f76616c5f4e616d65001a4e616d65204f6620417070726f76616c20417574686f72697479000a5469746c6520636173650029456e74657220746865206e616d65206f662074686520617070726f76616c20617574686f726974792e0029456e74657220746865206e616d65206f
-662074686520617070726f76616c20617574686f726974792e0000000000}{\*\formfield{\fftype0\ffownhelp\ffownstat\fftypetxt0{\*\ffname Doc_Approval_Name}{\*\ffdeftext Name Of Approval Authority}{\*\ffformat Title case}{\*\ffhelptext 
-Enter the name of the approval authority.}{\*\ffstattext Enter the name of the approval authority.}}}}}{\fldrslt {\f1\lang1024\langfe1024\noproof\insrsid6226036 Name Of Approval Authority}}}\sectd 
-\psz9\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl\sftnbj {\insrsid6226036 {\*\bkmkend Doc_Approval_Name}\cell }{\b\f1\fs20\kerning0\insrsid6226036 Approval Ref.:\cell {\*\bkmkstart Doc_Approval_Ref}}{\field{\*\fldinst {\f1\insrsid6226036 
- FORMTEXT }{\f1\insrsid11890070 {\*\datafield 
-800100000000000010446f635f417070726f76616c5f526566000c417070726f76616c20526566000a5469746c6520636173650026456e7465722074686520646f63756d656e7420617070726f76616c207265666572656e63652e0026456e7465722074686520646f63756d656e7420617070726f76616c20726566657265
-6e63652e0000000000}{\*\formfield{\fftype0\ffownhelp\ffownstat\fftypetxt0{\*\ffname Doc_Approval_Ref}{\*\ffdeftext Approval Ref}{\*\ffformat Title case}{\*\ffhelptext Enter the document approval reference.}{\*\ffstattext 
-Enter the document approval reference.}}}}}{\fldrslt {\f1\lang1024\langfe1024\noproof\insrsid6226036 Approval Ref}}}\sectd \psz9\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl\sftnbj {\insrsid6226036 {\*\bkmkend Doc_Approval_Ref}\cell 
-}\pard\plain \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\b\insrsid6226036 \trowd \irow7\irowband7\lastrow \ts11\trgaph108\trleft-108\trbrdrb\brdrs\brdrw15 
-\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl
-\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4820\clshdrawnil \cellx6521\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1701\clshdrawnil \cellx8222
-\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1559\clshdrawnil \cellx9782\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\insrsid6226036 
-\par }\pard\plain \s1\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \b\f1\fs24\lang2057\langfe2057\kerning28\cgrid\langnp2057\langfenp2057 {\ul\cf6\insrsid6226036 \sect }\sectd 
-\psz9\sbknone\linex0\headery709\footery709\colsx709\endnhere\sectunlocked1\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnqc\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnqc\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3
-\pndec\pnqc\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnqc\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnqc\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnqc\pnstart1\pnindent720\pnhang 
-{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnqc\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnqc\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnqc\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}
-\pard\plain \s1\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \b\f1\fs24\lang2057\langfe2057\kerning28\cgrid\langnp2057\langfenp2057 {\insrsid6226036 {\*\bkmkstart _Toc420414641}Introduction
-{\*\bkmkend _Toc420414641}
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 {\*\bkmkstart _Toc420154979}{\*\bkmkstart _Toc420156457}
-{\*\bkmkstart _Toc420414642}Purpose and scope{\*\bkmkend _Toc420154979}{\*\bkmkend _Toc420156457}{\*\bkmkend _Toc420414642}
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 
-This document describes the use of the sampling and analysis tools that can be used to profile execution on EPOC devices.}{\cf6\insrsid6226036 {\*\bkmkstart _Toc419889484}{\*\bkmkstart _Toc420414643}
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 References{\*\bkmkend _Toc419889484}{\*\bkmkend _Toc420414643}
-\par {\*\bkmkstart _Toc419889485}{\*\bkmkstart _Toc420414644}Open Issues{\*\bkmkend _Toc419889485}{\*\bkmkend _Toc420414644}
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 The following issues need to be resolved before this document is completed.
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid678217 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid678217 Abbrevations
-\par }\trowd \irow0\irowband0\ts25\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb
-\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth8046\clshdrawnil \cellx9747
-\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\yts25 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid678217 XIP image\cell eXecuteInPlace ROM image. The executables are }{\insrsid481371 executed}{
-\insrsid678217  from the place they are stored. Their run addresses are decided during rombuild process. NOR Flash is }{\insrsid2495527 an example of }{\insrsid678217 XIP media.\cell }\pard\plain 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid678217 \trowd \irow0\irowband0\ts25\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 
-\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb
-\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth8046\clshdrawnil \cellx9747
-\row }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\yts25 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid678217 non-XIP image\cell 
-The executables of the non-XIP image are copied into RAM before being run. Their run addresses are decided during run time. NAND Flash is }{\insrsid2495527 an example }{\insrsid678217 non-XIP media.\cell }\pard\plain 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid678217 \trowd \irow1\irowband1\lastrow \ts25\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl
-\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb
-\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth8046\clshdrawnil \cellx9747
-\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\insrsid678217 
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 {\*\bkmkstart _Toc419889486}{\*\bkmkstart _Toc420414645}
-Document History{\*\bkmkend _Toc419889486}{\*\bkmkend _Toc420414645}
-\par }\trowd \irow0\irowband0\ts11\trgaph108\trleft0\trhdr\trbrdrt\brdrs\brdrw15\brdrcf1 \trbrdrl\brdrs\brdrw15\brdrcf1 \trbrdrb\brdrs\brdrw15\brdrcf1 \trbrdrr\brdrs\brdrw15\brdrcf1 \trbrdrh\brdrs\brdrw15\brdrcf1 \trbrdrv\brdrs\brdrw15\brdrcf1 
-\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 
-\clshdng6000\cltxlrtb\clftsWidth3\clwWidth1276\clshdngraw6000 \cellx1276\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 
-\clshdng6000\cltxlrtb\clftsWidth3\clwWidth974\clshdngraw6000 \cellx2250\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 
-\clshdng6000\cltxlrtb\clftsWidth3\clwWidth973\clshdngraw6000 \cellx3223\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 
-\clshdng6000\cltxlrtb\clftsWidth3\clwWidth5709\clshdngraw6000 \cellx8932\pard\plain \s18\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 \b\fs21\cf8\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Date\cell Version
-\cell Status\cell Description\cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 \trowd \irow0\irowband0
-\ts11\trgaph108\trleft0\trhdr\trbrdrt\brdrs\brdrw15\brdrcf1 \trbrdrl\brdrs\brdrw15\brdrcf1 \trbrdrb\brdrs\brdrw15\brdrcf1 \trbrdrr\brdrs\brdrw15\brdrcf1 \trbrdrh\brdrs\brdrw15\brdrcf1 \trbrdrv\brdrs\brdrw15\brdrcf1 
-\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 
-\clshdng6000\cltxlrtb\clftsWidth3\clwWidth1276\clshdngraw6000 \cellx1276\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 
-\clshdng6000\cltxlrtb\clftsWidth3\clwWidth974\clshdngraw6000 \cellx2250\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 
-\clshdng6000\cltxlrtb\clftsWidth3\clwWidth973\clshdngraw6000 \cellx3223\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 
-\clshdng6000\cltxlrtb\clftsWidth3\clwWidth5709\clshdngraw6000 \cellx8932\row }\trowd \irow1\irowband1\ts11\trgaph108\trleft0\trbrdrt\brdrs\brdrw15\brdrcf1 \trbrdrl\brdrs\brdrw15\brdrcf1 \trbrdrb\brdrs\brdrw15\brdrcf1 \trbrdrr\brdrs\brdrw15\brdrcf1 
-\trbrdrh\brdrs\brdrw15\brdrcf1 \trbrdrv\brdrs\brdrw15\brdrcf1 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr
-\brdrs\brdrw15\brdrcf1 \cltxlrtb\clftsWidth3\clwWidth1276\clshdrawnil \cellx1276\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 
-\cltxlrtb\clftsWidth3\clwWidth974\clshdrawnil \cellx2250\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 \cltxlrtb\clftsWidth3\clwWidth973\clshdrawnil \cellx3223
-\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 \cltxlrtb\clftsWidth3\clwWidth5709\clshdrawnil \cellx8932\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 {\*\xmlopen\xmlns1{\factoidname date}{\xmlattr\xmlattrns0{\xmlattrname Month}{\xmlattrvalue 9}}{\xmlattr\xmlattrns0{\xmlattrname Day}{\xmlattrvalue 27}}
-{\xmlattr\xmlattrns0{\xmlattrname Year}{\xmlattrvalue 2000}}}27/09/2000{\*\xmlclose}\cell }\pard \qc \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 0.01\cell }\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 Draft\cell \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow1\irowband1
-\ts11\trgaph108\trleft0\trbrdrt\brdrs\brdrw15\brdrcf1 \trbrdrl\brdrs\brdrw15\brdrcf1 \trbrdrb\brdrs\brdrw15\brdrcf1 \trbrdrr\brdrs\brdrw15\brdrcf1 \trbrdrh\brdrs\brdrw15\brdrcf1 \trbrdrv\brdrs\brdrw15\brdrcf1 
-\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 
-\cltxlrtb\clftsWidth3\clwWidth1276\clshdrawnil \cellx1276\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 \cltxlrtb\clftsWidth3\clwWidth974\clshdrawnil \cellx2250
-\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 \cltxlrtb\clftsWidth3\clwWidth973\clshdrawnil \cellx3223\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl
-\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 \cltxlrtb\clftsWidth3\clwWidth5709\clshdrawnil \cellx8932\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6372845 
-{\*\xmlopen\xmlns1{\factoidname date}{\xmlattr\xmlattrns0{\xmlattrname Month}{\xmlattrvalue 5}}{\xmlattr\xmlattrns0{\xmlattrname Day}{\xmlattrvalue 31}}{\xmlattr\xmlattrns0{\xmlattrname Year}{\xmlattrvalue 2005}}}31/05/2005{\*\xmlclose}\cell }\pard 
-\qc \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6372845 0.02\cell }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6372845 Draft\cell }{\insrsid2495527 Added}{\insrsid6372845  non-XIP support
-}{\insrsid2495527  in profiler}{\insrsid6372845 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6372845 \trowd \irow2\irowband2\ts11\trgaph108\trleft0\trbrdrt\brdrs\brdrw15\brdrcf1 \trbrdrl
-\brdrs\brdrw15\brdrcf1 \trbrdrb\brdrs\brdrw15\brdrcf1 \trbrdrr\brdrs\brdrw15\brdrcf1 \trbrdrh\brdrs\brdrw15\brdrcf1 \trbrdrv\brdrs\brdrw15\brdrcf1 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt
-\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 \cltxlrtb\clftsWidth3\clwWidth1276\clshdrawnil \cellx1276\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb
-\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 \cltxlrtb\clftsWidth3\clwWidth974\clshdrawnil \cellx2250\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 
-\cltxlrtb\clftsWidth3\clwWidth973\clshdrawnil \cellx3223\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 \cltxlrtb\clftsWidth3\clwWidth5709\clshdrawnil \cellx8932\row 
-}\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid13524902 {\*\xmlopen\xmlns1{\factoidname date}{\xmlattr\xmlattrns0{\xmlattrname Month}{\xmlattrvalue 9}}{\xmlattr\xmlattrns0{\xmlattrname Day}{\xmlattrvalue 8}}
-{\xmlattr\xmlattrns0{\xmlattrname Year}{\xmlattrvalue 2006}}}08/09/2006{\*\xmlclose}\cell }\pard \qc \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid13524902 0.03\cell }\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid13524902 Draft\cell Added description of \endash drive= option\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {
-\insrsid13524902 \trowd \irow3\irowband3\ts11\trgaph108\trleft0\trbrdrt\brdrs\brdrw15\brdrcf1 \trbrdrl\brdrs\brdrw15\brdrcf1 \trbrdrb\brdrs\brdrw15\brdrcf1 \trbrdrr\brdrs\brdrw15\brdrcf1 \trbrdrh\brdrs\brdrw15\brdrcf1 \trbrdrv\brdrs\brdrw15\brdrcf1 
-\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 
-\cltxlrtb\clftsWidth3\clwWidth1276\clshdrawnil \cellx1276\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 \cltxlrtb\clftsWidth3\clwWidth974\clshdrawnil \cellx2250
-\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 \cltxlrtb\clftsWidth3\clwWidth973\clshdrawnil \cellx3223\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl
-\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 \cltxlrtb\clftsWidth3\clwWidth5709\clshdrawnil \cellx8932\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid11890070 
-{\*\xmlopen\xmlns1{\factoidname date}{\xmlattr\xmlattrns0{\xmlattrname Month}{\xmlattrvalue 7}}{\xmlattr\xmlattrns0{\xmlattrname Day}{\xmlattrvalue 9}}{\xmlattr\xmlattrns0{\xmlattrname Year}{\xmlattrvalue 2007}}}09/07/2007{\*\xmlclose}\cell }\pard 
-\qc \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid11890070 0.04\cell }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid11890070 Draft\cell Changed XIP to non-XIP for }{\cs27\insrsid11890070 
-\endash }{\cs27\insrsid11890070 rofs}{\cs27\insrsid11890070  option. }{\insrsid11890070 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid11890070 \trowd \irow4\irowband4\lastrow 
-\ts11\trgaph108\trleft0\trbrdrt\brdrs\brdrw15\brdrcf1 \trbrdrl\brdrs\brdrw15\brdrcf1 \trbrdrb\brdrs\brdrw15\brdrcf1 \trbrdrr\brdrs\brdrw15\brdrcf1 \trbrdrh\brdrs\brdrw15\brdrcf1 \trbrdrv\brdrs\brdrw15\brdrcf1 
-\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 
-\cltxlrtb\clftsWidth3\clwWidth1276\clshdrawnil \cellx1276\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 \cltxlrtb\clftsWidth3\clwWidth974\clshdrawnil \cellx2250
-\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 \cltxlrtb\clftsWidth3\clwWidth973\clshdrawnil \cellx3223\clvertalt\clbrdrt\brdrs\brdrw15\brdrcf1 \clbrdrl
-\brdrs\brdrw15\brdrcf1 \clbrdrb\brdrs\brdrw15\brdrcf1 \clbrdrr\brdrs\brdrw15\brdrcf1 \cltxlrtb\clftsWidth3\clwWidth5709\clshdrawnil \cellx8932\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\insrsid6226036 
-\par }\pard\plain \s1\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \b\f1\fs24\lang2057\langfe2057\kerning28\cgrid\langnp2057\langfenp2057 {\insrsid6226036 The profiling tool
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 
-The profiler consists of a program running on the target device which periodically samples the PC (program counter) and current thread ID, saving the resulting }{\i\insrsid6226036 trace data}{\insrsid6226036  to a file. This program comprises of:
-\par {\pntext\pard\plain\f3\fs20\insrsid6226036 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard \ql \fi-283\li283\ri0\sb60\sa60\widctlpar\wrapdefault{\*\pn \pnlvlblt\ilvl0\ls1\pnrnot0\pnf3\pnstart1\pnindent283\pnhang {\pntxtb \'b7}}
-\faauto\ls1\rin0\lin283\itap0\pararsid6890489 {\insrsid6226036 a kernel-dependant device driver, currently only ARM targets are supported
-\par {\pntext\pard\plain\f3\fs20\insrsid6226036 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard \ql \fi-283\li283\ri0\sb60\sa60\widctlpar\wrapdefault{\*\pn \pnlvlblt\ilvl0\ls1\pnrnot0\pnf3\pnstart1\pnindent283\pnhang {\pntxtb \'b7}}
-\faauto\ls1\rin0\lin283\itap0\pararsid6890489 {\insrsid6226036 an executable which can be controlled via command line, programmatically by IPC, or through a console interface
-\par {\pntext\pard\plain\f3\fs20\insrsid6226036 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard \ql \fi-283\li283\ri0\sb60\sa60\widctlpar\wrapdefault{\*\pn \pnlvlblt\ilvl0\ls1\pnrnot0\pnf3\pnstart1\pnindent283\pnhang {\pntxtb \'b7}}
-\faauto\ls1\rin0\lin283\itap0\pararsid6890489 {\insrsid6226036 an optional DLL which provides a }{\i\insrsid6226036 hot-key}{\insrsid6226036  UI to replace the default console
-\par }\pard \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\faauto\rin0\lin0\itap0 {\insrsid6226036 
-Currently the sample rate is fixed at 1000Hz, typically generating 3Kb of data per second of processor activity. It can run on a standard build of EPOC (no kernel modifications are required), and does not require changes to the code to be profiled.
-\par }{\insrsid12336355 When profiler runs, it gets all the data from the device driver and stores it in memory. This ultimately becomes a limitation and when the profiler runs out of heap memory, it stops and writes all the data to disk. With a defaul
-t heap that can grow to 1MB and with 3Kb of data per second, the profiler will run for 5-6 minutes before running out of memory and stopping. You can increase the maximum heap size of the profiler in order for it to run longer.
-\par }{\insrsid12218284 The tool also supports profiling of non-XIP executables. It uses Kernel\rquote s debug interface to collects the relevant information regarding non-XIP code segments. In order to do so, Kernel must be built with }{
-\insrsid15342006\charrsid15342006 __DEBUGGER_SUPPORT__}{\insrsid15342006  }{\insrsid12218284 option.}{\insrsid7406415  (Assabet, Lubbock and H2 are all built by default in this way.)}{\insrsid12218284 
-\par }{\insrsid6226036 After }{\insrsid6816192 profiling the trace data file ([drive letter]}{\insrsid6226036 :\\PROFILER.DAT on the device) is transferred to a PC, where it can be processed using a Win32 tool: Analyse. Some of its feature include:
-\par {\pntext\pard\plain\f3\fs20\insrsid6226036 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard \ql \fi-283\li283\ri0\sb60\sa60\widctlpar\wrapdefault{\*\pn \pnlvlblt\ilvl0\ls1\pnrnot0\pnf3\pnstart1\pnindent283\pnhang {\pntxtb \'b7}}
-\faauto\ls1\rin0\lin283\itap0\pararsid6890489 {\insrsid6226036 Providing various reports based on the trace data, including a basic trace listing, a thread/location profile distribution table and a thread/time profile
-\par {\pntext\pard\plain\f3\fs20\insrsid6226036 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard \ql \fi-283\li283\ri0\sb60\sa60\widctlpar\wrapdefault{\*\pn \pnlvlblt\ilvl0\ls1\pnrnot0\pnf3\pnstart1\pnindent283\pnhang {\pntxtb \'b7}}
-\faauto\ls1\rin0\lin283\itap0\pararsid6890489 {\insrsid6226036 A rom symbol file can be used to translate code addresses into DLL or function names
-\par {\pntext\pard\plain\f3\fs20\insrsid6226036 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard \ql \fi-283\li283\ri0\sb60\sa60\widctlpar\wrapdefault{\*\pn \pnlvlblt\ilvl0\ls1\pnrnot0\pnf3\pnstart1\pnindent283\pnhang {\pntxtb \'b7}}
-\faauto\ls1\rin0\lin283\itap0\pararsid6890489 {\insrsid6226036 The trace can be filtered in various ways before generating the report, e.g. restrict analysis to a single thread, process, DLL and/or time interval.
-\par {\pntext\pard\plain\f3\fs20\insrsid6226036 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard \ql \fi-283\li283\ri0\sb60\sa60\widctlpar\wrapdefault{\*\pn \pnlvlblt\ilvl0\ls1\pnrnot0\pnf3\pnstart1\pnindent283\pnhang {\pntxtb \'b7}}
-\faauto\ls1\rin0\lin283\itap0\pararsid6890489 {\insrsid6226036 Output suitable for pasting directly into Excel can be generated to enable simple graphical analysis of the results
-\par }\pard\plain \s1\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \b\f1\fs24\lang2057\langfe2057\kerning28\cgrid\langnp2057\langfenp2057 {\insrsid6226036 \page Using the profiler
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Installing the profiler
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 To 
-generate the profiling trace, the profile program must be installed on the EPOC device (e.g. by copying to a CF card). Three parts of the program need to be installed as follows:
-\par }\trowd \irow0\irowband0\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1668\clshdrawnil \cellx1560\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth2835\clshdrawnil \cellx4395\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb
-\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth5353\clshdrawnil \cellx9748\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\b\insrsid6226036 File\cell Found in\cell Install to\cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\b\insrsid6226036 \trowd \irow0\irowband0\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt
-\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1668\clshdrawnil \cellx1560\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth2835\clshdrawnil \cellx4395\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth5353\clshdrawnil \cellx9748\row }\trowd \irow1\irowband1
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1668\clshdrawnil \cellx1560\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth2835\clshdrawnil \cellx4395\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth5353\clshdrawnil \cellx9748\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 Profiler.exe\cell \\epoc\\release\\}{\i\insrsid6226036 <ABI>}{\insrsid6226036 \\urel\cell \\}{
-\insrsid6372845 s}{\insrsid481371 ys}{\insrsid6226036 \\}{\insrsid6372845 bin}{\insrsid6226036  or other suitable location on the device\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 
-\trowd \irow1\irowband1\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1668\clshdrawnil 
-\cellx1560\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth2835\clshdrawnil \cellx4395\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth5353\clshdrawnil \cellx9748\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 Sampler.ldd\cell \\epoc\\release\\}{\i\insrsid6226036 <A}{\i\insrsid6890489 BI}{\i\insrsid6226036 >}{
-\insrsid6226036 \\urel\cell \\}{\insrsid6372845 s}{\insrsid6226036 ys\\}{\insrsid6372845 bin}{\insrsid6226036 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow2\irowband2
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1668\clshdrawnil \cellx1560\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth2835\clshdrawnil \cellx4395\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth5353\clshdrawnil \cellx9748\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 ProfilerKeys.dll\cell \\epoc\\release\\}{\i\insrsid6226036 <ABI>}{\insrsid6226036 \\urel\cell \\}{
-\insrsid6372845 s}{\insrsid6226036 ys\\}{\insrsid6372845 bin}{\insrsid6226036 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow3\irowband3\lastrow 
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1668\clshdrawnil \cellx1560\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth2835\clshdrawnil \cellx4395\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth5353\clshdrawnil \cellx9748\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid6226036 {\insrsid6226036 In this table, }{\i\insrsid6226036 ABI}{\insrsid6226036 
- refers to the flavour of ARM build required\emdash }{\insrsid6890489 e.g. ARM4. }{\insrsid6226036 The final component\emdash ProfilerKeys.dll\emdash 
-requires the full Window Server to function, thus it is optional and omitting from the installation will cause the profiler to provide a console UI instead of using hot keys.
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Running the profiler
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 To load the profiler, the Profiler.exe program must be execu
-ted on the target device, it then remains loaded until asked to exit.
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Profiler commands
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 The Profiler understands four commands:
-\par }\trowd \irow0\irowband0\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth959\clshdrawnil 
-\cellx851\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8895\clshdrawnil \cellx9746\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\b\insrsid6226036 start\cell }{
-\insrsid6226036 Start sampling, if not already doing so.\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow0\irowband0
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth959\clshdrawnil \cellx851\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8895\clshdrawnil \cellx9746\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\b\insrsid6226036 stop\cell }{
-\insrsid6226036 Stop sampling. If restarted, the new samples are added to the current trace data.\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow1\irowband1
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth959\clshdrawnil \cellx851\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8895\clshdrawnil \cellx9746\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\b\insrsid6226036 close\cell }{
-\insrsid6226036 Stop sampling if necessary and then close the trace data file. If restarted, the current trace data is discarded and a new trace file started. This allows the file to be copied from the internal disk without having to unload the profiler.
-\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow2\irowband2\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth959\clshdrawnil \cellx851\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth8895\clshdrawnil \cellx9746\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\b\insrsid6226036 unload\cell }{\insrsid6226036 
-Stop sampling if necessary and unload the profiler. This first ensures that all trace data is saved before the program exits.\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 
-\trowd \irow3\irowband3\lastrow \ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth959\clshdrawnil \cellx851\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8895\clshdrawnil \cellx9746\row }\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid6372845 {\insrsid6372845 It also accepts the following options:
-\par }\trowd \irow0\irowband0\ts11\trgaph108\trleft-108\trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth7903\clshdrawnil \cellx9746\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid2495527 {\b\insrsid6372845 -noui\cell }{\insrsid6372845 Starts profiler application without }{\insrsid12218284 user interface. }{\insrsid481371 Particularly}{\insrsid12218284  }{
-\insrsid481371 useful}{\insrsid12218284  on eshell window server system}{\insrsid2495527 s}{\insrsid12218284  with no touch sensitive screen.}{\insrsid6372845 
-\par }{\insrsid12218284 In such case, the profiler should be started from the ESHELL by:
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin284\pararsid12218284 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid12218284 start profiler start \endash noui
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid2495527 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid12218284 and stopped by:
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin284\pararsid12218284 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid12218284 profiler exit\cell }\pard\plain 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6372845 \trowd \irow0\irowband0
-\ts11\trgaph108\trleft-108\trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth7903\clshdrawnil \cellx9746\row }\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid2495527 {\b\insrsid6372845 -xiponly\cell }{\insrsid12218284 Suppresses any activity in the tool regarding non-XIP }{\insrsid15342006 support}{\insrsid12218284 
-. This is recommended option when r}{\insrsid2495527 unning the profiler tool on XIP-}{\insrsid12218284 only platforms.}{\insrsid6372845 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6372845 
-\trowd \irow1\irowband1\ts11\trgaph108\trleft-108\trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth7903\clshdrawnil \cellx9746\row }\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid2495527 {\b\insrsid6816192 -drive=[drive letter]}{\b\insrsid6816192\charrsid6816192 \cell }{\insrsid6816192 
-Specify which drive to store the trace data file (PROFILER.DAT), where [drive letter] can be }{\insrsid13524902 one of the 26 drive letters, }{\insrsid6816192 \lquote A\rquote  to \lquote Z\rquote 
-.  When this drive letter option is not specified the default drive C is used.  If the file cannot be created at the specified drive the profiler will not start.\cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6816192 \trowd \irow2\irowband2\lastrow 
-\ts11\trgaph108\trleft-108\trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth7903\clshdrawnil \cellx9746\row }\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid6372845 {\insrsid6372845\charrsid6372845 
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Command line control
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 The Profiler can be controll
-ed from the command line, by specifying the action as a parameter to the Profiler.exe program. If the profiler is already loaded, this will just pass on the control request to the running program, otherwise it will load the profiler ready for further comm
-ands. E.g. use the following command in ESHELL:
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 profiler start
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Console control
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 
-The console UI is used if the ProfilerKeys.dll is not present on the device. When the console is in the foreground, it interprets the following keypresses to control the profiler:
-\par }\trowd \irow0\irowband0\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth675\clshdrawnil \cellx567\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4536\clshdrawnil \cellx5103\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\b\insrsid6226036 Key\cell Action\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\b\insrsid6226036 \trowd \irow0\irowband0
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth675\clshdrawnil \cellx567\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4536\clshdrawnil \cellx5103\row }\trowd \irow1\irowband1
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth675\clshdrawnil \cellx567\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4536\clshdrawnil \cellx5103\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 s\cell }{\insrsid12218284 S}{
-\insrsid6226036 tart\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow1\irowband1
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth675\clshdrawnil \cellx567\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4536\clshdrawnil \cellx5103\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 p\cell }{\insrsid12218284 S}{
-\insrsid6226036 top\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow2\irowband2
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth675\clshdrawnil \cellx567\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4536\clshdrawnil \cellx5103\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 c\cell }{\insrsid12218284 C}{
-\insrsid6226036 lose\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow3\irowband3
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth675\clshdrawnil \cellx567\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4536\clshdrawnil \cellx5103\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 x\cell unload\cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow4\irowband4\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone 
-\clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth675\clshdrawnil \cellx567\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4536\clshdrawnil \cellx5103\row 
-}\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 ?\cell Display the key mapping used to control the profiler\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {
-\insrsid6226036 \trowd \irow5\irowband5\lastrow \ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth675\clshdrawnil \cellx567\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4536\clshdrawnil \cellx5103\row }\pard\plain 
-\s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Hot key control
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 
-If ProfilerKeys.dll is installed then the profiler hooks the following key combinations which can be used to control the profiler from any application:
-\par }\trowd \irow0\irowband0\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1668\clshdrawnil \cellx1560\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4961\clshdrawnil \cellx6521\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\b\insrsid6226036 Key\cell Action\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\b\insrsid6226036 \trowd \irow0\irowband0
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1668\clshdrawnil \cellx1560\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4961\clshdrawnil \cellx6521\row }\trowd \irow1\irowband1
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1668\clshdrawnil \cellx1560\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4961\clshdrawnil \cellx6521\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 Fn+Ctrl+Shift+1\cell start\cell 
-}\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow1\irowband1\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt
-\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1668\clshdrawnil \cellx1560\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4961\clshdrawnil 
-\cellx6521\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 Fn+Ctrl+Shift+2\cell stop\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 
-\trowd \irow2\irowband2\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1668\clshdrawnil 
-\cellx1560\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4961\clshdrawnil \cellx6521\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 
-Fn+Ctrl+Shift+3\cell close\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow3\irowband3
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1668\clshdrawnil \cellx1560\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4961\clshdrawnil \cellx6521\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 Fn+Ctrl+Shift+4\cell unload
-\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow4\irowband4\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1668\clshdrawnil \cellx1560\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth4961\clshdrawnil \cellx6521\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 Fn+Ctrl+Shift+0\cell Display the current operation of the profiler in an infoprint\cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow5\irowband5\lastrow \ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt
-\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1668\clshdrawnil \cellx1560\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4961\clshdrawnil 
-\cellx6521\row }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Programmatic control
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 
-The profiler can also be controlled from within another program on the device by using the API defined in profiler.h. This defines the }{\f36\fs18\insrsid6226036 Profiler}{\insrsid6226036  class, which
- has static functions corresponding to each profiler command. Note that }{\f36\fs18\insrsid6226036 Profiler::Start()}{\insrsid6226036 
- will not load the profiler if it is not currently loaded, it will only cause an already loaded profiler to start sampling. It is possible to check for this possibility and use the command line to run the profiler using the following code:
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 if (Profiler::Start() == KErrNotFound)\line \tab \{\line \tab _LIT(KProfiler,"profiler");
-\line \tab _LIT(KStart,"start");\line \tab RProcess p;\line \tab if (p.Create(KProfiler,KStart) == KErrNone)\line \tab \tab \{\line \tab \tab p.Resume();\line \tab \tab p.Close();\line \tab \tab \}\line \tab \}
-\par }\pard\plain \s1\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \b\f1\fs24\lang2057\langfe2057\kerning28\cgrid\langnp2057\langfenp2057 {\insrsid6226036 \page Analysing the trace data
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 
-Once a trace data file has been obtained using the profiler, it needs to be transferred to a PC for analysis using the Analyse program, which should be present in the EPOC tools directory. Here are some example of standard 
-uses of the tool, followed by a complete command reference describing all of the options.
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Generating a full listing of the trace
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 The full trace recorded in the trace file can be output in text form using the listing }{
-\f36\fs18\insrsid6226036 -listing}{\insrsid6226036  (}{\f36\fs18\insrsid6226036 -l}{\insrsid6226036 ) option:
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 analyse profiler.dat -listing
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 
-This outputs one line for each sample, recording the sample number, thread ID and a PC value. A table mapping these thread IDs to thread names is provided at the end of the listing. By default, samples of the NULL thread are not shown\emdash processor
- inactivity can be detected by samples that are missing in the trace\emdash if necessary the NULL thread can be reported using the }{\f36\fs18\insrsid6226036 -null}{\insrsid6226036  (}{\f36\fs18\insrsid6226036 -n}{\insrsid6226036 ) option.
-\par A more interesting trace can be generated if a ROM symbol file matching the device ROM is available\emdash PC values are then displayed relative to symbols in the {\*\xmlopen\xmlns1{\factoidname country-region}}ROM.{\*\xmlclose} This is done using the }{
-\f36\fs18\insrsid6226036 -rom}{\insrsid6226036  (}{\f36\fs18\insrsid6226036 -r}{\insrsid6226036 ) command option:
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 analyse profiler.dat -rom \\epoc32\\rom\\myrom.symbol -listing
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Finding out where threads spend most of their time
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 A distribution of thread against location can be generated using the }{\f36\fs18\insrsid6226036 
--profile}{\insrsid6226036  (}{\f36\fs18\insrsid6226036 -p}{\insrsid6226036 ) command option\emdash this is the default if }{\f36\fs18\insrsid6226036 -l}{\insrsid6226036  and }{\f36\fs18\insrsid6226036 -v}{\insrsid6226036 
- are omitted. The address space can be divided up by address, by DLL or by function, the latter two requiring a symbol file. The following command will analyse the trace and report the amount of time spent by each thread in each function in the ROM:
-
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 analyse profiler.dat -rom \\epoc32\\rom\\myrom.symbol -byfunction
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 You may need a very wide command prompt to read the tablulated output
- sensibly. The output begins with a summary of the sample analysed: the total number of samples, the number of active samples (i.e. ignoring the NULL thread), and the number of samples analysed in the following report. Then there is a thread ID to name ma
-p
-ping, followed by a table with the threads across the top and the locations down the right side. The first row contains the proportion of time spent overall in that thread, the last column is the proportion of time spent by all threads in that function. N
-ote that both the threads and locations are sorted into descending order.
-\par Usually, the last few threads and locations are of no interest for analysis, and eliminating them makes the output easier to follow. A \lquote cut off\rquote  value can be supplied which eliminates
- the output of results for threads or locations which contain fewer samples than the provided value. The }{\f36\fs18\insrsid6226036 -cutoff}{\insrsid6226036  (}{\f36\fs18\insrsid6226036 -c}{\insrsid6226036 
-) option takes a number which is specified in percent, e.g.
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 analyse profiler.dat -r \\epoc32\\rom\\myrom.symbol -bf -cutuff0.5
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 This produces th
-e same results as last time, but does not report on any threads or locations with less than 0.5% of the overall samples.
-\par }{\insrsid12336355 When using the analyse tool with a symbol file, there is a limitation you should be aware of. C static functions (LOCAL_C functions) ar
-e not listed in the symbol file by the tools (they do not appear in the .map file). As a consequence of this, hits in these functions will be wrongly attributed to the functions right before of them in {\*\xmlopen\xmlns1{\factoidname country-region}}
-{\*\xmlopen\xmlns1{\factoidname country-region}}ROM.{\*\xmlclose}{\*\xmlclose}
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Finding out when threads are executing
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 A distribution of thread activity against time can be generated using the }{\f36\fs18\insrsid6226036 
--activity}{\insrsid6226036  (}{\f36\fs18\insrsid6226036 -v}{\insrsid6226036 ) command option. The following command will analyse the trace and report the amount of time spent by each thread in each block of 1000 samples (1 second):
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 analyse profiler.dat -activity -bysize1000
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 If the }{\f36\fs18\insrsid6226036 -bysize}{\insrsid6226036 
- parameter is omitted, a default value of 100 samples is used. The cutoff option can be used to eliminate threads that contribute little to the overall execution time.
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Restricting the analysis to certain samples
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Filters ca
-n be provided to restrict the analysis to specific samples in the trace. These options generally work for all types of output.
-\par }\pard\plain \s3\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel2\rin0\lin0\itap0 \f1\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Filtering by thread name
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 The samples for a specific thread can be analysed using the }{\f36\fs18\insrsid6226036 -thread}{
-\insrsid6226036  (}{\f36\fs18\insrsid6226036 -t}{\insrsid6226036 ) option, this is followed by a basic wildcard pattern for the thread name to analyse. (The }{\f36\fs18\insrsid6226036 *}{\insrsid6226036 
- character can represent zero or more of any character). E.g. to analyse just the threads in the file server the following commands could be used:
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 analyse profiler.dat -r \\epoc32\\rom\\myrom.symbol -bf -thread efile*
-\par }\pard\plain \s3\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel2\rin0\lin0\itap0 \f1\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Filtering by dll name
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 
-Analysis for the thread/location distribution can be restricted to DLLs matching a provided pattern using the }{\f36\fs18\insrsid6226036 -dll}{\insrsid6226036  (}{\f36\fs18\insrsid6226036 -d}{\insrsid6226036 
-) option. E.g. to restrict analysis to BitGdi.dll the following command could be used:
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 analyse profiler.dat -r \\epoc32\\rom\\myrom.symbol -bf -dll bitgdi.dll
-\par }\pard\plain \s3\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel2\rin0\lin0\itap0 \f1\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Filtering by function name
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 
-Analysis can be even more specific by providing a DLL and function pattern to match. In this case, the first matching function in the first matching DLL is analysed by ad
-dress, defaulting to instruction-level granularity. This can provide code-path analysis for execution hotspots. E.g. to analyse execution in the }{\f36\fs18\insrsid6226036 ExecuteJava()}{\insrsid6226036  function the following command could be used:
-
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 analyse profiler.dat -r \\epoc32\\rom\\myrom.symbol -d pjavai.dll -function executejava
-
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Note that the \lquote function name\rquote 
- usually includes the signature of the parameters, so it is often effective to add a }{\f36\fs18\insrsid6226036 *}{\insrsid6226036  to the end of the function name for analysis.
-\par }\pard\plain \s3\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel2\rin0\lin0\itap0 \f1\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Filtering by sample number
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 The }{\f36\fs18\insrsid6226036 -samples}{\insrsid6226036  (}{\f36\fs18\insrsid6226036 -s}{
-\insrsid6226036 ) option allows a
- specific range of samples to be analysed, rather than the entire file. This can be useful if the trace contains activity which should not be analysed, or for generating high-resolution activity traces for specific parts of the trace. E.g. to analyse 1000
- samples starting at sample number 2500, the following command could be used:
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 analyse profiler.dat -v -bs50 -samples2500+1000
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Generating graphs and charts from the output
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 By default, spaces are us
-ed when formatting the output resulting in tables that are easily read by eye. However, very often it helps to be able to generate charts from the tabulated data for visual analysis. The }{\f36\fs18\insrsid6226036 -formatexcel}{\insrsid6226036  (}{
-\f36\fs18\insrsid6226036 -mx}{\insrsid6226036 ) option instructs Analyse to format the output so t
-hat it is suitable for cut-and-paste into Microsoft Excel: using tabs rather than spaces, rearranging the tables for chart generation, and using numerical representation of sample data (rather than %). If the output from Analyse is directed to a file, thi
-s can then be opened by a text editor and the table can be pasted directly into Excel.
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid735290 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid735290 Profiling Jazelle code
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid735290 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid735290 
-Profiler tool clears the LSB bit in every sample. This is because it is used for some other markings that help keep log file short. ARM and Thumb i
-nstructions always appear on even program addresses. However, Jazelle instructions are one byte long and can appear on any program address. As the consequence, sampling Jazelle code does not give the exact result. If a Jazelle instruction on odd program a
-ddress is sampled, it will be reported as the Jazelle instruction on the preceding even program address.}{\insrsid735290\charrsid735290 
-\par }\pard\plain \s1\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \b\f1\fs24\lang2057\langfe2057\kerning28\cgrid\langnp2057\langfenp2057 {\insrsid6226036 \page Analyse command reference
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Command line
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 analyse }{\f0\fs20\insrsid6226036 [ report-type ]}{\insrsid6226036  }{
-\f0\fs20\insrsid6226036 [ options ]}{\fs20\insrsid6226036  }{\i\f0\fs20\insrsid6226036 tracefile}{\insrsid6226036 
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Reports
-\par }\trowd \irow0\irowband0\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb
-\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\b\insrsid6226036 
-Report type\cell Abbrev.\cell Description\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\b\insrsid6226036 \trowd \irow0\irowband0
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\trowd \irow1\irowband1\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone 
-\clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl
-\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -listing}{\insrsid6226036 \cell }{
-\f36\fs18\insrsid6226036 -l}{\insrsid6226036 \cell Generate a listing of the trace\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow1\irowband1
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\trowd \irow2\irowband2\ts11\trgaph108\trrh221\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb
-\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone 
-\clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -profile}{\insrsid6226036 \cell }{
-\f36\fs18\insrsid6226036 -p}{\insrsid6226036 \cell Generate a thread vs. location profile of the data. This is the default type of report.\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 
-\trowd \irow2\irowband2\ts11\trgaph108\trrh221\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb
-\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\trowd \irow3\irowband3\lastrow \ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone 
-\clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835
-\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -activity}{
-\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -v}{\insrsid6226036 \cell Generate a thread activity profile of the data\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 
-\trowd \irow3\irowband3\lastrow \ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb
-\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 
-\b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Options
-\par }\trowd \irow0\irowband0\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb
-\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\b\insrsid6226036 Option
-\cell Abbrev.\cell Description\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\b\insrsid6226036 \trowd \irow0\irowband0
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\trowd \irow1\irowband1\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone 
-\clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl
-\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -help}{\insrsid6226036 \cell }{
-\f36\fs18\insrsid6226036 -h}{\insrsid6226036 \line }{\f36\fs18\insrsid6226036 -?}{\insrsid6226036 \cell Display a brief summary of the command line options\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {
-\insrsid6226036 \trowd \irow1\irowband1\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb
-\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid1653898 -help config\cell -h }{\f2\fs18\insrsid1653898\charrsid1653898 
-config}{\f36\fs18\insrsid1653898 \cell }{\insrsid1653898 Display an example of the config file\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid1653898 \trowd \irow2\irowband2
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -rom}{\insrsid6226036  }{\i\insrsid6226036 symbolfile}{\insrsid6226036 \cell }{
-\f36\fs18\insrsid6226036 -r }{\insrsid6226036 \'85\cell Supply a ROM symbol file}{\insrsid3948828  of the XIP image}{\insrsid6226036  for interpretation of PC values\cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow3\irowband3\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone 
-\clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835
-\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -samples}{
-\i\insrsid6226036 range}{\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -s}{\insrsid6226036 \'85\cell Restrict the analysis to the sample range specified. The range can either be specified as }{\i\insrsid6226036 begin}{\f36\fs18\insrsid6226036 -}{
-\i\insrsid6226036 end}{\insrsid6226036  or as }{\i\insrsid6226036 begin}{\f36\fs18\insrsid6226036 +}{\i\insrsid6226036 count}{\insrsid6226036 , the sample numbers should be specified in decimal. So the following are equivalent:
-\par }{\f36\fs18\insrsid6226036 -samples2500-3500}{\insrsid6226036 \line }{\f36\fs18\insrsid6226036 -samples2500+1000}{\insrsid6226036 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 
-\trowd \irow4\irowband4\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil 
-\cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -null}{\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -n}{\insrsid6226036 \cell Include
- the EPOC Kernel NULL thread in the analysis. This thread is ignored by default.\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow5\irowband5
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -thread}{\insrsid6226036  }{\i\insrsid6226036 name}{\insrsid6226036 \cell }{
-\f36\fs18\insrsid6226036 -t }{\insrsid6226036 \'85\cell Restrict analysis to threads whose full name (}{\i\insrsid6226036 processname}{\insrsid6226036 ::}{\i\insrsid6226036 threadname}{\insrsid6226036 
-) matches the pattern provided. The pattern matching has a single wildcard character \lquote *\rquote , which will match zero or more of any character.\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {
-\insrsid6226036 \trowd \irow6\irowband6\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb
-\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -dll }{\i\insrsid6226036 name}{\insrsid6226036 \cell }{
-\f36\fs18\insrsid6226036 -d }{\insrsid6226036 \'85\cell Restrict analysis to Dlls whose name matches the pattern provided.
-\par This option is only effective for a Profile report, and requires a ROM symbol file.\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow7\irowband7
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -function }{\i\insrsid6226036 name}{\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -f }{
-\insrsid6226036 \'85\cell Restrict analysis to functions whose name matches the pattern provided. If }{\f36\fs18\insrsid6226036 -dll}{\insrsid6226036  is also specified, then only functions matching the pattern within a matching Dll are analysed.
-\par This option is only effective for a Profile report, and requires a ROM symbol file.\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow8\irowband8
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -address}{\i\insrsid6226036 range}{\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -a}{
-\insrsid6226036 \'85\cell Restrict analysis to the address range specified. This may be useful if no symbol file is available when generating a Profile report. The range can either be specified as }{\i\insrsid6226036 begin}{\f36\fs18\insrsid6226036 -}{
-\i\insrsid6226036 end}{\insrsid6226036  or as }{\i\insrsid6226036 begin}{\f36\fs18\insrsid6226036 +}{\i\insrsid6226036 size}{\insrsid6226036 , the addresses should be specified in hexadecimal. So the following would both analyse the first 6Mb of the ROM:
-
-\par }{\f36\fs18\insrsid6226036 -address50000000-50600000}{\insrsid6226036 \line }{\f36\fs18\insrsid6226036 -address50000000+600000}{\insrsid6226036 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {
-\insrsid6226036 \trowd \irow9\irowband9\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb
-\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -by\'85}{\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -b\'85
-}{\insrsid6226036 \cell Determine the way in which the space is partitioned in a Profile or Activity report. Only one of the following four options should be specified:\cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow10\irowband10\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt
-\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil 
-\cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 
--bydll}{\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -bd}{\insrsid6226036 \cell Split the address space by Dll in a Profile report.
-\par This requires a ROM symbol file. It is the default partitioning if neither }{\f36\fs18\insrsid6226036 -dll}{\insrsid6226036  or }{\f36\fs18\insrsid6226036 \_function}{\insrsid6226036  are specified.\cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow11\irowband11\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt
-\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil 
-\cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 
--byfunction}{\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -bf}{\insrsid6226036 \cell Split the address space by function in a Profile report.
-\par This requires a ROM symbol file. It is the default partitioning if }{\f36\fs18\insrsid6226036 -dll}{\insrsid6226036  is specified without }{\f36\fs18\insrsid6226036 -function}{\insrsid6226036 .\cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow12\irowband12\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt
-\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil 
-\cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 
--bysize}{\i\insrsid6226036 size}{\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -bs}{\insrsid6226036 \'85\cell In a Profile report, this will split the address space into blocks of approximately }{\i\insrsid6226036 size}{\insrsid6226036 
- bytes. This assumes that either the }{\f36\fs18\insrsid6226036 -address}{\insrsid6226036  option has been used, or analysis is focussed on a single function using the }{\f36\fs18\insrsid6226036 -function}{\insrsid6226036 
- option. It is the default partitioning if }{\f36\fs18\insrsid6226036 -function}{\insrsid6226036  is specified, providing instruction level analysis.
-\par In an Activity report, this is the number of samples grouped in each line of the report. The default value of }{\i\insrsid6226036 size}{\insrsid6226036  in this case is 100 samples.\cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow13\irowband13\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt
-\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil 
-\cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 
--bynumber}{\i\insrsid6226036 count}{\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -bn}{\insrsid6226036 \'85\cell Split the address space into }{\i\insrsid6226036 count}{\insrsid6226036  \lquote buckets\rquote  in a Profile report.
-\par It is the default partitioning if }{\f36\fs18\insrsid6226036 -address}{\insrsid6226036  is specified, providing 100 buckets.\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 
-\trowd \irow14\irowband14\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil 
-\cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -cutoff}{\i\insrsid6226036 percent}{\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -c}{
-\insrsid6226036 \'85\cell Discard threads and locations from the output that account for less than }{\i\insrsid6226036 percent}{\insrsid6226036  samples in the analysis. }{\i\insrsid6226036 Percent}{\insrsid6226036 
- is a floating point percentage value, i.e. the following specifies a cutoff at 0.5%:
-\par }{\f36\fs18\insrsid6226036 -cutoff.5}{\insrsid6226036 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow15\irowband15
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -format\'85}{\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -m\'85}{\insrsid6226036 \cell 
-Modify the format of the reports. Any number of the following options can be concatenated into the option string, e.g.
-\par }{\f36\fs18\insrsid6226036 -formatexceltotalother}{\insrsid6226036 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow16\irowband16
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -formatpercent}{\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -mp}{\insrsid6226036 \cell 
-Report samples as a percentage of the total analysed. This is the default.\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow17\irowband17
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -formatsamples}{\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -ms}{\insrsid6226036 \cell 
-Report the number of samples for each entry.\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow18\irowband18
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -formatexcel}{\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -mx}{\insrsid6226036 \cell 
-Generate an excel compatible report for cut-and-paste.\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow19\irowband19
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -formatzero\cell -mz}{\insrsid6226036 \cell 
-Report zero values explicitly. The default is to leave blanks.\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow20\irowband20
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -formattotal}{\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -mt}{\insrsid6226036 \cell 
-Just report the \lquote total\rquote  column in a Profile report, and discard the thread breakdown.\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow21\irowband21
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -formatother}{\insrsid6226036 \cell }{\f36\fs18\insrsid6226036 -mo}{\insrsid6226036 \cell 
-Discard the \lquote other\rquote  location from a Profile report. This is where all samples that do not fit in another identified location are accumulated.\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {
-\insrsid6226036 \trowd \irow22\irowband22\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb
-\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid5454414 -oby}{\f36\fs18\insrsid15342006 \cell }{
-\f36\fs18\insrsid5454414 -o}{\f36\fs18\insrsid15342006 \cell }{\insrsid5454414 Supply oby file of the non-XIP image}{\insrsid15342006 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid15342006 
-\trowd \irow23\irowband23\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil 
-\cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid3948828 -}{\f36\fs18\insrsid3948828\charrsid3948828 rofs}{\f36\fs18\insrsid5454414\charrsid3948828 
-\cell }{\f36\fs18\insrsid5454414 -z\cell }{\insrsid5454414 Supply symbol file of the }{\insrsid16414626 non-}{\insrsid5454414 XIP image\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid5454414 
-\trowd \irow24\irowband24\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil 
-\cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid3948828 -}{\f36\fs18\insrsid3948828\charrsid3948828 config\cell }{\f36\fs18\insrsid3948828 -x\cell }
-{\insrsid3948828 Supply configuration file. The file can contains all input argument and options. A template of the file is given in Appendix A.\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {
-\insrsid3948828 \trowd \irow25\irowband25\lastrow \ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1951\clshdrawnil \cellx1843\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth992\clshdrawnil \cellx2835\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb
-\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6912\clshdrawnil \cellx9747\row }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 
-\b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid6226036 Options used in each type of report
-\par }\trowd \irow0\irowband0\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb
-\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\pard\plain 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\b\insrsid6226036 Option\cell Listing\cell Profile\cell Activity\cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\b\insrsid6226036 \trowd \irow0\irowband0\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt
-\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb
-\brdrs\brdrw15 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\trowd \irow1\irowband1\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl
-\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\pard \ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -rom\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {
-\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell \cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow1\irowband1\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone 
-\clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552
-\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard \ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -samples\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {
-\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }{\insrsid6226036 
-{\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow2\irowband2
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard 
-\ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -null\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings"
- \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt
-\f10\fs20}}}{\insrsid6226036 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow3\irowband3
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard 
-\ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -thread\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings"
- \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt
-\f10\fs20}}}{\insrsid6226036 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow4\irowband4
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard 
-\ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -dll\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f 
-"Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow5\irowband5
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard 
-\ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -function\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL
- 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow6\irowband6
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard 
-\ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -address\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL
- 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow7\irowband7
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard 
-\ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -bydll\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL
- 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow8\irowband8
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard 
-\ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -byfunction\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL
- 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow9\irowband9
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard 
-\ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -bysize\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL
- 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow10\irowband10\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt
-\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil 
-\cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard \ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -bynumber\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {
-\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 
-\trowd \irow11\irowband11\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil 
-\cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard 
-\ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -cutoff\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL
- 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow12\irowband12\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt
-\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil 
-\cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard \ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -formatpercent\cell }\pard 
-\qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL
- 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow13\irowband13
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard 
-\ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -formatsamples\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL
- 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow14\irowband14\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt
-\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil 
-\cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard \ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -formatexcel\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 
-{\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell 
-}\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow15\irowband15\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt
-\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil 
-\cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard \ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -formatzero\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {
-\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell 
-}\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow16\irowband16\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt
-\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil 
-\cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard \ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -formattotal\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 
-{\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 
-\trowd \irow17\irowband17\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil 
-\cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard 
-\ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid6226036 -formatother\cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid6226036 \cell }{\insrsid6226036 {\field{\*\fldinst SYMBOL
- 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid6226036 \cell \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid6226036 \trowd \irow18\irowband18
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard 
-\ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid3948828 - o}{\f36\fs18\insrsid678217 by}{\f36\fs18\insrsid3948828 \cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid3948828 
-{\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid3948828 \cell }{\insrsid3948828 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid3948828 \cell \cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid3948828 \trowd \irow19\irowband19\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt
-\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil 
-\cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard \ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid3948828 - }{\f36\fs18\insrsid678217 rofs}{\f36\fs18\insrsid3948828 \cell }\pard 
-\qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid3948828 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid3948828 \cell }{\insrsid3948828 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings"
- \\s 10}{\fldrslt\f10\fs20}}}{\insrsid3948828 \cell \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid3948828 \trowd \irow20\irowband20
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard 
-\ql \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\f36\fs18\insrsid3948828 - }{\f36\fs18\insrsid678217 config}{\f36\fs18\insrsid3948828 \cell }\pard \qc \li0\ri0\sb40\sa40\widctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\insrsid3948828 
-{\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid3948828 \cell }{\insrsid3948828 {\field{\*\fldinst SYMBOL 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid3948828 \cell }{\insrsid3948828 {\field{\*\fldinst SYMBOL
- 252 \\f "Wingdings" \\s 10}{\fldrslt\f10\fs20}}}{\insrsid3948828 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid3948828 \trowd \irow21\irowband21\lastrow 
-\ts11\trgaph108\trleft-108\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1809\clshdrawnil \cellx1701\clvertalt
-\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth851\clshdrawnil \cellx2552\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
-\cltxlrtb\clftsWidth3\clwWidth850\clshdrawnil \cellx3402\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth993\clshdrawnil \cellx4395\row }\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\insrsid678217 
-\par }\pard\plain \s1\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0\pararsid678217 \b\f1\fs24\lang2057\langfe2057\kerning28\cgrid\langnp2057\langfenp2057 {\insrsid678217 \page 
-Appendix A: non-XIP support and configuration file}{\insrsid6226036 
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid678217 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid10961137 N}{\insrsid678217 
-on-XIP executables are copied into RAM memory before being executed. Their run addresses are not known during ROM image build up. Therefore, corresponding symbol file does not contain run addresses of each particular function in the image, as }{
-\insrsid15867397 it}{\insrsid678217  is the case with XIP images. Instead, it contains the offset}{\insrsid11476477 s}{\insrsid678217  of the functions }{\insrsid10961137 within their }{\insrsid678217 e}{\insrsid5070621 xe}{\insrsid678217 cutables.
-\par }{\insrsid11476477 In order to calculate actual run addresses of non-XIP }{\insrsid15867397 functions}{\insrsid11476477 , the profiler tool also collects the events }{\insrsid5070621 of}{\insrsid10961137  non-XIP}{\insrsid11476477  code segment}{
-\insrsid10961137 s}{\insrsid11476477  creation/deletion. It uses Kernel debug interface and Kernel has to be built with }{\insrsid11476477\charrsid15342006 __DEBUGGER_SUPPORT__}{\insrsid3544718  option.}{\insrsid11476477 
-\par }{\insrsid3544718 During start}{\insrsid5070621 -}{\insrsid3544718 up of the }{\insrsid15867397 profiler }{\insrsid3544718 tool,}{\insrsid15867397  }{\insrsid3544718 the current list of all active non-XIP }{\insrsid10961137 code segments }{
-\insrsid3544718 are collected and stored into the c:\\profiler.dat. Once the profiling }{\insrsid10961137 is }{\insrsid3544718 started, the driver is still }{\insrsid481371 continuously}{\insrsid3544718  }{\insrsid10961137 monitoring}{\insrsid3544718 
- for such events and logs them into the file, alongside with sample data.
-\par }{\insrsid5070621 
-\par }{\insrsid15867397 For each particular non-XIP ima}{\insrsid481371 ge, both oby and symbol file have}{\insrsid15867397  to be provided to the analyse tool (XIP image requires only symbol }{\insrsid5070621 file}{\insrsid15867397 
-). As there could be more non-XIP images in the system, a more convenient way for passing input argument}{\insrsid481371 s}{\insrsid15867397  to analyse tool would }{\insrsid5070621 be }{\insrsid15867397 by }{\insrsid5070621 means of }{\insrsid15867397 
-configuration file.}{\insrsid3544718 
-\par }{\insrsid5070621 Below}{\insrsid15867397  is }{\insrsid481371 an}{\insrsid15867397  example of the configuration file to profile }{\insrsid9066106 NAND image of H2 Techview.}{\insrsid15867397 
-\par }{\insrsid5070621 It is used as:
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0\pararsid5070621 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid5070621 analyse \endash x analyse.cfg
-\par }\pard \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0\pararsid335316 {\insrsid5070621 
-\par }{\fs16\insrsid5070621\charrsid4540351 ;***************************
-\par }{\fs16\insrsid335316\charrsid4540351 ;Analase.cfg file
-\par [Common]
-\par TraceFile=PROFILER.DAT
-\par ;Mode=listing|profile|activity
-\par }{\fs16\insrsid10961137\charrsid4540351 Mode=profile}{\fs16\insrsid335316\charrsid4540351 
-\par SymbolFile=om_001.techview.nand.symbol
-\par ;Range=100-200 | 100+100
-\par ;IncludeNullThread=0|1
-\par 
-\par [Profile]
-\par Thread=
-\par Dll=
-\par Function=
-\par ;Range=1f1a+20 | 1f1a-1f3a
-\par Range=
-\par 
-\par [Partition]
-\par ;Mode=dll|function
-\par BucketSize=
-\par NumberOfBuckets=
-\par 
-\par [Format]
-\par ;Mode=percentages|samples|excel
-\par Mode=
-\par ;ZeroValues=0|1
-\par ZeroValues=
-\par ;NoOthers=0|1
-\par NoOthers=
-\par ;TotalOnly=0|1
-\par TotalOnly=
-\par 
-\par [NonXIP]
-\par ObyFile1=om_001.techview.nand.rofs.oby
-\par RofsSymbolFile1=om_001.techview.nand.rofs.symbol}{\fs16\insrsid9066106\charrsid4540351 
-\par }\pard \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0\pararsid5070621 {\fs16\insrsid5070621\charrsid4540351 ;***************************
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid1653898 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid1653898 Any option provided in the configur
-ation file can be overwritten by the same option in the command line.
-\par 
-\par }\pard\plain \s1\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0\pararsid1653898 \b\f1\fs24\lang2057\langfe2057\kerning28\cgrid\langnp2057\langfenp2057 {\insrsid10961137 \page 
-Appendix B: The format of the profiler.dat file}{\insrsid15867397 
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid8592727 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 {\*\bkmkstart _Toc100392815}Basic Elements
-{\*\bkmkend _Toc100392815}
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid8592727 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 Profiler.dat is built}{\insrsid5070621  up }{\insrsid8592727 
-from the following basic elements:
-\par {\listtext\pard\plain\fs20\insrsid8592727 \hich\af0\dbch\af0\loch\f0 -\tab}}\pard \ql \fi-360\li450\ri0\sb60\sa60\widctlpar\jclisttab\tx450\wrapdefault\faauto\ls5\rin0\lin450\itap0\pararsid8592727 {\insrsid8592727 UInt (32-bits unsigned integer);
-\par {\listtext\pard\plain\fs20\insrsid8592727 \hich\af0\dbch\af0\loch\f0 -\tab}Int (32-bit signed integer);
-\par {\listtext\pard\plain\fs20\insrsid8592727 \hich\af0\dbch\af0\loch\f0 -\tab}Text (up to 255 bytes long non-unicode text).
-\par }\pard \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid8592727 {\insrsid8592727 
-\par They are encoded as:
-\par }\pard\plain \s3\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel2\rin0\lin0\itap0\pararsid8592727 \f1\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 {\*\bkmkstart _Toc100392816}UInt{\*\bkmkend _Toc100392816}
-
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid8592727 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 
-7 bits occupies a byte (starting from the least significant bits) with MSB=1 in the last byte. To decode, value should be extended to 32-bit length by 0s.
-\par }\trowd \irow0\irowband0\ts25\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trftsWidthB3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 
-\clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil \cellx4409\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil \cellx9747\pard\plain 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid481371\yts25 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 UInt}{\insrsid481371  (32 bits divided into groups of 7 bits)}{\insrsid8592727 \cell 
-Encoded as:\cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\f2\insrsid8592727 \trowd \irow0\irowband0\ts25\trgaph108\trleft-108\trbrdrt
-\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trftsWidthB3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 
-\clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil \cellx4409\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil \cellx9747\row 
-}\trowd \irow1\irowband1\ts25\trgaph108\trrh301\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trftsWidthB3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 
-\clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil \cellx4409\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil \cellx9747\pard\plain 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid2495527\yts25 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\f2\fs18\insrsid8592727\charrsid8592727 1001}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{
-\f2\fs18\insrsid8592727\charrsid8592727 1000110}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 1000011}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 1101100}{
-\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 0001101\cell }{\b\f2\fs18\insrsid8592727\charrsid8592727 0}{\f2\fs18\insrsid8592727\charrsid8592727 0001101 }{\b\f2\fs18\insrsid8592727\charrsid8592727 0}{
-\f2\fs18\insrsid8592727\charrsid8592727 1101100 }{\b\f2\fs18\insrsid8592727\charrsid8592727 0}{\f2\fs18\insrsid8592727\charrsid8592727 1000011 }{\b\f2\fs18\insrsid8592727\charrsid8592727 0}{\f2\fs18\insrsid8592727\charrsid8592727 1000110 }{
-\b\f2\fs18\insrsid8592727\charrsid8592727 1}{\i\f2\fs18\insrsid8592727\charrsid8592727 000}{\f2\fs18\insrsid8592727\charrsid8592727 1001\cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 
-\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\f2\insrsid8592727 \trowd \irow1\irowband1\ts25\trgaph108\trrh301\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 
-\trbrdrv\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 
-\clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil \cellx4409\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil 
-\cellx9747\row }\trowd \irow2\irowband2\ts25\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trftsWidthB3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 
-\clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil \cellx4409\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil \cellx9747\pard\plain 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid2495527\yts25 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\f2\fs18\insrsid8592727\charrsid8592727 0000}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{
-\f2\fs18\insrsid8592727\charrsid8592727 0000000}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 0000000}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 0001100}{
-\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 0001101\cell }{\b\f2\fs18\insrsid8592727\charrsid8592727 0}{\f2\fs18\insrsid8592727\charrsid8592727 0001101 }{\b\f2\fs18\insrsid8592727\charrsid8592727 1}{
-\f2\fs18\insrsid8592727\charrsid8592727 0001100\cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\f2\insrsid8592727 \trowd \irow2\irowband2
-\ts25\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trftsWidthB3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 
-\clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil \cellx4409\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil \cellx9747\row 
-}\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid2495527\yts25 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\f2\fs18\insrsid8592727\charrsid8592727 0000}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{
-\f2\fs18\insrsid8592727\charrsid8592727 0000000}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 0000000}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 0000000}{
-\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 0001101\cell }{\b\f2\fs18\insrsid8592727\charrsid8592727 1}{\f2\fs18\insrsid8592727\charrsid8592727 0001101\cell }\pard\plain 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\f2\insrsid8592727 \trowd \irow3\irowband3\lastrow \ts25\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl
-\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trftsWidthB3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 
-\clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil \cellx4409\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil \cellx9747\row 
-}\pard\plain \s3\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel2\rin0\lin0\itap0\pararsid8592727 \f1\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 {\*\bkmkstart _Toc100392817}Int{\*\bkmkend _Toc100392817}
-
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid8592727 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 
-7 bits occupies a byte (starting from the least significant bits) with MSB=1 in the last byte. To decode, value should be extended to 32-bit length by the most significant bit.}{\insrsid8592727\charrsid8592727 
-\par }\trowd \irow0\irowband0\ts11\trgaph108\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil \cellx4508
-\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil \cellx9747\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid481371 {
-\insrsid8592727 Int}{\insrsid481371  (32 bits divided into groups of 7 bits)}{\insrsid8592727 \cell Encoded as:\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid8592727 \trowd \irow0\irowband0
-\ts11\trgaph108\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 
-\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil \cellx4508\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr
-\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil \cellx9747\row }\trowd \irow1\irowband1\ts11\trgaph108\trrh297\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv
-\brdrs\brdrw10 \trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil 
-\cellx4508\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil \cellx9747\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid2495527 {\f2\fs18\insrsid8592727\charrsid8592727 1001}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 1000110}{
-\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 1000011}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 1101100}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{
-\f2\fs18\insrsid8592727\charrsid8592727 0001101\cell }{\b\f2\fs18\insrsid8592727\charrsid8592727 0}{\f2\fs18\insrsid8592727\charrsid8592727 0001101 }{\b\f2\fs18\insrsid8592727\charrsid8592727 0}{\f2\fs18\insrsid8592727\charrsid8592727 1101100 }{
-\b\f2\fs18\insrsid8592727\charrsid8592727 0}{\f2\fs18\insrsid8592727\charrsid8592727 1000011 }{\b\f2\fs18\insrsid8592727\charrsid8592727 0}{\f2\fs18\insrsid8592727\charrsid8592727 1000110 }{\b\f2\fs18\insrsid8592727\charrsid8592727 1}{
-\b\i\f2\fs18\insrsid8592727\charrsid8592727 111}{\f2\fs18\insrsid8592727\charrsid8592727 1001\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\f2\insrsid8592727 \trowd \irow1\irowband1
-\ts11\trgaph108\trrh297\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil \cellx4508
-\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil \cellx9747\row }\trowd \irow2\irowband2\ts11\trgaph108\trrh301\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl
-\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 
-\clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil \cellx4508\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil 
-\cellx9747\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid2495527 {\f2\fs18\insrsid8592727\charrsid8592727 1111}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 1111111}{
-\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 1111111}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 1111111}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{
-\f2\fs18\insrsid8592727\charrsid8592727 1111111\cell }{\b\f2\fs18\insrsid8592727\charrsid8592727 1}{\f2\fs18\insrsid8592727\charrsid8592727 1111111\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {
-\f2\insrsid8592727 \trowd \irow2\irowband2\ts11\trgaph108\trrh301\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil \cellx4508
-\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid2495527 
-{\f2\fs18\insrsid8592727\charrsid8592727 0111}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 1111111}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 1111111}{
-\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 1111111}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 1111111\cell }{\b\f2\fs18\insrsid8592727\charrsid8592727 0}{
-\f2\fs18\insrsid8592727\charrsid8592727 1111111 }{\b\f2\fs18\insrsid8592727\charrsid8592727 0}{\f2\fs18\insrsid8592727\charrsid8592727 1111111 }{\b\f2\fs18\insrsid8592727\charrsid8592727 0}{\f2\fs18\insrsid8592727\charrsid8592727 1111111 }{
-\b\f2\fs18\insrsid8592727\charrsid8592727 0}{\f2\fs18\insrsid8592727\charrsid8592727 1111111 }{\b\f2\fs18\insrsid8592727\charrsid8592727 1}{\b\i\f2\fs18\insrsid8592727\charrsid8592727 000}{\f2\fs18\insrsid8592727\charrsid8592727 0111}{
-\b\f2\fs18\insrsid8592727\charrsid8592727 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\f2\insrsid8592727 \trowd \irow3\irowband3\ts11\trgaph108\trrh301\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl
-\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 
-\clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil \cellx4508\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil 
-\cellx9747\row }\trowd \irow4\irowband4\ts11\trgaph108\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil \cellx4508
-\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil \cellx9747\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid2495527 {
-\f2\fs18\insrsid8592727\charrsid8592727 1111}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 1111111}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 1111111}{
-\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 1111000}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 1111111\cell }{\b\f2\fs18\insrsid8592727\charrsid8592727 0}{
-\f2\fs18\insrsid8592727\charrsid8592727 1111111 }{\b\f2\fs18\insrsid8592727\charrsid8592727 1}{\f2\fs18\insrsid8592727\charrsid8592727 1111000\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {
-\f2\insrsid8592727 \trowd \irow4\irowband4\ts11\trgaph108\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil \cellx4508
-\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid2495527 
-{\f2\fs18\insrsid8592727\charrsid8592727 0000}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 0000000}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 0000000}{
-\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 0000000}{\b\f2\fs18\insrsid8592727\charrsid8592727 |}{\f2\fs18\insrsid8592727\charrsid8592727 0001101\cell }{\b\f2\fs18\insrsid8592727\charrsid8592727 1}{
-\f2\fs18\insrsid8592727\charrsid8592727 0001101\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\f2\insrsid8592727 \trowd \irow5\irowband5\lastrow \ts11\trgaph108\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl
-\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 
-\clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4537\clshdrawnil \cellx4508\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5543\clshdrawnil 
-\cellx9747\row }\pard\plain \s3\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel2\rin0\lin0\itap0\pararsid8592727 \f1\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 {\*\bkmkstart _Toc100392818}Text
-{\*\bkmkend _Toc100392818}
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid8592727 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 Supports up to 255 long non Unicode text:
-\par }\trowd \irow0\irowband0\ts11\trgaph108\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4500\clshdrawnil \cellx4354
-\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5580\clshdrawnil \cellx9747\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid481371 {
-\insrsid8592727 Text\cell Encoded as:\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid8592727 \trowd \irow0\irowband0\ts11\trgaph108\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb
-\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 
-\clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4500\clshdrawnil \cellx4354\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5580\clshdrawnil \cellx9747\row 
-}\trowd \irow1\irowband1\ts11\trgaph108\trrh297\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4500\clshdrawnil \cellx4354
-\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5580\clshdrawnil \cellx9747\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid2495527 {
-\f2\fs18\insrsid8592727\charrsid8592727 \'93Text\'94\cell 4, \lquote T\rquote , \lquote e\rquote , \lquote x\rquote , \lquote t\rquote \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\f2\insrsid8592727 
-\trowd \irow1\irowband1\ts11\trgaph108\trrh297\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4500\clshdrawnil \cellx4354
-\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5580\clshdrawnil \cellx9747\row }\trowd \irow2\irowband2\ts11\trgaph108\trrh301\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl
-\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 
-\clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4500\clshdrawnil \cellx4354\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5580\clshdrawnil 
-\cellx9747\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid2495527 {\f2\fs18\insrsid8592727\charrsid8592727 \lquote x\rquote  times 255\cell 255, \lquote x\rquote  times 255\cell }\pard 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\f2\insrsid8592727 \trowd \irow2\irowband2\ts11\trgaph108\trrh301\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 
-\trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 
-\cltxlrtb\clftsWidth3\clwWidth4500\clshdrawnil \cellx4354\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5580\clshdrawnil \cellx9747\row }\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid2495527 {\f2\fs18\insrsid8592727\charrsid8592727 \'93\'94\cell 0\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {
-\f2\insrsid8592727 \trowd \irow3\irowband3\lastrow \ts11\trgaph108\trrh301\trleft0\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind108\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4500\clshdrawnil \cellx4354
-\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5580\clshdrawnil \cellx9747\row }\pard\plain 
-\s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid8592727 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 {\*\bkmkstart _Toc100392819}Derived Elements
-{\*\bkmkend _Toc100392819}
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid8592727 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 The following derived elements are defined as well:
-\par }\pard\plain \s3\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel2\rin0\lin0\itap0\pararsid8592727 \f1\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 {\*\bkmkstart _Toc100392820}Tag{\*\bkmkend _Toc100392820}
-
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid8592727 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid5070621 This is the header of the file.}{\insrsid8592727 
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0\pararsid8592727 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 Tag = Text(\'93Profiler\'94) + UInt(MajorVersionNumber)
-\par }\pard\plain \s3\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel2\rin0\lin0\itap0\pararsid8592727 \f1\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 {\*\bkmkstart _Toc100392821}Thread
-{\*\bkmkend _Toc100392821}
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid8592727 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 
-Contains processID and thread name. Also can contain process name if the process is seen for the first time:
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0\pararsid8592727 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 
-Thread(DThread*) = UInt(processID) [+ Text(processName) ]+ Text(threadName]
-\par }\pard\plain \s3\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel2\rin0\lin0\itap0\pararsid8592727 \f1\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 {\*\bkmkstart _Toc100392822}Repeat
-{\*\bkmkend _Toc100392822}
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid8592727 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 Encode repeated sequence of the same sample:
-\par }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin284\itap0\pararsid8592727 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 Repeat(x) = Int(0) + UI}{\insrsid12536172 nt(x)}{\insrsid8592727 :
-\par }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid8592727 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 {\*\bkmkstart _Toc100392823}File build up
-{\*\bkmkend _Toc100392823}
-\par {\listtext\pard\plain\fs20\insrsid8592727 \hich\af0\dbch\af0\loch\f0 -\tab}}\pard\plain \ql \fi-360\li405\ri0\sb60\sa60\widctlpar\jclisttab\tx405\wrapdefault\faauto\ls6\rin0\lin405\itap0\pararsid12536172 
-\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 File starts with Tag element.
-\par {\listtext\pard\plain\fs20\insrsid8592727 \hich\af0\dbch\af0\loch\f0 -\tab}It is followed by samples that are recorded as:
-\par }\trowd \irow0\irowband0\ts11\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 
-\cltxlrtb\clftsWidth3\clwWidth4455\clshdrawnil \cellx4347\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5400\clshdrawnil \cellx9747\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid12536172 {\insrsid8592727 Sample description\cell Sample record\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {
-\f2\insrsid8592727 \trowd \irow0\irowband0\ts11\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 
-\cltxlrtb\clftsWidth3\clwWidth4455\clshdrawnil \cellx4347\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5400\clshdrawnil \cellx9747\row }\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid12536172 {\insrsid8592727 The first sample record}{\insrsid12536172 .}{\insrsid8592727 \cell }\pard\plain 
-\s23\ql \li284\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin284\pararsid12536172 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 Int(PC | 1)
-\par }{\f2\fs20\insrsid8592727 UInt(threadID)
-\par UInt(processID)   ]
-\par Text(processName) ] Thread element
-\par Text(threadName)  ]\cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\f2\insrsid8592727 \trowd \irow1\irowband1\ts11\trgaph108\trleft-108
-\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 
-\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4455\clshdrawnil \cellx4347\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr
-\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5400\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid12536172 {\insrsid481371 A s}{\insrsid8592727 
-ample record with a new thread and a new process seen\cell }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin284\pararsid12536172 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 
-Int((PC - PC of the previous sample) | 1)
-\par }{\f2\fs20\insrsid8592727 UInt(threadID)
-\par UInt(processID)   ]
-\par Text(processName) ] Thread element
-\par Text(threadName)  ]\cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\f2\insrsid8592727 \trowd \irow2\irowband2\ts11\trgaph108\trleft-108
-\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 
-\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4455\clshdrawnil \cellx4347\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr
-\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5400\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid12536172 {\insrsid481371 A s}{\insrsid8592727 
-ample record with a new thread seen (with already known process)\cell }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin284\pararsid12536172 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 
-Int((PC - PC of the previous sample) | 1)
-\par }{\f2\fs20\insrsid8592727 UInt(threadID)
-\par UInt(processID)   ]
-\par Text(threadName)  ] Thread element\cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\f2\insrsid8592727 \trowd \irow3\irowband3
-\ts11\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 
-\cltxlrtb\clftsWidth3\clwWidth4455\clshdrawnil \cellx4347\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5400\clshdrawnil \cellx9747\row }\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid12536172 {\insrsid481371 A s}{\insrsid8592727 ample record with already known thread\cell }\pard\plain 
-\s23\ql \li284\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin284\pararsid12536172 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 Int((PC - PC of the previous sample) | 1)
-\par }{\f2\fs20\insrsid8592727 UInt(threadID)\cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\f2\insrsid8592727 \trowd \irow4\irowband4
-\ts11\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 
-\cltxlrtb\clftsWidth3\clwWidth4455\clshdrawnil \cellx4347\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5400\clshdrawnil \cellx9747\row }\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid12536172 {\insrsid481371 A s}{\insrsid8592727 ample with the same thread ID as the previous sample\cell }\pard\plain 
-\s23\ql \li284\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin284\pararsid12536172 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 Int(PC - PC of the previous sample)\cell }\pard\plain 
-\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\f2\insrsid8592727 \trowd \irow5\irowband5\ts11\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl
-\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 
-\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4455\clshdrawnil \cellx4347\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 
-\cltxlrtb\clftsWidth3\clwWidth5400\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid12536172 {\insrsid481371 A s}{\insrsid8592727 
-amples with the same PC and threadID that repeat N consecutive times\cell }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin284\pararsid12536172 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {
-\insrsid8592727 <Any sample record described above>
-\par Repeat(N-1)\cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid8592727 \trowd \irow6\irowband6\lastrow \ts11\trgaph108\trleft-108\trbrdrt
-\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt
-\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4455\clshdrawnil \cellx4347\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 
-\cltxlrtb\clftsWidth3\clwWidth5400\clshdrawnil \cellx9747\row }\pard\plain \s2\ql \li0\ri0\sb120\sa60\keepn\widctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid12536172 \b\i\f1\fs22\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {
-\insrsid12536172 {\*\bkmkstart _Toc100392824}Non-XIP code support{\*\bkmkend _Toc100392824}
-\par }\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid12536172 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid12536172 
-The record of non-XIP DCodeSeg creation/deletion can be inserted between any two consecutive sample records. It can also appea}{\insrsid5070621 r immediately after Tag element or just before Repeat element.}{\insrsid12536172 
-\par All records (samples and DCodeSeg) are placed in chronological order.
-\par }\pard\plain \s26\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid12536172 \f2\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid12536172 
-\par }\trowd \irow0\irowband0\ts11\trgaph108\trleft-108\trkeep\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4788\clshdrawnil \cellx4348\clvertalt
-\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5688\clshdrawnil \cellx9747\pard\plain \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid12536172 
-\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid12536172 Description\cell Recorded as\cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid12536172 \trowd \irow0\irowband0
-\ts11\trgaph108\trleft-108\trkeep\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4788\clshdrawnil \cellx4348\clvertalt
-\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5688\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid12536172 {
-\insrsid12536172\charrsid3154883 The record of nonXIP code segment creation. CodeSegFullName contains full path of the file name. If it is longer then 255 characters, the last 255 characters will be recorded.\cell }\pard\plain 
-\s23\ql \li284\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin284\pararsid12536172 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid12536172 Int(0)
-\par UInt(0)
-\par UInt(CodeSegRunAddress)
-\par UInt(CodeSegSize)
-\par Text(CodeSegFullName)\cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid12536172 \trowd \irow1\irowband1
-\ts11\trgaph108\trleft-108\trkeep\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4788\clshdrawnil \cellx4348\clvertalt
-\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5688\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid12536172 {
-\insrsid12536172 The record of nonXIP code segment deletion\cell }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin284\pararsid12536172 \f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid12536172 Int(0)
-
-\par UInt(0)
-\par UInt(CodeSegRunAddress | 1)\cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid12536172 \trowd \irow2\irowband2
-\ts11\trgaph108\trleft-108\trkeep\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4788\clshdrawnil \cellx4348\clvertalt
-\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5688\clshdrawnil \cellx9747\row }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid12536172 {
-\insrsid12536172 Footer. Resides at the bottom of the file. 
-\par }{\insrsid481371\charrsid16604991 RowBufferErrCounter}{\insrsid481371  }{\insrsid5055728 is the number of the dropped sample records due to full buffer condition in the driver.}{\insrsid481371 
-\par }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid5055728 {\insrsid5055728\charrsid16604991 CookBufferErrCounter}{\insrsid5055728 
- is the number of the dropped code segment events due to full buffer condition in the driver.
-\par }\pard \ql \li0\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid12536172 {\insrsid5055728 \cell }\pard\plain \s23\ql \li284\ri0\sb60\sa60\widctlpar\intbl\wrapdefault\faauto\rin0\lin284\pararsid12536172 
-\f36\fs18\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid12536172 Int(0)
-\par UInt(0)
-\par UInt(0)
-\par UInt(}{\insrsid12536172\charrsid16604991 RowBufferErrCounter}{\insrsid12536172 )
-\par UInt(}{\insrsid12536172\charrsid16604991 CookBufferErrCounter}{\insrsid12536172 )
-\par UInt(ReportBitMask) where:
-\par   bit 0 set in }{\insrsid12536172\charrsid5403878 NonXIPMode}{\insrsid12536172 
-\par   bit 1 set if }{\insrsid12536172\charrsid5403878 NonXIPMode}{\insrsid12536172  but Kernel
-\par             hasn\rquote t got debu}{\insrsid5070621 g}{\insrsid12536172 ger support}{\insrsid12536172\charrsid5403878 \cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 
-\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid12536172 \trowd \irow3\irowband3\lastrow \ts11\trgaph108\trleft-108\trkeep\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 
-\trbrdrv\brdrs\brdrw10 \trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 
-\cltxlrtb\clftsWidth3\clwWidth4788\clshdrawnil \cellx4348\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5688\clshdrawnil \cellx9747\row }\pard 
-\ql \li0\ri0\sb60\sa60\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid678217 {\insrsid10961137 
-\par }}
\ No newline at end of file
--- a/kerneltest/e32utils/group/base_e32utils.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32utils/group/base_e32utils.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "E32 Utilities"
 
 component	base_e32utils
@@ -31,7 +16,6 @@
 source	\sf\os\kernelhwsrv\kerneltest\e32utils\testusbcldd
 source	\sf\os\kernelhwsrv\kerneltest\e32utils\trace
 source	\sf\os\kernelhwsrv\kerneltest\e32utils\usbmsapp
-source	\sf\os\kernelhwsrv\kerneltest\e32utils\sdpartition	
 	
 #MattD: Reltools 2.67 don't understand 'cwtools' are the CW equivelent of 'tools' and try to do '-what cwtools udeb' instead of '-what cwtools deb'.
 #binary	\sf\os\kernelhwsrv\kerneltest\e32utils\group cwtools
@@ -41,7 +25,6 @@
 binary	\epoc32\release\tools\rel\analyse.exe
 binary	\epoc32\release\tools\rel\netcards.exe
 
--export_file	\sf\os\kernelhwsrv\kerneltest\e32utils\analyse\profiler.rtf	\epoc32\engdoc\profiler\Profiler.rtf
 notes_source	\component_defs\release.src
 
 
--- a/kerneltest/e32utils/group/bld.inf	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/e32utils/group/bld.inf	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -30,21 +30,17 @@
 
 PRJ_EXPORTS
 
-
-
-
 ../profiler/profiler.h						SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(profiler.h)
 
-../d_exc/printstk.pl /epoc32/rom/tools/printstk.pl
-../d_exc/printsym.pl /epoc32/rom/tools/printsym.pl
+../d_exc/printstk.pl 						/epoc32/rom/tools/printstk.pl
+../d_exc/printsym.pl 						/epoc32/rom/tools/printsym.pl
 
-../setcap/setcap.iby  /epoc32/rom/include/setcap.iby
+../setcap/setcap.iby						/epoc32/rom/include/setcap.iby
 
 ../demandpaging/dptest.h					SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(dptest.h)
-../demandpaging/dptestcons.oby /epoc32/rom/include/dptestcons.oby
+../demandpaging/dptestcons.oby 				/epoc32/rom/include/dptestcons.oby
 
 PRJ_TESTEXPORTS
-../trace/btracevw.pl /epoc32/tools/btracevw.pl
 
 PRJ_TESTMMPFILES
 #if defined(TOOLS2)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/hcrscripts/hcrdat.pm	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,378 @@
+#!perl -w
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+use strict;
+
+#use Math::BigInt;
+
+#
+# Perl module to create and maintain feature manager data files.
+# You can either set up the information programmatically or else load up
+# information from a pre-existing feature data file and then modify it. You
+# can also save the information to a file (in feature manager dataset format).
+#
+# This class maintains header information plus two arrays, one containing
+# feature flag information and the other containing default supported range
+# information. Those are themselves objects and have their own accessor
+# methods.
+#
+
+package HCRdat;
+
+use HCRrec;
+
+
+#
+# n e w
+#
+# Create a new HCRdat object. For example 'my $hd = HCRdat->new("filea");
+#
+sub new
+{
+	my $arg = shift;
+	my $fn = shift;
+	my $class = ref($arg) || $arg;
+	my $self = {
+			        fingerprint => "HCRf",  # 4 bytes wide.
+					fileversion => 1,       # 2 bytes.
+					fileflags => 0x0001,  # 2 bytes.
+					numrecords => 0,      # 4 bytes. 
+					lsdoffset => 0,       # 4 bytes. 
+					lsdsize => 0,         # 4 bytes.
+				    packprefix => "V",    # Changed with endian-ness.
+					                      # Used to create binary strings.
+
+					settingrecords => [],  # Array of objects
+					lsd => [],             # Array of bytes
+	           };
+    bless $self, $class;
+	return $self;
+}
+
+
+# Print to STDOUT the header information we have.
+sub ShowHeader
+{
+	my $self = shift;
+	return undef unless(ref($self));
+
+	# Get header information..
+	my $typefield = $self->TypeField();
+	my $fileversion = $self->FileVersion();
+	my $fileflags = $self->FileFlags();
+	my $numrecords = $self->NumRecords();
+	my $lsdoffset = $self->LsdOffset();
+	my $lsdsize = $self->LsdSize();
+	
+	# Display it in English.
+	print "  FINGERPRINTF: '$typefield'\n";
+	print "  FILEVERSION: '$fileversion'\n";
+	print "  FILEFLAGS: '$fileflags'\n";
+	print "  NUMRECORDS: '$numrecords'\n";
+	print "  LSDOFFSET: '$lsdoffset'\n";
+    print "  LSDSIZE: '$lsdsize'\n";
+
+	return(0);
+}
+
+# Get/Set the endian-ness we want. Changes the 'packprefix' member which is
+# used in the creation of binary data.
+sub Endian
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $arg = shift;
+	return $self->{endian} unless(defined($arg));
+	if($arg =~ m/(LE|BE)/i)
+	{
+		my $endian = uc($1);
+		$self->{endian} = $endian;
+		# Used by 'pack' to generate binary strings.
+		$self->{packprefix} = "V" if($endian eq "LE");
+		$self->{packprefix} = "N" if($endian eq "BE");
+	}
+	return $self->{endian};
+}
+
+# This is the fingerprint.
+sub TypeField
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $arg = shift;
+	$self->{fingerprint} = $arg if(defined($arg));
+	return $self->{fingerprint};
+}
+
+sub FileVersion
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $arg = shift;
+	# Should we be testing for a numeric value?
+	$self->{fileversion} = $arg if(defined($arg));
+	return $self->{fileversion};
+}
+
+sub FileFlags
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $arg = shift;
+	$self->{fileflags} = $arg if(defined($arg));
+	return $self->{fileflags};
+}
+
+# How many feature flag objects have we got?
+sub NumRecords
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $arg = shift;
+	$self->{numrecords} += $arg if(defined($arg));
+	return $self->{numrecords};
+}
+
+
+sub LsdOffset
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $arg = shift;
+	$self->{lsdoffset} = $arg if(defined($arg));
+	return $self->{lsdoffset};
+}
+
+sub LsdSize
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $arg = shift;
+	$self->{lsdsize} = $arg if(defined($arg));
+	return $self->{lsdsize};
+}
+
+# Create a binary string containing the header information for the
+# feature manager data file based on the various fields in this object.
+sub CreateBinaryHeader
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $hdrstring;
+
+	# Get the letter for packing information with 'pack' into a binary form.
+	my $pack16 = lc($self->{packprefix});
+	my $pack32 = uc($self->{packprefix});
+	
+	# Get header information..
+	my $typefield = $self->TypeField();
+	my $fileversion = $self->FileVersion();
+	my $fileflags = $self->FileFlags();
+	my $numrecords = $self->NumRecords();
+	my $lsdoffset = $self->LsdOffset();
+	my $lsdsize = $self->LsdSize();
+
+	# Write the 'type' field out. This is 'feat'. Would this be different on
+	# big-endian systems?
+	$hdrstring = $typefield;
+
+	# Now the file version number. A 16-bit value.. Will this cause trouble
+	# if the shifted value is signed?
+	$hdrstring .= pack($pack16 . "1", $fileversion);
+
+	# Now the file flags. Another 16-bit value..
+	$hdrstring .= pack($pack16 . "1", $fileflags);
+
+	# Now the number of listed features - a 32-bit value.
+	$hdrstring .= pack($pack32 . "1", $numrecords);
+
+	# Now the number of listed features - a 32-bit value.
+	$hdrstring .= pack($pack32 . "1", $lsdoffset);
+
+	# Now the number of listed features - a 32-bit value.
+	$hdrstring .= pack($pack32 . "1", $lsdsize);
+
+	# Now the 3 reserved words
+	$hdrstring .= pack($pack32 . "3", (0, 0, 0));
+
+	return $hdrstring;
+}
+
+sub CreateImageHdr
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	#my $partid = shift;
+	#return -1 unless(defined($partid));
+
+	# Add fingerprint, 1st reserved word and format version
+	my $imghdr = pack "V4", (0x5F524348, 0x54524150, 0x00000000, 0x00000001);
+	# Add space for image size, timestamp, 2nd reserved word
+	$imghdr .= pack "V3", (0x00000000, time, 0x00000000);
+	# Add space for payload checksum, HCR Payload constants: UID and 0x0 flags
+    $imghdr .= pack "V3", (0x00000000, 0x10286AB8, 0x00000000);
+    #Reserved space
+    $imghdr .= pack "x216", (0x00000000);
+ 
+    return $imghdr;
+}
+
+sub WriteToImage
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $imgfile = shift;
+	return -1 unless(defined($imgfile));
+	my $datfile = shift;
+	return -1 unless(defined($datfile));
+	#my $partid = shift;
+	#return -1 unless(defined($partid));
+	my $rc = 0;
+	
+    open IMGFILE, "> $imgfile" or die "Couldn't open file '$imgfile' for writing.\n";
+	binmode IMGFILE;
+   
+ 	syswrite(IMGFILE, $self->CreateImageHdr(), 256);	
+ 	
+    open DATFILE, "$datfile" or die "Couldn't open file '$datfile' for reading.\n";
+	binmode DATFILE;
+	# print FILE $self->BinaryContent();
+	
+    #my $wordsum = 0x1200000000;
+    #my $wordsum = Math::BigInt->new("0x0220100123");
+    #printf("test: %x\n", $wordsum->external();
+
+	my $imgsize = 256;
+	my $word;
+	printf("-reading image:\n")  if ($mhd::otrace);
+	while (sysread (DATFILE, $word, 4)) {
+	    #printf ("%08x ",$word)  if ($mhd::otrace);
+        my $iword = unpack("V" , $word);
+	    printf ("%08x ",$iword)  if ($mhd::otrace);
+        $rc = syswrite (IMGFILE, $word, 4);
+        die "error: ($rc) failed to write datfile word into imgfile.\n" if ($rc != 4);
+	    #$wordsum->badd($iword);
+        $imgsize += 4;
+	    print "\n" if (($mhd::otrace) && ($imgsize%16==0));
+        }
+    print "\n" if ($mhd::otrace);
+    # ordsum: 0x". $wordsum ."\n" if ($mhd::otrace);
+	my $checksum = 0x12345678;
+	close DATFILE;
+	
+	printf("-image size: %d, checksum: 0x%08x", $imgsize, $checksum) if ($mhd::otrace);
+	
+	$rc = sysseek(IMGFILE, 16, 0);
+	die "error: ($rc) failed to seek in image to write header.\n" if ($rc != 16);
+
+	# Write out the image size	
+	my $imginfo1 = pack "V1", ($imgsize);
+	$rc = syswrite(IMGFILE, $imginfo1, 4);
+	die "error: ($rc) failed to write image size/checksum to image header.\n" if ($rc != 4);
+
+	$rc = sysseek(IMGFILE, 28, 0);
+	die "error: ($rc) failed to seek in image to write header.\n" if ($rc != 28);
+	
+	# Write out the image checksum 
+	my $imginfo2 = pack "V1", ($checksum);
+	$rc = syswrite(IMGFILE, $imginfo2, 4);
+	die "error: ($rc) failed to write image size/checksum to image header.\n" if ($rc != 4);
+  
+	close IMGFILE; 	
+	
+    return 0;
+}
+
+# Writes the binary file specified as an argument with the content of this
+# and contained feature flag and dsr objects.
+sub WriteToFile
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $file = shift;
+	return undef unless(defined($file));
+    open FILE, "> $file" or die "Couldn't open file '$file' for writing.\n";
+	binmode FILE;
+	print FILE $self->BinaryContent();
+	
+	close FILE;
+	return 0;
+}
+
+
+# Create the binary equivalent of the internal data and return it as a
+# string.
+sub BinaryContent
+{
+	my $self = shift;
+	return undef unless(ref($self));
+
+    # Get the feature flag entries.. This is an array reference.
+	# For each one append the binary representation of the information
+	# contained.
+	my $records = "";
+    my $lsd = "";
+   	my $ffs_ref = $self->SettingRecords();
+	my $ff;
+
+    my $count = 0;
+	foreach $ff (@$ffs_ref)
+	{
+	    $count++;
+	    printf("-encoding record: %04d (0x%08x:%04d)\n", $count, $ff->CUID(), $ff->EID());
+		$records .= $ff->GetRecHdrBinary(length ($lsd));
+	    my $stype = $ff->Type();
+    	if (($stype & 0xffff0000) && ($ff->Length() > 0)) {
+		    $lsd .= $ff->GetRecLsdBinary();
+            }
+	}
+
+    $self->LsdOffset(32+length ($records));     # header size 32
+    $self->LsdSize(length ($lsd));
+    
+	my $header = $self->CreateBinaryHeader();
+
+	return $header . $records . $lsd;
+}
+
+# Return a reference to the 'feature flags' array.
+sub SettingRecords
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	return $self->{settingrecords};
+}
+
+# Add a Feature Flag object. Perhaps there should be code to check if we
+# already know about this feature flag. (i.e check the uid against the ones
+# we have).
+sub AddSettingRecord
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $arg = shift;
+	die "panic: method 'AddSettingRecord' requires a 'HCRrec' object as argument.\n"
+   	    unless(ref($arg) eq  "HCRrec");
+   	
+	push @{$self->SettingRecords()}, $arg;
+	$self->NumRecords(1);
+	
+    return 0;
+}
+
+
+1;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/hcrscripts/hcrmd.bat	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,19 @@
+@rem
+@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of the License "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description:
+@rem
+
+@echo off
+
+@perl -S -I%EPOCROOT%epoc32/tools/hcr %EPOCROOT%epoc32/tools/hcr/makehcrdat.pl %*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/hcrscripts/hcrrec.pm	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,437 @@
+#!perl -w
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+use strict;
+
+#
+# A simple class to manage feature flags for a feature set data file.
+#
+package HCRrec;
+
+my %typemap = (
+    Int32 =>       0x00000001,
+    Int16 =>       0x00000002,    
+    Int8 =>        0x00000004,
+    Bool =>        0x00000008,    
+    UInt32 =>      0x00000010,
+    UInt16 =>      0x00000020,    
+    UInt8 =>       0x00000040,
+    LinAddr =>     0x00000100,
+    BinData =>     0x00010000,
+    Text8 =>       0x00020000,    
+	ArrayInt32 =>  0x00040000,
+	ArrayUInt32 => 0x00080000,
+    Int64 =>       0x01000000,
+    UInt64 =>      0x02000000,    
+);
+my %maptype = reverse %typemap;
+my %lsdtype2packmap = (
+    0x00010000 => "C",
+    0x00020000 => "a",    
+    0x01000000 => "C",
+    0x02000000 => "C",    
+);
+
+# Create a feature flag object.
+sub new
+{
+	my $arg = shift;
+	my $class = ref($arg) || $arg;
+
+	my $self = {
+			     cuid => 0,              # 4 bytes
+			     eid => 0,               # 4 bytes
+			     type => 0,              # 4 bytes
+			     flagword => 0x0000,     # 2 bytes 
+                 valueset => 0,
+                           
+			     intvalue => 0,           # 4 bytes
+			     strvalue => "",          # array of chars
+			     binvalue => [],          # array of bytes
+			     arrvalue => [],		  # array of 4 byte integers
+			     
+   				 endian => "LE",
+			   };
+ 
+	bless $self, $class;
+	return $self;
+}
+
+sub Endian
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $arg = shift;
+	return $self->{endian} unless(defined($arg) and $arg =~ m/(^BE$|^LE$)/i);
+	$self->{endian} = lc($1);
+	return $self->{endian};
+}
+
+# Return a twelve byte string 'feature flag' information.
+sub GetRecHdrBinary
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	
+	my $lsd_size = shift;
+	
+	my $stype = $self->Type(); 
+	my @hdrarr = ( $self->CUID(), $self->EID(), $stype, $self->Flags(),
+                $self->SizeInBytes() );
+    
+	# Decide whether we want big or little endian output.
+	# According to the documentation, 'V', 'N' are GUARANTEED to be 32-bit.
+	my $packstring;
+	if($self->Endian() eq "BE") {
+	    $packstring = "N3n2N";
+        }
+    else {
+        $packstring = "V3v2V"; # Little endian.
+        }
+        
+    #
+    # Could add range checks here for 8-bit and 16-bit types.
+    # However would stop negative test cases from being generated.
+    # Do it later.
+    #
+    
+    if ($stype & 0xffff) {
+        print "Writing integer\n" if ($mhd::otrace);
+        push @hdrarr, $self->IntValue();
+        }
+    
+    if ($stype & 0xffff0000) {
+        if ($self->Length() > 0) {
+            print "Writing offset: " . $lsd_size . "\n" if ($mhd::otrace);
+            push @hdrarr, $lsd_size;
+            }
+        else {
+            print "Writing null offset: 0\n" if ($mhd::otrace);
+            push @hdrarr, 0;            
+            }
+        }
+
+	my $hdr_string = pack $packstring, @hdrarr;
+	
+	return $hdr_string;
+}
+
+# Return a twelve byte string 'feature flag' information.
+# Assumes Little Endian output!
+sub GetRecLsdBinary
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	
+    my $value = "";
+    my $valuelen = $self->Length();
+    my $vallen = $valuelen;
+    #print "vallen before:" . $vallen . "\n";
+    $vallen = ($valuelen+3)&0xfffc if ($valuelen%4) ;
+    #print "vallen after:" . $vallen . "\n";
+	my $valtype = $self->{type};
+
+    # String
+    if ($valtype & 0x00020000) {
+	    my $packstr = $lsdtype2packmap{$valtype} . $vallen;
+	    printf ("packstr:%s\n", $packstr) if($mhd::otrace);
+        printf ("strvalue:%s\n", $self->{strvalue}) if($mhd::otrace);
+        $value = pack $packstr,  $self->{strvalue} ;
+        }
+    # Binary Data
+    elsif ($valtype & 0x00010000) {
+        for (my $c=0;  $c < $valuelen; $c++) {
+            my $byte = $self->{binvalue}[$c];
+            $value .= pack $lsdtype2packmap{$valtype}, $byte;
+            $vallen--;     
+        }
+        while ($vallen > 0) {
+            $value .= pack "C", ( 0x00 );
+            $vallen--;
+            }
+    }
+    # 64bit quantity
+    elsif ($valtype & 0x03000000) {
+        die "error: 64 bit integer missing hex binvalues\n" if (! exists $self->{binvalue}[7]);
+        $value  = pack $lsdtype2packmap{$valtype}, $self->{binvalue}[0];
+        $value  .= pack $lsdtype2packmap{$valtype}, $self->{binvalue}[1];
+        $value  .= pack $lsdtype2packmap{$valtype}, $self->{binvalue}[2];
+        $value  .= pack $lsdtype2packmap{$valtype}, $self->{binvalue}[3];
+        $value  .= pack $lsdtype2packmap{$valtype}, $self->{binvalue}[4];
+        $value  .= pack $lsdtype2packmap{$valtype}, $self->{binvalue}[5];
+        $value  .= pack $lsdtype2packmap{$valtype}, $self->{binvalue}[6];
+        $value  .= pack $lsdtype2packmap{$valtype}, $self->{binvalue}[7];
+        }
+    # array of 32bit quantity
+    elsif ($valtype & 0x000C0000) {
+        for (my $c=0;  $c < $valuelen; $c++) {
+            my $int = $self->{arrvalue}[$c];
+            $value .= pack "V", $int;
+            $vallen--;     
+            }
+	}    
+    else {
+        die "panic: proramming error!!";
+    }
+    
+	return $value;
+	}
+
+# A single 32-bit number.
+sub CUID
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $uid = shift;
+	return $self->{cuid} unless(defined($uid));
+	my $uidv = hex($uid);
+	$self->{cuid} = $uidv;
+	return $uidv;
+}
+
+# A single 32-bit number.
+sub EID
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $id = shift;
+	return $self->{eid} unless(defined($id));
+	my $idv = int($id);
+	$self->{eid} = $idv;
+	return $idv;
+}
+
+sub Type
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $type = shift;
+	return $self->{type} unless(defined($type));
+	my $enum = $typemap{$type};
+	#print "--->Defined\n" if (defined $enum);
+	#print "--->NOT Defined\n" if (! defined $enum);
+	die "error: unknown setting type found in input file\n" if (! defined $enum);
+   	$self->{type} = $enum;
+	return $enum;
+}
+
+sub TypeName
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	return "Undefined Type" if (! exists $maptype{$self->{type}});
+	return $maptype{$self->{type}};
+}
+
+sub Flags
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $flags = shift;
+	return $self->{flagword} unless(defined($flags));
+	my $vf = hex($flags);
+	$self->{flagword} = $vf;
+	return $vf;
+}
+
+sub Length
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $len = shift;
+	die "panic: Length() does not take an argument!\n" if (defined($len));
+	
+	my $length = 0;
+	if ($self->{type} & 0x00020000) {
+        $length = length ($self->{strvalue});
+        }
+    elsif ($self->{type} & 0x03010000) {
+	    my $array_ref = $self->{binvalue};
+	    my @array = @$array_ref;
+	    $length = $#array+1;
+	    }
+    elsif ($self->{type} & 0x000C0000) {
+	    my $array_ref = $self->{arrvalue};
+	    my @array = @$array_ref;
+	    $length = $#array+1;
+	    #printf ("arrval length %d %d\n",  length ($self->{arrval}), $length);
+	    }
+	else {
+	    $length = 0;
+        }
+	return $length;	
+}
+
+sub SizeInBytes
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $len = shift;
+	die "panic: Length() does not take an argument!\n" if (defined($len));
+	
+	my $size = 0;
+	if ($self->{type} & 0x00020000) {
+        $size = length ($self->{strvalue});
+        }
+    elsif ($self->{type} & 0x03010000) {
+	    my $array_ref = $self->{binvalue};
+	    my @array = @$array_ref;
+	    $size = $#array+1;
+	    }
+    elsif ($self->{type} & 0x000C0000) {
+	    my $array_ref = $self->{arrvalue};
+	    my @array = @$array_ref;
+	    $size = ($#array+1)*4;
+	    #printf ("arrval length %d %d\n",  length ($self->{arrval}), $length);
+	    }
+	else {
+	    $size = 0;
+        }
+	return $size;	
+}
+
+sub IsValid
+{
+	my $self = shift;
+	return undef unless(ref($self));
+
+    if (($self->{cuid} == 0) || ($self->{eid} == 0) ||
+        ($self->{type} == 0) || ($self->{flagword} != 0) ||
+        ($self->IsValueSet() == 0)) {
+        return 0;
+        }    
+    
+    #Record valid if we reach here
+    return 1;    
+}
+
+sub IsValueSet
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	return $self->{valueset};
+}
+
+sub MarkValueSet
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	$self->{valueset} = 1;
+}
+
+sub IntValue
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $value = shift;
+	if (defined($value)) {
+        my $int = int($value);
+        $self->{intvalue} = $int;
+        $self->MarkValueSet();
+        }
+	return $self->{intvalue};
+}
+
+sub HexValue
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $value = shift;
+	return $self->{intvalue} unless(defined($value));
+	my $int = hex($value);
+	$self->{intvalue} = $int;
+	$self->MarkValueSet();
+    return $int;
+}
+
+sub StrValue
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $value = shift;
+	return $self->{strvalue} unless(defined($value));
+	#printf ("strlen before %d\n", length ($self->{strvalue}));	
+    $self->{strvalue} .= $value;
+	#printf ("strlen after %d\n",  length ($self->{strvalue}));
+	$self->MarkValueSet();
+    return $value;
+}
+
+sub ArrValue
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $value = shift;
+
+	return $self->{arrvalue} unless(defined($value));
+
+    my $int = int($value);
+	my $index = $self->Length();
+
+	$self->{arrvalue}[$index] = $int; # Increments the array size as well as appending item
+	$index*=4; 
+
+	printf ("warning: array value larger than HCR maximum (512 bytes): %d\n", $index) if ($index > 512);    
+	$self->MarkValueSet();
+
+    return $self->{arrvalue};
+}
+
+sub BinValue
+{
+	my $self = shift;
+	return undef unless(ref($self));
+	my $value = shift;
+	
+	return $self->{binvalue} unless(defined($value));
+
+    my @hwords = split(/\s/,$value);
+    shift @hwords if ($hwords[0] eq "");
+    my $hwordslen = scalar(@hwords);  
+
+    #printf("(len:%d)(0:%04x 1:%04x last:%04x)\n", $hwordslen, hex($hwords[0]), hex($hwords[1]), hex($hwords[$hwordslen-1])) if ($mhd::trace);
+    
+    my $index = $self->Length();
+	#printf ("binlen before %d\n", $index);
+         
+    #print "Index: " . $index . "\n";
+    foreach my $word (@hwords) {
+        if (length ($word) == 2) {
+	        $self->{binvalue}[$index] = hex($word);
+            }
+        else {
+            die "error: hexadecimal value '$word' too short/large for 8-bit integer\n";
+            }
+
+
+	   #$self->{binvalue}[$index] = $mint;
+	   #printf("%d: %04x\n", $count, $self->{binvalue}[$count]);
+       $index++;	  
+	   }
+	  
+
+	#printf ("binlen after %d\n", $index);
+            
+    printf ("warning: binary value larger than HCR maximum (512 bytes): %d\n", $index) if ($index > 512);
+    $self->MarkValueSet();            
+	return $self->{binvalue};
+}
+
+
+# ###########################################################################
+
+1;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/hcrscripts/hcrscripts.inf	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,31 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Hardware Configuration Respoitory Scripts and Utils
+// Convienence inf file, to build:  bldmake -f hcrscripts.inf bldfiles
+// Scripts not part of the offical OS build, hence these are unsupported.
+// Available for developer adhoc-testing only until offical HCR tools available.
+//
+
+/**
+@file
+Hardware Configuration Repository Scripts
+*/
+
+PRJ_EXPORTS
+
+./hcrmd.bat								/epoc32/tools/hcrmd.bat
+./hcrdat.pm								/epoc32/tools/hcr/hcrdat.pm
+./hcrrec.pm								/epoc32/tools/hcr/hcrrec.pm	
+./makehcrdat.pl							/epoc32/tools/hcr/makehcrdat.pl
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/hcrscripts/makehcrdat.pl	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,219 @@
+#!perl -w
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+# This simple script makes a binary HCR data file from a text input file
+#
+use strict;
+
+use HCRdat;
+use HCRrec;
+
+package mhd;
+
+#
+# Find out what file the user is interested in..
+# Make sure it's specified and exists.
+#
+$mhd::trace = 0;
+$mhd::otrace = 0;
+
+if (@ARGV < 2 || @ARGV > 4) {
+    die "\nUsage: hcrmd.bat <source_textfile> <dest_datfile> [-i]\n";
+    }
+
+my $textfile = shift @ARGV;
+my $datfile  = shift @ARGV;
+
+my $do_create_image = 0;
+my $opt_i = shift @ARGV;
+#my $partid = 0x10000005;
+if (defined($opt_i)) {
+    $do_create_image = 1 if ($opt_i eq "-i");
+    die "error: unknown command option\n" if ($opt_i ne "-i");
+    #my $i_no = shift @ARGV;
+    #$partid = hex($i_no) if (defined($i_no)); 
+    #printf("partitionid: 0x%x\n", $partid)
+    }
+
+
+print "\n    HCR Binary Data File Generator, version v0.1\n";
+print "    Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.\n\n";
+print "-input: $textfile\n" if($mhd::trace);
+print "-output: $datfile\n" if($mhd::trace);
+
+die "error: Specifed source_textfile not found!" unless(-f $textfile);
+#die "error: Specified dest_binfile '$datfile' already exists!" if(-e $datfile);
+
+printf "\nReading input file... $textfile\n";
+
+printf "-opening text file\n" if($mhd::trace);
+my $tfh;
+open($tfh, "<$textfile");
+
+printf "-started conversion...\n"  if($mhd::trace);
+my $datobj = HCRdat->new();
+my $inrec = 0;
+my $ln = 0;
+my $recobj;
+
+while (<$tfh>)
+    {
+    $ln++;
+    if ($_ =~ '^\s*#') {
+        printf "-comment\n" if($mhd::trace);
+        }
+    elsif ($_ =~ '^@') {
+        die "error: Syntax error line $ln: New record started before previous one is closed" if($inrec > 0);
+        printf "-start\n" if($mhd::trace);
+        $inrec = 1;
+        $recobj = HCRrec->new();
+        }
+    elsif ($_ =~ '^\.') {
+        die "error: Syntax error line $ln: Record closed before a new record has been opened" if($inrec == 0); 
+        printf "-end\n" if($mhd::trace);
+        if ($recobj->IsValid()) {
+            $datobj->AddSettingRecord($recobj);
+            }
+        else {
+            die "error: Record after record " . $datobj->NumRecords() . " completed but not valid, missing or has =0  fields?\n";
+            }
+        $inrec = 0;
+        }
+    elsif ($_ =~ '^\s*$') {
+        printf "-blank\n" if($mhd::trace);
+        }
+    elsif ($_ =~ '^\s*cuid:\s') {
+        print "--cuid " if($mhd::trace);
+        my @hwords = split(/\s+/,$_);
+        die "error: 'cuid:' line incorrectly formed" if (scalar(@hwords) != 2); 
+
+        $recobj->CUID($hwords[1]);
+        printf("=0x%08x\n", $recobj->CUID()) if($mhd::trace);
+        }
+    elsif ($_ =~ '^\s*eid:\s') {
+        print "--eid " if($mhd::trace);
+        my @hwords = split(/\s+/,$_);
+        die "error: 'eid:' line incorrectly formed" if (scalar(@hwords) != 2); 
+
+        $recobj->EID($hwords[1]);
+        print "=".($recobj->EID())."\n" if($mhd::trace);  
+        }
+    elsif ($_ =~ '^\s*type:\s') {
+        print "--type " if($mhd::trace);
+        my @hwords = split(/\s+/,$_);
+        die "error: 'type:' line incorrectly formed" if (scalar(@hwords) != 2); 
+        
+        $recobj->Type($hwords[1]); 
+        printf("=0x%08x (%s)\n", $recobj->Type(), $recobj->TypeName()) if($mhd::trace);
+        }
+    elsif ($_ =~ '^\s*flags:\s') {
+        print "--flags " if($mhd::trace);
+        my @hwords = split(/\s+/,$_);
+        die "error: 'flags:' line incorrectly formed" if (scalar(@hwords) != 2);
+        
+        $recobj->Flags($hwords[1]);
+        printf ("=0x%x\n", $recobj->Flags()) if($mhd::trace);  
+        printf ("warning: flag length value greater than 2-bytes\n") if ($recobj->Flags() > 0xffff);
+        }
+    elsif ($_ =~ '^\s*intval:\s') {
+        print "--intval " if($mhd::trace);
+        my @hwords = split(/\s+/,$_);
+        die "error: 'intval:' line incorrectly formed" if (scalar(@hwords) != 2); 
+
+        $recobj->IntValue($hwords[1]);
+        printf("=%d (0x%x)\n", $recobj->IntValue(), $recobj->IntValue()) if($mhd::trace);  
+        }
+    elsif ($_ =~ '^\s*hexval:\s') {
+        print "--hexval " if($mhd::trace);
+        my @hwords = split(/\s+/,$_);
+        die "error: 'hexval:' line incorrectly formed" if (scalar(@hwords) != 2); 
+
+        $recobj->HexValue($hwords[1]);
+        printf("=%d (0x%x)\n", $recobj->IntValue(), $recobj->IntValue()) if($mhd::trace);  
+        }
+    elsif ($_ =~ '^\s*arrval:\s') {
+        print "--arrval " if($mhd::trace);
+        my @hwords = split(/\s+/,$_);
+        die "error: 'arrval:' line incorrectly formed" if (scalar(@hwords) != 2); 
+        
+		print  $hwords[1]."\n" if ($mhd::trace);
+        $recobj->ArrValue($hwords[1]);  
+        }
+    elsif ($_ =~ '^\s*strval:\s') {
+        print "--strval " if($mhd::trace);
+        my @hwords = split(/\"/,$_);
+        die "error: 'strval:' line incorrectly formed" if (scalar(@hwords) != 3); 
+
+        my $strval_size = $recobj->Length();
+        $recobj->StrValue($hwords[1]);
+        
+        printf("=\"%s\"\n", substr($recobj->StrValue(), $strval_size)) if($mhd::trace);  
+        }
+    elsif ($_ =~ '^\s*binval:\s') {
+        print "--binval " if($mhd::trace);
+        my @hwords = split(/:/,$_);
+        die "error: 'binval:' line incorrectly formed" if (scalar(@hwords) < 2); 
+
+        my $binval_size = $recobj->Length();
+        $recobj->BinValue($hwords[1]);
+        
+        my $binval_ref = $recobj->BinValue();
+        my @binval = @$binval_ref;
+        
+        printf("(%d) =", $#binval+1) if($mhd::trace);
+        my $uint16 = $binval_size;
+        for (; $uint16 < @binval; $uint16++) {
+            printf("%02x ", $binval[$uint16]) if($mhd::trace);
+            } 
+
+        print "\n" if($mhd::trace);
+        }
+    elsif ($_ =~ '') {
+        }
+    else {
+        die "error: unknown line type '$_'" 
+#        print $_  if($mhd::trace);
+        }
+    }
+
+close $tfh;
+
+printf "\nGenerating output file... $datfile\n";
+
+printf "-creating binary data file\n"  if($mhd::otrace);
+if ($datobj->WriteToFile($datfile.".tmp") != 0) {
+    die "error: failed to write to dest_binfile";
+    }
+    
+printf "-renaming file to temp file to $datfile\n"  if($mhd::otrace);
+rename ($datfile.".tmp", $datfile);
+
+printf "-file header written:\n"  if($mhd::otrace);
+$datobj->ShowHeader() if($mhd::otrace);
+
+if ($do_create_image) {
+    my $imgfile = $datfile . ".img";
+    print "\nGenerating partition image... ".  $imgfile . "\n";
+
+    if ($datobj->WriteToImage($imgfile, $datfile) != 0) {
+        die "error: failed to write to image file $imgfile";
+        }
+    }
+
+print "\nDone.\n";
+exit 0;
+
+
+
Binary file kerneltest/e32utils/hcrscripts/test/array_hcrfile.dat has changed
Binary file kerneltest/e32utils/hcrscripts/test/array_hcrfile.dat.img has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/hcrscripts/test/array_test.txt	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,54 @@
+#------------------------------------------------------------------------------
+# Large Array Settings Test file for use with the 'hcrmd' tool.
+#
+
+#------------------------------------------------------------------------------
+# Signed Integer array 32-bit tests
+#
+@
+cuid: 0xee000001
+eid:  121
+type: ArrayInt32
+flags: 0x0000
+arrval: 2147483647
+arrval: 2147483647
+.
+@
+cuid: 0xee000001
+eid:  122
+type: ArrayInt32
+flags: 0x0000
+arrval: 1
+.
+@
+cuid: 0xee000001
+eid:  123
+type: ArrayInt32
+flags: 0x0000
+arrval: -2147483648
+arrval: -2147483648
+arrval: -2147483648
+.
+
+
+#------------------------------------------------------------------------------
+# Unsigned Integer array 32-bit tests
+#
+@
+cuid: 0xee000004
+eid:  131
+type: ArrayUInt32
+flags: 0x0000
+arrval: 4294967295
+arrval: 4294967295
+arrval: 4294967295
+arrval: 4294967295
+.
+
+@
+cuid: 0xee000004
+eid:  132
+type: ArrayUInt32
+flags: 0x0000
+arrval: 0
+.
Binary file kerneltest/e32utils/hcrscripts/test/integer_hcrfile.dat has changed
Binary file kerneltest/e32utils/hcrscripts/test/integer_hcrfile.dat.img has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/hcrscripts/test/integer_test.txt	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,205 @@
+#------------------------------------------------------------------------------
+# Integer Setting Test file for use with the 'hcrmd' tool.
+#
+
+#------------------------------------------------------------------------------
+# Signed Integer 32-bit tests
+#
+@
+cuid: 0xff000001
+eid:  1
+type: Int32
+flags: 0x0000
+intval: 2147483647
+.
+@
+cuid: 0xff000001
+eid:  2
+type: Int32
+flags: 0x0000
+intval: 0
+.
+@
+cuid: 0xff000001
+eid:  3
+type: Int32
+flags: 0x0000
+intval: -2147483648
+.
+
+#------------------------------------------------------------------------------
+# Signed Integer 16-bit tests
+#
+@
+cuid: 0xff000002
+eid:  11
+type: Int16
+flags: 0x0000
+intval: 32767
+.
+@
+cuid: 0xff000002
+eid:  12
+type: Int16
+flags: 0x0000
+intval: 0
+.
+@
+cuid: 0xff000002
+eid:  13
+type: Int16
+flags: 0x0000
+intval: -32768
+.
+
+#------------------------------------------------------------------------------
+# Signed Integer 8-bit tests
+#
+@
+cuid: 0xff000003
+eid:  21
+type: Int8
+flags: 0x0000
+intval: 127
+.
+
+@
+cuid: 0xff000003
+eid:  22
+type: Int8
+flags: 0x0000
+intval: 0
+.
+@
+cuid: 0xff000003
+eid:  23
+type: Int8
+flags: 0x0000
+intval: -128
+.
+
+#------------------------------------------------------------------------------
+# Unsigned Integer tests
+#
+@
+cuid: 0xff000004
+eid:  31
+type: UInt32
+flags: 0x0000
+intval: 4294967295
+.
+@
+cuid: 0xff000004
+eid:  32
+type: UInt16
+flags: 0x0000
+intval: 65535
+.
+@
+cuid: 0xff000004
+eid:  33
+type: UInt8
+flags: 0x0000
+intval: 255
+.
+
+#------------------------------------------------------------------------------
+# Boolean tests
+#
+@
+cuid: 0xff000005
+eid:  41
+type: Bool
+flags: 0x0000
+intval: 1
+.
+@
+cuid: 0xff000005
+eid:  42
+type: Bool
+flags: 0x0000
+intval: 0
+.
+
+
+#------------------------------------------------------------------------------
+# Linear Addrress tests
+#
+@
+cuid: 0xff000006
+eid:  51
+type: LinAddr
+flags: 0x0000
+hexval: 0x80000000
+.
+@
+cuid: 0xff000006
+eid:  52
+type: LinAddr
+flags: 0x0000
+hexval: 0x01008004
+.
+@
+cuid: 0xff000006
+eid:  53
+type: LinAddr
+flags: 0x0000
+hexval: 0x00000000
+.
+
+
+#------------------------------------------------------------------------------
+# Synatx tests
+#
+
+# Tool should cope with these
+@
+cuid: 0xffff0001
+eid:  101
+type: Int32
+intval: 1889025
+.
+@
+cuid: 0xffff0002
+eid:  102
+type: Int32
+intval: 5889025
+.
+
+# Missing fields - Tool should abort for these records
+# 
+#@
+#cuid: 0xffff0003
+#eid:  103
+#type: Int32
+#.
+#@
+#cuid: 0xffff0004
+#eid:  104
+#.
+#@
+#cuid: 0xffff0005
+#.
+#@
+#.
+
+# Incorrect Types - Tool should abort for these records
+# 
+#@
+#cuid: 0xffff0006
+#eid:  106
+#type: int32
+#intval: 1889025
+#.
+#@
+#cuid: 0xffff0007
+#eid:  107
+#type: Int
+#intval: 1889025
+#.
+#@
+#cuid: 0xffff0008
+#eid:  108
+#type: Int32ab
+#intval: 1889025
+#.
Binary file kerneltest/e32utils/hcrscripts/test/large_hcrfile.dat has changed
Binary file kerneltest/e32utils/hcrscripts/test/large_hcrfile.dat.img has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/hcrscripts/test/large_test.txt	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,378 @@
+#------------------------------------------------------------------------------
+# Large Settings Test file for use with the 'hcrmd' tool.
+#
+
+#------------------------------------------------------------------------------
+# BinData tests
+#
+
+@
+cuid: 0x000000ff
+eid:  13
+type: BinData
+flags: 000000
+binval: 0E
+.
+@
+cuid: 0x000000ff
+eid:  23
+type: BinData
+flags: 000000
+binval: 0E 1F 
+.
+@
+cuid: 0x000000ff
+eid:  33
+type: BinData
+flags: 000000
+binval: 0E 1F BA
+.
+@
+cuid: 0x000000ff
+eid:  43
+type: BinData
+flags: 000000
+binval: 0E 1F BA 11
+.
+@
+cuid: 0x000000ff
+eid:  53
+type: BinData
+flags: 000000
+binval: 0E 1F BA 11 1F
+.
+@
+cuid: 0x000000ff
+eid:  63
+type: BinData
+flags: 000000
+binval: FF FF BA 0E 00 B4 
+.
+@
+cuid: 0x000000ff
+eid:  64
+type: BinData
+flags: 000000
+binval: FF FF BA 0E 00 B4 2E
+.
+@
+cuid: 0x000000ff
+eid:  73
+type: BinData
+flags: 000000
+binval: FF FF BA 0E 00 B4 2E AA
+.
+@
+cuid: 0x000000ff
+eid:  83
+type: BinData
+flags: 000000
+binval: FF FF BA 0E 00 B4 2E AA DD
+.
+@
+cuid: 0x000000ff
+eid:  93
+type: BinData
+flags: 000000
+binval: FF FF BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68
+binval: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F 
+binval: 74 20 62 65 20 72 75 6E 20 69 6E 20 44 4F 53 20 
+binval: 6D 6F 64 65 2E 0D 0D 0A 24 00 00 00 00 00 00 0F
+binval: 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68 
+binval: 69 73 20 70 72 6F 67 72 61 6D 11 11 22 22 00 FF
+.
+
+@
+cuid: 0x000000ff
+eid:  103
+type: BinData
+flags: 000000
+binval: FF FF BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68
+binval: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F 
+binval: 74 20 62 65 20 72 75 6E 20 69 6E 20 44 4F 53 20 
+binval: 6D 6F 64 65 2E 0D 0D 0A 24 00 00 00 00 00 00 0F
+binval: 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68 
+binval: 69 73 20 70 72 6F 67 72 61 6D 11 11 22 22 00 FF
+binval: FF FF BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68
+binval: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F 
+binval: 74 20 62 65 20 72 75 6E 20 69 6E 20 44 4F 53 20 
+binval: 6D 6F 64 65 2E 0D 0D 0A 24 00 00 00 00 00 00 0F
+binval: 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68 
+binval: 69 73 20 70 72 6F 67 72 61 6D 11 11 22 22 00 FF
+binval: FF FF BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68
+binval: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F 
+binval: 74 20 62 65 20 72 75 6E 20 69 6E 20 44 4F 53 20 
+binval: 6D 6F 64 65 2E 0D 0D 0A 24 00 00 00 00 00 00 0F
+binval: 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68 
+binval: 69 73 20 70 72 6F 67 72 61 6D 11 11 22 22 00 FF
+binval: FF FF BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68
+binval: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F 
+binval: 74 20 62 65 20 72 75 6E 20 69 6E 20 44 4F 53 20 
+binval: 6D 6F 64 65 2E 0D 0D 0A 24 00 00 00 00 00 00 0F
+binval: 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68 
+binval: 69 73 20 70 72 6F 67 72 61 6D 11 11 22 22 00 FF
+binval: FF FF BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68
+binval: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F 
+binval: 74 20 62 65 20 72 75 6E 20 69 6E 20 44 4F 53 20 
+binval: 6D 6F 64 65 2E 0D 0D 0A 24 00 00 00 00 00 00 0F
+binval: 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68 
+binval: 69 73 20 70 72 6F 67 72 61 6D 11 11 22 22 00 FF
+binval: FF FF BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68
+binval: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F 
+.
+
+@
+cuid: 0x000000ff
+eid:  113
+type: BinData
+flags: 000000
+binval: FF FF BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68
+binval: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F 
+binval: 74 20 62 65 20 72 75 6E 20 69 6E 20 44 4F 53 20 
+binval: 6D 6F 64 65 2E 0D 0D 0A 24 00 00 00 00 00 00 0F
+binval: 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68 
+binval: 69 73 20 70 72 6F 67 72 61 6D 11 11 22 22 00 FF
+binval: FF FF BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68
+binval: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F 
+binval: 74 20 62 65 20 72 75 6E 20 69 6E 20 44 4F 53 20 
+binval: 6D 6F 64 65 2E 0D 0D 0A 24 00 00 00 00 00 00 0F
+binval: 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68 
+binval: 69 73 20 70 72 6F 67 72 61 6D 11 11 22 22 00 FF
+binval: FF FF BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68
+binval: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F 
+binval: 74 20 62 65 20 72 75 6E 20 69 6E 20 44 4F 53 20 
+binval: 6D 6F 64 65 2E 0D 0D 0A 24 00 00 00 00 00 00 0F
+binval: 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68 
+binval: 69 73 20 70 72 6F 67 72 61 6D 11 11 22 22 00 FF
+binval: FF FF BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68
+binval: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F 
+binval: 74 20 62 65 20 72 75 6E 20 69 6E 20 44 4F 53 20 
+binval: 6D 6F 64 65 2E 0D 0D 0A 24 00 00 00 00 00 00 0F
+binval: 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68 
+binval: 69 73 20 70 72 6F 67 72 61 6D 11 11 22 22 00 FF
+binval: FF FF BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68
+binval: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F 
+binval: 74 20 62 65 20 72 75 6E 20 69 6E 20 44 4F 53 20 
+binval: 6D 6F 64 65 2E 0D 0D 0A 24 00 00 00 00 00 00 0F
+binval: 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68 
+binval: 69 73 20 70 72 6F 67 72 61 6D 11 11 22 22 00 FF
+binval: FF FF BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68
+binval: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F  
+binval: 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68 
+binval: 69 73 20 70 72 6F 67 72 61 6D 11 11 22 22 00 FF
+binval: FF FF BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68
+binval: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F  
+.
+
+#------------------------------------------------------------------------------
+# Text8 tests
+#
+
+# Length field tests
+#
+@
+cuid: 0x11223301
+eid:  1
+type: Text8
+flags: 0x0000
+strval: "Hello World!!"   
+.
+@
+cuid: 0x11223302
+eid:  2
+type: Text8
+flags: 0x0000
+strval: "Hell"   
+.
+@
+cuid: 0x11223303
+eid:  3
+type: Text8
+flags: 0x0000
+strval: "Hello World!!    "   
+.
+
+# strval field tests
+#
+@
+cuid: 0x11223304
+eid:  1
+type: Text8
+flags: 0x0000
+strval: ""   
+.
+@
+cuid: 0x11223305
+eid:  5
+type: Text8
+flags: 0x0000
+strval: "012345678901234567890123456789ab012345678901234567890123456789ab012345678901234567890123456789ab012345678901234567890123456789ab"
+.
+
+@
+cuid: 0x11223306
+eid:  6
+type: Text8
+flags: 0x0000
+strval: "012345678901234567890123456789ab012345678901234567890123456789ab012345678901234567890123456789ab012345678901234567890123456789ab"
+strval: "012345678901234567890123456789ab012345678901234567890123456789ab012345678901234567890123456789ab012345678901234567890123456789bc"
+strval: "012345678901234567890123456789ab012345678901234567890123456789ab012345678901234567890123456789ab012345678901234567890123456789cd"
+strval: "012345678901234567890123456789ab012345678901234567890123456789ab012345678901234567890123456789ab012345678901234567890123456789de" 
+.
+
+
+# strval field and padding tests
+#
+@
+cuid: 0x11223311
+eid:  128
+type: Text8
+flags: 0x0000
+strval: "A"   
+.
+@
+cuid: 0x11223312
+eid:  128
+type: Text8
+flags: 0x0000
+strval: "We"  
+. 
+@
+cuid: 0x11223313
+eid:  128
+type: Text8
+flags: 0x0000
+strval: "Car"   
+.
+@
+cuid: 0x11223314
+eid:  128
+type: Text8
+flags: 0x0000
+strval: "Cake"   
+.
+@
+cuid: 0x11223315
+eid:  128
+type: Text8
+flags: 0x0000
+strval: "1---A"
+.
+@
+cuid: 0x11223316
+eid:  128
+type: Text8
+flags: 0x0000
+strval: "1---We"  
+. 
+@
+cuid: 0x11223317
+eid:  128
+type: Text8
+flags: 0x0000
+strval: "1---Car"   
+.
+@
+cuid: 0x11223318
+eid:  128
+type: Text8
+flags: 0x0000
+strval: "1---Cake"   
+.
+@
+cuid: 0x11223319
+eid:  128
+type: Text8
+flags: 0x0000
+strval: "1---2---A"
+.
+@
+cuid: 0x1122331a 
+eid:  128
+type: Text8
+flags: 0x0000
+strval: "1---2---We"  
+. 
+@
+cuid: 0x1122331b
+eid:  128
+type: Text8
+flags: 0x0000
+strval: "1---2---Car"   
+.
+@
+cuid: 0x1122331c
+eid:  128
+type: Text8
+flags: 0x0000
+strval: "1---2---Cake"   
+.
+@
+cuid: 0x1122331d
+eid:  128
+type: Text8
+flags: 0x0000
+strval: "1---2---3---A"
+.
+@
+cuid: 0x1122331e
+eid:  128
+type: Text8
+flags: 0x0000
+strval: "1---2---3---We"  
+. 
+@
+cuid: 0x1122331f
+eid:  128
+type: Text8
+flags: 0x0000
+strval: "1---2---3---Car"   
+.
+@
+cuid: 0x11223320
+eid:  128
+type: Text8
+flags: 0x0000
+strval: "1---2---3---Cake"   
+.
+
+
+#------------------------------------------------------------------------------
+# UInt64 & Int64 tests
+#
+
+@
+cuid: 0x55667711
+eid:  91
+type: Int64
+flags: 0x0000
+binval: 00 00 00 00 00 00 00 80
+.
+@
+cuid: 0x55667711
+eid:  92
+type: Int64
+flags: 0x0000
+binval: 00 00 00 00 00 00 00 00
+.
+#@
+#cuid: 0x55667711
+#eid:  192
+#type: Int64
+#flags: 0x0000
+#binval: 00
+#.
+@
+cuid: 0x55667711
+eid:  93
+type: Int64
+flags: 0x0000
+binval: ff ff ff ff ff ff ff 7f 
+.
+@
+cuid: 0x55667711
+eid:  94
+type: UInt64
+flags: 0x0000
+binval: ff ff ff ff ff ff ff ff
+.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/include/cephes.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#ifndef _CEPHES_H_
+#define _CEPHES_H_
+
+double cephes_igamc(double a, double x);
+double cephes_igam(double a, double x);
+double cephes_lgam(double x);
+double cephes_p1evl(double x, double *coef, int N);
+double cephes_polevl(double x, double *coef, int N);
+double cephes_erf(double x);
+double cephes_erfc(double x);
+double cephes_normal(double x);
+
+#endif /*  _CEPHES_H_  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/include/config.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,65 @@
+/*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#ifndef _CONFIG_H_
+#define	_CONFIG_H_
+
+//#define	WINDOWS32
+//#define	PROTOTYPES
+//#define	LITTLE_ENDIAN
+//#define	LOWHI
+
+/*
+ * AUTO DEFINES (DON'T TOUCH!)
+ */
+
+#ifndef	CSTRTD
+typedef char *CSTRTD;
+#endif
+#ifndef	BSTRTD
+typedef unsigned char *BSTRTD;
+#endif
+
+#ifndef	BYTE
+typedef unsigned char BYTE;
+#endif
+#ifndef	UINT
+typedef unsigned int UINT;
+#endif
+#ifndef	USHORT
+typedef unsigned short USHORT;
+#endif
+#ifndef	ULONG
+typedef unsigned long ULONG;
+#endif
+#ifndef	DIGIT
+typedef USHORT DIGIT;	/* 16-bit word */
+#endif
+#ifndef	DBLWORD
+typedef ULONG DBLWORD;  /* 32-bit word */
+#endif
+
+#ifndef	WORD64
+typedef ULONG WORD64[2];  /* 64-bit word */
+#endif
+
+#endif /* _CONFIG_H_ */
+
+#if defined(__cplusplus)
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/include/decls.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#ifndef _DECLS_H_
+#define _DECLS_H_ 
+
+#include "../include/defs.h"
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+                   G L O B A L   D A T A  S T R U C T U R E S 
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+BitSequence	*epsilon;				// BIT STREAM
+TP			tp;						// TEST PARAMETER STRUCTURE
+FILE		*stats[NUMOFTESTS+1];	// FILE OUTPUT STREAM
+FILE		*results[NUMOFTESTS+1];	// FILE OUTPUT STREAM
+FILE		*freqfp;				// FILE OUTPUT STREAM
+FILE		*summary;				// FILE OUTPUT STREAM
+int			testVector[NUMOFTESTS+1];
+
+char	generatorDir[NUMOFGENERATORS][20] = { "AlgorithmTesting", "LCG", "QCG1", "QCG2","CCG", "XOR",
+			"MODEXP", "BBS", "MS", "G-SHA1", "HASH_DRBG" };
+				
+char	testNames[NUMOFTESTS+1][32] = { " ", "Frequency", "BlockFrequency", "CumulativeSums", "Runs", "LongestRun", "Rank",
+			"FFT", "NonOverlappingTemplate", "OverlappingTemplate", "Universal", "ApproximateEntropy", "RandomExcursions",
+			"RandomExcursionsVariant", "Serial", "LinearComplexity" };
+
+#endif // _DECLS_H_
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/include/defs.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,92 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+                       D E B U G G I N G  A I D E S
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifndef _DEFS_H_
+#define _DEFS_H_
+
+#include "config.h"
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+                              M A C R O S
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#define MAX(x,y)             ((x) <  (y)  ? (y)  : (x))
+#define MIN(x,y)             ((x) >  (y)  ? (y)  : (x))
+#define isNonPositive(x)     ((x) <= 0.e0 ?   1  : 0)
+#define isPositive(x)        ((x) >  0.e0 ?   1 : 0)
+#define isNegative(x)        ((x) <  0.e0 ?   1 : 0)
+#define isGreaterThanOne(x)  ((x) >  1.e0 ?   1 : 0)
+#define isZero(x)            ((x) == 0.e0 ?   1 : 0)
+#define isOne(x)             ((x) == 1.e0 ?   1 : 0)
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
+                         G L O B A L  C O N S T A N T S
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#define ALPHA							0.01	/* SIGNIFICANCE LEVEL */
+#define MAXNUMOFTEMPLATES				148		/* APERIODIC TEMPLATES: 148=>temp_length=9 */
+#define NUMOFTESTS						15		/* MAX TESTS DEFINED  */
+#define NUMOFGENERATORS					11		/* MAX PRNGs */
+#define MAXFILESPERMITTEDFORPARTITION	148
+#define	TEST_FREQUENCY					1
+#define	TEST_BLOCK_FREQUENCY			2
+#define	TEST_CUSUM						3
+#define	TEST_RUNS						4
+#define	TEST_LONGEST_RUN				5
+#define	TEST_RANK						6
+#define	TEST_FFT						7
+#define	TEST_NONPERIODIC				8
+#define	TEST_OVERLAPPING				9
+#define	TEST_UNIVERSAL					10
+#define	TEST_APEN						11
+#define	TEST_RND_EXCURSION				12
+#define	TEST_RND_EXCURSION_VAR			13
+#define	TEST_SERIAL						14
+#define	TEST_LINEARCOMPLEXITY			15
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+                   G L O B A L   D A T A  S T R U C T U R E S
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+typedef unsigned char	BitSequence;
+
+typedef struct _testParameters {
+	int		n;
+	int		blockFrequencyBlockLength;
+	int		nonOverlappingTemplateBlockLength;
+	int		overlappingTemplateBlockLength;
+	int		serialBlockLength;
+	int		linearComplexitySequenceLength;
+	int		approximateEntropyBlockLength;
+	int		numOfBitStreams;
+} TP;
+
+#endif // _DEFS_H_
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/include/externs.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,48 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#ifndef _EXTERNS_H_
+#define _EXTERNS_H_
+
+#include "../include/defs.h"
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+                   G L O B A L   D A T A  S T R U C T U R E S 
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+extern BitSequence	*epsilon;				// BIT STREAM
+extern TP			tp;						// TEST PARAMETER STRUCTURE
+extern FILE			*stats[NUMOFTESTS+1];	// FILE OUTPUT STREAM
+extern FILE			*results[NUMOFTESTS+1];	// FILE OUTPUT STREAM
+extern FILE			*freqfp;				// FILE OUTPUT STREAM
+extern FILE			*summary;				// FILE OUTPUT STREAM
+extern int			testVector[NUMOFTESTS+1];
+
+extern char	generatorDir[NUMOFGENERATORS][20];
+extern char	testNames[NUMOFTESTS+1][32];
+
+#endif // _EXTERNS_H_
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/include/generators.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,116 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#ifndef _GENERATORS_H_
+#define _GENERATORS_H_
+//#include	"../include/sha.h"
+
+void	lcg();
+double	lcg_rand(int, double, double*, int);
+void	quadRes1();
+void	quadRes2();
+void	cubicRes();
+void	exclusiveOR();
+void	modExp();
+void	bbs();
+void	micali_schnorr();
+void	SHA1();
+void    HASH_DRBG();
+
+/* The circular shifts. */
+#define CS1(x) ((((ULONG)x)<<1)|(((ULONG)x)>>31))
+#define CS5(x)  ((((ULONG)x)<<5)|(((ULONG)x)>>27))
+#define CS30(x)  ((((ULONG)x)<<30)|(((ULONG)x)>>2))
+
+/* K constants */
+
+#define K0  0x5a827999L
+#define K1  0x6ed9eba1L
+#define K2  0x8f1bbcdcL
+#define K3  0xca62c1d6L
+
+#define f1(x,y,z)   ( (x & (y ^ z)) ^ z )
+
+#define f3(x,y,z)   ( (x & ( y ^ z )) ^ (z & y) )
+
+#define f2(x,y,z)   ( x ^ y ^ z )                           /* Rounds 20-39 */
+
+#define  expand(x)  Wbuff[x%16] = CS1(Wbuff[(x - 3)%16 ] ^ Wbuff[(x - 8)%16 ] ^ Wbuff[(x - 14)%16] ^ Wbuff[x%16])
+
+#define sub1Round1(count)      { \
+	 temp = CS5(A) + f1(B, C, D) + E + Wbuff[count] + K0; \
+	 E = D; \
+	 D = C; \
+	 C = CS30( B ); \
+	 B = A; \
+	 A = temp; \
+	 } \
+
+#define sub2Round1(count)   \
+	 { \
+	 expand(count); \
+	 temp = CS5(A) + f1(B, C, D) + E + Wbuff[count%16] + K0; \
+	 E = D; \
+	 D = C; \
+	 C = CS30( B ); \
+	 B = A; \
+	 A = temp; \
+	} \
+
+#define Round2(count)     \
+	 { \
+	 expand(count); \
+	 temp = CS5( A ) + f2( B, C, D ) + E + Wbuff[count%16] + K1;  \
+	 E = D; \
+	 D = C; \
+	 C = CS30( B ); \
+	 B = A; \
+	 A = temp;  \
+	 } \
+
+#define Round3(count)    \
+	 { \
+	 expand(count); \
+	 temp = CS5( A ) + f3( B, C, D ) + E + Wbuff[count%16] + K2; \
+	 E = D; \
+	 D = C; \
+	 C = CS30( B ); \
+	 B = A; \
+	 A = temp; \
+	 }
+
+#define Round4(count)    \
+	 { \
+	 expand(count); \
+	 temp = CS5( A ) + f2( B, C, D ) + E + Wbuff[count%16] + K3; \
+	 E = D; \
+	 D = C; \
+	 C = CS30( B ); \
+	 B = A; \
+	 A = temp; \
+	 }
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/include/genutils.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#ifndef _GENUTILS_H_
+#define _GENUTILS_H_
+
+#include "openc.h"
+#include "config.h"
+
+typedef struct _MP_struct {
+	int		size;	/*  in bytes  */
+	int		bitlen;	/*  in bits, duh  */
+	BYTE	*val;
+	} MP;
+
+#define	FREE(A)	if ( (A) ) { free((A)); (A) = NULL; }
+#define	ASCII2BIN(ch)	( (((ch) >= '0') && ((ch) <= '9')) ? ((ch) - '0') : (((ch) >= 'A') && ((ch) <= 'F')) ? ((ch) - 'A' + 10) : ((ch) - 'a' + 10) )
+
+#ifndef EXPWD
+#define	EXPWD		((DBLWORD)1<<NUMLEN)
+#endif
+
+#define	sniff_bit(ptr,mask)		(*(ptr) & mask)
+
+/*
+ * Function Declarations
+ */
+int		greater(BYTE *x, BYTE *y, int l);
+int		less(BYTE *x, BYTE *y, int l);
+BYTE	bshl(BYTE *x, int l);
+void	bshr(BYTE *x, int l);
+int		Mult(BYTE *A, BYTE *B, int LB, BYTE *C, int LC);
+void	ModSqr(BYTE *A, BYTE *B, int LB, BYTE *M, int LM);
+void	ModMult(BYTE *A, BYTE *B, int LB, BYTE *C, int LC, BYTE *M, int LM);
+void	smult(BYTE *A, BYTE b, BYTE *C, int L);
+void	Square(BYTE *A, BYTE *B, int L);
+void	ModExp(BYTE *A, BYTE *B, int LB, BYTE *C, int LC, BYTE *M, int LM);
+int		DivMod(BYTE *x, int lenx, BYTE *n, int lenn, BYTE *quot, BYTE *rem);
+void	Mod(BYTE *x, int lenx, BYTE *n, int lenn);
+void	Div(BYTE *x, int lenx, BYTE *n, int lenn);
+void	sub(BYTE *A, int LA, BYTE *B, int LB);
+int		negate(BYTE *A, int L);
+BYTE	add(BYTE *A, int LA, BYTE *B, int LB);
+void	prettyprintBstr(char *S, BYTE *A, int L);
+void	byteReverse(ULONG *buffer, int byteCount);
+void	ahtopb (char *ascii_hex, BYTE *p_binary, int bin_len);
+
+#endif  /* _GENUTILS_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/include/matrix.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+       R A N K  A L G O R I T H M  F U N C T I O N  P R O T O T Y P E S 
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifndef _MATRIX_H_
+#define _MATRIX_H_
+
+int				computeRank(int M, int Q, BitSequence **matrix);
+void			perform_elementary_row_operations(int flag, int i, int M, int Q, BitSequence **A);
+int				find_unit_element_and_swap(int flag, int i, int M, int Q, BitSequence **A);
+int				swap_rows(int i, int index, int Q, BitSequence **A);
+int				determine_rank(int m, int M, int Q, BitSequence **A);
+BitSequence**	create_matrix(int M, int Q);
+void			display_matrix(int M, int Q, BitSequence **m);
+void			def_matrix(int M, int Q, BitSequence **m,int k);
+void			delete_matrix(int M, BitSequence **matrix);
+
+#endif // _MATRIX_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/include/stat_fncs.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,51 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+     S T A T I S T I C A L  T E S T  F U N C T I O N  P R O T O T Y P E S 
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _STAT_FNCS_H_
+#define _STAT_FNCS_H_
+
+void	Frequency(int n);
+void	BlockFrequency(int M, int n);
+void	CumulativeSums(int n);
+void	Runs(int n);
+void	LongestRunOfOnes(int n);
+void	Rank(int n);
+void	DiscreteFourierTransform(int n);
+void	NonOverlappingTemplateMatchings(int m, int n);
+void	OverlappingTemplateMatchings(int m, int n);
+void	Universal(int n);
+void	ApproximateEntropy(int m, int n);
+void	RandomExcursions(int n);
+void	RandomExcursionsVariant(int n);
+void	LinearComplexity(int M, int n);
+void	Serial(int m, int n);
+
+#endif // _STAT_FNCS_H_
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/include/utilities.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+              U T I L I T Y  F U N C T I O N  P R O T O T Y P E S 
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifndef _UTILITIES_H_
+#define _UTILITIES_H_
+
+int		displayGeneratorOptions();
+int		generatorOptions(char** streamFile);
+void	chooseTests();
+void	fixParameters();
+void	fileBasedBitStreams(char *streamFile);
+void	readBinaryDigitsInASCIIFormat(FILE *fp, char *streamFile);
+void	readHexDigitsInBinaryFormat(FILE *fp);
+int		convertToBits(const BYTE *x, int xBitLength, int bitsNeeded, int *num_0s, int *num_1s, int *bitsRead);
+void	openOutputStreams(int option);
+void    InitializeNISTSuiteL(int option);
+void    ReleaseResources();
+void	invokeTestSuite(int option, char *streamFile);
+void	nist_test_suite();
+void    GetNextTemplateItem(BitSequence aBitSequence[]);
+
+
+extern CConsoleBase*    gConsole;
+extern TBuf8<KMaxFileName>       gLogFilePath;
+
+extern TInt gTemplateIndex;
+
+const TInt KMaxBit = 32;
+
+
+
+// inline functions
+inline void ResetTemplateIndex()
+    {
+    gTemplateIndex = 1;
+    }
+
+
+#endif // _UTILITIES_H_
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/include/utils/openc.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*/
+
+
+#ifndef _OPENC_H_
+#define _OPENC_H_
+
+#include <e32base.h>
+#include <e32std.h>
+#include <e32cons.h>            // Console
+#include <f32file.h>
+
+#include <e32math.h>
+
+extern RFs gFileSession;
+
+// Math functions
+double log(double);
+double exp(double);
+double fabs(double);
+double floor(double);
+double sqrt(double);
+double erf(double);
+double erfc(double);
+
+double pow(double, double);
+
+// Math trigonometric functions
+double sin(double);
+double cos(double);
+
+
+// data types
+typedef RFile FILE;
+#define EOF (-1)
+typedef TUint32     u_int32_t;
+typedef TInt32      int32_t;
+
+#define SEEK_SET    0   /* set file offset to offset */
+#define SEEK_CUR    1   /* set file offset to current plus offset */
+#define SEEK_END    2   /* set file offset to EOF plus offset */
+
+
+// stdio functions
+int     printf(const char * __restrict, ...);
+int     scanf(const char * __restrict, ...);
+int     sprintf(char * __restrict, const char * __restrict, ...);
+int     puts ( const char * str );
+int     putchar ( int character );
+char*   strcpy(char* aDest, const char* aSrc);
+
+FILE    *fopen(const char * __restrict, const char * __restrict);
+int     fclose(FILE *);
+int     fprintf(FILE * __restrict, const char * __restrict, ...);
+int     fscanf(FILE * __restrict, const char * __restrict, ...);
+TUint32  fread(void * __restrict, TUint32, TUint32, FILE * __restrict);
+int     fseek(FILE *, long, int);
+
+int     fflush(FILE *);
+
+// stdlib functions
+void*   calloc(TUint32, TUint32);
+void    free(void *);
+
+void    qsort (void* base, TUint32 nmemb, TUint32 size, int (*compar)(const void*, const void*));
+
+void    exit (int status);
+
+// Other utility functions
+void ReadStringFromConsole(TDes& aString);
+TInt ReadIntL(TInt& aValue);
+
+#endif /* _OPENC_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/approximateEntropy.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,111 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/utilities.h"
+#include "../include/cephes.h"  
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+                A P P R O X I M A T E  E N T R O P Y   T E S T
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+void
+ApproximateEntropy(int m, int n)
+{
+	int				i, j, k, r, blockSize, seqLength, powLen, index;
+	double			sum, numOfBlocks, ApEn[2], apen, chi_squared, p_value;
+	unsigned int	*P;
+	
+	fprintf(stats[TEST_APEN], "\t\t\tAPPROXIMATE ENTROPY TEST\n");
+	fprintf(stats[TEST_APEN], "\t\t--------------------------------------------\n");
+	fprintf(stats[TEST_APEN], "\t\tCOMPUTATIONAL INFORMATION:\n");
+	fprintf(stats[TEST_APEN], "\t\t--------------------------------------------\n");
+	fprintf(stats[TEST_APEN], "\t\t(a) m (block length)    = %d\n", m);
+
+	seqLength = n;
+	r = 0;
+	
+	for ( blockSize=m; blockSize<=m+1; blockSize++ ) {
+		if ( blockSize == 0 ) {
+			ApEn[0] = 0.00;
+			r++;
+		}
+		else {
+			numOfBlocks = (double)seqLength;
+			powLen = (int)pow(2, blockSize+1)-1;
+			if ( (P = (unsigned int*)calloc(powLen,sizeof(unsigned int)))== NULL ) {
+				fprintf(stats[TEST_APEN], "ApEn:  Insufficient memory available.\n");
+				return;
+			}
+			for ( i=1; i<powLen-1; i++ )
+				P[i] = 0;
+			for ( i=0; i<numOfBlocks; i++ ) { /* COMPUTE FREQUENCY */
+				k = 1;
+				for ( j=0; j<blockSize; j++ ) {
+					k <<= 1;
+					if ( (int)epsilon[(i+j) % seqLength] == 1 )
+						k++;
+				}
+				P[k-1]++;
+			}
+			/* DISPLAY FREQUENCY */
+			sum = 0.0;
+			index = (int)pow(2, blockSize)-1;
+			for ( i=0; i<(int)pow(2, blockSize); i++ ) {
+				if ( P[index] > 0 )
+					sum += P[index]*log(P[index]/numOfBlocks);
+				index++;
+			}
+			sum /= numOfBlocks;
+			ApEn[r] = sum;
+			r++;
+			free(P);
+		}
+	}
+	apen = ApEn[0] - ApEn[1];
+	
+	chi_squared = 2.0*seqLength*(log(2) - apen);
+	p_value = cephes_igamc(pow(2, m-1), chi_squared/2.0);
+	
+	fprintf(stats[TEST_APEN], "\t\t(b) n (sequence length) = %d\n", seqLength);
+	fprintf(stats[TEST_APEN], "\t\t(c) Chi^2               = %f\n", chi_squared);
+	fprintf(stats[TEST_APEN], "\t\t(d) Phi(m)	       = %f\n", ApEn[0]);
+	fprintf(stats[TEST_APEN], "\t\t(e) Phi(m+1)	       = %f\n", ApEn[1]);
+	fprintf(stats[TEST_APEN], "\t\t(f) ApEn                = %f\n", apen);
+	fprintf(stats[TEST_APEN], "\t\t(g) Log(2)              = %f\n", log(2.0));
+	fprintf(stats[TEST_APEN], "\t\t--------------------------------------------\n");
+
+	if ( m > (int)(log(seqLength)/log(2)-5) ) {
+		fprintf(stats[TEST_APEN], "\t\tNote: The blockSize = %d exceeds recommended value of %d\n", m,
+			MAX(1, (int)(log(seqLength)/log(2)-5)));
+		fprintf(stats[TEST_APEN], "\t\tResults are inaccurate!\n");
+		fprintf(stats[TEST_APEN], "\t\t--------------------------------------------\n");
+	}
+	
+	fprintf(stats[TEST_APEN], "%s\t\tp_value = %f\n\n", p_value < ALPHA ? "FAILURE" : "SUCCESS", p_value);
+	fprintf(results[TEST_APEN], "%f\n", p_value);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/assess.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,419 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*/
+
+
+/* --------------------------------------------------------------------------
+   Title       :  The NIST Statistical Test Suite
+
+   Date        :  December 1999
+
+   Programmer  :  Juan Soto
+
+   Summary     :  For use in the evaluation of the randomness of bitstreams
+                  produced by cryptographic random number generators.
+
+   Package     :  Version 1.0
+
+   Copyright   :  (c) 1999 by the National Institute Of Standards & Technology
+
+   History     :  Version 1.0 by J. Soto, October 1999
+                  Revised by J. Soto, November 1999
+                  Revised by Larry Bassham, March 2008
+
+   Keywords    :  Pseudorandom Number Generator (PRNG), Randomness, Statistical 
+                  Tests, Complementary Error functions, Incomplete Gamma 
+                  Function, Random Walks, Rank, Fast Fourier Transform, 
+                  Template, Cryptographically Secure PRNG (CSPRNG),
+                  Approximate Entropy (ApEn), Secure Hash Algorithm (SHA-1), 
+                  Blum-Blum-Shub (BBS) CSPRNG, Micali-Schnorr (MS) CSPRNG, 
+
+   Source      :  David Banks, Elaine Barker, James Dray, Allen Heckert, 
+                  Stefan Leigh, Mark Levenson, James Nechvatal, Andrew Rukhin, 
+                  Miles Smid, Juan Soto, Mark Vangel, and San Vo.
+
+   Technical
+   Assistance  :  Larry Bassham, Ron Boisvert, James Filliben, Daniel Lozier,
+                  and Bert Rust.
+
+   Warning     :  Portability Issues.
+
+   Limitation  :  Amount of memory allocated for workspace.
+
+   Restrictions:  Permission to use, copy, and modify this software without 
+                  fee is hereby granted, provided that this entire notice is 
+                  included in all copies of any software which is or includes
+                  a copy or modification of this software and in all copies 
+                  of the supporting documentation for such software.
+   -------------------------------------------------------------------------- */
+//system include
+#include <e32base.h>
+#include <e32std.h>
+#include <e32cons.h>
+
+// user include
+#include "openc.h"
+#include "../include/decls.h"
+#include "../include/cephes.h"  
+#include "../include/utilities.h"
+#include "../include/generators.h"
+
+typedef int (*CompareFnType)(const void*, const void*);
+
+void	partitionResultFile(int numOfFiles, int numOfSequences, int option, int testNameID);
+void	postProcessResults(int option);
+int		cmp(const double *a, const double *b);
+int		computeMetrics(char *s, int test);
+
+int
+StartNISTTest()
+{
+	int		i;
+	int		option = 10;			/* TEMPLATE LENGTH/STREAM LENGTH/GENERATOR*/
+	char	*streamFile = NULL;	/* STREAM FILENAME     */
+	
+
+	tp.n = 1000000; // length of the individual bit stream(s) to be processed
+	tp.blockFrequencyBlockLength = 128;
+	tp.nonOverlappingTemplateBlockLength = 9;
+	tp.overlappingTemplateBlockLength = 9;
+	tp.approximateEntropyBlockLength = 10;
+	tp.serialBlockLength = 16;
+	tp.linearComplexitySequenceLength = 500;
+	tp.numOfBitStreams = 100;
+	chooseTests();
+	fixParameters();
+	openOutputStreams(option);
+	invokeTestSuite(option, streamFile);
+	fclose(freqfp);
+	for( i=1; i<=NUMOFTESTS; i++ ) {
+		if ( stats[i] != NULL )
+			fclose(stats[i]);
+		if ( results[i] != NULL )
+			fclose(results[i]);
+	}
+	if ( (testVector[0] == 1) || (testVector[TEST_CUSUM] == 1) ) 
+		partitionResultFile(2, tp.numOfBitStreams, option, TEST_CUSUM);
+	if ( (testVector[0] == 1) || (testVector[TEST_NONPERIODIC] == 1) ) 
+		partitionResultFile(MAXNUMOFTEMPLATES, tp.numOfBitStreams, option, TEST_NONPERIODIC);
+	if ( (testVector[0] == 1) || (testVector[TEST_RND_EXCURSION] == 1) )
+		partitionResultFile(8, tp.numOfBitStreams, option, TEST_RND_EXCURSION);
+	if ( (testVector[0] == 1) || (testVector[TEST_RND_EXCURSION_VAR] == 1) )
+		partitionResultFile(18, tp.numOfBitStreams, option, TEST_RND_EXCURSION_VAR);
+	if ( (testVector[0] == 1) || (testVector[TEST_SERIAL] == 1) )
+		partitionResultFile(2, tp.numOfBitStreams, option, TEST_SERIAL);
+	fprintf(summary, "------------------------------------------------------------------------------\n");
+	fprintf(summary, "RESULTS FOR THE UNIFORMITY OF P-VALUES AND THE PROPORTION OF PASSING SEQUENCES\n");
+	fprintf(summary, "------------------------------------------------------------------------------\n");
+	fprintf(summary, " C1  C2  C3  C4  C5  C6  C7  C8  C9 C10  P-VALUE  PROPORTION  STATISTICAL TEST\n");
+	fprintf(summary, "------------------------------------------------------------------------------\n");
+	postProcessResults(option);
+	fclose(summary);
+
+	return 1;
+    }
+
+void
+partitionResultFile(int numOfFiles, int numOfSequences, int option, int testNameID)
+{ 
+	int		i, k, m, j, start, end, num, numread;
+	float	c;
+	FILE	**fp = (FILE **)calloc(numOfFiles+1, sizeof(FILE *));
+	int		*results = (int *)calloc(numOfFiles, sizeof(int *));
+	char	*s[MAXFILESPERMITTEDFORPARTITION];
+	char	resultsDir[200];
+	
+	for ( i=0; i<MAXFILESPERMITTEDFORPARTITION; i++ )
+		s[i] = (char*)calloc(200, sizeof(char));
+	
+	sprintf(resultsDir, "%s\\experiments\\%s\\%s\\results", gLogFilePath.PtrZ(), generatorDir[option], testNames[testNameID]);
+	
+	if ( (fp[numOfFiles] = fopen(resultsDir, "r")) == NULL ) {
+		printf("%s", resultsDir);
+		printf(" -- file not found. Exiting program.\n");
+		exit(-1);
+	}
+	
+	for ( i=0; i<numOfFiles; i++ ) 
+	    {
+		sprintf(s[i], "%s\\experiments\\%s\\%s\\data%d", gLogFilePath.PtrZ(), generatorDir[option], testNames[testNameID], i+1);
+        }
+	numread = 0;
+	m = numOfFiles/20;
+	if ( (numOfFiles%20) != 0 )
+		m++;
+	for ( i=0; i<numOfFiles; i++ ) {
+		if ( (fp[i] = fopen(s[i], "w")) == NULL ) {
+			printf("%s", s[i]);
+			printf(" -- file not found. Exiting program.\n");
+			exit(-1);
+		}
+		fclose(fp[i]);
+	}
+	for ( num=0; num<numOfSequences; num++ ) {
+		for ( k=0; k<m; k++ ) { 			/* FOR EACH BATCH */
+			
+			start = k*20;		/* BOUNDARY SEGMENTS */
+			end   = k*20+19;
+			if ( k == (m-1) )
+				end = numOfFiles-1;
+			
+			for ( i=start; i<=end; i++ ) {		/* OPEN FILE */
+				if ( (fp[i] = fopen(s[i], "a")) == NULL ) {
+					printf("%s", s[i]);
+					printf(" -- file not found. Exiting program.\n");
+					exit(-1);
+				}
+			}
+			
+			for ( j=start; j<=end; j++ ) {		/* POPULATE FILE */
+				fscanf(fp[numOfFiles], "%f", &c);
+				fprintf(fp[j], "%f\n", c);
+				numread++;
+			}
+
+			for ( i=start; i<=end; i++ )		/* CLOSE FILE */
+				fclose(fp[i]);
+		}
+	}
+	fclose(fp[numOfFiles]);
+	for ( i=0; i<MAXFILESPERMITTEDFORPARTITION; i++ )
+		free(s[i]);
+	
+	free(fp);
+	free(results);
+	return;
+}
+
+int
+cmp(const double *a, const double *b)
+{
+	if ( *a < *b )
+		return -1;
+	if ( *a == *b )
+		return 0;
+	return 1;
+}
+
+void
+postProcessResults(int option)
+{
+	int    i, k;
+	int    randomExcursionSampleSize = 0;
+	int    generalSampleSize = 0;
+	int		case1, case2, numOfFiles = 2;
+	double	passRate;
+	char	s[200];
+	
+	for ( i=1; i<=NUMOFTESTS; i++ ) {		// FOR EACH TEST
+		if ( testVector[i] ) {
+			// SPECIAL CASES -- HANDLING MULTIPLE FILES FOR A SINGLE TEST
+			if ( ((i == TEST_CUSUM) && testVector[TEST_CUSUM] ) ||
+				 ((i == TEST_NONPERIODIC) && testVector[TEST_NONPERIODIC] ) ||
+				 ((i == TEST_RND_EXCURSION) && testVector[TEST_RND_EXCURSION]) ||
+				 ((i == TEST_RND_EXCURSION_VAR) && testVector[TEST_RND_EXCURSION_VAR]) || 
+				 ((i == TEST_SERIAL) && testVector[TEST_SERIAL]) ) {
+				
+				if ( (i == TEST_NONPERIODIC) && testVector[TEST_NONPERIODIC] )  
+					numOfFiles = MAXNUMOFTEMPLATES;
+				else if ( (i == TEST_RND_EXCURSION) && testVector[TEST_RND_EXCURSION] ) 
+					numOfFiles = 8;
+				else if ( (i == TEST_RND_EXCURSION_VAR) && testVector[TEST_RND_EXCURSION_VAR] ) 
+					numOfFiles = 18;
+				else
+					numOfFiles = 2;
+				for ( k=0; k<numOfFiles; k++ ) {
+					if ( k < 10 )
+						sprintf(s, "%s\\experiments\\%s\\%s\\data%1d", gLogFilePath.PtrZ(), generatorDir[option], testNames[i], k+1);
+					else if ( k < 100 )
+						sprintf(s, "%s\\experiments\\%s\\%s\\data%2d", gLogFilePath.PtrZ(), generatorDir[option], testNames[i], k+1);
+					else
+						sprintf(s, "%s\\experiments\\%s\\%s\\data%3d", gLogFilePath.PtrZ(), generatorDir[option], testNames[i], k+1);
+					if ( (i == TEST_RND_EXCURSION) || (i == TEST_RND_EXCURSION_VAR) ) 
+						randomExcursionSampleSize = computeMetrics(s,i);
+					else
+						generalSampleSize = computeMetrics(s,i);
+				}
+			}
+			else {
+				sprintf(s, "%s\\experiments\\%s\\%s\\results", gLogFilePath.PtrZ(), generatorDir[option], testNames[i]);
+				generalSampleSize = computeMetrics(s,i);
+			}
+		}
+	}
+
+	fprintf(summary, "\n\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n");
+	case1 = 0;
+	case2 = 0;
+	if ( testVector[TEST_RND_EXCURSION] || testVector[TEST_RND_EXCURSION_VAR] ) 
+		case2 = 1;
+	for ( i=1; i<=NUMOFTESTS; i++ ) {
+		if ( testVector[i] && (i != TEST_RND_EXCURSION) && (i != TEST_RND_EXCURSION_VAR) ) {
+			case1 = 1;
+			break;
+		}
+	}
+	if ( case1 ) {
+		if ( generalSampleSize == 0 ) {
+			fprintf(summary, "The minimum pass rate for each statistical test with the exception of the\n");
+			fprintf(summary, "random excursion (variant) test is undefined.\n\n");
+		}
+		else {
+			passRate = 0.99-3.0*sqrt(0.01*(1.0-ALPHA)/(double)generalSampleSize);
+			fprintf(summary, "The minimum pass rate for each statistical test with the exception of the\n");
+			fprintf(summary, "random excursion (variant) test is approximately = %f for a\n", generalSampleSize ? passRate : 0.0);
+			fprintf(summary, "sample size = %d binary sequences.\n\n", generalSampleSize);
+		}
+	}
+	if ( case2 ) {
+		if ( randomExcursionSampleSize == 0 )
+			fprintf(summary, "The minimum pass rate for the random excursion (variant) test is undefined.\n\n");
+		else {
+			passRate = 0.99-3.0*sqrt(0.01*(1.0-ALPHA)/(double)randomExcursionSampleSize);
+			fprintf(summary, "The minimum pass rate for the random excursion (variant) test\n");
+			fprintf(summary, "is approximately %f for a sample size = %d binary sequences.\n\n", passRate, randomExcursionSampleSize);
+		}
+	}
+	fprintf(summary, "For further guidelines construct a probability table using the MAPLE program\n");
+	fprintf(summary, "provided in the addendum section of the documentation.\n");
+	fprintf(summary, "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n");
+}
+
+int
+computeMetrics(char *s, int test)
+{
+	int		j, pos, count, sampleSize, expCount;
+	int		freqPerBin[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+	double	*A = NULL;
+	double  *T = NULL;
+	double  chi2, proportion, uniformity;
+	float	c;
+	FILE	*fp = NULL;
+
+	if ( (fp = fopen(s, "r")) == NULL ) {
+		printf("%s",s);
+		printf(" -- file not found. Exiting program.\n");
+		exit(-1);
+	}
+	
+	/* Compute Metric 1: Proportion of Passing Sequences */
+	
+	count = 0; 		
+	sampleSize = tp.numOfBitStreams;
+	
+	if ( (test == TEST_RND_EXCURSION) || (test == TEST_RND_EXCURSION_VAR) ) { /* Special Case: Random Excursion Tests */
+		if ( (T = (double *)calloc(tp.numOfBitStreams, sizeof(double))) == NULL ) {
+			printf("Final Analysis Report aborted due to insufficient workspace\n");
+			// Perform cleanup before returning
+			fclose(fp);
+			return 0;
+		}
+		for ( j=0; j<sampleSize; j++ ) {
+			fscanf(fp, "%f", &c);
+			if ( c > 0.000000 )
+				T[count++] = c;
+		}
+
+		if ( (A = (double *)calloc(count, sizeof(double))) == NULL ) {
+			printf("Final Analysis Report aborted due to insufficient workspace\n");
+            // Perform cleanup before returning
+            fclose(fp);
+            free(T);
+			return 0;
+		}
+
+		for ( j=0; j<count; j++ )
+			A[j] = T[j];
+		
+		sampleSize = count;
+		count = 0;
+		for ( j=0; j<sampleSize; j++ )
+			if ( A[j] < ALPHA )
+				count++;
+		free(T);
+		T = NULL;
+	}
+	else {
+		if ( (A = (double *)calloc(sampleSize, sizeof(double))) == NULL ) {
+			printf("Final Analysis Report aborted due to insufficient workspace\n");
+            // Perform cleanup before returning
+            fclose(fp);
+			return 0;
+		}
+		for ( j=0; j<sampleSize; j++ ) {
+			fscanf(fp, "%f", &c);
+			if ( c < ALPHA )
+				count++;
+			A[j] = c;
+		}
+	}
+	if ( sampleSize == 0 )
+		proportion = 0.0;
+	else
+		proportion = 1.0-(double)count/sampleSize;
+
+	/* Compute Metric 2: Histogram */
+
+	qsort((void *)A, sampleSize, sizeof(double), (CompareFnType)cmp);
+	
+	for ( j=0; j<sampleSize; j++ ) {
+		pos = (int)floor(A[j]*10);
+		if ( pos == 10 )
+			pos--;
+		freqPerBin[pos]++;
+	}
+	chi2 = 0.0;
+	expCount = sampleSize/10;
+	for ( j=0; j<10; j++ )
+		chi2 += pow(freqPerBin[j]-expCount, 2)/expCount;
+	uniformity = cephes_igamc(9.0/2.0, chi2/2.0);
+
+	for ( j=0; j<10; j++ )			/* DISPLAY RESULTS */
+		fprintf(summary, "%3d ", freqPerBin[j]);
+
+	if ( expCount == 0 )
+		fprintf(summary, "    ----    ");
+	else if ( uniformity < 0.0001 )
+		fprintf(summary, " %8.6f * ", uniformity);
+	else
+		fprintf(summary, " %8.6f   ", uniformity);
+
+	if ( sampleSize == 0 )
+		fprintf(summary, " ----     %s\n", testNames[test]);
+	else if ( proportion < 0.96 )
+		fprintf(summary, "%6.4f *  %s\n", proportion, testNames[test]);
+	else
+		fprintf(summary, "%6.4f    %s\n", proportion, testNames[test]);
+
+	fclose(fp);
+	free(A);
+	
+	return sampleSize;
+}
+
+/*
+Gobal Entry Function
+*/
+GLDEF_C TInt E32Main()
+    {
+    __UHEAP_MARK;
+    TInt ret = StartNISTTest();
+    __UHEAP_MARKEND;
+    
+    return ret;
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/blockFrequency.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,68 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/cephes.h"
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+                    B L O C K  F R E Q U E N C Y  T E S T
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+void
+BlockFrequency(int M, int n)
+{
+	int		i, j, N, blockSum;
+	double	p_value, sum, pi, v, chi_squared;
+	
+	N = n/M; 		/* # OF SUBSTRING BLOCKS      */
+	sum = 0.0;
+	
+	for ( i=0; i<N; i++ ) {
+		blockSum = 0;
+		for ( j=0; j<M; j++ )
+			blockSum += epsilon[j+i*M];
+		pi = (double)blockSum/(double)M;
+		v = pi - 0.5;
+		sum += v*v;
+	}
+	chi_squared = 4.0 * M * sum;
+	p_value = cephes_igamc(N/2.0, chi_squared/2.0);
+
+	fprintf(stats[TEST_BLOCK_FREQUENCY], "\t\t\tBLOCK FREQUENCY TEST\n");
+	fprintf(stats[TEST_BLOCK_FREQUENCY], "\t\t---------------------------------------------\n");
+	fprintf(stats[TEST_BLOCK_FREQUENCY], "\t\tCOMPUTATIONAL INFORMATION:\n");
+	fprintf(stats[TEST_BLOCK_FREQUENCY], "\t\t---------------------------------------------\n");
+	fprintf(stats[TEST_BLOCK_FREQUENCY], "\t\t(a) Chi^2           = %f\n", chi_squared);
+	fprintf(stats[TEST_BLOCK_FREQUENCY], "\t\t(b) # of substrings = %d\n", N);
+	fprintf(stats[TEST_BLOCK_FREQUENCY], "\t\t(c) block length    = %d\n", M);
+	fprintf(stats[TEST_BLOCK_FREQUENCY], "\t\t(d) Note: %d bits were discarded.\n", n % M);
+	fprintf(stats[TEST_BLOCK_FREQUENCY], "\t\t---------------------------------------------\n");
+
+	fprintf(stats[TEST_BLOCK_FREQUENCY], "%s\t\tp_value = %f\n\n", p_value < ALPHA ? "FAILURE" : "SUCCESS", p_value);
+	fprintf(results[TEST_BLOCK_FREQUENCY], "%f\n", p_value);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/cephes.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,357 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+
+
+#include "openc.h"
+#include "../include/cephes.h"
+
+static const double	rel_error = 1E-12;
+
+double MACHEP = 1.11022302462515654042E-16;		// 2**-53
+double MAXLOG = 7.09782712893383996732224E2;	// log(MAXNUM)
+double MAXNUM = 1.7976931348623158E308;			// 2**1024*(1-MACHEP)
+double PI     = 3.14159265358979323846;			// pi, duh!
+
+static double big = 4.503599627370496e15;
+static double biginv =  2.22044604925031308085e-16;
+
+int sgngam = 0;
+
+double
+cephes_igamc(double a, double x)
+{
+	double ans, ax, c, yc, r, t, y, z;
+	double pk, pkm1, pkm2, qk, qkm1, qkm2;
+
+	if ( (x <= 0) || ( a <= 0) )
+		return( 1.0 );
+
+	if ( (x < 1.0) || (x < a) )
+		return( 1.e0 - cephes_igam(a,x) );
+
+	ax = a * log(x) - x - cephes_lgam(a);
+
+	if ( ax < -MAXLOG ) {
+		printf("igamc: UNDERFLOW\n");
+		return 0.0;
+	}
+	ax = exp(ax);
+
+	/* continued fraction */
+	y = 1.0 - a;
+	z = x + y + 1.0;
+	c = 0.0;
+	pkm2 = 1.0;
+	qkm2 = x;
+	pkm1 = x + 1.0;
+	qkm1 = z * x;
+	ans = pkm1/qkm1;
+
+	do {
+		c += 1.0;
+		y += 1.0;
+		z += 2.0;
+		yc = y * c;
+		pk = pkm1 * z  -  pkm2 * yc;
+		qk = qkm1 * z  -  qkm2 * yc;
+		if ( qk != 0 ) {
+			r = pk/qk;
+			t = fabs( (ans - r)/r );
+			ans = r;
+		}
+		else
+			t = 1.0;
+		pkm2 = pkm1;
+		pkm1 = pk;
+		qkm2 = qkm1;
+		qkm1 = qk;
+		if ( fabs(pk) > big ) {
+			pkm2 *= biginv;
+			pkm1 *= biginv;
+			qkm2 *= biginv;
+			qkm1 *= biginv;
+		}
+	} while ( t > MACHEP );
+
+	return ans*ax;
+}
+
+double
+cephes_igam(double a, double x)
+{
+	double ans, ax, c, r;
+
+	if ( (x <= 0) || ( a <= 0) )
+		return 0.0;
+
+	if ( (x > 1.0) && (x > a ) )
+		return 1.e0 - cephes_igamc(a,x);
+
+	/* Compute  x**a * exp(-x) / gamma(a)  */
+	ax = a * log(x) - x - cephes_lgam(a);
+	if ( ax < -MAXLOG ) {
+		printf("igam: UNDERFLOW\n");
+		return 0.0;
+	}
+	ax = exp(ax);
+
+	/* power series */
+	r = a;
+	c = 1.0;
+	ans = 1.0;
+
+	do {
+		r += 1.0;
+		c *= x/r;
+		ans += c;
+	} while ( c/ans > MACHEP );
+
+	return ans * ax/a;
+}
+
+
+/* A[]: Stirling's formula expansion of log gamma
+ * B[], C[]: log gamma function between 2 and 3
+ */
+static unsigned short A[] = {
+	0x6661,0x2733,0x9850,0x3f4a,
+	0xe943,0xb580,0x7fbd,0xbf43,
+	0x5ebb,0x20dc,0x019f,0x3f4a,
+	0xa5a1,0x16b0,0xc16c,0xbf66,
+	0x554b,0x5555,0x5555,0x3fb5
+};
+static unsigned short B[] = {
+	0x6761,0x8ff3,0x8901,0xc095,
+	0xb93e,0x355b,0xf234,0xc0e2,
+	0x89e5,0xf890,0x3d73,0xc114,
+	0xdb51,0xf994,0xbc82,0xc131,
+	0xf20b,0x0219,0x4589,0xc13a,
+	0x055e,0x5418,0x0c67,0xc12a
+};
+static unsigned short C[] = {
+	/*0x0000,0x0000,0x0000,0x3ff0,*/
+	0x12b2,0x1cf3,0xfd0d,0xc075,
+	0xd757,0x7b89,0xaa0d,0xc0d0,
+	0x4c9b,0xb974,0xeb84,0xc10a,
+	0x0043,0x7195,0x6286,0xc131,
+	0xf34c,0x892f,0x5255,0xc143,
+	0xe14a,0x6a11,0xce4b,0xc13e
+};
+
+#define MAXLGM 2.556348e305
+
+
+/* Logarithm of gamma function */
+double
+cephes_lgam(double x)
+{
+	double	p, q, u, w, z;
+	int		i;
+
+	sgngam = 1;
+
+	if ( x < -34.0 ) {
+		q = -x;
+		w = cephes_lgam(q); /* note this modifies sgngam! */
+		p = floor(q);
+		if ( p == q ) {
+lgsing:
+			goto loverf;
+		}
+		i = (int)p;
+		if ( (i & 1) == 0 )
+			sgngam = -1;
+		else
+			sgngam = 1;
+		z = q - p;
+		if ( z > 0.5 ) {
+			p += 1.0;
+			z = p - q;
+		}
+		z = q * sin( PI * z );
+		if ( z == 0.0 )
+			goto lgsing;
+		/*      z = log(PI) - log( z ) - w;*/
+		z = log(PI) - log( z ) - w;
+		return z;
+	}
+
+	if ( x < 13.0 ) {
+		z = 1.0;
+		p = 0.0;
+		u = x;
+		while ( u >= 3.0 ) {
+			p -= 1.0;
+			u = x + p;
+			z *= u;
+		}
+		while ( u < 2.0 ) {
+			if ( u == 0.0 )
+				goto lgsing;
+			z /= u;
+			p += 1.0;
+			u = x + p;
+		}
+		if ( z < 0.0 ) {
+			sgngam = -1;
+			z = -z;
+		}
+		else
+			sgngam = 1;
+		if ( u == 2.0 )
+			return( log(z) );
+		p -= 2.0;
+		x = x + p;
+		p = x * cephes_polevl( x, (double *)B, 5 ) / cephes_p1evl( x, (double *)C, 6);
+
+		return log(z) + p;
+	}
+
+	if ( x > MAXLGM ) {
+loverf:
+		printf("lgam: OVERFLOW\n");
+
+		return sgngam * MAXNUM;
+	}
+
+	q = ( x - 0.5 ) * log(x) - x + log( sqrt( 2*PI ) );
+	if ( x > 1.0e8 )
+		return q;
+
+	p = 1.0/(x*x);
+	if ( x >= 1000.0 )
+		q += ((   7.9365079365079365079365e-4 * p
+		        - 2.7777777777777777777778e-3) *p
+				+ 0.0833333333333333333333) / x;
+	else
+		q += cephes_polevl( p, (double *)A, 4 ) / x;
+
+	return q;
+}
+
+double
+cephes_polevl(double x, double *coef, int N)
+{
+	double	ans;
+	int		i;
+	double	*p;
+
+	p = coef;
+	ans = *p++;
+	i = N;
+
+	do
+		ans = ans * x  +  *p++;
+	while ( --i );
+
+	return ans;
+}
+
+double
+cephes_p1evl(double x, double *coef, int N)
+{
+	double	ans;
+	double	*p;
+	int		i;
+
+	p = coef;
+	ans = x + *p++;
+	i = N-1;
+
+	do
+		ans = ans * x  + *p++;
+	while ( --i );
+
+	return ans;
+}
+
+double
+cephes_erf(double x)
+{
+	static const double two_sqrtpi = 1.128379167095512574;
+	double	sum = x, term = x, xsqr = x * x;
+	int		j = 1;
+
+	if ( fabs(x) > 2.2 )
+		return 1.0 - cephes_erfc(x);
+
+	do {
+		term *= xsqr/j;
+		sum -= term/(2*j+1);
+		j++;
+		term *= xsqr/j;
+		sum += term/(2*j+1);
+		j++;
+	} while ( fabs(term)/sum > rel_error );
+
+	return two_sqrtpi*sum;
+}
+
+double
+cephes_erfc(double x)
+{
+	static const double one_sqrtpi = 0.564189583547756287;
+	double	a = 1, b = x, c = x, d = x*x + 0.5;
+	double	q1, q2 = b/d, n = 1.0, t;
+
+	if ( fabs(x) < 2.2 )
+		return 1.0 - cephes_erf(x);
+	if ( x < 0 )
+		return 2.0 - cephes_erfc(-x);
+
+	do {
+		t = a*n + b*x;
+		a = b;
+		b = t;
+		t = c*n + d*x;
+		c = d;
+		d = t;
+		n += 0.5;
+		q1 = q2;
+		q2 = b/d;
+	} while ( fabs(q1-q2)/q2 > rel_error );
+
+	return one_sqrtpi*exp(-x*x)*q2;
+}
+
+
+double
+cephes_normal(double x)
+{
+	double arg, result, sqrt2=1.414213562373095048801688724209698078569672;
+
+	if (x > 0) {
+		arg = x/sqrt2;
+		result = 0.5 * ( 1 + erf(arg) );
+	}
+	else {
+		arg = -x/sqrt2;
+		result = 0.5 * ( 1 - erf(arg) );
+	}
+
+	return( result);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/cusum.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,109 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/cephes.h"
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+		    C U M U L A T I V E  S U M S  T E S T
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+void
+CumulativeSums(int n)
+{
+	int	   S, sup, inf;
+	int    z = 0;
+	int    zrev = 0;
+	int    k;
+	double	sum1, sum2, p_value;
+
+	S = 0;
+	sup = 0;
+	inf = 0;
+	for ( k=0; k<n; k++ ) {
+		epsilon[k] ? S++ : S--;
+		if ( S > sup )
+			sup++;
+		if ( S < inf )
+			inf--;
+		z = (sup > -inf) ? sup : -inf;
+		zrev = (sup-S > S-inf) ? sup-S : S-inf;
+	}
+	
+	// forward
+	sum1 = 0.0;
+	for ( k=(-n/z+1)/4; k<=(n/z-1)/4; k++ ) {
+		sum1 += cephes_normal(((4*k+1)*z)/sqrt(n));
+		sum1 -= cephes_normal(((4*k-1)*z)/sqrt(n));
+	}
+	sum2 = 0.0;
+	for ( k=(-n/z-3)/4; k<=(n/z-1)/4; k++ ) {
+		sum2 += cephes_normal(((4*k+3)*z)/sqrt(n));
+		sum2 -= cephes_normal(((4*k+1)*z)/sqrt(n));
+	}
+
+	p_value = 1.0 - sum1 + sum2;
+	
+	fprintf(stats[TEST_CUSUM], "\t\t      CUMULATIVE SUMS (FORWARD) TEST\n");
+	fprintf(stats[TEST_CUSUM], "\t\t-------------------------------------------\n");
+	fprintf(stats[TEST_CUSUM], "\t\tCOMPUTATIONAL INFORMATION:\n");
+	fprintf(stats[TEST_CUSUM], "\t\t-------------------------------------------\n");
+	fprintf(stats[TEST_CUSUM], "\t\t(a) The maximum partial sum = %d\n", z);
+	fprintf(stats[TEST_CUSUM], "\t\t-------------------------------------------\n");
+
+	if ( isNegative(p_value) || isGreaterThanOne(p_value) )
+		fprintf(stats[TEST_CUSUM], "\t\tWARNING:  P_VALUE IS OUT OF RANGE\n");
+
+	fprintf(stats[TEST_CUSUM], "%s\t\tp_value = %f\n\n", p_value < ALPHA ? "FAILURE" : "SUCCESS", p_value);
+	fprintf(results[TEST_CUSUM], "%f\n", p_value);
+		
+	// backwards
+	sum1 = 0.0;
+	for ( k=(-n/zrev+1)/4; k<=(n/zrev-1)/4; k++ ) {
+		sum1 += cephes_normal(((4*k+1)*zrev)/sqrt(n));
+		sum1 -= cephes_normal(((4*k-1)*zrev)/sqrt(n));
+	}
+	sum2 = 0.0;
+	for ( k=(-n/zrev-3)/4; k<=(n/zrev-1)/4; k++ ) {
+		sum2 += cephes_normal(((4*k+3)*zrev)/sqrt(n));
+		sum2 -= cephes_normal(((4*k+1)*zrev)/sqrt(n));
+	}
+	p_value = 1.0 - sum1 + sum2;
+
+	fprintf(stats[TEST_CUSUM], "\t\t      CUMULATIVE SUMS (REVERSE) TEST\n");
+	fprintf(stats[TEST_CUSUM], "\t\t-------------------------------------------\n");
+	fprintf(stats[TEST_CUSUM], "\t\tCOMPUTATIONAL INFORMATION:\n");
+	fprintf(stats[TEST_CUSUM], "\t\t-------------------------------------------\n");
+	fprintf(stats[TEST_CUSUM], "\t\t(a) The maximum partial sum = %d\n", zrev);
+	fprintf(stats[TEST_CUSUM], "\t\t-------------------------------------------\n");
+
+	if ( isNegative(p_value) || isGreaterThanOne(p_value) )
+		fprintf(stats[TEST_CUSUM], "\t\tWARNING:  P_VALUE IS OUT OF RANGE\n");
+
+	fprintf(stats[TEST_CUSUM], "%s\t\tp_value = %f\n\n", p_value < ALPHA ? "FAILURE" : "SUCCESS", p_value);
+	fprintf(results[TEST_CUSUM], "%f\n", p_value);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/dfft.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,1399 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original of this file was released into the public domain, see below for details
+*/
+
+
+/* Notes from RFB: 
+
+   Looks like the user-level routines are:
+
+   Real FFT
+
+   void __ogg_fdrffti(int n, double *wsave, int *ifac)
+   void __ogg_fdrfftf(int n,double *r,double *wsave,int *ifac)
+   void __ogg_fdrfftb(int n, double *r, double *wsave, int *ifac)
+
+     __ogg_fdrffti == initialization
+     __ogg_fdrfftf == forward transform
+     __ogg_fdrfftb == backward transform
+
+     Parameters are
+     n == length of sequence
+     r == sequence to be transformed (input)
+       == transformed sequence (output)
+     wsave == work array of length 2n (allocated by caller)
+     ifac == work array of length 15 (allocated by caller)
+
+   Cosine quarter-wave FFT
+
+   void __ogg_fdcosqi(int n, double *wsave, int *ifac)
+   void __ogg_fdcosqf(int n,double *x,double *wsave,int *ifac)
+   void __ogg_fdcosqb(int n,double *x,double *wsave,int *ifac)
+*/
+
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggSQUISH SOFTWARE CODEC SOURCE CODE.   *
+ *                                                                  *
+ ********************************************************************
+
+  file: fft.c
+  function: Fast discrete Fourier and cosine transforms and inverses
+  author: Monty <xiphmont@mit.edu>
+  modifications by: Monty
+  last modification date: Jul 1 1996
+
+ ********************************************************************/
+
+/* These Fourier routines were originally based on the Fourier
+   routines of the same names from the NETLIB bihar and fftpack
+   fortran libraries developed by Paul N. Swarztrauber at the National
+   Center for Atmospheric Research in Boulder, CO USA.  They have been
+   reimplemented in C and optimized in a few ways for OggSquish. */
+
+/* As the original fortran libraries are public domain, the C Fourier
+   routines in this file are hereby released to the public domain as
+   well.  The C routines here produce output exactly equivalent to the
+   original fortran routines.  Of particular interest are the facts
+   that (like the original fortran), these routines can work on
+   arbitrary length vectors that need not be powers of two in
+   length. */
+
+#include "openc.h"
+#define STIN static
+
+static void drfti1(int n, double *wa, int *ifac){
+  static int ntryh[4] = { 4,2,3,5 };
+  static double tpi = 6.28318530717958647692528676655900577;
+  double arg,argh,argld,fi;
+  int ntry=0,i,j=-1;
+  int k1, l1, l2, ib;
+  int ld, ii, ip, is, nq, nr;
+  int ido, ipm, nfm1;
+  int nl=n;
+  int nf=0;
+
+ L101:
+  j++;
+  if (j < 4)
+    ntry=ntryh[j];
+  else
+    ntry+=2;
+
+ L104:
+  nq=nl/ntry;
+  nr=nl-ntry*nq;
+  if (nr!=0) goto L101;
+
+  nf++;
+  ifac[nf+1]=ntry;
+  nl=nq;
+  if(ntry!=2)goto L107;
+  if(nf==1)goto L107;
+
+  for (i=1;i<nf;i++){
+    ib=nf-i+1;
+    ifac[ib+1]=ifac[ib];
+  }
+  ifac[2] = 2;
+
+ L107:
+  if(nl!=1)goto L104;
+  ifac[0]=n;
+  ifac[1]=nf;
+  argh=tpi/n;
+  is=0;
+  nfm1=nf-1;
+  l1=1;
+
+  if(nfm1==0)return;
+
+  for (k1=0;k1<nfm1;k1++){
+    ip=ifac[k1+2];
+    ld=0;
+    l2=l1*ip;
+    ido=n/l2;
+    ipm=ip-1;
+
+    for (j=0;j<ipm;j++){
+      ld+=l1;
+      i=is;
+      argld=(double)ld*argh;
+      fi=0.;
+      for (ii=2;ii<ido;ii+=2){
+	fi+=1.;
+	arg=fi*argld;
+	wa[i++]=cos(arg);
+	wa[i++]=sin(arg);
+      }
+      is+=ido;
+    }
+    l1=l2;
+  }
+}
+
+void __ogg_fdrffti(int n, double *wsave, int *ifac){
+
+  if (n == 1) return;
+  drfti1(n, wsave+n, ifac);
+}
+
+void __ogg_fdcosqi(int n, double *wsave, int *ifac){
+  static double pih = 1.57079632679489661923132169163975;
+  static int k;
+  static double fk, dt;
+
+  dt=pih/n;
+  fk=0.;
+  for(k=0;k<n;k++){
+    fk+=1.;
+    wsave[k] = cos(fk*dt);
+  }
+
+  __ogg_fdrffti(n, wsave+n,ifac);
+}
+
+STIN void dradf2(int ido,int l1,double *cc,double *ch,double *wa1){
+  int i,k;
+  double ti2,tr2;
+  int t0,t1,t2,t3,t4,t5,t6;
+  
+  t1=0;
+  t0=(t2=l1*ido);
+  t3=ido<<1;
+  for(k=0;k<l1;k++){
+    ch[t1<<1]=cc[t1]+cc[t2];
+    ch[(t1<<1)+t3-1]=cc[t1]-cc[t2];
+    t1+=ido;
+    t2+=ido;
+  }
+
+  if(ido<2)return;
+  if(ido==2)goto L105;
+
+  t1=0;
+  t2=t0;
+  for(k=0;k<l1;k++){
+    t3=t2;
+    t4=(t1<<1)+(ido<<1);
+    t5=t1;
+    t6=t1+t1;
+    for(i=2;i<ido;i+=2){
+      t3+=2;
+      t4-=2;
+      t5+=2;
+      t6+=2;
+      tr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3];
+      ti2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1];
+      ch[t6]=cc[t5]+ti2;
+      ch[t4]=ti2-cc[t5];
+      ch[t6-1]=cc[t5-1]+tr2;
+      ch[t4-1]=cc[t5-1]-tr2;
+    }
+    t1+=ido;
+    t2+=ido;
+  }
+
+  if(ido%2==1)return;
+
+ L105:
+  t3=(t2=(t1=ido)-1);
+  t2+=t0;
+  for(k=0;k<l1;k++){
+    ch[t1]=-cc[t2];
+    ch[t1-1]=cc[t3];
+    t1+=ido<<1;
+    t2+=ido;
+    t3+=ido;
+  }
+}
+
+STIN void dradf4(int ido,int l1,double *cc,double *ch,double *wa1,
+	    double *wa2,double *wa3){
+  static double hsqt2 = .70710678118654752440084436210485;
+  int i,k,t0,t1,t2,t3,t4,t5,t6;
+  double ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
+  t0=l1*ido;
+  
+  t1=t0;
+  t4=t1<<1;
+  t2=t1+(t1<<1);
+  t3=0;
+
+  for(k=0;k<l1;k++){
+    tr1=cc[t1]+cc[t2];
+    tr2=cc[t3]+cc[t4];
+    ch[t5=t3<<2]=tr1+tr2;
+    ch[(ido<<2)+t5-1]=tr2-tr1;
+    ch[(t5+=(ido<<1))-1]=cc[t3]-cc[t4];
+    ch[t5]=cc[t2]-cc[t1];
+
+    t1+=ido;
+    t2+=ido;
+    t3+=ido;
+    t4+=ido;
+  }
+
+  if(ido<2)return;
+  if(ido==2)goto L105;
+
+  t1=0;
+  for(k=0;k<l1;k++){
+    t2=t1;
+    t4=t1<<2;
+    t5=(t6=ido<<1)+t4;
+    for(i=2;i<ido;i+=2){
+      t3=(t2+=2);
+      t4+=2;
+      t5-=2;
+
+      t3+=t0;
+      cr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3];
+      ci2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1];
+      t3+=t0;
+      cr3=wa2[i-2]*cc[t3-1]+wa2[i-1]*cc[t3];
+      ci3=wa2[i-2]*cc[t3]-wa2[i-1]*cc[t3-1];
+      t3+=t0;
+      cr4=wa3[i-2]*cc[t3-1]+wa3[i-1]*cc[t3];
+      ci4=wa3[i-2]*cc[t3]-wa3[i-1]*cc[t3-1];
+
+      tr1=cr2+cr4;
+      tr4=cr4-cr2;
+      ti1=ci2+ci4;
+      ti4=ci2-ci4;
+      ti2=cc[t2]+ci3;
+      ti3=cc[t2]-ci3;
+      tr2=cc[t2-1]+cr3;
+      tr3=cc[t2-1]-cr3;
+
+      
+      ch[t4-1]=tr1+tr2;
+      ch[t4]=ti1+ti2;
+
+      ch[t5-1]=tr3-ti4;
+      ch[t5]=tr4-ti3;
+
+      ch[t4+t6-1]=ti4+tr3;
+      ch[t4+t6]=tr4+ti3;
+
+      ch[t5+t6-1]=tr2-tr1;
+      ch[t5+t6]=ti1-ti2;
+    }
+    t1+=ido;
+  }
+  if(ido%2==1)return;
+
+ L105:
+  
+  t2=(t1=t0+ido-1)+(t0<<1);
+  t3=ido<<2;
+  t4=ido;
+  t5=ido<<1;
+  t6=ido;
+
+  for(k=0;k<l1;k++){
+    ti1=-hsqt2*(cc[t1]+cc[t2]);
+    tr1=hsqt2*(cc[t1]-cc[t2]);
+    ch[t4-1]=tr1+cc[t6-1];
+    ch[t4+t5-1]=cc[t6-1]-tr1;
+    ch[t4]=ti1-cc[t1+t0];
+    ch[t4+t5]=ti1+cc[t1+t0];
+    t1+=ido;
+    t2+=ido;
+    t4+=t3;
+    t6+=ido;
+  }
+}
+
+STIN void dradfg(int ido,int ip,int l1,int idl1,double *cc,double *c1,
+			  double *c2,double *ch,double *ch2,double *wa){
+
+  static double tpi=6.28318530717958647692528676655900577;
+  int idij,ipph,i,j,k,l,ic,ik,is;
+  int t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+  double dc2,ai1,ai2,ar1,ar2,ds2;
+  int nbd;
+  double dcp,arg,dsp,ar1h,ar2h;
+  int idp2,ipp2;
+  
+  arg=tpi/(double)ip;
+  dcp=cos(arg);
+  dsp=sin(arg);
+  ipph=(ip+1)>>1;
+  ipp2=ip;
+  idp2=ido;
+  nbd=(ido-1)>>1;
+  t0=l1*ido;
+  t10=ip*ido;
+
+  if(ido==1)goto L119;
+  for(ik=0;ik<idl1;ik++)ch2[ik]=c2[ik];
+
+  t1=0;
+  for(j=1;j<ip;j++){
+    t1+=t0;
+    t2=t1;
+    for(k=0;k<l1;k++){
+      ch[t2]=c1[t2];
+      t2+=ido;
+    }
+  }
+
+  is=-ido;
+  t1=0;
+  if(nbd>l1){
+    for(j=1;j<ip;j++){
+      t1+=t0;
+      is+=ido;
+      t2= -ido+t1;
+      for(k=0;k<l1;k++){
+	idij=is-1;
+	t2+=ido;
+	t3=t2;
+	for(i=2;i<ido;i+=2){
+	  idij+=2;
+	  t3+=2;
+	  ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3];
+	  ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1];
+	}
+      }
+    }
+  }else{
+
+    for(j=1;j<ip;j++){
+      is+=ido;
+      idij=is-1;
+      t1+=t0;
+      t2=t1;
+      for(i=2;i<ido;i+=2){
+	idij+=2;
+	t2+=2;
+	t3=t2;
+	for(k=0;k<l1;k++){
+	  ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3];
+	  ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1];
+	  t3+=ido;
+	}
+      }
+    }
+  }
+
+  t1=0;
+  t2=ipp2*t0;
+  if(nbd<l1){
+    for(j=1;j<ipph;j++){
+      t1+=t0;
+      t2-=t0;
+      t3=t1;
+      t4=t2;
+      for(i=2;i<ido;i+=2){
+	t3+=2;
+	t4+=2;
+	t5=t3-ido;
+	t6=t4-ido;
+	for(k=0;k<l1;k++){
+	  t5+=ido;
+	  t6+=ido;
+	  c1[t5-1]=ch[t5-1]+ch[t6-1];
+	  c1[t6-1]=ch[t5]-ch[t6];
+	  c1[t5]=ch[t5]+ch[t6];
+	  c1[t6]=ch[t6-1]-ch[t5-1];
+	}
+      }
+    }
+  }else{
+    for(j=1;j<ipph;j++){
+      t1+=t0;
+      t2-=t0;
+      t3=t1;
+      t4=t2;
+      for(k=0;k<l1;k++){
+	t5=t3;
+	t6=t4;
+	for(i=2;i<ido;i+=2){
+	  t5+=2;
+	  t6+=2;
+	  c1[t5-1]=ch[t5-1]+ch[t6-1];
+	  c1[t6-1]=ch[t5]-ch[t6];
+	  c1[t5]=ch[t5]+ch[t6];
+	  c1[t6]=ch[t6-1]-ch[t5-1];
+	}
+	t3+=ido;
+	t4+=ido;
+      }
+    }
+  }
+
+L119:
+  for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik];
+
+  t1=0;
+  t2=ipp2*idl1;
+  for(j=1;j<ipph;j++){
+    t1+=t0;
+    t2-=t0;
+    t3=t1-ido;
+    t4=t2-ido;
+    for(k=0;k<l1;k++){
+      t3+=ido;
+      t4+=ido;
+      c1[t3]=ch[t3]+ch[t4];
+      c1[t4]=ch[t4]-ch[t3];
+    }
+  }
+
+  ar1=1.;
+  ai1=0.;
+  t1=0;
+  t2=ipp2*idl1;
+  t3=(ip-1)*idl1;
+  for(l=1;l<ipph;l++){
+    t1+=idl1;
+    t2-=idl1;
+    ar1h=dcp*ar1-dsp*ai1;
+    ai1=dcp*ai1+dsp*ar1;
+    ar1=ar1h;
+    t4=t1;
+    t5=t2;
+    t6=t3;
+    t7=idl1;
+
+    for(ik=0;ik<idl1;ik++){
+      ch2[t4++]=c2[ik]+ar1*c2[t7++];
+      ch2[t5++]=ai1*c2[t6++];
+    }
+
+    dc2=ar1;
+    ds2=ai1;
+    ar2=ar1;
+    ai2=ai1;
+
+    t4=idl1;
+    t5=(ipp2-1)*idl1;
+    for(j=2;j<ipph;j++){
+      t4+=idl1;
+      t5-=idl1;
+
+      ar2h=dc2*ar2-ds2*ai2;
+      ai2=dc2*ai2+ds2*ar2;
+      ar2=ar2h;
+
+      t6=t1;
+      t7=t2;
+      t8=t4;
+      t9=t5;
+      for(ik=0;ik<idl1;ik++){
+	ch2[t6++]+=ar2*c2[t8++];
+	ch2[t7++]+=ai2*c2[t9++];
+      }
+    }
+  }
+
+  t1=0;
+  for(j=1;j<ipph;j++){
+    t1+=idl1;
+    t2=t1;
+    for(ik=0;ik<idl1;ik++)ch2[ik]+=c2[t2++];
+  }
+
+  if(ido<l1)goto L132;
+
+  t1=0;
+  t2=0;
+  for(k=0;k<l1;k++){
+    t3=t1;
+    t4=t2;
+    for(i=0;i<ido;i++)cc[t4++]=ch[t3++];
+    t1+=ido;
+    t2+=t10;
+  }
+
+  goto L135;
+
+ L132:
+  for(i=0;i<ido;i++){
+    t1=i;
+    t2=i;
+    for(k=0;k<l1;k++){
+      cc[t2]=ch[t1];
+      t1+=ido;
+      t2+=t10;
+    }
+  }
+
+ L135:
+  t1=0;
+  t2=ido<<1;
+  t3=0;
+  t4=ipp2*t0;
+  for(j=1;j<ipph;j++){
+
+    t1+=t2;
+    t3+=t0;
+    t4-=t0;
+
+    t5=t1;
+    t6=t3;
+    t7=t4;
+
+    for(k=0;k<l1;k++){
+      cc[t5-1]=ch[t6];
+      cc[t5]=ch[t7];
+      t5+=t10;
+      t6+=ido;
+      t7+=ido;
+    }
+  }
+
+  if(ido==1)return;
+  if(nbd<l1)goto L141;
+
+  t1=-ido;
+  t3=0;
+  t4=0;
+  t5=ipp2*t0;
+  for(j=1;j<ipph;j++){
+    t1+=t2;
+    t3+=t2;
+    t4+=t0;
+    t5-=t0;
+    t6=t1;
+    t7=t3;
+    t8=t4;
+    t9=t5;
+    for(k=0;k<l1;k++){
+      for(i=2;i<ido;i+=2){
+	ic=idp2-i;
+	cc[i+t7-1]=ch[i+t8-1]+ch[i+t9-1];
+	cc[ic+t6-1]=ch[i+t8-1]-ch[i+t9-1];
+	cc[i+t7]=ch[i+t8]+ch[i+t9];
+	cc[ic+t6]=ch[i+t9]-ch[i+t8];
+      }
+      t6+=t10;
+      t7+=t10;
+      t8+=ido;
+      t9+=ido;
+    }
+  }
+  return;
+
+ L141:
+
+  t1=-ido;
+  t3=0;
+  t4=0;
+  t5=ipp2*t0;
+  for(j=1;j<ipph;j++){
+    t1+=t2;
+    t3+=t2;
+    t4+=t0;
+    t5-=t0;
+    for(i=2;i<ido;i+=2){
+      t6=idp2+t1-i;
+      t7=i+t3;
+      t8=i+t4;
+      t9=i+t5;
+      for(k=0;k<l1;k++){
+	cc[t7-1]=ch[t8-1]+ch[t9-1];
+	cc[t6-1]=ch[t8-1]-ch[t9-1];
+	cc[t7]=ch[t8]+ch[t9];
+	cc[t6]=ch[t9]-ch[t8];
+	t6+=t10;
+	t7+=t10;
+	t8+=ido;
+	t9+=ido;
+      }
+    }
+  }
+}
+
+STIN void drftf1(int n,double *c,double *ch,double *wa,int *ifac){
+  int i,k1,l1,l2;
+  int na,kh,nf;
+  int ip,iw,ido,idl1,ix2,ix3;
+
+  nf=ifac[1];
+  na=1;
+  l2=n;
+  iw=n;
+
+  for(k1=0;k1<nf;k1++){
+    kh=nf-k1;
+    ip=ifac[kh+1];
+    l1=l2/ip;
+    ido=n/l2;
+    idl1=ido*l1;
+    iw-=(ip-1)*ido;
+    na=1-na;
+
+    if(ip!=4)goto L102;
+
+    ix2=iw+ido;
+    ix3=ix2+ido;
+    if(na!=0)
+      dradf4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1);
+    else
+      dradf4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1);
+    goto L110;
+
+ L102:
+    if(ip!=2)goto L104;
+    if(na!=0)goto L103;
+
+    dradf2(ido,l1,c,ch,wa+iw-1);
+    goto L110;
+
+  L103:
+    dradf2(ido,l1,ch,c,wa+iw-1);
+    goto L110;
+
+  L104:
+    if(ido==1)na=1-na;
+    if(na!=0)goto L109;
+
+    dradfg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1);
+    na=1;
+    goto L110;
+
+  L109:
+    dradfg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1);
+    na=0;
+
+  L110:
+    l2=l1;
+  }
+
+  if(na==1)return;
+
+  for(i=0;i<n;i++)c[i]=ch[i];
+}
+
+void __ogg_fdrfftf(int n,double *r,double *wsave,int *ifac){
+  if(n==1)return;
+  drftf1(n,r,wsave,wsave+n,ifac);
+}
+
+STIN void dcsqf1(int n,double *x,double *w,double *xh,int *ifac){
+  int modn,i,k,kc;
+  int np2,ns2;
+  double xim1;
+
+  ns2=(n+1)>>1;
+  np2=n;
+
+  kc=np2;
+  for(k=1;k<ns2;k++){
+    kc--;
+    xh[k]=x[k]+x[kc];
+    xh[kc]=x[k]-x[kc];
+  }
+
+  modn=n%2;
+  if(modn==0)xh[ns2]=x[ns2]+x[ns2];
+
+  for(k=1;k<ns2;k++){
+    kc=np2-k;
+    x[k]=w[k-1]*xh[kc]+w[kc-1]*xh[k];
+    x[kc]=w[k-1]*xh[k]-w[kc-1]*xh[kc];
+  }
+
+  if(modn==0)x[ns2]=w[ns2-1]*xh[ns2];
+
+  __ogg_fdrfftf(n,x,xh,ifac);
+
+  for(i=2;i<n;i+=2){
+    xim1=x[i-1]-x[i];
+    x[i]=x[i-1]+x[i];
+    x[i-1]=xim1;
+  }
+}
+
+void __ogg_fdcosqf(int n,double *x,double *wsave,int *ifac){
+    static double sqrt2=1.4142135623730950488016887242097;
+    double tsqx;
+
+  switch(n){
+  case 0:case 1:
+    return;
+  case 2:
+    tsqx=sqrt2*x[1];
+    x[1]=x[0]-tsqx;
+    x[0]+=tsqx;
+    return;
+  default:
+    dcsqf1(n,x,wsave,wsave+n,ifac);
+    return;
+  }
+}
+
+STIN void dradb2(int ido,int l1,double *cc,double *ch,double *wa1){
+  int i,k,t0,t1,t2,t3,t4,t5,t6;
+  double ti2,tr2;
+
+  t0=l1*ido;
+  
+  t1=0;
+  t2=0;
+  t3=(ido<<1)-1;
+  for(k=0;k<l1;k++){
+    ch[t1]=cc[t2]+cc[t3+t2];
+    ch[t1+t0]=cc[t2]-cc[t3+t2];
+    t2=(t1+=ido)<<1;
+  }
+
+  if(ido<2)return;
+  if(ido==2)goto L105;
+
+  t1=0;
+  t2=0;
+  for(k=0;k<l1;k++){
+    t3=t1;
+    t5=(t4=t2)+(ido<<1);
+    t6=t0+t1;
+    for(i=2;i<ido;i+=2){
+      t3+=2;
+      t4+=2;
+      t5-=2;
+      t6+=2;
+      ch[t3-1]=cc[t4-1]+cc[t5-1];
+      tr2=cc[t4-1]-cc[t5-1];
+      ch[t3]=cc[t4]-cc[t5];
+      ti2=cc[t4]+cc[t5];
+      ch[t6-1]=wa1[i-2]*tr2-wa1[i-1]*ti2;
+      ch[t6]=wa1[i-2]*ti2+wa1[i-1]*tr2;
+    }
+    t2=(t1+=ido)<<1;
+  }
+
+  if(ido%2==1)return;
+
+L105:
+  t1=ido-1;
+  t2=ido-1;
+  for(k=0;k<l1;k++){
+    ch[t1]=cc[t2]+cc[t2];
+    ch[t1+t0]=-(cc[t2+1]+cc[t2+1]);
+    t1+=ido;
+    t2+=ido<<1;
+  }
+}
+
+STIN void dradb3(int ido,int l1,double *cc,double *ch,double *wa1,
+			  double *wa2){
+  static double taur = -.5;
+  static double taui = .86602540378443864676372317075293618;
+  int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+  double ci2,ci3,di2,di3,cr2,cr3,dr2,dr3,ti2,tr2;
+  t0=l1*ido;
+
+  t1=0;
+  t2=t0<<1;
+  t3=ido<<1;
+  t4=ido+(ido<<1);
+  t5=0;
+  for(k=0;k<l1;k++){
+    tr2=cc[t3-1]+cc[t3-1];
+    cr2=cc[t5]+(taur*tr2);
+    ch[t1]=cc[t5]+tr2;
+    ci3=taui*(cc[t3]+cc[t3]);
+    ch[t1+t0]=cr2-ci3;
+    ch[t1+t2]=cr2+ci3;
+    t1+=ido;
+    t3+=t4;
+    t5+=t4;
+  }
+
+  if(ido==1)return;
+
+  t1=0;
+  t3=ido<<1;
+  for(k=0;k<l1;k++){
+    t7=t1+(t1<<1);
+    t6=(t5=t7+t3);
+    t8=t1;
+    t10=(t9=t1+t0)+t0;
+
+    for(i=2;i<ido;i+=2){
+      t5+=2;
+      t6-=2;
+      t7+=2;
+      t8+=2;
+      t9+=2;
+      t10+=2;
+      tr2=cc[t5-1]+cc[t6-1];
+      cr2=cc[t7-1]+(taur*tr2);
+      ch[t8-1]=cc[t7-1]+tr2;
+      ti2=cc[t5]-cc[t6];
+      ci2=cc[t7]+(taur*ti2);
+      ch[t8]=cc[t7]+ti2;
+      cr3=taui*(cc[t5-1]-cc[t6-1]);
+      ci3=taui*(cc[t5]+cc[t6]);
+      dr2=cr2-ci3;
+      dr3=cr2+ci3;
+      di2=ci2+cr3;
+      di3=ci2-cr3;
+      ch[t9-1]=wa1[i-2]*dr2-wa1[i-1]*di2;
+      ch[t9]=wa1[i-2]*di2+wa1[i-1]*dr2;
+      ch[t10-1]=wa2[i-2]*dr3-wa2[i-1]*di3;
+      ch[t10]=wa2[i-2]*di3+wa2[i-1]*dr3;
+    }
+    t1+=ido;
+  }
+}
+
+STIN void dradb4(int ido,int l1,double *cc,double *ch,double *wa1,
+			  double *wa2,double *wa3){
+  static double sqrt2=1.4142135623730950488016887242097;
+  int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8;
+  double ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
+  t0=l1*ido;
+  
+  t1=0;
+  t2=ido<<2;
+  t3=0;
+  t6=ido<<1;
+  for(k=0;k<l1;k++){
+    t4=t3+t6;
+    t5=t1;
+    tr3=cc[t4-1]+cc[t4-1];
+    tr4=cc[t4]+cc[t4]; 
+    tr1=cc[t3]-cc[(t4+=t6)-1];
+    tr2=cc[t3]+cc[t4-1];
+    ch[t5]=tr2+tr3;
+    ch[t5+=t0]=tr1-tr4;
+    ch[t5+=t0]=tr2-tr3;
+    ch[t5+=t0]=tr1+tr4;
+    t1+=ido;
+    t3+=t2;
+  }
+
+  if(ido<2)return;
+  if(ido==2)goto L105;
+
+  t1=0;
+  for(k=0;k<l1;k++){
+    t5=(t4=(t3=(t2=t1<<2)+t6))+t6;
+    t7=t1;
+    for(i=2;i<ido;i+=2){
+      t2+=2;
+      t3+=2;
+      t4-=2;
+      t5-=2;
+      t7+=2;
+      ti1=cc[t2]+cc[t5];
+      ti2=cc[t2]-cc[t5];
+      ti3=cc[t3]-cc[t4];
+      tr4=cc[t3]+cc[t4];
+      tr1=cc[t2-1]-cc[t5-1];
+      tr2=cc[t2-1]+cc[t5-1];
+      ti4=cc[t3-1]-cc[t4-1];
+      tr3=cc[t3-1]+cc[t4-1];
+      ch[t7-1]=tr2+tr3;
+      cr3=tr2-tr3;
+      ch[t7]=ti2+ti3;
+      ci3=ti2-ti3;
+      cr2=tr1-tr4;
+      cr4=tr1+tr4;
+      ci2=ti1+ti4;
+      ci4=ti1-ti4;
+
+      ch[(t8=t7+t0)-1]=wa1[i-2]*cr2-wa1[i-1]*ci2;
+      ch[t8]=wa1[i-2]*ci2+wa1[i-1]*cr2;
+      ch[(t8+=t0)-1]=wa2[i-2]*cr3-wa2[i-1]*ci3;
+      ch[t8]=wa2[i-2]*ci3+wa2[i-1]*cr3;
+      ch[(t8+=t0)-1]=wa3[i-2]*cr4-wa3[i-1]*ci4;
+      ch[t8]=wa3[i-2]*ci4+wa3[i-1]*cr4;
+    }
+    t1+=ido;
+  }
+
+  if(ido%2 == 1)return;
+
+ L105:
+
+  t1=ido;
+  t2=ido<<2;
+  t3=ido-1;
+  t4=ido+(ido<<1);
+  for(k=0;k<l1;k++){
+    t5=t3;
+    ti1=cc[t1]+cc[t4];
+    ti2=cc[t4]-cc[t1];
+    tr1=cc[t1-1]-cc[t4-1];
+    tr2=cc[t1-1]+cc[t4-1];
+    ch[t5]=tr2+tr2;
+    ch[t5+=t0]=sqrt2*(tr1-ti1);
+    ch[t5+=t0]=ti2+ti2;
+    ch[t5+=t0]=-sqrt2*(tr1+ti1);
+
+    t3+=ido;
+    t1+=t2;
+    t4+=t2;
+  }
+}
+
+STIN void dradbg(int ido,int ip,int l1,int idl1,double *cc,double *c1,
+	    double *c2,double *ch,double *ch2,double *wa){
+  static double tpi=6.28318530717958647692528676655900577;
+  int idij,ipph,i,j,k,l,ik,is,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,
+      t11,t12;
+  double dc2,ai1,ai2,ar1,ar2,ds2;
+  int nbd;
+  double dcp,arg,dsp,ar1h,ar2h;
+  int ipp2;
+
+  t10=ip*ido;
+  t0=l1*ido;
+  arg=tpi/(double)ip;
+  dcp=cos(arg);
+  dsp=sin(arg);
+  nbd=(ido-1)>>1;
+  ipp2=ip;
+  ipph=(ip+1)>>1;
+  if(ido<l1)goto L103;
+  
+  t1=0;
+  t2=0;
+  for(k=0;k<l1;k++){
+    t3=t1;
+    t4=t2;
+    for(i=0;i<ido;i++){
+      ch[t3]=cc[t4];
+      t3++;
+      t4++;
+    }
+    t1+=ido;
+    t2+=t10;
+  }
+  goto L106;
+
+ L103:
+  t1=0;
+  for(i=0;i<ido;i++){
+    t2=t1;
+    t3=t1;
+    for(k=0;k<l1;k++){
+      ch[t2]=cc[t3];
+      t2+=ido;
+      t3+=t10;
+    }
+    t1++;
+  }
+
+ L106:
+  t1=0;
+  t2=ipp2*t0;
+  t7=(t5=ido<<1);
+  for(j=1;j<ipph;j++){
+    t1+=t0;
+    t2-=t0;
+    t3=t1;
+    t4=t2;
+    t6=t5;
+    for(k=0;k<l1;k++){
+      ch[t3]=cc[t6-1]+cc[t6-1];
+      ch[t4]=cc[t6]+cc[t6];
+      t3+=ido;
+      t4+=ido;
+      t6+=t10;
+    }
+    t5+=t7;
+  }
+
+  if (ido == 1)goto L116;
+  if(nbd<l1)goto L112;
+
+  t1=0;
+  t2=ipp2*t0;
+  t7=0;
+  for(j=1;j<ipph;j++){
+    t1+=t0;
+    t2-=t0;
+    t3=t1;
+    t4=t2;
+
+    t7+=(ido<<1);
+    t8=t7;
+    for(k=0;k<l1;k++){
+      t5=t3;
+      t6=t4;
+      t9=t8;
+      t11=t8;
+      for(i=2;i<ido;i+=2){
+	t5+=2;
+	t6+=2;
+	t9+=2;
+	t11-=2;
+	ch[t5-1]=cc[t9-1]+cc[t11-1];
+	ch[t6-1]=cc[t9-1]-cc[t11-1];
+	ch[t5]=cc[t9]-cc[t11];
+	ch[t6]=cc[t9]+cc[t11];
+      }
+      t3+=ido;
+      t4+=ido;
+      t8+=t10;
+    }
+  }
+  goto L116;
+
+ L112:
+  t1=0;
+  t2=ipp2*t0;
+  t7=0;
+  for(j=1;j<ipph;j++){
+    t1+=t0;
+    t2-=t0;
+    t3=t1;
+    t4=t2;
+    t7+=(ido<<1);
+    t8=t7;
+    t9=t7;
+    for(i=2;i<ido;i+=2){
+      t3+=2;
+      t4+=2;
+      t8+=2;
+      t9-=2;
+      t5=t3;
+      t6=t4;
+      t11=t8;
+      t12=t9;
+      for(k=0;k<l1;k++){
+	ch[t5-1]=cc[t11-1]+cc[t12-1];
+	ch[t6-1]=cc[t11-1]-cc[t12-1];
+	ch[t5]=cc[t11]-cc[t12];
+	ch[t6]=cc[t11]+cc[t12];
+	t5+=ido;
+	t6+=ido;
+	t11+=t10;
+	t12+=t10;
+      }
+    }
+  }
+
+L116:
+  ar1=1.;
+  ai1=0.;
+  t1=0;
+  t9=(t2=ipp2*idl1);
+  t3=(ip-1)*idl1;
+  for(l=1;l<ipph;l++){
+    t1+=idl1;
+    t2-=idl1;
+
+    ar1h=dcp*ar1-dsp*ai1;
+    ai1=dcp*ai1+dsp*ar1;
+    ar1=ar1h;
+    t4=t1;
+    t5=t2;
+    t6=0;
+    t7=idl1;
+    t8=t3;
+    for(ik=0;ik<idl1;ik++){
+      c2[t4++]=ch2[t6++]+ar1*ch2[t7++];
+      c2[t5++]=ai1*ch2[t8++];
+    }
+    dc2=ar1;
+    ds2=ai1;
+    ar2=ar1;
+    ai2=ai1;
+
+    t6=idl1;
+    t7=t9-idl1;
+    for(j=2;j<ipph;j++){
+      t6+=idl1;
+      t7-=idl1;
+      ar2h=dc2*ar2-ds2*ai2;
+      ai2=dc2*ai2+ds2*ar2;
+      ar2=ar2h;
+      t4=t1;
+      t5=t2;
+      t11=t6;
+      t12=t7;
+      for(ik=0;ik<idl1;ik++){
+	c2[t4++]+=ar2*ch2[t11++];
+	c2[t5++]+=ai2*ch2[t12++];
+      }
+    }
+  }
+
+  t1=0;
+  for(j=1;j<ipph;j++){
+    t1+=idl1;
+    t2=t1;
+    for(ik=0;ik<idl1;ik++)ch2[ik]+=ch2[t2++];
+  }
+
+  t1=0;
+  t2=ipp2*t0;
+  for(j=1;j<ipph;j++){
+    t1+=t0;
+    t2-=t0;
+    t3=t1;
+    t4=t2;
+    for(k=0;k<l1;k++){
+      ch[t3]=c1[t3]-c1[t4];
+      ch[t4]=c1[t3]+c1[t4];
+      t3+=ido;
+      t4+=ido;
+    }
+  }
+
+  if(ido==1)goto L132;
+  if(nbd<l1)goto L128;
+
+  t1=0;
+  t2=ipp2*t0;
+  for(j=1;j<ipph;j++){
+    t1+=t0;
+    t2-=t0;
+    t3=t1;
+    t4=t2;
+    for(k=0;k<l1;k++){
+      t5=t3;
+      t6=t4;
+      for(i=2;i<ido;i+=2){
+	t5+=2;
+	t6+=2;
+	ch[t5-1]=c1[t5-1]-c1[t6];
+	ch[t6-1]=c1[t5-1]+c1[t6];
+	ch[t5]=c1[t5]+c1[t6-1];
+	ch[t6]=c1[t5]-c1[t6-1];
+      }
+      t3+=ido;
+      t4+=ido;
+    }
+  }
+  goto L132;
+
+ L128:
+  t1=0;
+  t2=ipp2*t0;
+  for(j=1;j<ipph;j++){
+    t1+=t0;
+    t2-=t0;
+    t3=t1;
+    t4=t2;
+    for(i=2;i<ido;i+=2){
+      t3+=2;
+      t4+=2;
+      t5=t3;
+      t6=t4;
+      for(k=0;k<l1;k++){
+	ch[t5-1]=c1[t5-1]-c1[t6];
+	ch[t6-1]=c1[t5-1]+c1[t6];
+	ch[t5]=c1[t5]+c1[t6-1];
+	ch[t6]=c1[t5]-c1[t6-1];
+	t5+=ido;
+	t6+=ido;
+      }
+    }
+  }
+
+L132:
+  if(ido==1)return;
+
+  for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik];
+
+  t1=0;
+  for(j=1;j<ip;j++){
+    t2=(t1+=t0);
+    for(k=0;k<l1;k++){
+      c1[t2]=ch[t2];
+      t2+=ido;
+    }
+  }
+
+  if(nbd>l1)goto L139;
+
+  is= -ido-1;
+  t1=0;
+  for(j=1;j<ip;j++){
+    is+=ido;
+    t1+=t0;
+    idij=is;
+    t2=t1;
+    for(i=2;i<ido;i+=2){
+      t2+=2;
+      idij+=2;
+      t3=t2;
+      for(k=0;k<l1;k++){
+	c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3];
+	c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1];
+	t3+=ido;
+      }
+    }
+  }
+  return;
+
+ L139:
+  is= -ido-1;
+  t1=0;
+  for(j=1;j<ip;j++){
+    is+=ido;
+    t1+=t0;
+    t2=t1;
+    for(k=0;k<l1;k++){
+      idij=is;
+      t3=t2;
+      for(i=2;i<ido;i+=2){
+	idij+=2;
+	t3+=2;
+	c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3];
+	c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1];
+      }
+      t2+=ido;
+    }
+  }
+}
+
+STIN void drftb1(int n, double *c, double *ch, double *wa, int *ifac){
+  int i,k1,l1,l2;
+  int na;
+  int nf,ip,iw,ix2,ix3,ido,idl1;
+
+  nf=ifac[1];
+  na=0;
+  l1=1;
+  iw=1;
+
+  for(k1=0;k1<nf;k1++){
+    ip=ifac[k1 + 2];
+    l2=ip*l1;
+    ido=n/l2;
+    idl1=ido*l1;
+    if(ip!=4)goto L103;
+    ix2=iw+ido;
+    ix3=ix2+ido;
+
+    if(na!=0)
+      dradb4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1);
+    else
+      dradb4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1);
+    na=1-na;
+    goto L115;
+
+  L103:
+    if(ip!=2)goto L106;
+
+    if(na!=0)
+      dradb2(ido,l1,ch,c,wa+iw-1);
+    else
+      dradb2(ido,l1,c,ch,wa+iw-1);
+    na=1-na;
+    goto L115;
+
+  L106:
+    if(ip!=3)goto L109;
+
+    ix2=iw+ido;
+    if(na!=0)
+      dradb3(ido,l1,ch,c,wa+iw-1,wa+ix2-1);
+    else
+      dradb3(ido,l1,c,ch,wa+iw-1,wa+ix2-1);
+    na=1-na;
+    goto L115;
+
+  L109:
+/*    The radix five case can be translated later..... */
+/*    if(ip!=5)goto L112;
+
+    ix2=iw+ido;
+    ix3=ix2+ido;
+    ix4=ix3+ido;
+    if(na!=0)
+      dradb5(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1);
+    else
+      dradb5(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1);
+    na=1-na;
+    goto L115;
+
+  L112:*/
+    if(na!=0)
+      dradbg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1);
+    else
+      dradbg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1);
+    if(ido==1)na=1-na;
+
+  L115:
+    l1=l2;
+    iw+=(ip-1)*ido;
+  }
+
+  if(na==0)return;
+
+  for(i=0;i<n;i++)c[i]=ch[i];
+}
+
+void __ogg_fdrfftb(int n, double *r, double *wsave, int *ifac){
+  if (n == 1)return;
+  drftb1(n, r, wsave, wsave+n, ifac);
+}
+
+STIN void dcsqb1(int n,double *x,double *w,double *xh,int *ifac){
+  int modn,i,k,kc;
+  int np2,ns2;
+  double xim1;
+
+  ns2=(n+1)>>1;
+  np2=n;
+
+  for(i=2;i<n;i+=2){
+    xim1=x[i-1]+x[i];
+    x[i]-=x[i-1];
+    x[i-1]=xim1;
+  }
+
+  x[0]+=x[0];
+  modn=n%2;
+  if(modn==0)x[n-1]+=x[n-1];
+
+  __ogg_fdrfftb(n,x,xh,ifac);
+
+  kc=np2;
+  for(k=1;k<ns2;k++){
+    kc--;
+    xh[k]=w[k-1]*x[kc]+w[kc-1]*x[k];
+    xh[kc]=w[k-1]*x[k]-w[kc-1]*x[kc];
+  }
+
+  if(modn==0)x[ns2]=w[ns2-1]*(x[ns2]+x[ns2]);
+
+  kc=np2;
+  for(k=1;k<ns2;k++){
+    kc--;
+    x[k]=xh[k]+xh[kc];
+    x[kc]=xh[k]-xh[kc];
+  }
+  x[0]+=x[0];
+}
+
+void __ogg_fdcosqb(int n,double *x,double *wsave,int *ifac){
+  static double tsqrt2 = 2.8284271247461900976033774484194;
+  double x1;
+
+  if(n<2){
+    x[0]*=4;
+    return;
+  }
+  if(n==2){
+    x1=(x[0]+x[1])*4;
+    x[1]=tsqrt2*(x[0]-x[1]);
+    x[0]=x1;
+    return;
+  }
+  
+  dcsqb1(n,x,wsave,wsave+n,ifac);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/discreteFourierTransform.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,102 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/utilities.h"
+#include "../include/cephes.h"
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+         D I S C R E T E  F O U R I E R  T R A N S F O R M  T E S T 
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void  __ogg_fdrffti(int n, double* wsave, int* ifac);
+void  __ogg_fdrfftf(int n, double* X, double* wsave, int* ifac);
+
+void
+DiscreteFourierTransform(int n)
+{
+	double     p_value, upperBound, percentile, N_l, N_o, d;
+	double*    m = NULL;
+	double*    X = NULL;
+	double*    wsave = NULL;
+	int*       ifac = NULL;
+	int		i, count;
+	
+	if ( ((X = (double*) calloc(n,sizeof(double))) == NULL) ||
+		 ((wsave = (double *)calloc(2*n+15,sizeof(double))) == NULL) ||
+		 ((ifac = (int *)calloc(15,sizeof(int))) == NULL) ||
+		 ((m = (double*)calloc(n/2+1, sizeof(double))) == NULL) ) {
+			fprintf(stats[7],"\t\tUnable to allocate working arrays for the DFT.\n");
+			if( X != NULL )
+				free(X);
+			if( wsave != NULL )
+				free(wsave);
+			if( ifac != NULL )
+				free(ifac);
+			if( m != NULL )
+				free(m);
+			return;
+	}
+	for ( i=0; i<n; i++ )
+		X[i] = 2*(int)epsilon[i] - 1;
+	
+	__ogg_fdrffti(n, wsave, ifac);		/* INITIALIZE WORK ARRAYS */
+	__ogg_fdrfftf(n, X, wsave, ifac);	/* APPLY FORWARD FFT */
+	
+	m[0] = sqrt(X[0]*X[0]);	    /* COMPUTE MAGNITUDE */
+	
+	for ( i=0; i<n/2; i++ ) {	   	    /* DISPLAY FOURIER POINTS */
+		m[i+1] = sqrt(pow(X[2*i+1],2)+pow(X[2*i+2],2)); 
+	}
+	count = 0;				       /* CONFIDENCE INTERVAL */
+	upperBound = sqrt(2.995732274*n);
+	for ( i=0; i<n/2; i++ )
+		if ( m[i] < upperBound )
+			count++;
+	percentile = (double)count/(n/2)*100;
+	N_l = (double) count;       /* number of peaks less than h = sqrt(3*n) */
+	N_o = (double) 0.95*n/2.0;
+	d = (N_l - N_o)/sqrt(n/2.0*0.95*0.05);
+	p_value = erfc(fabs(d)/sqrt(2.0));
+
+	fprintf(stats[TEST_FFT], "\t\t\t\tFFT TEST\n");
+	fprintf(stats[TEST_FFT], "\t\t-------------------------------------------\n");
+	fprintf(stats[TEST_FFT], "\t\tCOMPUTATIONAL INFORMATION:\n");
+	fprintf(stats[TEST_FFT], "\t\t-------------------------------------------\n");
+	fprintf(stats[TEST_FFT], "\t\t(a) Percentile = %f\n", percentile);
+	fprintf(stats[TEST_FFT], "\t\t(b) N_l        = %f\n", N_l);
+	fprintf(stats[TEST_FFT], "\t\t(c) N_o        = %f\n", N_o);
+	fprintf(stats[TEST_FFT], "\t\t(d) d          = %f\n", d);
+	fprintf(stats[TEST_FFT], "\t\t-------------------------------------------\n");
+
+	fprintf(stats[TEST_FFT], "%s\t\tp_value = %f\n\n", p_value < ALPHA ? "FAILURE" : "SUCCESS", p_value);
+	fprintf(results[TEST_FFT], "%f\n", p_value);
+
+	free(X);
+	free(wsave);
+	free(ifac);
+	free(m);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/frequency.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,57 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#include "openc.h"
+#include "../include/externs.h"
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+                          F R E Q U E N C Y  T E S T
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+void
+Frequency(int n)
+{
+	int		i;
+	double	f, s_obs, p_value, sum, sqrt2 = 1.41421356237309504880;
+	
+	sum = 0.0;
+	for ( i=0; i<n; i++ )
+		sum += 2*(int)epsilon[i]-1;
+	s_obs = fabs(sum)/sqrt(n);
+	f = s_obs/sqrt2;
+	p_value = erfc(f);
+
+	fprintf(stats[TEST_FREQUENCY], "\t\t\t      FREQUENCY TEST\n");
+	fprintf(stats[TEST_FREQUENCY], "\t\t---------------------------------------------\n");
+	fprintf(stats[TEST_FREQUENCY], "\t\tCOMPUTATIONAL INFORMATION:\n");
+	fprintf(stats[TEST_FREQUENCY], "\t\t---------------------------------------------\n");
+	fprintf(stats[TEST_FREQUENCY], "\t\t(a) The nth partial sum = %d\n", (int)sum);
+	fprintf(stats[TEST_FREQUENCY], "\t\t(b) S_n/n               = %f\n", sum/n);
+	fprintf(stats[TEST_FREQUENCY], "\t\t---------------------------------------------\n");
+
+	fprintf(stats[TEST_FREQUENCY], "%s\t\tp_value = %f\n\n", p_value < ALPHA ? "FAILURE" : "SUCCESS", p_value);
+	fprintf(results[TEST_FREQUENCY], "%f\n", p_value);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/generators.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,510 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/utilities.h"
+#include "../include/generators.h"
+#include "../include/genutils.h"
+
+const int KRandomByteCount = 1024;
+
+double
+lcg_rand(int N, double SEED, double* DUNIF, int NDIM)
+{
+	int    i;
+	double	DZ, DOVER, DZ1, DZ2, DOVER1, DOVER2;
+	double	DTWO31, DMDLS, DA1, DA2;
+
+	DTWO31 = 2147483648.0; /* DTWO31=2**31  */
+	DMDLS  = 2147483647.0; /* DMDLS=2**31-1 */
+	DA1 = 41160.0;       /* DA1=950706376 MOD 2**16 */
+	DA2 = 950665216.0;   /* DA2=950706376-DA1 */
+
+	DZ = SEED;
+	if ( N > NDIM )
+		N = NDIM;
+	for ( i=1; i<=N; i++ ) {
+		DZ = floor(DZ);
+		DZ1 = DZ*DA1;
+		DZ2 = DZ*DA2;
+		DOVER1 = floor(DZ1/DTWO31);
+		DOVER2 = floor(DZ2/DTWO31);
+		DZ1 = DZ1-DOVER1*DTWO31;
+		DZ2 = DZ2-DOVER2*DTWO31;
+		DZ = DZ1+DZ2+DOVER1+DOVER2;
+		DOVER = floor(DZ/DMDLS);
+		DZ = DZ-DOVER*DMDLS;
+		DUNIF[i-1] = DZ/DMDLS;
+		SEED = DZ;
+	}
+
+	return SEED;
+}
+
+void
+lcg()
+{
+	double*    DUNIF = NULL;
+	double     SEED;
+	int		i;
+	unsigned bit;
+	int		num_0s, num_1s, v, bitsRead;
+
+	SEED = 23482349.0;
+	if ( ((epsilon = (BitSequence *) calloc(tp.n, sizeof(BitSequence))) == NULL) ||
+	     ((DUNIF = (double*)calloc(tp.n, sizeof(double))) == NULL) ) {
+		printf("Insufficient memory available.\n");
+		exit(1);
+	}
+	 
+	for ( v=0; v<tp.numOfBitStreams; v++ ) {
+		num_0s = 0;
+		num_1s = 0;
+		bitsRead = 0;
+		SEED = lcg_rand(tp.n, SEED, DUNIF, tp.n);
+		for ( i=0; i<tp.n; i++ ) {
+			if ( DUNIF[i] < 0.5 ) {
+				bit = 0;
+				num_0s++;
+			}
+			else {
+				bit = 1;
+				num_1s++;
+			}
+			bitsRead++;
+			epsilon[i] = (BitSequence)bit;
+		}
+		fprintf(freqfp, "\t\tBITSREAD = %d 0s = %d 1s = %d\n", bitsRead, num_0s, num_1s);
+		nist_test_suite();
+		}
+	free(DUNIF);
+	free(epsilon);
+}
+
+
+void
+quadRes1()
+{
+	int		k, num_0s, num_1s, bitsRead, done;
+	BYTE	p[64], g[64], x[128];
+	
+	if ( ((epsilon = (BitSequence *)calloc(tp.n, sizeof(BitSequence))) == NULL) ) {
+		printf("Insufficient memory available.\n");
+		exit(1);
+	}
+	ahtopb("987b6a6bf2c56a97291c445409920032499f9ee7ad128301b5d0254aa1a9633fdbd378d40149f1e23a13849f3d45992f5c4c6b7104099bc301f6005f9d8115e1", p, 64);
+	ahtopb("3844506a9456c564b8b8538e0cc15aff46c95e69600f084f0657c2401b3c244734b62ea9bb95be4923b9b7e84eeaf1a224894ef0328d44bc3eb3e983644da3f5", g, 64);
+	num_0s = 0;
+	num_1s = 0;
+	done = 0;
+	bitsRead = 0;
+	for ( k=0; k<tp.numOfBitStreams; k++ ) {
+		num_0s = 0;
+		num_1s = 0;
+		done = 0;
+		bitsRead = 0;
+		do {
+			memset(x, 0x00, 128);
+			ModMult(x, g, 64, g, 64, p,64);
+			memcpy(g, x+64, 64);
+			done = convertToBits(g, 512, tp.n, &num_0s, &num_1s, &bitsRead);
+		} while ( !done );
+		fprintf(freqfp, "\t\tBITSREAD = %d 0s = %d 1s = %d\n", bitsRead, num_0s, num_1s);
+		nist_test_suite();
+	}
+	free(epsilon);
+
+	return;
+}
+
+void
+quadRes2()
+{
+	BYTE	g[64], x[129], t1[65];
+	BYTE	One[1], Two, Three[1];
+	int		k, num_0s, num_1s, bitsRead, done;
+	
+	if ( ((epsilon = (BitSequence *)calloc(tp.n, sizeof(BitSequence))) == NULL) ) {
+		printf("Insufficient memory available.\n");
+		exit(1);
+	}
+	One[0] = 0x01;
+	Two = 0x02;
+	Three[0] = 0x03;
+
+	ahtopb("7844506a9456c564b8b8538e0cc15aff46c95e69600f084f0657c2401b3c244734b62ea9bb95be4923b9b7e84eeaf1a224894ef0328d44bc3eb3e983644da3f5", g, 64);
+	
+	for( k=0; k<tp.numOfBitStreams; k++ ) {
+		num_0s = 0;
+		num_1s = 0;
+		done = 0;
+		bitsRead = 0;
+		do {
+			memset(t1, 0x00, 65);
+			memset(x, 0x00, 129);
+			smult(t1, Two, g, 64);		/* 2x */
+			add(t1, 65, Three, 1);		/* 2x+3 */
+			Mult(x, t1, 65, g, 64);		/* x(2x+3) */
+			add(x, 129, One, 1);		/* x(2x+3)+1 */
+			memcpy(g, x+65, 64);
+			done = convertToBits(g, 512, tp.n, &num_0s, &num_1s, &bitsRead);
+		} while ( !done) ;
+		fprintf(freqfp, "\t\tBITSREAD = %d 0s = %d 1s = %d\n", bitsRead, num_0s, num_1s);
+		nist_test_suite();
+	}
+	free(epsilon);
+
+	return;
+}
+
+void
+cubicRes()
+{
+	BYTE	g[64], tmp[128], x[192];
+	int		k, num_0s, num_1s, bitsRead, done;
+	
+	if ( ((epsilon = (BitSequence *)calloc(tp.n, sizeof(BitSequence))) == NULL) ) {
+		printf("Insufficient memory available.\n");
+		exit(1);
+	}
+	
+	ahtopb("7844506a9456c564b8b8538e0cc15aff46c95e69600f084f0657c2401b3c244734b62ea9bb95be4923b9b7e84eeaf1a224894ef0328d44bc3eb3e983644da3f5", g, 64);
+
+	for ( k=0; k<tp.numOfBitStreams; k++ ) {
+		num_0s = 0;
+		num_1s = 0;
+		bitsRead = 0;
+		done = 0;
+		do {
+			memset(tmp, 0x00, 128);
+			memset(x, 0x00, 192);
+			Mult(tmp, g, 64, g, 64);
+			Mult(x, tmp, 128, g, 64); // Don't need to mod by 2^512, just take low 64 bytes
+			memcpy(g, x+128, 64);
+			done = convertToBits(g, 512, tp.n, &num_0s, &num_1s, &bitsRead);
+		} while ( !done );
+		fprintf(freqfp, "\t\tBITSREAD = %d 0s = %d 1s = %d\n", bitsRead, num_0s, num_1s);
+		nist_test_suite();
+	}
+	free(epsilon);
+
+	return;
+}
+
+void
+exclusiveOR()
+{
+	int		i, num_0s, num_1s, bitsRead;
+	BYTE	bit_sequence[127];
+	
+	if ( ((epsilon = (BitSequence *)calloc(tp.n,sizeof(BitSequence))) == NULL) ) {
+		printf("Insufficient memory available.\n");
+		exit(1);
+	}
+
+	memcpy(bit_sequence, "0001011011011001000101111001001010011011101101000100000010101111111010100100001010110110000000000100110000101110011111111100111", 127);
+	num_0s = 0;
+	num_1s = 0;
+	bitsRead = 0;
+	for (i=0; i<127; i++ ) {
+		if ( bit_sequence[i]  ) {
+			epsilon[bitsRead] = 1;
+			num_1s++;
+		}
+		else {
+			epsilon[bitsRead] = 0;
+			num_1s++;
+		}
+		bitsRead++;
+	}
+	for ( i=127; i<tp.n*tp.numOfBitStreams; i++ ) {
+		if ( bit_sequence[(i-1)%127] != bit_sequence[(i-127)%127] ) {
+			bit_sequence[i%127] = 1;
+			epsilon[bitsRead] = 1;
+			num_1s++;
+		}
+		else {
+			bit_sequence[i%127] = 0;
+			epsilon[bitsRead] = 0;
+			num_0s++;
+		}
+		bitsRead++;
+		if ( bitsRead == tp.n ) {
+			fprintf(freqfp, "\t\tBITSREAD = %d 0s = %d 1s = %d\n", bitsRead, num_0s, num_1s);
+			nist_test_suite();
+			num_0s = 0;
+			num_1s = 0;
+			bitsRead = 0;
+		}
+	}
+	free(epsilon);
+		
+	return;
+}
+
+
+void
+modExp()
+{
+	int		k, num_0s, num_1s, bitsRead, done;
+	BYTE	p[64], g[64], x[192], y[20];
+
+	if ( (epsilon = (BitSequence *)calloc(tp.n, sizeof(BitSequence))) == NULL ) {
+		printf("Insufficient memory available.\n");
+		exit(1);
+	}
+	ahtopb("7AB36982CE1ADF832019CDFEB2393CABDF0214EC", y, 20);
+	ahtopb("987b6a6bf2c56a97291c445409920032499f9ee7ad128301b5d0254aa1a9633fdbd378d40149f1e23a13849f3d45992f5c4c6b7104099bc301f6005f9d8115e1", p, 64);
+	ahtopb("3844506a9456c564b8b8538e0cc15aff46c95e69600f084f0657c2401b3c244734b62ea9bb95be4923b9b7e84eeaf1a224894ef0328d44bc3eb3e983644da3f5", g, 64);
+
+	for ( k=0; k<tp.numOfBitStreams; k++ ) {
+		num_0s = 0;
+		num_1s = 0;
+		bitsRead = 0;
+		done = 0;
+		do {
+			memset(x, 0x00, 128);
+			ModExp(x, g, 64, y, 20, p, 64);	      /* NOTE:  g must be less than p */
+			done = convertToBits(x, 512, tp.n, &num_0s, &num_1s, &bitsRead);
+			memcpy(y, x+44, 20);
+			} while ( !done );
+		fprintf(freqfp, "\t\tBITSREAD = %d 0s = %d 1s = %d\n", bitsRead, num_0s, num_1s);
+		nist_test_suite();
+	}
+	free(epsilon);
+
+	return;
+}
+
+void
+bbs()
+{
+	int		i, v, bitsRead;
+	BYTE	p[64], q[64], n[128], s[64], x[256];
+	int		num_0s, num_1s;
+
+	if ( (epsilon = (BitSequence*)calloc(tp.n, sizeof(BitSequence))) == NULL ) {
+		printf("Insufficient memory available.\n");
+		exit(1);
+	}
+	ahtopb("E65097BAEC92E70478CAF4ED0ED94E1C94B154466BFB9EC9BE37B2B0FF8526C222B76E0E915017535AE8B9207250257D0A0C87C0DACEF78E17D1EF9DC44FD91F", p, 64);
+	ahtopb("E029AEFCF8EA2C29D99CB53DD5FA9BC1D0176F5DF8D9110FD16EE21F32E37BA86FF42F00531AD5B8A43073182CC2E15F5C86E8DA059E346777C9A985F7D8A867", q, 64);
+	memset(n, 0x00, 128);
+	Mult(n, p, 64, q, 64);
+	memset(s, 0x00, 64);
+	ahtopb("10d6333cfac8e30e808d2192f7c0439480da79db9bbca1667d73be9a677ed31311f3b830937763837cb7b1b1dc75f14eea417f84d9625628750de99e7ef1e976", s, 64);
+	memset(x, 0x00, 256);
+	ModSqr(x, s, 64, n, 128);
+ 
+	for ( v=0; v<tp.numOfBitStreams; v++ ) {
+		num_0s = 0;
+		num_1s = 0;
+		bitsRead = 0;
+		for ( i=0; i<tp.n; i++ ) {
+			ModSqr(x, x, 128, n, 128);
+			memcpy(x, x+128, 128);
+			if ( (x[127] & 0x01) == 0 ) {
+				num_0s++;
+				epsilon[i] = 0;
+			}
+			else {
+				num_1s++;
+				epsilon[i] = 1;
+			}
+			bitsRead++;
+			if ( (i % 50000) == 0 )
+				printf("\t\tBITSREAD = %d 0s = %d 1s = %d\n", bitsRead, num_0s, num_1s);
+		}
+
+		fprintf(freqfp, "\t\tBITSREAD = %d 0s = %d 1s = %d\n", bitsRead, num_0s, num_1s);
+		nist_test_suite();
+	}
+	free(epsilon);
+}
+
+
+// The exponent, e, is set to 11
+// This results in k = 837 and r = 187
+void
+micali_schnorr()
+{
+	long	i, j;
+	int		k=837, num_0s, num_1s, bitsRead, done;
+	BYTE	p[64], q[64], n[128], e[1], X[128], Y[384], Tail[105];
+
+	if ( (epsilon = (BitSequence *)calloc(tp.n, sizeof(BitSequence))) == NULL ) {
+		printf("Insufficient memory available.\n");
+		exit(1);
+	}
+	ahtopb("E65097BAEC92E70478CAF4ED0ED94E1C94B154466BFB9EC9BE37B2B0FF8526C222B76E0E915017535AE8B9207250257D0A0C87C0DACEF78E17D1EF9DC44FD91F", p, 64);
+	ahtopb("E029AEFCF8EA2C29D99CB53DD5FA9BC1D0176F5DF8D9110FD16EE21F32E37BA86FF42F00531AD5B8A43073182CC2E15F5C86E8DA059E346777C9A985F7D8A867", q, 64);
+	memset(n, 0x00, 128);
+	Mult(n, p, 64, q, 64);
+	e[0] = 0x0b;
+	memset(X, 0x00, 128);
+	ahtopb("237c5f791c2cfe47bfb16d2d54a0d60665b20904ec822a6", X+104, 24);
+
+	for ( i=0; i<tp.numOfBitStreams; i++ ) {
+		num_0s = 0;
+		num_1s = 0;
+		bitsRead = 0;
+		do {
+			ModExp(Y, X, 128, e, 1, n, 128);
+			memcpy(Tail, Y+23, 105);
+			for ( j=0; j<3; j++ )
+				bshl(Tail, 105);
+			done = convertToBits(Tail, k, tp.n, &num_0s, &num_1s, &bitsRead);
+			memset(X, 0x00, 128);
+			memcpy(X+104, Y, 24);
+			for ( j=0; j<5; j++ )
+				bshr(X+104, 24);
+		} while ( !done );
+
+		fprintf(freqfp, "\t\tBITSREAD = %d 0s = %d 1s = %d\n", bitsRead, num_0s, num_1s);
+		nist_test_suite();
+	}
+	free(epsilon);
+}
+
+//  Uses 160 bit Xkey and no XSeed (b=160)
+//  This is the generic form of the generator found on the last page of the Change Notice for FIPS 186-2
+void
+SHA1()
+{
+	ULONG	A, B, C, D, E, temp, Wbuff[16];
+	BYTE	Xkey[20], G[20], M[64];
+	BYTE	One[1] = { 0x01 };
+	int		i, num_0s, num_1s, bitsRead;
+	int		done;
+	ULONG	tx[5] = { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0 };
+	
+	if ( ((epsilon = (BitSequence *) calloc(tp.n,sizeof(BitSequence))) == NULL) ) {
+		printf("Insufficient memory available.\n");
+		exit(1);
+	}
+
+	ahtopb("ec822a619d6ed5d9492218a7a4c5b15d57c61601", Xkey, 20);
+	
+	for ( i=0; i<tp.numOfBitStreams; i++ ) {
+		num_0s = 0;
+		num_1s = 0;
+		bitsRead = 0;
+		do {
+			memcpy(M, Xkey, 20);
+			memset(M+20, 0x00, 44);
+			
+			// Start: SHA Steps A-E
+			A = tx[0];
+			B = tx[1];
+			C = tx[2];
+			D = tx[3];
+			E = tx[4];
+
+			memcpy((BYTE *)Wbuff, M, 64);
+#ifdef LITTLE_ENDIAN
+			byteReverse(Wbuff, 20);
+#endif
+			sub1Round1( 0 );  sub1Round1( 1 );  sub1Round1( 2 );  sub1Round1( 3 );
+			sub1Round1( 4 );  sub1Round1( 5 );  sub1Round1( 6 );  sub1Round1( 7 );
+			sub1Round1( 8 );  sub1Round1( 9 );  sub1Round1( 10 ); sub1Round1( 11 );
+			sub1Round1( 12 ); sub1Round1( 13 ); sub1Round1( 14 ); sub1Round1( 15 );
+			sub2Round1( 16 ); sub2Round1( 17 ); sub2Round1( 18 ); sub2Round1( 19 );
+			Round2( 20 ); Round2( 21 ); Round2( 22 ); Round2( 23 );
+			Round2( 24 ); Round2( 25 ); Round2( 26 ); Round2( 27 );
+			Round2( 28 ); Round2( 29 ); Round2( 30 ); Round2( 31 );
+			Round2( 32 ); Round2( 33 ); Round2( 34 ); Round2( 35 );
+			Round2( 36 ); Round2( 37 ); Round2( 38 ); Round2( 39 );
+			Round3( 40 ); Round3( 41 ); Round3( 42 ); Round3( 43 );
+			Round3( 44 ); Round3( 45 ); Round3( 46 ); Round3( 47 );
+			Round3( 48 ); Round3( 49 ); Round3( 50 ); Round3( 51 );
+			Round3( 52 ); Round3( 53 ); Round3( 54 ); Round3( 55 );
+			Round3( 56 ); Round3( 57 ); Round3( 58 ); Round3( 59 );
+			Round4( 60 ); Round4( 61 ); Round4( 62 ); Round4( 63 );
+			Round4( 64 ); Round4( 65 ); Round4( 66 ); Round4( 67 );
+			Round4( 68 ); Round4( 69 ); Round4( 70 ); Round4( 71 );
+			Round4( 72 ); Round4( 73 ); Round4( 74 ); Round4( 75 );
+			Round4( 76 ); Round4( 77 ); Round4( 78 ); Round4( 79 );
+			
+			A += tx[0];
+			B += tx[1];
+			C += tx[2];
+			D += tx[3];
+			E += tx[4];
+			
+			memcpy(G, (BYTE *)&A, 4);
+			memcpy(G+4, (BYTE *)&B, 4);
+			memcpy(G+8, (BYTE *)&C, 4);
+			memcpy(G+12, (BYTE *)&D, 4);
+			memcpy(G+16, (BYTE *)&E, 4);
+#ifdef LITTLE_ENDIAN
+			byteReverse((ULONG *)G, 20);
+#endif
+			// End: SHA Steps A-E
+
+			done = convertToBits(G, 160, tp.n, &num_0s, &num_1s, &bitsRead);
+			add(Xkey, 20, G, 20);
+			add(Xkey, 20, One, 1);
+		} while ( !done );
+		fprintf(freqfp, "\t\tBITSREAD = %d 0s = %d 1s = %d\n", bitsRead, num_0s, num_1s);
+		nist_test_suite();
+	}
+	free(epsilon);
+}
+
+void HASH_DRBG()
+    {
+    int     done = 0;
+    int     num_0s = 0;
+    int     num_1s = 0;
+    int     bitsRead = 0;
+
+    if ( ((epsilon = (BitSequence *) calloc(tp.n,sizeof(BitSequence))) == NULL) ) {
+        printf("Insufficient memory available.\n");
+        exit(1);
+    }
+    
+    TBuf8<KRandomByteCount> randBuffer(KRandomByteCount);
+
+    for (int i = 0; i < tp.numOfBitStreams; ++i) 
+        {
+        gConsole->Printf(_L("Starting test %d\n"), i+1);
+        num_0s = 0;
+        num_1s = 0;
+        bitsRead = 0;
+        done = 0;
+        do 
+            {
+            Math::Random(randBuffer);
+            done = convertToBits(randBuffer.Ptr() , KRandomByteCount*8, tp.n, &num_0s, &num_1s, &bitsRead);
+            } while ( !done );
+        fprintf(freqfp, "\t\tBITSREAD = %d 0s = %d 1s = %d\n", bitsRead, num_0s, num_1s);
+        
+        nist_test_suite();
+        }
+        free(epsilon);
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/genutils.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,693 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+/*
+ * file: mp.c
+ *
+ * DESCRIPTION
+ *
+ * These functions comprise a multi-precision integer arithmetic
+ * and discrete function package.
+ */
+
+#include	"../include/genutils.h"
+
+#define	MAXPLEN		384
+
+
+/*****************************************
+** greater - Test if x > y               *
+**                                       *
+** Returns TRUE (1) if x greater than y, *
+** otherwise FALSE (0).                  *
+**                                       *
+** Parameters:                           *
+**                                       *
+**  x      Address of array x            *
+**  y      Address of array y            *
+**  l      Length both x and y in bytes  *
+**                                       *
+******************************************/ 
+int greater(BYTE *x, BYTE *y, int l)
+{
+	int		i;
+
+	for ( i=0; i<l; i++ )
+		if ( x[i] != y[i] )
+			break;
+
+	if ( i == l )
+		return 0;
+
+	if ( x[i] > y[i] )
+		return 1;
+
+	return 0;
+}
+
+
+/*****************************************
+** less - Test if x < y                  *
+**                                       *
+** Returns TRUE (1) if x less than y,    *
+** otherwise FALSE (0).                  *
+**                                       *
+** Parameters:                           *
+**                                       *
+**  x      Address of array x            *
+**  y      Address of array y            *
+**  l      Length both x and y in bytes  *
+**                                       *
+******************************************/ 
+int less(BYTE *x, BYTE *y, int l)
+{
+	int		i;
+
+	for ( i=0; i<l; i++ )
+		if ( x[i] != y[i] )
+			break;
+
+	if ( i == l ) {
+		return 0;
+	}
+
+	if ( x[i] < y[i] ) {
+		return 1;
+	}
+
+	return 0;
+}
+
+
+/*****************************************
+** bshl - shifts array left              *
+**                  by one bit.          *
+**                                       *	
+** x = x * 2                             *
+**                                       *
+** Parameters:                           *	
+**                                       *
+**  x      Address of array x            *
+**  l      Length array x in bytes       *
+**                                       *
+******************************************/ 
+BYTE bshl(BYTE *x, int l)
+{
+	BYTE	*p;
+	int		c1, c2;
+
+	p = x + l - 1;
+	c1 = 0;
+	c2 = 0;
+	while ( p != x ) {
+		if ( *p & 0x80 )
+			c2 = 1;
+		*p <<= 1;  /* shift the word left once (ls bit = 0) */
+		if ( c1 )
+			*p |= 1;
+		c1 = c2;
+		c2 = 0;
+		p--;
+	}
+
+	if ( *p & 0x80 )
+		c2 = 1;
+	*p <<= 1;  /* shift the word left once (ls bit = 0) */
+	if ( c1 )
+		*p |= (DIGIT)1;
+
+	return (BYTE)c2;
+}
+
+
+/*****************************************
+** bshr - shifts array right             *
+**                   by one bit.         *
+**                                       *	
+** x = x / 2                             *
+**                                       *
+** Parameters:                           *	
+**                                       *
+**  x      Address of array x            *
+**  l      Length array x in bytes       *	
+**                                       *
+******************************************/
+void bshr(BYTE *x, int l)	
+{
+	BYTE	*p;
+	int		c1,c2;
+
+	p = x;
+	c1 = 0;
+	c2 = 0;
+	while ( p != x+l-1 ) {
+		if ( *p & 0x01 )
+			c2 = 1;
+		*p >>= 1;  /* shift the word right once (ms bit = 0) */
+		if ( c1 )
+			*p |= 0x80;
+		c1 = c2;
+		c2 = 0;
+		p++;
+	}
+
+	*p >>= 1;  /* shift the word right once (ms bit = 0) */
+	if ( c1 )
+		*p |= 0x80;
+}
+
+
+/*****************************************
+** Mult - Multiply two integers          *
+**                                       *
+** A = B * C                             *
+**                                       *
+** Parameters:                           *	
+**                                       *
+**  A      Address of the result         *
+**  B      Address of the multiplier     *
+**  C      Address of the multiplicand   *
+**  LB      Length of B in bytes         *
+**  LC      Length of C in bytes         *
+**                                       *
+**  NOTE:  A MUST be LB+LC in length     *
+**                                       *
+******************************************/
+int Mult(BYTE *A, BYTE *B, int LB, BYTE *C, int LC)
+{
+	int    i, j;
+	int    k = 0;
+	DIGIT	result;
+
+
+	for ( i=LB-1; i>=0; i-- ) {
+		result = 0;
+		for ( j=LC-1; j>=0; j-- ) {
+			k = i+j+1;
+			result = (DIGIT)((DIGIT)A[k] + ((DIGIT)(B[i] * C[j])) + (result >> 8));
+			A[k] = (BYTE)result;
+			}
+		A[--k] = (BYTE)(result >> 8);
+	}
+
+	return 0;
+}
+
+
+void ModSqr(BYTE *A, BYTE *B, int LB, BYTE *M, int LM)
+{
+
+	Square(A, B, LB);
+	Mod(A, 2*LB, M, LM);
+}
+
+void ModMult(BYTE *A, BYTE *B, int LB, BYTE *C, int LC, BYTE *M, int LM)
+{
+	Mult(A, B, LB, C, LC);
+	Mod(A, (LB+LC), M, LM);
+}
+
+
+/*****************************************
+** smult - Multiply array by a scalar.   *
+**                                       *
+** A = b * C                             *
+**                                       *
+** Parameters:                           *	
+**                                       *
+**  A      Address of the result         *
+**  b      Scalar (1 BYTE)               *
+**  C      Address of the multiplicand   *
+**  L      Length of C in bytes          *
+**                                       *
+**  NOTE:  A MUST be L+1 in length       *
+**                                       *
+******************************************/
+void smult(BYTE *A, BYTE b, BYTE *C, int L)
+{
+	int		i;
+	DIGIT	result;
+
+	result = 0;
+	for ( i=L-1; i>0; i-- ) {
+		result = (DIGIT)(A[i] + ((DIGIT)b * C[i]) + (result >> 8));
+		A[i] = (BYTE)(result & 0xff);
+		A[i-1] = (BYTE)(result >> 8);
+	}
+}
+
+/*****************************************
+** Square() - Square an integer          *
+**                                       *
+** A = B^2                               *
+**                                       *
+** Parameters:                           *
+**                                       *
+**  A      Address of the result         *
+**  B      Address of the operand        *
+**  L      Length of B in bytes          *
+**                                       *
+**  NOTE:  A MUST be 2*L in length       *
+**                                       *
+******************************************/
+void Square(BYTE *A, BYTE *B, int L)
+{
+	Mult(A, B, L, B, L);
+}
+
+/*****************************************
+** ModExp - Modular Exponentiation       *
+**                                       *
+** A = B ** C (MOD M)                    *
+**                                       *	
+** Parameters:                           *	
+**                                       *
+**  A      Address of result             *
+**  B      Address of mantissa           *
+**  C      Address of exponent           *
+**  M      Address of modulus            *
+**  LB     Length of B in bytes          *
+**  LC     Length of C in bytes          *
+**  LM     Length of M in bytes          *
+**                                       *
+**  NOTE: The integer B must be less     *
+**        than the modulus M.      	 *
+**  NOTE: A must be at least 3*LM        *
+**        bytes long.  However, the      *
+**        result stored in A will be     *
+**        only LM bytes long.            *
+******************************************/
+void ModExp(BYTE *A, BYTE *B, int LB, BYTE *C, int LC, BYTE *M, int LM)
+{
+	BYTE	wmask;
+	int		bits;
+
+	bits = LC*8;
+	wmask = 0x80;
+
+	A[LM-1] = 1;
+
+	while ( !sniff_bit(C,wmask) ) {
+		wmask >>= 1;
+		bits--;
+		if ( !wmask ) {
+			wmask = 0x80;
+			C++;
+		}
+	}
+
+	while ( bits-- ) {
+		memset(A+LM, 0x00, LM*2);
+
+		/* temp = A*A (MOD M) */
+		ModSqr(A+LM, A,LM,  M,LM);
+
+		/* A = lower L bytes of temp */
+		memcpy(A, A+LM*2, LM);
+		memset(A+LM, 0x00, 2*LM);
+
+		if ( sniff_bit(C,wmask) ) {
+			memset(A+LM, 0x00, (LM+LB));
+			ModMult(A+LM, B,LB, A,LM,  M,LM);       /* temp = B * A (MOD M) */
+			memcpy(A, A+LM+(LM+LB)-LM, LM);  /* A = lower LM bytes of temp */
+			memset(A+LM, 0x00, 2*LM);
+		}
+ 
+		wmask >>= 1;
+		if ( !wmask ) {
+			wmask = 0x80;
+			C++;
+		}
+	}
+}
+
+
+/* DivMod:
+ *
+ *   computes:
+ *         quot = x / n
+ *         rem = x % n
+ *   returns:
+ *         length of "quot"
+ *
+ *  len of rem is lenx+1
+ */
+int DivMod(BYTE *x, int lenx, BYTE *n, int lenn, BYTE *quot, BYTE *rem)
+{
+	BYTE	*tx, *tn, *ttx, *ts, bmult[1];
+	int		i, shift, lgth_x, lgth_n, t_len, lenq;
+	DIGIT	tMSn, mult;
+	ULONG	tMSx;
+	int		underflow;
+
+	tx = x;
+	tn = n;
+	
+	/* point to the MSD of n  */
+	for ( i=0, lgth_n=lenn; i<lenn; i++, lgth_n-- ) {
+		if ( *tn )
+			break;
+		tn++;
+	}
+	if ( !lgth_n )
+		return 0;
+	
+	/* point to the MSD of x  */
+	for ( i=0, lgth_x=lenx; i<lenx; i++, lgth_x-- ) {
+		if ( *tx )
+			break;
+		tx++;
+	}
+	if ( !lgth_x )
+		return 0;
+
+	if ( lgth_x < lgth_n )
+		lenq = 1;
+	else
+		lenq = lgth_x - lgth_n + 1;
+	memset(quot, 0x00, lenq);
+	
+	/* Loop while x > n,  WATCH OUT if lgth_x == lgth_n */
+	while ( (lgth_x > lgth_n) || ((lgth_x == lgth_n) && !less(tx, tn, lgth_n)) ) {
+		shift = 1;
+		if ( lgth_n == 1 ) {
+			if ( *tx < *tn ) {
+				tMSx = (DIGIT) (((*tx) << 8) | *(tx+1));
+				tMSn = *tn;
+				shift = 0;
+			}
+			else {
+				tMSx = *tx;
+				tMSn = *tn;
+			}
+		}
+		else if ( lgth_n > 1 ) {
+			tMSx = (DIGIT) (((*tx) << 8) | *(tx+1));
+			tMSn = (DIGIT) (((*tn) << 8) | *(tn+1));
+			if ( (tMSx < tMSn) || ((tMSx == tMSn) && less(tx, tn, lgth_n)) ) {
+				tMSx = (tMSx << 8) | *(tx+2);
+				shift = 0;
+			}
+		}
+		else {
+			tMSx = (DIGIT) (((*tx) << 8) | *(tx+1));
+			tMSn = *tn;
+			shift = 0;
+		}
+
+		mult = (DIGIT) (tMSx / tMSn);
+		if ( mult > 0xff )
+			mult = 0xff;
+		bmult[0] = (BYTE)(mult & 0xff);
+
+		ts = rem;
+		do {
+			memset(ts, 0x00, lgth_x+1);
+			Mult(ts, tn, lgth_n, bmult, 1);
+
+			underflow = 0;
+			if ( shift ) {
+				if ( ts[0] != 0 )
+					underflow = 1;
+				else {
+					for ( i=0; i<lgth_x; i++ )
+						ts[i] = ts[i+1];
+					ts[lgth_x] = 0x00;
+				}
+			}
+			if ( greater(ts, tx, lgth_x) || underflow ) {
+				bmult[0]--;
+				underflow = 1;
+			}
+			else
+				underflow = 0;
+		} while ( underflow );
+		sub(tx, lgth_x, ts, lgth_x);
+		if ( shift )
+			quot[lenq - (lgth_x - lgth_n) - 1] = bmult[0];
+		else
+			quot[lenq - (lgth_x - lgth_n)] = bmult[0];
+		
+		ttx = tx;
+		t_len = lgth_x;
+		for ( i=0, lgth_x=t_len; i<t_len; i++, lgth_x-- ) {
+			if ( *ttx )
+				break;
+			ttx++;
+		}
+		tx = ttx;
+	}
+	memset(rem, 0x00, lenn);
+	if ( lgth_x )
+		memcpy(rem+lenn-lgth_x, tx, lgth_x);
+
+	return lenq;
+}
+
+
+/* 
+ * Mod - Computes an integer modulo another integer
+ *
+ * x = x (mod n)
+ *
+ */
+void Mod(BYTE *x, int lenx, BYTE *n, int lenn)
+{
+	BYTE	quot[MAXPLEN+1], rem[2*MAXPLEN+1];
+
+	memset(quot, 0x00, sizeof(quot));
+	memset(rem, 0x00, sizeof(rem));
+	if ( DivMod(x, lenx, n, lenn, quot, rem) ) {
+		memset(x, 0x00, lenx);
+		memcpy(x+lenx-lenn, rem, lenn);
+	}
+}
+
+/* 
+ * Div - Computes the integer division of two numbers
+ *
+ * x = x / n
+ *
+ */
+void Div(BYTE *x, int lenx, BYTE *n, int lenn)
+{
+	BYTE	quot[MAXPLEN+1], rem[2*MAXPLEN+1];
+	int		lenq;
+
+	memset(quot, 0x00, sizeof(quot));
+	memset(rem, 0x00, sizeof(rem));
+	if ( (lenq = DivMod(x, lenx, n, lenn, quot, rem)) != 0 ) {
+		memset(x, 0x00, lenx);
+		memcpy(x+lenx-lenq, quot, lenq);
+	}
+}
+
+
+/*****************************************
+** sub - Subtract two integers           *
+**                                       *
+** A = A - B                             *
+**                                       *
+**                                       *
+** Parameters:                           *	
+**                                       *
+**  A      Address of subtrahend integer *
+**  B      Address of subtractor integer *
+**  L      Length of A and B in bytes    *
+**                                       *
+**  NOTE: In order to save RAM, B is     *
+**        two's complemented twice,      *
+**        rather than using a copy of B  *
+**                                       *
+******************************************/
+void sub(BYTE *A, int LA, BYTE *B, int LB)
+{
+	BYTE	*tb;
+
+	tb = (BYTE *)calloc(LA, 1);
+	memcpy(tb, B, LB);
+	negate(tb, LB);
+	add(A, LA, tb, LA);
+
+	FREE(tb);
+}
+
+
+/*****************************************
+** negate - Negate an integer            *
+**                                       *
+** A = -A                                *
+**                                       *
+**                                       *
+** Parameters:                           *	
+**                                       *
+**  A      Address of integer to negate  *
+**  L      Length of A in bytes          *
+**                                       *
+******************************************/
+int negate(BYTE *A, int L)
+{
+	int		i, tL;
+	DIGIT	accum;
+
+	/* Take one's complement of A */
+	for ( i=0; i<L; i++ )
+		A[i] = (BYTE)(~(A[i]));
+
+	/* Add one to get two's complement of A */
+	accum = 1;
+	tL = L-1;
+	while ( accum && (tL >= 0) ) {
+		accum = (DIGIT)(accum + A[tL]);
+		A[tL--] = (BYTE)(accum & 0xff);
+		accum = (DIGIT)(accum >> 8);
+	}
+
+	return accum;
+}
+
+
+/*
+ * add()
+ *
+ * A = A + B
+ *
+ * LB must be <= LA
+ *
+ */
+BYTE add(BYTE *A, int LA, BYTE *B, int LB)
+{
+	int		i, indexA, indexB;
+	DIGIT	accum;
+
+	indexA = LA - 1; 	/* LSD of result */
+	indexB = LB - 1; 	/* LSD of B */
+
+	accum = 0;
+	for ( i = 0; i < LB; i++ ) {
+		accum = (DIGIT)(accum + A[indexA]);
+		accum = (DIGIT)(accum + B[indexB--]);
+		A[indexA--] = (BYTE)(accum & 0xff);
+		accum = (DIGIT)(accum >> 8);
+	}
+
+	if ( LA > LB )
+		while ( accum  && (indexA >= 0) ) {
+			accum = (DIGIT)(accum + A[indexA]);
+			A[indexA--] = (BYTE)(accum & 0xff);
+			accum = (DIGIT)(accum >> 8);
+		}
+
+	return (BYTE)accum;
+}
+
+
+void prettyprintBstr(char *S, BYTE *A, int L)
+{
+	int		i, extra, ctrb, ctrl;
+
+	if ( L == 0 )
+		printf("%s <empty>", S);
+	else
+		printf("%s\n\t", S);
+	extra = L % 24;
+	if ( extra ) {
+		ctrb = 0;
+		for ( i=0; i<24-extra; i++ ) {
+			printf("  ");
+			if ( ++ctrb == 4) {
+				printf(" ");
+				ctrb = 0;
+			}
+		}
+
+		for ( i=0; i<extra; i++ ) {
+			printf("%02X", A[i]);
+			if ( ++ctrb == 4) {
+				printf(" ");
+				ctrb = 0;
+			}
+		}
+		printf("\n\t");
+	}
+
+	ctrb = ctrl = 0;
+	for ( i=extra; i<L; i++ ) {
+		printf("%02X", A[i]);
+		if ( ++ctrb == 4) {
+			ctrl++;
+			if ( ctrl == 6 ) {
+				printf("\n\t");
+				ctrl = 0;
+			}
+			else
+				printf(" ");
+			ctrb = 0;
+		}
+	}
+	printf("\n\n");
+}
+
+
+/**********************************************************************/
+/*  Performs byte reverse for PC based implementation (little endian) */
+/**********************************************************************/
+void byteReverse(ULONG *buffer, int byteCount)
+{
+	ULONG value;
+	int count;
+
+	byteCount /= sizeof( ULONG );
+	for( count = 0; count < byteCount; count++ ) {
+		value = ( buffer[ count ] << 16 ) | ( buffer[ count ] >> 16 );
+		buffer[ count ] = ( ( value & 0xFF00FF00L ) >> 8 ) | ( ( value & 0x00FF00FFL ) << 8 );
+	}
+}
+
+void
+ahtopb (char *ascii_hex, BYTE *p_binary, int bin_len)
+{
+	BYTE    nibble;
+	int     i; 
+	
+	for ( i=0; i<bin_len; i++ ) {
+        nibble = ascii_hex[i * 2];
+	    if ( nibble > 'F' )
+	        nibble -= 0x20;   
+	    if ( nibble > '9' )
+	        nibble -= 7;      
+	    nibble -= '0';   
+	    p_binary[i] = (BYTE)(nibble << 4);
+		
+	    nibble = ascii_hex[i * 2 + 1];
+	    if ( nibble > 'F' )
+			nibble -= 0x20;
+        if ( nibble > '9' )
+            nibble -= 7;   
+        nibble -= '0';
+		p_binary[i] = (BYTE)(p_binary[i] + nibble);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/linearComplexity.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,153 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/cephes.h"  
+
+void
+LinearComplexity(int M, int n)
+{
+	int       i, ii, j, d, N, L, m, N_, sign, K = 6;
+	double    p_value, T_, mean, nu[7], chi2;
+	double    pi[7] = { 0.01047, 0.03125, 0.12500, 0.50000, 0.25000, 0.06250, 0.020833 };
+	BitSequence*   T = NULL;
+	BitSequence*   P = NULL;
+	BitSequence*   B_ = NULL;
+	BitSequence*   C = NULL;
+	
+	N = (int)floor(n/M);
+	if ( ((B_ = (BitSequence *) calloc(M, sizeof(BitSequence))) == NULL) ||
+		 ((C  = (BitSequence *) calloc(M, sizeof(BitSequence))) == NULL) ||
+		 ((P  = (BitSequence *) calloc(M, sizeof(BitSequence))) == NULL) ||
+		 ((T  = (BitSequence *) calloc(M, sizeof(BitSequence))) == NULL) ) {
+		printf("Insufficient Memory for Work Space:: Linear Complexity Test\n");
+		if ( B_!= NULL )
+			free(B_);
+		if ( C != NULL )
+			free(C);
+		if ( P != NULL )
+			free(P);
+		if ( T != NULL )
+			free(T);
+		return;
+	}
+
+
+	fprintf(stats[TEST_LINEARCOMPLEXITY], "-----------------------------------------------------\n");
+	fprintf(stats[TEST_LINEARCOMPLEXITY], "\tL I N E A R  C O M P L E X I T Y\n");
+	fprintf(stats[TEST_LINEARCOMPLEXITY], "-----------------------------------------------------\n");
+	fprintf(stats[TEST_LINEARCOMPLEXITY], "\tM (substring length)     = %d\n", M);
+	fprintf(stats[TEST_LINEARCOMPLEXITY], "\tN (number of substrings) = %d\n", N);
+	fprintf(stats[TEST_LINEARCOMPLEXITY], "-----------------------------------------------------\n");
+	fprintf(stats[TEST_LINEARCOMPLEXITY], "        F R E Q U E N C Y                            \n");
+	fprintf(stats[TEST_LINEARCOMPLEXITY], "-----------------------------------------------------\n");
+	fprintf(stats[TEST_LINEARCOMPLEXITY], "  C0   C1   C2   C3   C4   C5   C6    CHI2    P-value\n");
+	fprintf(stats[TEST_LINEARCOMPLEXITY], "-----------------------------------------------------\n");
+	fprintf(stats[TEST_LINEARCOMPLEXITY], "\tNote: %d bits were discarded!\n", n%M);
+
+	for ( i=0; i<K+1; i++ )
+		nu[i] = 0.00;
+	for ( ii=0; ii<N; ii++ ) {
+		for ( i=0; i<M; i++ ) {
+			B_[i] = 0;
+			C[i] = 0;
+			T[i] = 0;
+			P[i] = 0;
+		}
+		L = 0;
+		m = -1;
+		d = 0;
+		C[0] = 1;
+		B_[0] = 1;
+		
+		/* DETERMINE LINEAR COMPLEXITY */
+		N_ = 0;
+		while ( N_ < M ) {
+			d = (int)epsilon[ii*M+N_];
+			for ( i=1; i<=L; i++ )
+				d += C[i] * epsilon[ii*M+N_-i];
+			d = d%2;
+			if ( d == 1 ) {
+				for ( i=0; i<M; i++ ) {
+					T[i] = C[i];
+					P[i] = 0;
+				}
+				for ( j=0; j<M; j++ )
+					if ( B_[j] == 1 )
+						P[j+N_-m] = 1;
+				for ( i=0; i<M; i++ )
+					C[i] = (BitSequence)((C[i] + P[i])%2);
+				if ( L <= N_/2 ) {
+					L = N_ + 1 - L;
+					m = N_;
+					for ( i=0; i<M; i++ )
+						B_[i] = T[i];
+				}
+			}
+			N_++;
+		}
+		if (((M+1)%2) == 0 ) 
+			sign = -1;
+		else 
+			sign = 1;
+		mean = M/2.0 + (9.0+sign)/36.0 - 1.0/pow(2, M) * (M/3.0 + 2.0/9.0);
+		if ( (M%2) == 0 )
+			sign = 1;
+		else 
+			sign = -1;
+		T_ = sign * (L - mean) + 2.0/9.0;
+		
+		if ( T_ <= -2.5 )
+			nu[0]++;
+		else if ( T_ > -2.5 && T_ <= -1.5 )
+			nu[1]++;
+		else if ( T_ > -1.5 && T_ <= -0.5 )
+			nu[2]++;
+		else if ( T_ > -0.5 && T_ <= 0.5 )
+			nu[3]++;
+		else if ( T_ > 0.5 && T_ <= 1.5 )
+			nu[4]++;
+		else if ( T_ > 1.5 && T_ <= 2.5 )
+			nu[5]++;
+		else
+			nu[6]++;
+	}
+	chi2 = 0.00;
+	for ( i=0; i<K+1; i++ ) 
+		fprintf(stats[TEST_LINEARCOMPLEXITY], "%4d ", (int)nu[i]);
+	for ( i=0; i<K+1; i++ )
+		chi2 += pow(nu[i]-N*pi[i], 2) / (N*pi[i]);
+	p_value = cephes_igamc(K/2.0, chi2/2.0);
+
+	fprintf(stats[TEST_LINEARCOMPLEXITY], "%9.6f%9.6f\n", chi2, p_value);
+	fprintf(results[TEST_LINEARCOMPLEXITY], "%f\n", p_value);
+
+	free(B_);
+	free(P);
+	free(C);
+	free(T);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/longestRunOfOnes.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,142 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+/* got rid of unused 'k' */
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/cephes.h"  
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+                      L O N G E S T  R U N S  T E S T
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+void
+LongestRunOfOnes(int n)
+{
+	double			pval, chi2, pi[7];
+	int				run, v_n_obs, N, i, j, K, M, V[7];
+	unsigned int	nu[7] = { 0, 0, 0, 0, 0, 0, 0 };
+
+	if ( n < 128 ) {
+		fprintf(stats[TEST_LONGEST_RUN], "\t\t\t  LONGEST RUNS OF ONES TEST\n");
+		fprintf(stats[TEST_LONGEST_RUN], "\t\t---------------------------------------------\n");
+		fprintf(stats[TEST_LONGEST_RUN], "\t\t   n=%d is too short\n", n);
+		return;
+	}
+	if ( n < 6272 ) {
+		K = 3;
+		M = 8;
+		V[0] = 1; V[1] = 2; V[2] = 3; V[3] = 4;
+		pi[0] = 0.21484375;
+		pi[1] = 0.3671875;
+		pi[2] = 0.23046875;
+		pi[3] = 0.1875;
+	}
+	else if ( n < 750000 ) {
+		K = 5;
+		M = 128;
+		V[0] = 4; V[1] = 5; V[2] = 6; V[3] = 7; V[4] = 8; V[5] = 9;
+		pi[0] = 0.1174035788;
+		pi[1] = 0.242955959;
+		pi[2] = 0.249363483;
+		pi[3] = 0.17517706;
+		pi[4] = 0.102701071;
+		pi[5] = 0.112398847;
+	}
+	else {
+		K = 6;
+		M = 10000;
+			V[0] = 10; V[1] = 11; V[2] = 12; V[3] = 13; V[4] = 14; V[5] = 15; V[6] = 16;
+		pi[0] = 0.0882;
+		pi[1] = 0.2092;
+		pi[2] = 0.2483;
+		pi[3] = 0.1933;
+		pi[4] = 0.1208;
+		pi[5] = 0.0675;
+		pi[6] = 0.0727;
+	}
+	
+	N = n/M;
+	for ( i=0; i<N; i++ ) {
+		v_n_obs = 0;
+		run = 0;
+		for ( j=0; j<M; j++ ) {
+			if ( epsilon[i*M+j] == 1 ) {
+				run++;
+				if ( run > v_n_obs )
+					v_n_obs = run;
+			}
+			else
+				run = 0;
+		}
+		if ( v_n_obs < V[0] )
+			nu[0]++;
+		for ( j=0; j<=K; j++ ) {
+			if ( v_n_obs == V[j] )
+				nu[j]++;
+		}
+		if ( v_n_obs > V[K] )
+			nu[K]++;
+	}
+
+	chi2 = 0.0;
+	for ( i=0; i<=K; i++ )
+		chi2 += ((nu[i] - N * pi[i]) * (nu[i] - N * pi[i])) / (N * pi[i]);
+
+	pval = cephes_igamc((double)(K/2.0), chi2 / 2.0);
+
+	fprintf(stats[TEST_LONGEST_RUN], "\t\t\t  LONGEST RUNS OF ONES TEST\n");
+	fprintf(stats[TEST_LONGEST_RUN], "\t\t---------------------------------------------\n");
+	fprintf(stats[TEST_LONGEST_RUN], "\t\tCOMPUTATIONAL INFORMATION:\n");
+	fprintf(stats[TEST_LONGEST_RUN], "\t\t---------------------------------------------\n");
+	fprintf(stats[TEST_LONGEST_RUN], "\t\t(a) N (# of substrings)  = %d\n", N);
+	fprintf(stats[TEST_LONGEST_RUN], "\t\t(b) M (Substring Length) = %d\n", M);
+	fprintf(stats[TEST_LONGEST_RUN], "\t\t(c) Chi^2                = %f\n", chi2);
+	fprintf(stats[TEST_LONGEST_RUN], "\t\t---------------------------------------------\n");
+	fprintf(stats[TEST_LONGEST_RUN], "\t\t      F R E Q U E N C Y\n");
+	fprintf(stats[TEST_LONGEST_RUN], "\t\t---------------------------------------------\n");
+
+	if ( K == 3 ) {
+		fprintf(stats[TEST_LONGEST_RUN], "\t\t  <=1     2     3    >=4   P-value  Assignment");
+		fprintf(stats[TEST_LONGEST_RUN], "\n\t\t %3d %3d %3d  %3d ", nu[0], nu[1], nu[2], nu[3]);
+	}
+	else if ( K == 5 ) {
+		fprintf(stats[TEST_LONGEST_RUN], "\t\t<=4  5  6  7  8  >=9 P-value  Assignment");
+		fprintf(stats[TEST_LONGEST_RUN], "\n\t\t %3d %3d %3d %3d %3d  %3d ", nu[0], nu[1], nu[2],
+				nu[3], nu[4], nu[5]);
+	}
+	else {
+		fprintf(stats[TEST_LONGEST_RUN],"\t\t<=10  11  12  13  14  15 >=16 P-value  Assignment");
+		fprintf(stats[TEST_LONGEST_RUN],"\n\t\t %3d %3d %3d %3d %3d %3d  %3d ", nu[0], nu[1], nu[2],
+				nu[3], nu[4], nu[5], nu[6]);
+	}
+	if ( isNegative(pval) || isGreaterThanOne(pval) )
+		fprintf(stats[TEST_LONGEST_RUN], "WARNING:  P_VALUE IS OUT OF RANGE.\n");
+
+	fprintf(stats[TEST_LONGEST_RUN], "%s\t\tp_value = %f\n\n", pval < ALPHA ? "FAILURE" : "SUCCESS", pval);
+	fprintf(results[TEST_LONGEST_RUN], "%f\n", pval);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/math/erf.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,355 @@
+/*
+* Portions Copyright (c) 2006, 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*/
+
+/* @(#)s_erf.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+#ifndef __SYMBIAN32__
+#ifndef lint
+static char rcsid[] = "$FreeBSD: src/lib/msun/src/s_erf.c,v 1.7 2002/05/28 18:15:04 alfred Exp $";
+#endif
+#endif //__SYMBIAN32__
+
+#include <e32std.h>
+
+#include "openc.h"
+
+/* double erf(double x)
+ * double erfc(double x)
+ *               x
+ *            2      |\
+ *     erf(x)  =  ---------  | exp(-t*t)dt
+ *         sqrt(pi) \|
+ *               0
+ *
+ *     erfc(x) =  1-erf(x)
+ *  Note that
+ *      erf(-x) = -erf(x)
+ *      erfc(-x) = 2 - erfc(x)
+ *
+ * Method:
+ *  1. For |x| in [0, 0.84375]
+ *      erf(x)  = x + x*R(x^2)
+ *          erfc(x) = 1 - erf(x)           if x in [-.84375,0.25]
+ *                  = 0.5 + ((0.5-x)-x*R)  if x in [0.25,0.84375]
+ *     where R = P/Q where P is an odd poly of degree 8 and
+ *     Q is an odd poly of degree 10.
+ *                       -57.90
+ *          | R - (erf(x)-x)/x | <= 2
+ *
+ *
+ *     Remark. The formula is derived by noting
+ *          erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....)
+ *     and that
+ *          2/sqrt(pi) = 1.128379167095512573896158903121545171688
+ *     is close to one. The interval is chosen because the fix
+ *     point of erf(x) is near 0.6174 (i.e., erf(x)=x when x is
+ *     near 0.6174), and by some experiment, 0.84375 is chosen to
+ *     guarantee the error is less than one ulp for erf.
+ *
+ *      2. For |x| in [0.84375,1.25], let s = |x| - 1, and
+ *         c = 0.84506291151 rounded to single (24 bits)
+ *          erf(x)  = sign(x) * (c  + P1(s)/Q1(s))
+ *          erfc(x) = (1-c)  - P1(s)/Q1(s) if x > 0
+ *            1+(c+P1(s)/Q1(s))    if x < 0
+ *          |P1/Q1 - (erf(|x|)-c)| <= 2**-59.06
+ *     Remark: here we use the taylor series expansion at x=1.
+ *      erf(1+s) = erf(1) + s*Poly(s)
+ *           = 0.845.. + P1(s)/Q1(s)
+ *     That is, we use rational approximation to approximate
+ *          erf(1+s) - (c = (single)0.84506291151)
+ *     Note that |P1/Q1|< 0.078 for x in [0.84375,1.25]
+ *     where
+ *      P1(s) = degree 6 poly in s
+ *      Q1(s) = degree 6 poly in s
+ *
+ *      3. For x in [1.25,1/0.35(~2.857143)],
+ *          erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1)
+ *          erf(x)  = 1 - erfc(x)
+ *     where
+ *      R1(z) = degree 7 poly in z, (z=1/x^2)
+ *      S1(z) = degree 8 poly in z
+ *
+ *      4. For x in [1/0.35,28]
+ *          erfc(x) = (1/x)*exp(-x*x-0.5625+R2/S2) if x > 0
+ *          = 2.0 - (1/x)*exp(-x*x-0.5625+R2/S2) if -6<x<0
+ *          = 2.0 - tiny        (if x <= -6)
+ *          erf(x)  = sign(x)*(1.0 - erfc(x)) if x < 6, else
+ *          erf(x)  = sign(x)*(1.0 - tiny)
+ *     where
+ *      R2(z) = degree 6 poly in z, (z=1/x^2)
+ *      S2(z) = degree 7 poly in z
+ *
+ *      Note1:
+ *     To compute exp(-x*x-0.5625+R/S), let s be a single
+ *     precision number and s := x; then
+ *      -x*x = -s*s + (s-x)*(s+x)
+ *          exp(-x*x-0.5626+R/S) =
+ *          exp(-s*s-0.5625)*exp((s-x)*(s+x)+R/S);
+ *      Note2:
+ *     Here 4 and 5 make use of the asymptotic series
+ *            exp(-x*x)
+ *      erfc(x) ~ ---------- * ( 1 + Poly(1/x^2) )
+ *            x*sqrt(pi)
+ *     We use rational approximation to approximate
+ *          g(s)=f(1/x^2) = log(erfc(x)*x) - x*x + 0.5625
+ *     Here is the error bound for R1/S1 and R2/S2
+ *          |R1/S1 - f(x)|  < 2**(-62.57)
+ *          |R2/S2 - f(x)|  < 2**(-61.52)
+ *
+ *      5. For inf > x >= 28
+ *          erf(x)  = sign(x) *(1 - tiny)  (raise inexact)
+ *          erfc(x) = tiny*tiny (raise underflow) if x > 0
+ *          = 2 - tiny if x<0
+ *
+ *      7. Special case:
+ *          erf(0)  = 0, erf(inf)  = 1, erf(-inf) = -1,
+ *          erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2,
+ *      erfc/erf(NaN) is NaN
+ */
+
+
+
+
+
+////--------------------------------------------------
+
+#define __ieee754_exp   exp
+typedef TUint32 u_int32_t;
+typedef TInt32 int32_t;
+
+typedef union
+    {
+    double value;
+    struct
+        {
+        u_int32_t lsw;
+        u_int32_t msw;
+        } parts;
+    } ieee_double_shape_type;
+
+
+inline void GET_HIGH_WORD(int32_t& aHighWord, double aValue)
+    {
+    ieee_double_shape_type gh_u;
+    gh_u.value = aValue;
+    aHighWord = gh_u.parts.msw;                  
+    }
+    
+inline void SET_LOW_WORD(double& aValue, int32_t aLowWord)
+    {
+    ieee_double_shape_type sl_u;
+    sl_u.value = aValue;
+    sl_u.parts.lsw = aLowWord;
+    aValue = sl_u.value;
+    }
+
+//----------------------------------------------------------------math_private.h
+
+static const double tiny    = 1e-300;
+static const double tinySquare    = 0.00; // tiny * tiny 
+static const double half    = 5.00000000000000000000e-01; /* 0x3FE00000, 0x00000000 */
+static const double one     = 1.00000000000000000000e+00; /* 0x3FF00000, 0x00000000 */
+static const double two     = 2.00000000000000000000e+00; /* 0x40000000, 0x00000000 */
+    /* c = (float)0.84506291151 */
+static const double erx     = 8.45062911510467529297e-01; /* 0x3FEB0AC1, 0x60000000 */
+/*
+ * Coefficients for approximation to  erf on [0,0.84375]
+ */
+static const double efx     =  1.28379167095512586316e-01; /* 0x3FC06EBA, 0x8214DB69 */
+static const double efx8    =  1.02703333676410069053e+00; /* 0x3FF06EBA, 0x8214DB69 */
+static const double pp0     =  1.28379167095512558561e-01; /* 0x3FC06EBA, 0x8214DB68 */
+static const double pp1     = -3.25042107247001499370e-01; /* 0xBFD4CD7D, 0x691CB913 */
+static const double pp2     = -2.84817495755985104766e-02; /* 0xBF9D2A51, 0xDBD7194F */
+static const double pp3     = -5.77027029648944159157e-03; /* 0xBF77A291, 0x236668E4 */
+static const double pp4     = -2.37630166566501626084e-05; /* 0xBEF8EAD6, 0x120016AC */
+static const double qq1     =  3.97917223959155352819e-01; /* 0x3FD97779, 0xCDDADC09 */
+static const double qq2     =  6.50222499887672944485e-02; /* 0x3FB0A54C, 0x5536CEBA */
+static const double qq3     =  5.08130628187576562776e-03; /* 0x3F74D022, 0xC4D36B0F */
+static const double qq4     =  1.32494738004321644526e-04; /* 0x3F215DC9, 0x221C1A10 */
+static const double qq5     = -3.96022827877536812320e-06; /* 0xBED09C43, 0x42A26120 */
+/*
+ * Coefficients for approximation to  erf  in [0.84375,1.25]
+ */
+static const double pa0     = -2.36211856075265944077e-03; /* 0xBF6359B8, 0xBEF77538 */
+static const double pa1     =  4.14856118683748331666e-01; /* 0x3FDA8D00, 0xAD92B34D */
+static const double pa2     = -3.72207876035701323847e-01; /* 0xBFD7D240, 0xFBB8C3F1 */
+static const double pa3     =  3.18346619901161753674e-01; /* 0x3FD45FCA, 0x805120E4 */
+static const double pa4     = -1.10894694282396677476e-01; /* 0xBFBC6398, 0x3D3E28EC */
+static const double pa5     =  3.54783043256182359371e-02; /* 0x3FA22A36, 0x599795EB */
+static const double pa6     = -2.16637559486879084300e-03; /* 0xBF61BF38, 0x0A96073F */
+static const double qa1     =  1.06420880400844228286e-01; /* 0x3FBB3E66, 0x18EEE323 */
+static const double qa2     =  5.40397917702171048937e-01; /* 0x3FE14AF0, 0x92EB6F33 */
+static const double qa3     =  7.18286544141962662868e-02; /* 0x3FB2635C, 0xD99FE9A7 */
+static const double qa4     =  1.26171219808761642112e-01; /* 0x3FC02660, 0xE763351F */
+static const double qa5     =  1.36370839120290507362e-02; /* 0x3F8BEDC2, 0x6B51DD1C */
+static const double qa6     =  1.19844998467991074170e-02; /* 0x3F888B54, 0x5735151D */
+/*
+ * Coefficients for approximation to  erfc in [1.25,1/0.35]
+ */
+static const double ra0     = -9.86494403484714822705e-03; /* 0xBF843412, 0x600D6435 */
+static const double ra1     = -6.93858572707181764372e-01; /* 0xBFE63416, 0xE4BA7360 */
+static const double ra2     = -1.05586262253232909814e+01; /* 0xC0251E04, 0x41B0E726 */
+static const double ra3     = -6.23753324503260060396e+01; /* 0xC04F300A, 0xE4CBA38D */
+static const double ra4     = -1.62396669462573470355e+02; /* 0xC0644CB1, 0x84282266 */
+static const double ra5     = -1.84605092906711035994e+02; /* 0xC067135C, 0xEBCCABB2 */
+static const double ra6     = -8.12874355063065934246e+01; /* 0xC0545265, 0x57E4D2F2 */
+static const double ra7     = -9.81432934416914548592e+00; /* 0xC023A0EF, 0xC69AC25C */
+static const double sa1     =  1.96512716674392571292e+01; /* 0x4033A6B9, 0xBD707687 */
+static const double sa2     =  1.37657754143519042600e+02; /* 0x4061350C, 0x526AE721 */
+static const double sa3     =  4.34565877475229228821e+02; /* 0x407B290D, 0xD58A1A71 */
+static const double sa4     =  6.45387271733267880336e+02; /* 0x40842B19, 0x21EC2868 */
+static const double sa5     =  4.29008140027567833386e+02; /* 0x407AD021, 0x57700314 */
+static const double sa6     =  1.08635005541779435134e+02; /* 0x405B28A3, 0xEE48AE2C */
+static const double sa7     =  6.57024977031928170135e+00; /* 0x401A47EF, 0x8E484A93 */
+static const double sa8     = -6.04244152148580987438e-02; /* 0xBFAEEFF2, 0xEE749A62 */
+/*
+ * Coefficients for approximation to  erfc in [1/.35,28]
+ */
+static const double rb0     = -9.86494292470009928597e-03; /* 0xBF843412, 0x39E86F4A */
+static const double rb1     = -7.99283237680523006574e-01; /* 0xBFE993BA, 0x70C285DE */
+static const double rb2     = -1.77579549177547519889e+01; /* 0xC031C209, 0x555F995A */
+static const double rb3     = -1.60636384855821916062e+02; /* 0xC064145D, 0x43C5ED98 */
+static const double rb4     = -6.37566443368389627722e+02; /* 0xC083EC88, 0x1375F228 */
+static const double rb5     = -1.02509513161107724954e+03; /* 0xC0900461, 0x6A2E5992 */
+static const double rb6     = -4.83519191608651397019e+02; /* 0xC07E384E, 0x9BDC383F */
+static const double sb1     =  3.03380607434824582924e+01; /* 0x403E568B, 0x261D5190 */
+static const double sb2     =  3.25792512996573918826e+02; /* 0x40745CAE, 0x221B9F0A */
+static const double sb3     =  1.53672958608443695994e+03; /* 0x409802EB, 0x189D5118 */
+static const double sb4     =  3.19985821950859553908e+03; /* 0x40A8FFB7, 0x688C246A */
+static const double sb5     =  2.55305040643316442583e+03; /* 0x40A3F219, 0xCEDF3BE6 */
+static const double sb6     =  4.74528541206955367215e+02; /* 0x407DA874, 0xE79FE763 */
+static const double sb7     = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */
+
+double erf(double x)
+{
+    TInt32 hx,ix,i;
+    double R,S,P,Q,s,y,z,r;
+    GET_HIGH_WORD(hx,x);
+    ix = hx&0x7fffffff;
+    if(ix>=0x7ff00000) {        /* erf(nan)=nan */
+        i = ((TUint32)hx>>31)<<1;
+        return (double)(1-i)+one/x; /* erf(+-inf)=+-1 */
+    }
+
+    if(ix < 0x3feb0000) {       /* |x|<0.84375 */
+        if(ix < 0x3e300000) {   /* |x|<2**-28 */
+            if (ix < 0x00800000)
+            return 0.125*(8.0*x+efx8*x);  /*avoid underflow */
+        return x + efx*x;
+        }
+        z = x*x;
+        r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
+        s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
+        y = r/s;
+        return x + x*y;
+    }
+    if(ix < 0x3ff40000) {       /* 0.84375 <= |x| < 1.25 */
+        s = fabs(x)-one;
+        P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
+        Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
+        if(hx>=0) return erx + P/Q; else return -erx - P/Q;
+    }
+    if (ix >= 0x40180000) {     /* inf>|x|>=6 */
+        if(hx>=0) return one-tiny; else return tiny-one;
+    }
+    x = fabs(x);
+    s = one/(x*x);
+    if(ix< 0x4006DB6E) {    /* |x| < 1/0.35 */
+        R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
+                ra5+s*(ra6+s*ra7))))));
+        S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
+                sa5+s*(sa6+s*(sa7+s*sa8)))))));
+    } else {    /* |x| >= 1/0.35 */
+        R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
+                rb5+s*rb6)))));
+        S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
+                sb5+s*(sb6+s*sb7))))));
+    }
+    z  = x;
+    SET_LOW_WORD(z,0);
+    r  =  __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S);
+    if(hx>=0) return one-r/x; else return  r/x-one;
+}
+
+double erfc(double x)
+{
+    int32_t hx,ix;
+    double R,S,P,Q,s,y,z,r;
+    GET_HIGH_WORD(hx,x);
+    ix = hx&0x7fffffff;
+    if(ix>=0x7ff00000) {            /* erfc(nan)=nan */
+                        /* erfc(+-inf)=0,2 */
+        return (double)(((u_int32_t)hx>>31)<<1)+one/x;
+    }
+
+    if(ix < 0x3feb0000) {       /* |x|<0.84375 */
+        if(ix < 0x3c700000)     /* |x|<2**-56 */
+        return one-x;
+        z = x*x;
+        r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
+        s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
+        y = r/s;
+        if(hx < 0x3fd00000) {   /* x<1/4 */
+        return one-(x+x*y);
+        } else {
+        r = x*y;
+        r += (x-half);
+            return half - r ;
+        }
+    }
+    if(ix < 0x3ff40000) {       /* 0.84375 <= |x| < 1.25 */
+        s = fabs(x)-one;
+        P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
+        Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
+        if(hx>=0) {
+            z  = one-erx; return z - P/Q;
+        } else {
+        z = erx+P/Q; return one+z;
+        }
+    }
+    if (ix < 0x403c0000) {      /* |x|<28 */
+        x = fabs(x);
+        s = one/(x*x);
+        if(ix< 0x4006DB6D) {    /* |x| < 1/.35 ~ 2.857143*/
+            R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
+                ra5+s*(ra6+s*ra7))))));
+            S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
+                sa5+s*(sa6+s*(sa7+s*sa8)))))));
+        } else {            /* |x| >= 1/.35 ~ 2.857143 */
+        if(hx<0&&ix>=0x40180000) return two-tiny;/* x < -6 */
+            R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
+                rb5+s*rb6)))));
+            S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
+                sb5+s*(sb6+s*sb7))))));
+        }
+        z  = x;
+        SET_LOW_WORD(z,0);
+        r  =  __ieee754_exp(-z*z-0.5625)*
+            __ieee754_exp((z-x)*(z+x)+R/S);
+        if(hx>0) return r/x; else return two-r/x;
+    } else {
+        if(hx>0) return tinySquare; else return two-tiny;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/matrix.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,189 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/matrix.h"
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+R A N K  A L G O R I T H M  R O U T I N E S
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#define	MATRIX_FORWARD_ELIMINATION	0
+#define	MATRIX_BACKWARD_ELIMINATION	1
+
+int
+computeRank(int M, int Q, BitSequence **matrix)
+{
+	int		i, rank, m=MIN(M,Q);
+	
+	/* FORWARD APPLICATION OF ELEMENTARY ROW OPERATIONS */ 
+	for ( i=0; i<m-1; i++ ) {
+		if ( matrix[i][i] == 1 ) 
+			perform_elementary_row_operations(MATRIX_FORWARD_ELIMINATION, i, M, Q, matrix);
+		else { 	/* matrix[i][i] = 0 */
+			if ( find_unit_element_and_swap(MATRIX_FORWARD_ELIMINATION, i, M, Q, matrix) == 1 ) 
+				perform_elementary_row_operations(MATRIX_FORWARD_ELIMINATION, i, M, Q, matrix);
+		}
+	}
+
+	/* BACKWARD APPLICATION OF ELEMENTARY ROW OPERATIONS */ 
+	for ( i=m-1; i>0; i-- ) {
+		if ( matrix[i][i] == 1 )
+			perform_elementary_row_operations(MATRIX_BACKWARD_ELIMINATION, i, M, Q, matrix);
+		else { 	/* matrix[i][i] = 0 */
+			if ( find_unit_element_and_swap(MATRIX_BACKWARD_ELIMINATION, i, M, Q, matrix) == 1 )
+				perform_elementary_row_operations(MATRIX_BACKWARD_ELIMINATION, i, M, Q, matrix);
+		}
+	} 
+
+	rank = determine_rank(m, M, Q, matrix);
+
+	return rank;
+}
+
+void
+perform_elementary_row_operations(int flag, int i, int M, int Q, BitSequence **A)
+{
+	int		j, k;
+	
+	if ( flag == MATRIX_FORWARD_ELIMINATION ) {
+		for ( j=i+1; j<M;  j++ )
+			if ( A[j][i] == 1 ) 
+				for ( k=i; k<Q; k++ ) 
+					A[j][k] = (BitSequence)((A[j][k] + A[i][k]) % 2);
+	}
+	else {
+		for ( j=i-1; j>=0;  j-- )
+			if ( A[j][i] == 1 )
+				for ( k=0; k<Q; k++ )
+					A[j][k] = (BitSequence)((A[j][k] + A[i][k]) % 2);
+	}
+}
+
+int
+find_unit_element_and_swap(int flag, int i, int M, int Q, BitSequence **A)
+{ 
+	int		index, row_op=0;
+	
+	if ( flag == MATRIX_FORWARD_ELIMINATION ) {
+		index = i+1;
+		while ( (index < M) && (A[index][i] == 0) ) 
+			index++;
+			if ( index < M )
+				row_op = swap_rows(i, index, Q, A);
+	}
+	else {
+		index = i-1;
+		while ( (index >= 0) && (A[index][i] == 0) ) 
+			index--;
+			if ( index >= 0 )
+				row_op = swap_rows(i, index, Q, A);
+	}
+	
+	return row_op;
+}
+
+int
+swap_rows(int i, int index, int Q, BitSequence **A)
+{
+	int			p;
+	BitSequence	temp;
+	
+	for ( p=0; p<Q; p++ ) {
+		temp = A[i][p];
+		A[i][p] = A[index][p];
+		A[index][p] = temp;
+	}
+	
+	return 1;
+}
+
+int
+determine_rank(int m, int M, int Q, BitSequence **A)
+{
+	int		i, j, rank, allZeroes;
+	
+	/* DETERMINE RANK, THAT IS, COUNT THE NUMBER OF NONZERO ROWS */
+	
+	rank = m;
+	for ( i=0; i<M; i++ ) {
+		allZeroes = 1; 
+		for ( j=0; j<Q; j++)  {
+			if ( A[i][j] == 1 ) {
+				allZeroes = 0;
+				break;
+			}
+		}
+		if ( allZeroes == 1 )
+			rank--;
+	} 
+	
+	return rank;
+}
+
+BitSequence**
+create_matrix(int M, int Q)
+{
+	int			i;
+	BitSequence	**matrix;
+	
+	if ( (matrix = (BitSequence **) calloc(M, sizeof(BitSequence *))) == NULL ) {
+		printf("ERROR IN FUNCTION create_matrix:  Insufficient memory available.\n");
+		
+		return NULL;
+	}
+	else {
+		for ( i=0; i<M; i++ ) {
+			if ( (matrix[i] = (unsigned char*)calloc(Q, sizeof(BitSequence))) == NULL ) {
+				printf("ERROR IN FUNCTION create_matrix: Insufficient memory for %dx%d matrix.\n", M, M);
+
+				return NULL;
+			}
+		}
+		return matrix;
+	}
+}
+
+void
+def_matrix(int M, int Q, BitSequence **m,int k)
+{
+	int		i,j;
+	
+	for ( i=0; i<M; i++ ) 
+		for ( j=0; j<Q; j++ )
+			m[i][j] = epsilon[k*(M*Q)+j+i*M];
+}
+
+void
+delete_matrix(int M, BitSequence **matrix)
+{
+	int		i;
+
+	for ( i=0; i<M; i++ )
+		free(matrix[i]);
+	free(matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/nonOverlappingTemplateMatchings.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,149 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/utilities.h"
+#include "../include/cephes.h"  
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+          N O N O V E R L A P P I N G  T E M P L A T E  T E S T
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+void
+NonOverlappingTemplateMatchings(int m, int n)
+{
+	int		numOfTemplates[100] = {0, 0, 2, 4, 6, 12, 20, 40, 74, 148, 284, 568, 1116,
+						2232, 4424, 8848, 17622, 35244, 70340, 140680, 281076, 562152};
+	/*----------------------------------------------------------------------------
+	NOTE:  Should additional templates lengths beyond 21 be desired, they must 
+	first be constructed, saved into files and then the corresponding 
+	number of nonperiodic templates for that file be stored in the m-th 
+	position in the numOfTemplates variable.
+	----------------------------------------------------------------------------*/
+	unsigned int	W_obs, *Wj = NULL; 
+	double			sum, chi2, p_value, lambda, pi[6], varWj;
+	int				i, j, jj, k, match, SKIP, M, N, K = 5;
+	
+	ResetTemplateIndex();
+
+	N = 8;
+	M = n/N;
+
+	if ( (Wj = (unsigned int*)calloc(N, sizeof(unsigned int))) == NULL ) {
+		fprintf(stats[TEST_NONPERIODIC], "\tNONOVERLAPPING TEMPLATES TESTS ABORTED DUE TO ONE OF THE FOLLOWING : \n");
+		fprintf(stats[TEST_NONPERIODIC], "\tInsufficient memory for required work space.\n");
+		return;
+	}
+	lambda = (M-m+1)/pow(2, m);
+	varWj = M*(1.0/pow(2.0, m) - (2.0*m-1.0)/pow(2.0, 2.0*m));
+
+	if ( isNegative(lambda) || isZero(lambda)) 
+	    {
+		fprintf(stats[TEST_NONPERIODIC], "\tNONOVERLAPPING TEMPLATES TESTS ABORTED DUE TO ONE OF THE FOLLOWING : \n");
+		fprintf(stats[TEST_NONPERIODIC], "\tLambda (%f) not being positive!\n", lambda);
+		}
+	else {
+		fprintf(stats[TEST_NONPERIODIC], "\t\t  NONPERIODIC TEMPLATES TEST\n");
+		fprintf(stats[TEST_NONPERIODIC], "-------------------------------------------------------------------------------------\n");
+		fprintf(stats[TEST_NONPERIODIC], "\t\t  COMPUTATIONAL INFORMATION\n");
+		fprintf(stats[TEST_NONPERIODIC], "-------------------------------------------------------------------------------------\n");
+		fprintf(stats[TEST_NONPERIODIC], "\tLAMBDA = %f\tM = %d\tN = %d\tm = %d\tn = %d\n", lambda, M, N, m, n);
+		fprintf(stats[TEST_NONPERIODIC], "-------------------------------------------------------------------------------------\n");
+		fprintf(stats[TEST_NONPERIODIC], "\t\tF R E Q U E N C Y\n");
+		fprintf(stats[TEST_NONPERIODIC], "Template   W_1  W_2  W_3  W_4  W_5  W_6  W_7  W_8    Chi^2   P_value Assignment Index\n");
+		fprintf(stats[TEST_NONPERIODIC], "-------------------------------------------------------------------------------------\n");
+
+		if ( numOfTemplates[m] < MAXNUMOFTEMPLATES )
+			SKIP = 1;
+		else
+			SKIP = (int)(numOfTemplates[m]/MAXNUMOFTEMPLATES);
+		numOfTemplates[m] = (int)numOfTemplates[m]/SKIP;
+		
+		sum = 0.0;
+		for ( i=0; i<2; i++ ) {                      /* Compute Probabilities */
+			pi[i] = exp(-lambda+i*log(lambda)-cephes_lgam(i+1));
+			sum += pi[i];
+		}
+		pi[0] = sum;
+		for ( i=2; i<=K; i++ ) {                      /* Compute Probabilities */
+			pi[i-1] = exp(-lambda+i*log(lambda)-cephes_lgam(i+1));
+			sum += pi[i-1];
+		}
+		pi[K] = 1 - sum;
+
+        BitSequence templateSequence[KMaxBit];
+
+        for( jj=0; jj<MIN(MAXNUMOFTEMPLATES, numOfTemplates[m]); jj++ ) {
+			sum = 0;
+            GetNextTemplateItem(templateSequence);
+
+			fprintf(stats[TEST_NONPERIODIC], " ");
+			for ( i=0; i<N; i++ ) {
+				W_obs = 0;
+				for ( j=0; j<M-m+1; j++ ) {
+					match = 1;
+					for ( k=0; k<m; k++ ) {
+					
+                    if ( (int)templateSequence[KMaxBit - k - 1] != (int)epsilon[i*M+j+k] ) {
+							match = 0;
+							break;
+						}
+					}
+					if ( match == 1 )
+						W_obs++;
+				}
+				Wj[i] = W_obs;
+			}
+			sum = 0;
+			chi2 = 0.0;                                   /* Compute Chi Square */
+			for ( i=0; i<N; i++ ) {
+				if ( m == 10 )
+					fprintf(stats[TEST_NONPERIODIC], "%3d  ", Wj[i]);
+				else
+					fprintf(stats[TEST_NONPERIODIC], "%4d ", Wj[i]);
+				chi2 += pow(((double)Wj[i] - lambda)/pow(varWj, 0.5), 2);
+			}
+			p_value = cephes_igamc(N/2.0, chi2/2.0);
+		
+			if ( isNegative(p_value) || isGreaterThanOne(p_value) )
+				fprintf(stats[TEST_NONPERIODIC], "\t\tWARNING:  P_VALUE IS OUT OF RANGE.\n");
+
+			fprintf(stats[TEST_NONPERIODIC], "%9.6f %f %s %3d\n", chi2, p_value, p_value < ALPHA ? "FAILURE" : "SUCCESS", jj);
+			if ( SKIP > 1 )
+			    {
+			    for(int index = 0; index < (SKIP-1)*2*m; ++index)
+			        {
+			        GetNextTemplateItem(templateSequence);
+			        }
+			    }
+			fprintf(results[TEST_NONPERIODIC], "%f\n", p_value);
+		}
+	}
+	
+	fprintf(stats[TEST_NONPERIODIC], "\n");
+	free(Wj);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/overlappingTemplateMatchings.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,132 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/utilities.h"
+#include "../include/cephes.h"  
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+               O V E R L A P P I N G  T E M P L A T E  T E S T
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+double	Pr(int u, double eta);
+
+void
+OverlappingTemplateMatchings(int m, int n)
+{
+	int				i, k, match;
+	double			W_obs, eta, sum, chi2, p_value, lambda;
+	int				M, N, j, K = 5;
+	unsigned int	nu[6] = { 0, 0, 0, 0, 0, 0 };
+	double			pi[6] = { 0.143783, 0.139430, 0.137319, 0.124314, 0.106209, 0.348945 };
+	BitSequence		*sequence;
+
+	M = 1032;
+	N = n/M;
+	
+	if ( (sequence = (BitSequence *) calloc(m, sizeof(BitSequence))) == NULL ) {
+		fprintf(stats[TEST_OVERLAPPING], "\t\t    OVERLAPPING TEMPLATE OF ALL ONES TEST\n");
+		fprintf(stats[TEST_OVERLAPPING], "\t\t---------------------------------------------\n");
+		fprintf(stats[TEST_OVERLAPPING], "\t\tTEMPLATE DEFINITION:  Insufficient memory, Overlapping Template Matchings test aborted!\n");
+	}
+	else
+		for ( i=0; i<m; i++ )
+			sequence[i] = 1;
+	
+	lambda = (double)(M-m+1)/pow(2,m);
+	eta = lambda/2.0;
+	sum = 0.0;
+	for ( i=0; i<K; i++ ) {			/* Compute Probabilities */
+		pi[i] = Pr(i, eta);
+		sum += pi[i];
+	}
+	pi[K] = 1 - sum;
+
+	for ( i=0; i<N; i++ ) {
+		W_obs = 0;
+		for ( j=0; j<M-m+1; j++ ) {
+			match = 1;
+			for ( k=0; k<m; k++ ) {
+				if ( sequence[k] != epsilon[i*M+j+k] )
+					match = 0;
+			}
+			if ( match == 1 )
+				W_obs++;
+		}
+		if ( W_obs <= 4 )
+			nu[(int)W_obs]++;
+		else
+			nu[K]++;
+	}
+	sum = 0;
+	chi2 = 0.0;                                   /* Compute Chi Square */
+	for ( i=0; i<K+1; i++ ) {
+		chi2 += pow((double)nu[i] - (double)N*pi[i], 2)/((double)N*pi[i]);
+		sum += nu[i];
+	}
+	p_value = cephes_igamc(K/2.0, chi2/2.0);
+
+	fprintf(stats[TEST_OVERLAPPING], "\t\t    OVERLAPPING TEMPLATE OF ALL ONES TEST\n");
+	fprintf(stats[TEST_OVERLAPPING], "\t\t-----------------------------------------------\n");
+	fprintf(stats[TEST_OVERLAPPING], "\t\tCOMPUTATIONAL INFORMATION:\n");
+	fprintf(stats[TEST_OVERLAPPING], "\t\t-----------------------------------------------\n");
+	fprintf(stats[TEST_OVERLAPPING], "\t\t(a) n (sequence_length)      = %d\n", n);
+	fprintf(stats[TEST_OVERLAPPING], "\t\t(b) m (block length of 1s)   = %d\n", m);
+	fprintf(stats[TEST_OVERLAPPING], "\t\t(c) M (length of substring)  = %d\n", M);
+	fprintf(stats[TEST_OVERLAPPING], "\t\t(d) N (number of substrings) = %d\n", N);
+	fprintf(stats[TEST_OVERLAPPING], "\t\t(e) lambda [(M-m+1)/2^m]     = %f\n", lambda);
+	fprintf(stats[TEST_OVERLAPPING], "\t\t(f) eta                      = %f\n", eta);
+	fprintf(stats[TEST_OVERLAPPING], "\t\t-----------------------------------------------\n");
+	fprintf(stats[TEST_OVERLAPPING], "\t\t   F R E Q U E N C Y\n");
+	fprintf(stats[TEST_OVERLAPPING], "\t\t  0   1   2   3   4 >=5   Chi^2   P-value  Assignment\n");
+	fprintf(stats[TEST_OVERLAPPING], "\t\t-----------------------------------------------\n");
+	fprintf(stats[TEST_OVERLAPPING], "\t\t%3d %3d %3d %3d %3d %3d  %f ",
+		nu[0], nu[1], nu[2], nu[3], nu[4], nu[5], chi2);
+
+	if ( isNegative(p_value) || isGreaterThanOne(p_value) )
+		fprintf(stats[TEST_OVERLAPPING], "WARNING:  P_VALUE IS OUT OF RANGE.\n");
+
+	free(sequence);
+	fprintf(stats[TEST_OVERLAPPING], "%f %s\n\n", p_value, p_value < ALPHA ? "FAILURE" : "SUCCESS");
+	fprintf(results[TEST_OVERLAPPING], "%f\n", p_value);
+}
+
+double
+Pr(int u, double eta)
+{
+	int		l;
+	double	sum, p;
+	
+	if ( u == 0 )
+		p = exp(-eta);
+	else {
+		sum = 0.0;
+		for ( l=1; l<=u; l++ )
+			sum += exp(-eta-u*log(2)+l*log(eta)-cephes_lgam(l+1)+cephes_lgam(u)-cephes_lgam(l)-cephes_lgam(u-l+1));
+		p = sum;
+	}
+	return p;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/randomExcursions.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,145 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/cephes.h"  
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+                     R A N D O M  E X C U R S I O N S  T E S T
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+void
+RandomExcursions(int n)
+{
+	int		b, i, j, k, J, x;
+	int		cycleStart, cycleStop, *cycle = NULL, *S_k = NULL;
+	int		stateX[8] = { -4, -3, -2, -1, 1, 2, 3, 4 };
+	int		counter[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+	double	p_value, sum, constraint, nu[6][8];
+	double	pi[5][6] = { {0.0000000000, 0.00000000000, 0.00000000000, 0.00000000000, 0.00000000000, 0.0000000000}, 
+						 {0.5000000000, 0.25000000000, 0.12500000000, 0.06250000000, 0.03125000000, 0.0312500000},
+						 {0.7500000000, 0.06250000000, 0.04687500000, 0.03515625000, 0.02636718750, 0.0791015625},
+						 {0.8333333333, 0.02777777778, 0.02314814815, 0.01929012346, 0.01607510288, 0.0803755143},
+						 {0.8750000000, 0.01562500000, 0.01367187500, 0.01196289063, 0.01046752930, 0.0732727051} };
+	
+	if ( ((S_k = (int *)calloc(n, sizeof(int))) == NULL) ||
+		 ((cycle = (int *)calloc(MAX(1000, n/100), sizeof(int))) == NULL) ) {
+		printf("Random Excursions Test:  Insufficent Work Space Allocated.\n");
+		if ( S_k != NULL )
+			free(S_k);
+		if ( cycle != NULL )
+			free(cycle);
+		return;
+	}
+	
+	J = 0; 					/* DETERMINE CYCLES */
+	S_k[0] = 2*(int)epsilon[0] - 1;
+	for( i=1; i<n; i++ ) {
+		S_k[i] = S_k[i-1] + 2*epsilon[i] - 1;
+		if ( S_k[i] == 0 ) {
+			J++;
+			if ( J > MAX(1000, n/100) ) {
+				printf("ERROR IN FUNCTION randomExcursions:  EXCEEDING THE MAX NUMBER OF CYCLES EXPECTED\n.");
+				free(S_k);
+				free(cycle);
+				return;
+			}
+			cycle[J] = i;
+		}
+	}
+	if ( S_k[n-1] != 0 )
+		J++;
+	cycle[J] = n;
+
+	fprintf(stats[TEST_RND_EXCURSION], "\t\t\t  RANDOM EXCURSIONS TEST\n");
+	fprintf(stats[TEST_RND_EXCURSION], "\t\t--------------------------------------------\n");
+	fprintf(stats[TEST_RND_EXCURSION], "\t\tCOMPUTATIONAL INFORMATION:\n");
+	fprintf(stats[TEST_RND_EXCURSION], "\t\t--------------------------------------------\n");
+	fprintf(stats[TEST_RND_EXCURSION], "\t\t(a) Number Of Cycles (J) = %04d\n", J);
+	fprintf(stats[TEST_RND_EXCURSION], "\t\t(b) Sequence Length (n)  = %d\n", n);
+
+	constraint = MAX(0.005*pow(n, 0.5), 500);
+	if (J < constraint) {
+		fprintf(stats[TEST_RND_EXCURSION], "\t\t---------------------------------------------\n");
+		fprintf(stats[TEST_RND_EXCURSION], "\t\tWARNING:  TEST NOT APPLICABLE.  THERE ARE AN\n");
+		fprintf(stats[TEST_RND_EXCURSION], "\t\t\t  INSUFFICIENT NUMBER OF CYCLES.\n");
+		fprintf(stats[TEST_RND_EXCURSION], "\t\t---------------------------------------------\n");
+		for(i = 0; i < 8; i++)
+			fprintf(results[TEST_RND_EXCURSION], "%f\n", 0.0);
+	}
+	else {
+		fprintf(stats[TEST_RND_EXCURSION], "\t\t(c) Rejection Constraint = %f\n", constraint);
+		fprintf(stats[TEST_RND_EXCURSION], "\t\t-------------------------------------------\n");
+
+		cycleStart = 0;
+		cycleStop  = cycle[1];
+		for ( k=0; k<6; k++ )
+			for ( i=0; i<8; i++ )
+				nu[k][i] = 0.;
+		for ( j=1; j<=J; j++ ) {                           /* FOR EACH CYCLE */
+			for ( i=0; i<8; i++ )
+				counter[i] = 0;
+			for ( i=cycleStart; i<cycleStop; i++ ) {
+				if ( (S_k[i] >= 1 && S_k[i] <= 4) || (S_k[i] >= -4 && S_k[i] <= -1) ) {
+					if ( S_k[i] < 0 )
+						b = 4;
+					else
+						b = 3;
+					counter[S_k[i]+b]++;
+				}
+			}
+			cycleStart = cycle[j]+1;
+			if ( j < J )
+				cycleStop = cycle[j+1];
+			
+			for ( i=0; i<8; i++ ) {
+				if ( (counter[i] >= 0) && (counter[i] <= 4) )
+					nu[counter[i]][i]++;
+				else if ( counter[i] >= 5 )
+					nu[5][i]++;
+			}
+		}
+		
+		for ( i=0; i<8; i++ ) {
+			x = stateX[i];
+			sum = 0.;
+			for ( k=0; k<6; k++ )
+				sum += pow(nu[k][i] - J*pi[(int)fabs(x)][k], 2) / (J*pi[(int)fabs(x)][k]);
+			p_value = cephes_igamc(2.5, sum/2.0);
+			
+			if ( isNegative(p_value) || isGreaterThanOne(p_value) )
+				fprintf(stats[TEST_RND_EXCURSION], "WARNING:  P_VALUE IS OUT OF RANGE.\n");
+
+			fprintf(stats[TEST_RND_EXCURSION], "%s\t\tx = %2d chi^2 = %9.6f p_value = %f\n",
+					p_value < ALPHA ? "FAILURE" : "SUCCESS", x, sum, p_value);
+			fprintf(results[TEST_RND_EXCURSION], "%f\n", p_value);
+		}
+	} 
+	fprintf(stats[TEST_RND_EXCURSION], "\n");
+	free(S_k);
+	free(cycle);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/randomExcursionsVariant.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,90 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/cephes.h"
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+            R A N D O M  E X C U R S I O N S  V A R I A N T  T E S T
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+void
+RandomExcursionsVariant(int n)
+{
+	int		i, p, J, x, constraint, count, *S_k;
+	int		stateX[18] = { -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+	double	p_value;
+	
+	if ( (S_k = (int *)calloc(n, sizeof(int))) == NULL ) {
+		fprintf(stats[TEST_RND_EXCURSION_VAR], "\t\tRANDOM EXCURSIONS VARIANT: Insufficent memory allocated.\n");
+		return;
+	}
+	J = 0;
+	S_k[0] = 2*(int)epsilon[0] - 1;
+	for ( i=1; i<n; i++ ) {
+		S_k[i] = S_k[i-1] + 2*epsilon[i] - 1;
+		if ( S_k[i] == 0 )
+			J++;
+	}
+	if ( S_k[n-1] != 0 )
+		J++;
+
+	fprintf(stats[TEST_RND_EXCURSION_VAR], "\t\t\tRANDOM EXCURSIONS VARIANT TEST\n");
+	fprintf(stats[TEST_RND_EXCURSION_VAR], "\t\t--------------------------------------------\n");
+	fprintf(stats[TEST_RND_EXCURSION_VAR], "\t\tCOMPUTATIONAL INFORMATION:\n");
+	fprintf(stats[TEST_RND_EXCURSION_VAR], "\t\t--------------------------------------------\n");
+	fprintf(stats[TEST_RND_EXCURSION_VAR], "\t\t(a) Number Of Cycles (J) = %d\n", J);
+	fprintf(stats[TEST_RND_EXCURSION_VAR], "\t\t(b) Sequence Length (n)  = %d\n", n);
+	fprintf(stats[TEST_RND_EXCURSION_VAR], "\t\t--------------------------------------------\n");
+
+	constraint = (int)MAX(0.005*pow(n, 0.5), 500);
+	if (J < constraint) {
+		fprintf(stats[TEST_RND_EXCURSION_VAR], "\n\t\tWARNING:  TEST NOT APPLICABLE.  THERE ARE AN\n");
+		fprintf(stats[TEST_RND_EXCURSION_VAR], "\t\t\t  INSUFFICIENT NUMBER OF CYCLES.\n");
+		fprintf(stats[TEST_RND_EXCURSION_VAR], "\t\t---------------------------------------------\n");
+		for ( i=0; i<18; i++ )
+			fprintf(results[TEST_RND_EXCURSION_VAR], "%f\n", 0.0);
+	}
+	else {
+		for ( p=0; p<=17; p++ ) {
+			x = stateX[p];
+			count = 0;
+			for ( i=0; i<n; i++ )
+				if ( S_k[i] == x )
+					count++;
+			p_value = erfc(fabs(count-J)/(sqrt(2.0*J*(4.0*fabs(x)-2))));
+
+			if ( isNegative(p_value) || isGreaterThanOne(p_value) )
+				fprintf(stats[TEST_RND_EXCURSION_VAR], "\t\t(b) WARNING: P_VALUE IS OUT OF RANGE.\n");
+			fprintf(stats[TEST_RND_EXCURSION_VAR], "%s\t\t", p_value < ALPHA ? "FAILURE" : "SUCCESS");
+			fprintf(stats[TEST_RND_EXCURSION_VAR], "(x = %2d) Total visits = %4d; p-value = %f\n", x, count, p_value);
+			fprintf(results[TEST_RND_EXCURSION_VAR], "%f\n", p_value);
+		}
+	}
+	fprintf(stats[TEST_RND_EXCURSION_VAR], "\n");
+	free(S_k);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/rank.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,111 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/cephes.h"
+#include "../include/matrix.h"
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+                              R A N K  T E S T
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+void
+Rank(int n)
+{
+	int			N, i, k, r;
+	double		p_value, product, chi_squared, arg1, p_32, p_31, p_30, R, F_32, F_31, F_30;
+	
+	N = n/(32*32);
+	if ( isZero(N) ) {
+		fprintf(stats[TEST_RANK], "\t\t\t\tRANK TEST\n");
+		fprintf(stats[TEST_RANK], "\t\tError: Insuffucient # Of Bits To Define An 32x32 (%dx%d) Matrix\n", 32, 32);
+		p_value = 0.00;
+	}
+	else {
+        BitSequence **matrix = create_matrix(32, 32);
+		
+        r = 32;					/* COMPUTE PROBABILITIES */
+		product = 1;
+		for ( i=0; i<=r-1; i++ )
+			product *= ((1.e0-pow(2, i-32))*(1.e0-pow(2, i-32)))/(1.e0-pow(2, i-r));
+		p_32 = pow(2, r*(32+32-r)-32*32) * product;
+		
+		r = 31;
+		product = 1;
+		for ( i=0; i<=r-1; i++ )
+			product *= ((1.e0-pow(2, i-32))*(1.e0-pow(2, i-32)))/(1.e0-pow(2, i-r));
+		p_31 = pow(2, r*(32+32-r)-32*32) * product;
+		
+		p_30 = 1 - (p_32+p_31);
+		
+		F_32 = 0;
+		F_31 = 0;
+		for ( k=0; k<N; k++ ) {			/* FOR EACH 32x32 MATRIX   */
+			def_matrix(32, 32, matrix, k);
+#if (DISPLAY_MATRICES == 1)
+			display_matrix(32, 32, matrix);
+#endif
+			R = computeRank(32, 32, matrix);
+			if ( R == 32 )
+				F_32++;			/* DETERMINE FREQUENCIES */
+			if ( R == 31 )
+				F_31++;
+		}
+		F_30 = (double)N - (F_32+F_31);
+		
+		chi_squared =(pow(F_32 - N*p_32, 2)/(double)(N*p_32) +
+					  pow(F_31 - N*p_31, 2)/(double)(N*p_31) +
+					  pow(F_30 - N*p_30, 2)/(double)(N*p_30));
+		
+		arg1 = -chi_squared/2.e0;
+
+		fprintf(stats[TEST_RANK], "\t\t\t\tRANK TEST\n");
+		fprintf(stats[TEST_RANK], "\t\t---------------------------------------------\n");
+		fprintf(stats[TEST_RANK], "\t\tCOMPUTATIONAL INFORMATION:\n");
+		fprintf(stats[TEST_RANK], "\t\t---------------------------------------------\n");
+		fprintf(stats[TEST_RANK], "\t\t(a) Probability P_%d = %f\n", 32,p_32);
+		fprintf(stats[TEST_RANK], "\t\t(b)             P_%d = %f\n", 31,p_31);
+		fprintf(stats[TEST_RANK], "\t\t(c)             P_%d = %f\n", 30,p_30);
+		fprintf(stats[TEST_RANK], "\t\t(d) Frequency   F_%d = %d\n", 32,(int)F_32);
+		fprintf(stats[TEST_RANK], "\t\t(e)             F_%d = %d\n", 31,(int)F_31);
+		fprintf(stats[TEST_RANK], "\t\t(f)             F_%d = %d\n", 30,(int)F_30);
+		fprintf(stats[TEST_RANK], "\t\t(g) # of matrices    = %d\n", N);
+		fprintf(stats[TEST_RANK], "\t\t(h) Chi^2            = %f\n", chi_squared);
+		fprintf(stats[TEST_RANK], "\t\t(i) NOTE: %d BITS WERE DISCARDED.\n", n%(32*32));
+		fprintf(stats[TEST_RANK], "\t\t---------------------------------------------\n");
+
+		p_value = exp(arg1);
+		if ( isNegative(p_value) || isGreaterThanOne(p_value) )
+			fprintf(stats[TEST_RANK], "WARNING:  P_VALUE IS OUT OF RANGE.\n");
+
+		for ( i=0; i<32; i++ )				/* DEALLOCATE MATRIX  */
+			free(matrix[i]);
+		free(matrix);
+	}
+	fprintf(stats[TEST_RANK], "%s\t\tp_value = %f\n\n", p_value < ALPHA ? "FAILURE" : "SUCCESS", p_value);
+	fprintf(results[TEST_RANK], "%f\n", p_value);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/runs.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,80 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/cephes.h"
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+                              R U N S  T E S T 
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+void
+Runs(int n)
+{
+	int		S, k;
+	double	pi, V, erfc_arg, p_value;
+
+	S = 0;
+	for ( k=0; k<n; k++ )
+		if ( epsilon[k] )
+			S++;
+	pi = (double)S / (double)n;
+
+	if ( fabs(pi - 0.5) > (2.0 / sqrt(n)) ) {
+		fprintf(stats[TEST_RUNS], "\t\t\t\tRUNS TEST\n");
+		fprintf(stats[TEST_RUNS], "\t\t------------------------------------------\n");
+		fprintf(stats[TEST_RUNS], "\t\tPI ESTIMATOR CRITERIA NOT MET! PI = %f\n", pi);
+		p_value = 0.0;
+	}
+	else {
+
+		V = 1;
+		for ( k=1; k<n; k++ )
+			if ( epsilon[k] != epsilon[k-1] )
+				V++;
+	
+		erfc_arg = fabs(V - 2.0 * n * pi * (1-pi)) / (2.0 * pi * (1-pi) * sqrt(2*n));
+		p_value = erfc(erfc_arg);
+		
+		fprintf(stats[TEST_RUNS], "\t\t\t\tRUNS TEST\n");
+		fprintf(stats[TEST_RUNS], "\t\t------------------------------------------\n");
+		fprintf(stats[TEST_RUNS], "\t\tCOMPUTATIONAL INFORMATION:\n");
+		fprintf(stats[TEST_RUNS], "\t\t------------------------------------------\n");
+		fprintf(stats[TEST_RUNS], "\t\t(a) Pi                        = %f\n", pi);
+		fprintf(stats[TEST_RUNS], "\t\t(b) V_n_obs (Total # of runs) = %d\n", (int)V);
+		fprintf(stats[TEST_RUNS], "\t\t(c) V_n_obs - 2 n pi (1-pi)\n");
+		fprintf(stats[TEST_RUNS], "\t\t    -----------------------   = %f\n", erfc_arg);
+		fprintf(stats[TEST_RUNS], "\t\t      2 sqrt(2n) pi (1-pi)\n");
+		fprintf(stats[TEST_RUNS], "\t\t------------------------------------------\n");
+		if ( isNegative(p_value) || isGreaterThanOne(p_value) )
+			fprintf(stats[TEST_RUNS], "WARNING:  P_VALUE IS OUT OF RANGE.\n");
+
+		fprintf(stats[TEST_RUNS], "%s\t\tp_value = %f\n\n", p_value < ALPHA ? "FAILURE" : "SUCCESS", p_value);
+	}
+
+	fprintf(results[TEST_RUNS], "%f\n", p_value);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/serial.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,101 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/cephes.h"  
+
+double psi2(int m, int n);
+
+void
+Serial(int m, int n)
+{
+	double	p_value1, p_value2, psim0, psim1, psim2, del1, del2;
+	
+	psim0 = psi2(m, n);
+	psim1 = psi2(m-1, n);
+	psim2 = psi2(m-2, n);
+	del1 = psim0 - psim1;
+	del2 = psim0 - 2.0*psim1 + psim2;
+	p_value1 = cephes_igamc(pow(2, m-1)/2, del1/2.0);
+	p_value2 = cephes_igamc(pow(2, m-2)/2, del2/2.0);
+	
+	fprintf(stats[TEST_SERIAL], "\t\t\t       SERIAL TEST\n");
+	fprintf(stats[TEST_SERIAL], "\t\t---------------------------------------------\n");
+	fprintf(stats[TEST_SERIAL], "\t\t COMPUTATIONAL INFORMATION:		  \n");
+	fprintf(stats[TEST_SERIAL], "\t\t---------------------------------------------\n");
+	fprintf(stats[TEST_SERIAL], "\t\t(a) Block length    (m) = %d\n", m);
+	fprintf(stats[TEST_SERIAL], "\t\t(b) Sequence length (n) = %d\n", n);
+	fprintf(stats[TEST_SERIAL], "\t\t(c) Psi_m               = %f\n", psim0);
+	fprintf(stats[TEST_SERIAL], "\t\t(d) Psi_m-1             = %f\n", psim1);
+	fprintf(stats[TEST_SERIAL], "\t\t(e) Psi_m-2             = %f\n", psim2);
+	fprintf(stats[TEST_SERIAL], "\t\t(f) Del_1               = %f\n", del1);
+	fprintf(stats[TEST_SERIAL], "\t\t(g) Del_2               = %f\n", del2);
+	fprintf(stats[TEST_SERIAL], "\t\t---------------------------------------------\n");
+
+	fprintf(stats[TEST_SERIAL], "%s\t\tp_value1 = %f\n", p_value1 < ALPHA ? "FAILURE" : "SUCCESS", p_value1);
+	fprintf(results[TEST_SERIAL], "%f\n", p_value1);
+
+	fprintf(stats[TEST_SERIAL], "%s\t\tp_value2 = %f\n\n", p_value2 < ALPHA ? "FAILURE" : "SUCCESS", p_value2);
+	fprintf(results[TEST_SERIAL], "%f\n", p_value2);
+}
+
+double
+psi2(int m, int n)
+{
+	int				i, j, k, powLen;
+	double			sum, numOfBlocks;
+	unsigned int	*P;
+	
+	if ( (m == 0) || (m == -1) )
+		return 0.0;
+	numOfBlocks = n;
+	powLen = (int)pow(2, m+1)-1;
+	if ( (P = (unsigned int*)calloc(powLen,sizeof(unsigned int)))== NULL ) {
+		fprintf(stats[TEST_SERIAL], "Serial Test:  Insufficient memory available.\n");
+		fflush(stats[TEST_SERIAL]);
+		return 0.0;
+	}
+	for ( i=1; i<powLen-1; i++ )
+		P[i] = 0;	  /* INITIALIZE NODES */
+	for ( i=0; i<numOfBlocks; i++ ) {		 /* COMPUTE FREQUENCY */
+		k = 1;
+		for ( j=0; j<m; j++ ) {
+			if ( epsilon[(i+j)%n] == 0 )
+				k *= 2;
+			else if ( epsilon[(i+j)%n] == 1 )
+				k = 2*k+1;
+		}
+		P[k-1]++;
+	}
+	sum = 0.0;
+	for ( i=(int)pow(2, m)-1; i<(int)pow(2, m+1)-1; i++ )
+		sum += pow(P[i], 2);
+	sum = (sum * pow(2, m)/(double)n) - (double)n;
+	free(P);
+	
+	return sum;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/universal.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,125 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/utilities.h"
+#include "../include/cephes.h"
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+                         U N I V E R S A L  T E S T
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+void
+Universal(int n)
+{
+	int		i, j, p, L, Q, K;
+	double	arg, sqrt2, sigma, phi, sum, p_value, c;
+	long	*T, decRep;
+	double	expected_value[17] = { 0, 0, 0, 0, 0, 0, 5.2177052, 6.1962507, 7.1836656,
+				8.1764248, 9.1723243, 10.170032, 11.168765,
+				12.168070, 13.167693, 14.167488, 15.167379 };
+	double   variance[17] = { 0, 0, 0, 0, 0, 0, 2.954, 3.125, 3.238, 3.311, 3.356, 3.384,
+				3.401, 3.410, 3.416, 3.419, 3.421 };
+	
+	/* * * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+	 * THE FOLLOWING REDEFINES L, SHOULD THE CONDITION:     n >= 1010*2^L*L       *
+	 * NOT BE MET, FOR THE BLOCK LENGTH L.                                        *
+	 * * * * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+	L = 5;
+	if ( n >= 387840 )     L = 6;
+	if ( n >= 904960 )     L = 7;
+	if ( n >= 2068480 )    L = 8;
+	if ( n >= 4654080 )    L = 9;
+	if ( n >= 10342400 )   L = 10;
+	if ( n >= 22753280 )   L = 11;
+	if ( n >= 49643520 )   L = 12;
+	if ( n >= 107560960 )  L = 13;
+	if ( n >= 231669760 )  L = 14;
+	if ( n >= 496435200 )  L = 15;
+	if ( n >= 1059061760 ) L = 16;
+	
+	Q = 10*(int)pow(2, L);
+	K = (int) (floor(n/L) - (double)Q);	 		    /* BLOCKS TO TEST */
+	
+	p = (int)pow(2, L);
+	if ( (L < 6) || (L > 16) || ((double)Q < 10*pow(2, L)) ||
+		 ((T = (long *)calloc(p, sizeof(long))) == NULL) ) {
+		fprintf(stats[TEST_UNIVERSAL], "\t\tUNIVERSAL STATISTICAL TEST\n");
+		fprintf(stats[TEST_UNIVERSAL], "\t\t---------------------------------------------\n");
+		fprintf(stats[TEST_UNIVERSAL], "\t\tERROR:  L IS OUT OF RANGE.\n");
+		fprintf(stats[TEST_UNIVERSAL], "\t\t-OR- :  Q IS LESS THAN %f.\n", 10*pow(2, L));
+		fprintf(stats[TEST_UNIVERSAL], "\t\t-OR- :  Unable to allocate T.\n");
+		return;
+	}
+	
+	/* COMPUTE THE EXPECTED:  Formula 16, in Marsaglia's Paper */
+	c = 0.7 - 0.8/(double)L + (4 + 32/(double)L)*pow(K, -3/(double)L)/15;
+	sigma = c * sqrt(variance[L]/(double)K);
+	sqrt2 = sqrt(2);
+	sum = 0.0;
+	for ( i=0; i<p; i++ )
+		T[i] = 0;
+	for ( i=1; i<=Q; i++ ) {		/* INITIALIZE TABLE */
+		decRep = 0;
+		for ( j=0; j<L; j++ )
+			decRep += epsilon[(i-1)*L+j] * (long)pow(2, L-1-j);
+		T[decRep] = i;
+	}
+	for ( i=Q+1; i<=Q+K; i++ ) { 	/* PROCESS BLOCKS */
+		decRep = 0;
+		for ( j=0; j<L; j++ )
+			decRep += epsilon[(i-1)*L+j] * (long)pow(2, L-1-j);
+		sum += log(i - T[decRep])/log(2);
+		T[decRep] = i;
+	}
+	phi = (double)(sum/(double)K);
+
+	fprintf(stats[TEST_UNIVERSAL], "\t\tUNIVERSAL STATISTICAL TEST\n");
+	fprintf(stats[TEST_UNIVERSAL], "\t\t--------------------------------------------\n");
+	fprintf(stats[TEST_UNIVERSAL], "\t\tCOMPUTATIONAL INFORMATION:\n");
+	fprintf(stats[TEST_UNIVERSAL], "\t\t--------------------------------------------\n");
+	fprintf(stats[TEST_UNIVERSAL], "\t\t(a) L         = %d\n", L);
+	fprintf(stats[TEST_UNIVERSAL], "\t\t(b) Q         = %d\n", Q);
+	fprintf(stats[TEST_UNIVERSAL], "\t\t(c) K         = %d\n", K);
+	fprintf(stats[TEST_UNIVERSAL], "\t\t(d) sum       = %f\n", sum);
+	fprintf(stats[TEST_UNIVERSAL], "\t\t(e) sigma     = %f\n", sigma);
+	fprintf(stats[TEST_UNIVERSAL], "\t\t(f) variance  = %f\n", variance[L]);
+	fprintf(stats[TEST_UNIVERSAL], "\t\t(g) exp_value = %f\n", expected_value[L]);
+	fprintf(stats[TEST_UNIVERSAL], "\t\t(h) phi       = %f\n", phi);
+	fprintf(stats[TEST_UNIVERSAL], "\t\t(i) WARNING:  %d bits were discarded.\n", n-(Q+K)*L);
+	fprintf(stats[TEST_UNIVERSAL], "\t\t-----------------------------------------\n");
+
+	arg = fabs(phi-expected_value[L])/(sqrt2 * sigma);
+	p_value = erfc(arg);
+	if ( isNegative(p_value) || isGreaterThanOne(p_value) )
+		fprintf(stats[TEST_UNIVERSAL], "\t\tWARNING:  P_VALUE IS OUT OF RANGE\n");
+
+	fprintf(stats[TEST_UNIVERSAL], "%s\t\tp_value = %f\n\n", p_value < ALPHA ? "FAILURE" : "SUCCESS", p_value);    
+	fprintf(results[TEST_UNIVERSAL], "%f\n", p_value);
+	
+	free(T);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/utilities.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,637 @@
+/*
+* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* The original NIST Statistical Test Suite code is placed in public domain.
+* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) 
+* 
+* This software was developed at the National Institute of Standards and Technology by 
+* employees of the Federal Government in the course of their official duties. Pursuant
+* to title 17 Section 105 of the United States Code this software is not subject to 
+* copyright protection and is in the public domain. The NIST Statistical Test Suite is
+* an experimental system. NIST assumes no responsibility whatsoever for its use by other 
+* parties, and makes no guarantees, expressed or implied, about its quality, reliability, 
+* or any other characteristic. We would appreciate acknowledgment if the software is used.
+*/
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+U T I L I T I E S
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "openc.h"
+#include "../include/externs.h"
+#include "../include/utilities.h"
+#include "../include/generators.h"
+#include "../include/stat_fncs.h"
+
+
+TBuf8<KMaxFileName> gLogFilePath;
+TInt                gTemplateIndex = 1;
+
+bool ConvertToAperiodicBits(BitSequence aSequence[32], long value);
+
+
+int
+displayGeneratorOptions()
+{
+	int		option = 0;
+
+	printf("           G E N E R A T O R    S E L E C T I O N \n");
+	printf("           ______________________________________\n\n");
+	printf("    [0] Input File                 [1] Linear Congruential\n");
+	printf("    [2] Quadratic Congruential I   [3] Quadratic Congruential II\n");
+	printf("    [4] Cubic Congruential         [5] XOR\n");
+	printf("    [6] Modular Exponentiation     [7] Blum-Blum-Shub\n");
+	printf("    [8] Micali-Schnorr             [9] G Using SHA-1\n\n");
+	printf("   Enter Choice: ");
+	scanf("%d", &option);
+	printf("\n\n");
+
+	return option;
+}
+
+
+int
+generatorOptions(char** streamFile)
+{
+	char	file[200];
+	int		option = NUMOFGENERATORS+1; 
+	
+	while ( (option < 0) || (option > NUMOFGENERATORS) ) {
+		option = displayGeneratorOptions();
+		switch( option ) {
+			case 0:
+				printf("\t\tUser Prescribed Input File: ");
+				scanf("%s", file);
+				*streamFile = (char*)calloc(200, sizeof(char));
+				sprintf(*streamFile, "%s", file);
+				printf("\n");
+				break;
+			case 1:
+				*streamFile = "Linear-Congruential";
+				break;
+			case 2:
+				*streamFile = "Quadratic-Congruential-1";
+				break;
+			case 3:
+				*streamFile = "Quadratic-Congruential-2";
+				break;
+			case 4:
+				*streamFile = "Cubic-Congruential";
+				break;
+			case 5:
+				*streamFile = "XOR";
+				break;
+			case 6:
+				*streamFile = "Modular-Exponentiation";
+				break;
+			case 7:
+				*streamFile = "Blum-Blum-Shub";
+				break;
+			case 8:
+				*streamFile = "Micali-Schnorr";
+				break;
+			case 9:
+				*streamFile = "G using SHA-1";
+				break;
+				
+			/* INTRODUCE NEW PRNG NAMES HERE */
+			/*
+			case 10:  *streamFile = "myNewPRNG";
+				break;
+			*/
+			default:
+				printf("Error:  Out of range - Try again!\n");
+				break;
+		}
+	}
+	return option;
+}
+
+
+void
+chooseTests()
+{
+	int		i;
+	
+	printf("                S T A T I S T I C A L   T E S T S\n");
+	printf("                _________________________________\n\n");
+	printf("    [01] Frequency                       [02] Block Frequency\n");
+	printf("    [03] Cumulative Sums                 [04] Runs\n");
+	printf("    [05] Longest Run of Ones             [06] Rank\n");
+	printf("    [07] Discrete Fourier Transform      [08] Nonperiodic Template Matchings\n");
+	printf("    [09] Overlapping Template Matchings  [10] Universal Statistical\n");
+	printf("    [11] Approximate Entropy             [12] Random Excursions\n");
+	printf("    [13] Random Excursions Variant       [14] Serial\n");
+	printf("    [15] Linear Complexity\n\n");
+	printf("         INSTRUCTIONS\n");
+	printf("            Enter 0 if you DO NOT want to apply all of the\n");
+	printf("            statistical tests to each sequence and 1 if you DO.\n\n");
+	printf("   Enter Choice: ");
+	scanf("%d", &testVector[0]);
+	printf("\n");
+	if ( testVector[0] == 1 )
+	    {
+		for( i=1; i<=NUMOFTESTS; i++ )
+			testVector[i] = 1;
+		
+		// Disable Fast Fourier Transform Test.
+		// NIST has discovered a problem with the Fast Fourier Transform test. 
+		// At this time NIST advises disregarding the results of this test until 
+		// a further update is posted.
+		// Link: http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html
+		//
+		// When the FFT test is fixed remove the following 5 lines.
+		printf(" Please Note: \n");
+		printf(" NIST has discovered a problem with the DFT test and hence the DFT results are invalid currently.\n");
+		printf(" DFT test will be disabled at the momemt in the NIST test suite run \n \n");        
+		testVector[TEST_FFT] = 0; 
+		testVector[0] = 0; 
+	    }
+	else {
+		printf("         INSTRUCTIONS\n");
+		printf("            Enter a 0 or 1 to indicate whether or not the numbered statistical\n");
+		printf("            test should be applied to each sequence.\n\n");
+		printf("      123456789111111\n");
+		printf("               012345\n");
+		printf("      ");
+        for ( i=1; i<=NUMOFTESTS; i++ ) 
+            scanf("%1d", &testVector[i]);
+        printf("\n\n");
+    }
+}
+
+
+void
+fixParameters()
+{
+	int		counter, testid;
+	
+	//  Check to see if any parameterized tests are selected
+	if ( (testVector[TEST_BLOCK_FREQUENCY] != 1) && (testVector[TEST_NONPERIODIC] != 1) && 
+		 (testVector[TEST_OVERLAPPING] != 1) && (testVector[TEST_APEN] != 1) &&
+		 (testVector[TEST_SERIAL] != 1) && (testVector[TEST_LINEARCOMPLEXITY] != 1) )
+			return;
+		
+	do {
+		counter = 1;
+		printf("        P a r a m e t e r   A d j u s t m e n t s\n");
+		printf("        -----------------------------------------\n");
+		if ( testVector[TEST_BLOCK_FREQUENCY] == 1 )
+			printf("    [%d] Block Frequency Test - block length(M):         %d\n", counter++, tp.blockFrequencyBlockLength);
+		if ( testVector[TEST_NONPERIODIC] == 1 )
+			printf("    [%d] NonOverlapping Template Test - block length(m): %d\n", counter++, tp.nonOverlappingTemplateBlockLength);
+		if ( testVector[TEST_OVERLAPPING] == 1 )
+			printf("    [%d] Overlapping Template Test - block length(m):    %d\n", counter++, tp.overlappingTemplateBlockLength);
+		if ( testVector[TEST_APEN] == 1 )
+			printf("    [%d] Approximate Entropy Test - block length(m):     %d\n", counter++, tp.approximateEntropyBlockLength);
+		if ( testVector[TEST_SERIAL] == 1 )
+			printf("    [%d] Serial Test - block length(m):                  %d\n", counter++, tp.serialBlockLength);
+		if ( testVector[TEST_LINEARCOMPLEXITY] == 1 )
+			printf("    [%d] Linear Complexity Test - block length(M):       %d\n", counter++, tp.linearComplexitySequenceLength);
+		printf("\n");
+		printf("   Select Test (0 to continue): ");
+		scanf("%1d", &testid);
+		printf("\n");
+		
+		counter = 0;
+		if ( testVector[TEST_BLOCK_FREQUENCY] == 1 ) {
+			counter++;
+			if ( counter == testid ) {
+				printf("   Enter Block Frequency Test block length: ");
+				scanf("%d", &tp.blockFrequencyBlockLength);
+				printf("\n");
+				continue;
+			}
+		}
+		if ( testVector[TEST_NONPERIODIC] == 1 ) {
+			counter++;
+			if ( counter == testid ) {
+				printf("   Enter NonOverlapping Template Test block Length: ");
+				scanf("%d", &tp.nonOverlappingTemplateBlockLength);
+				printf("\n");
+				continue;
+			}
+		}
+		if ( testVector[TEST_OVERLAPPING] == 1 ) {
+			counter++;
+			if ( counter == testid ) {
+				printf("   Enter Overlapping Template Test block Length: ");
+				scanf("%d", &tp.overlappingTemplateBlockLength);
+				printf("\n");
+				continue;
+			}
+		}
+		if ( testVector[TEST_APEN] == 1 ) {
+			counter++;
+			if ( counter == testid ) {
+				printf("   Enter Approximate Entropy Test block Length: ");
+				scanf("%d", &tp.approximateEntropyBlockLength);
+				printf("\n");
+				continue;
+			}
+		}
+		if ( testVector[TEST_SERIAL] == 1 ) {
+			counter++;
+			if ( counter == testid ) {
+				printf("   Enter Serial Test block Length: ");
+				scanf("%d", &tp.serialBlockLength);
+				printf("\n");
+				continue;
+			}
+		}
+		if ( testVector[TEST_LINEARCOMPLEXITY] == 1 ) {
+			counter++;
+			if ( counter == testid ) {
+				printf("   Enter Linear Complexity Test block Length: ");
+				scanf("%d", &tp.linearComplexitySequenceLength);
+				printf("\n");
+				continue;
+			}
+		}
+	} while ( testid != 0 );
+}
+
+
+void
+fileBasedBitStreams(char *streamFile)
+{
+	FILE	*fp;
+	int		mode;
+	
+	printf("   Input File Format:\n");
+	printf("    [0] ASCII - A sequence of ASCII 0's and 1's\n");
+	printf("    [1] Binary - Each byte in data file contains 8 bits of data\n\n");
+	printf("   Select input mode:  ");
+	scanf("%1d", &mode);
+	printf("\n");
+	if ( mode == 0 ) {
+		if ( (fp = fopen(streamFile, "r")) == NULL ) {
+			printf("ERROR IN FUNCTION fileBasedBitStreams:  file %s could not be opened.\n",  streamFile);
+			exit(-1);
+		}
+		readBinaryDigitsInASCIIFormat(fp, streamFile);
+		fclose(fp);
+	}
+	else if ( mode == 1 ) {
+		if ( (fp = fopen(streamFile, "rb")) == NULL ) {
+			printf("ERROR IN FUNCTION fileBasedBitStreams:  file %s could not be opened.\n", streamFile);
+			exit(-1);
+		}
+		readHexDigitsInBinaryFormat(fp);
+		fclose(fp);
+	}
+}
+
+
+void
+readBinaryDigitsInASCIIFormat(FILE *fp, char *streamFile)
+{
+	int		i, j, num_0s, num_1s, bitsRead, bit;
+	
+	if ( (epsilon = (BitSequence *) calloc(tp.n, sizeof(BitSequence))) == NULL ) {
+		printf("BITSTREAM DEFINITION:  Insufficient memory available.\n");
+		printf("Statistical Testing Aborted!\n");
+		return;
+	}
+	printf("     Statistical Testing In Progress.........\n\n");   
+	for ( i=0; i<tp.numOfBitStreams; i++ ) {
+		num_0s = 0;
+		num_1s = 0;
+		bitsRead = 0;
+		for ( j=0; j<tp.n; j++ ) {
+			if ( fscanf(fp, "%1d", &bit) == EOF ) {
+				printf("ERROR:  Insufficient data in file %s.  %d bits were read.\n", streamFile, bitsRead);
+				fclose(fp);
+				free(epsilon);
+				return;
+			}
+			else {
+				bitsRead++;
+				if ( bit == 0 ) 
+					num_0s++;
+				else 
+					num_1s++;
+				epsilon[j] = (BitSequence)bit;
+			}
+		}
+		fprintf(freqfp, "\t\tBITSREAD = %d 0s = %d 1s = %d\n", bitsRead, num_0s, num_1s);
+		nist_test_suite();
+	}
+	free(epsilon);
+}
+
+
+void
+readHexDigitsInBinaryFormat(FILE *fp)
+{
+	int		i, done, num_0s, num_1s, bitsRead;
+	BYTE	buffer[4];
+	
+	if ( (epsilon = (BitSequence *) calloc(tp.n,sizeof(BitSequence))) == NULL ) {
+		printf("BITSTREAM DEFINITION:  Insufficient memory available.\n");
+		return;
+	}
+
+	printf("     Statistical Testing In Progress.........\n\n");   
+	for ( i=0; i<tp.numOfBitStreams; i++ ) {
+		num_0s = 0;
+		num_1s = 0;
+		bitsRead = 0;
+		done = 0;
+		do {
+			if ( fread(buffer, sizeof(unsigned char), 4, fp) != 4 ) {
+				printf("READ ERROR:  Insufficient data in file.\n");
+				free(epsilon);
+				return;
+			}
+			done = convertToBits(buffer, 32, tp.n, &num_0s, &num_1s, &bitsRead);
+		} while ( !done );
+		fprintf(freqfp, "\t\tBITSREAD = %d 0s = %d 1s = %d\n", bitsRead, num_0s, num_1s);
+		
+		nist_test_suite();
+		
+	}
+	free(epsilon);
+}
+
+
+int
+convertToBits(const BYTE *x, int xBitLength, int bitsNeeded, int *num_0s, int *num_1s, int *bitsRead)
+{
+	int		i, j, count, bit;
+	BYTE	mask;
+	int		zeros, ones;
+
+	count = 0;
+	zeros = ones = 0;
+	for ( i=0; i<(xBitLength+7)/8; i++ ) {
+		mask = 0x80;
+		for ( j=0; j<8; j++ ) {
+			if ( *(x+i) & mask ) {
+				bit = 1;
+				(*num_1s)++;
+				ones++;
+			}
+			else {
+				bit = 0;
+				(*num_0s)++;
+				zeros++;
+			}
+			mask >>= 1;
+			epsilon[*bitsRead] = (BitSequence)bit;
+			(*bitsRead)++;
+			if ( *bitsRead == bitsNeeded )
+				return 1;
+			if ( ++count == xBitLength )
+				return 0;
+		}
+	}
+	
+	return 0;
+}
+
+
+void
+openOutputStreams(int option)
+{
+	int		i, numOfBitStreams, numOfOpenFiles = 0;
+	char	freqfn[200], statsDir[200], resultsDir[200];
+    TBuf16<200>      logFilePath;
+    logFilePath.Copy(_L("c:\\nist"));
+
+    printf("      Directory for logs : ");
+    gConsole->Printf(logFilePath);
+    ReadStringFromConsole(logFilePath);
+    gConsole->Printf(_L("\r\n"));
+    gLogFilePath.Copy(logFilePath);
+
+    TBuf8<100> tempName;
+    TBuf<100> directoryName;
+
+    for(i = 1; i <= NUMOFTESTS; ++i)
+        {
+        tempName.Format(_L8("%s\\experiments\\%s\\%s\\"), gLogFilePath.PtrZ(),  generatorDir[option], testNames[i]);
+        directoryName.Copy(tempName);
+        gFileSession.MkDirAll(directoryName);
+        }
+	
+	sprintf(freqfn, "%s\\experiments\\%s\\freq", gLogFilePath.PtrZ(), generatorDir[option]);
+	if ( (freqfp = fopen(freqfn, "w")) == NULL ) {
+		printf("\t\tMAIN:  Could not open freq file: experiments/%s/freq", generatorDir[option]);
+		exit(-1);
+	}
+
+	TBuf8<512> finalAnalysisReport;
+    finalAnalysisReport.Format(_L8("%s\\finalAnalysisReport"), gLogFilePath.PtrZ());
+
+    if ( (summary = fopen((const char *)finalAnalysisReport.PtrZ(), "w")) == NULL ) {
+		printf("\t\tMAIN:  Could not open stats file: %s\\experiments\\%s\\finalAnalysisReport",gLogFilePath.PtrZ(), generatorDir[option]);
+		exit(-1);
+	}
+	
+	for( i=1; i<=NUMOFTESTS; i++ ) {
+		if ( testVector[i] == 1 ) {
+			sprintf(statsDir, "%s\\experiments\\%s\\%s\\stats", gLogFilePath.PtrZ(), generatorDir[option], testNames[i]);
+			sprintf(resultsDir, "%s\\experiments\\%s\\%s\\results", gLogFilePath.PtrZ(), generatorDir[option], testNames[i]);
+			if ( (stats[i] = fopen(statsDir, "w")) == NULL ) {	/* STATISTICS LOG */
+				printf("ERROR: LOG FILES COULD NOT BE OPENED.\n");
+				printf("       MAX # OF OPENED FILES HAS BEEN REACHED = %d\n", numOfOpenFiles);
+				printf("-OR-   THE OUTPUT DIRECTORY DOES NOT EXIST.\n");
+				exit(-1);
+			}
+			else
+				numOfOpenFiles++;
+			if ( (results[i] = fopen(resultsDir, "w")) == NULL ) {	/* P_VALUES LOG   */
+				 printf("ERROR: LOG FILES COULD NOT BE OPENED.\n");
+				 printf("       MAX # OF OPENED FILES HAS BEEN REACHED = %d\n", numOfOpenFiles);
+				 printf("-OR-   THE OUTPUT DIRECTORY DOES NOT EXIST.\n");
+				 exit(-1);
+			}
+			else
+				numOfOpenFiles++;
+		}
+	}
+	printf("   How many bitstreams? ");
+	scanf("%d", &numOfBitStreams);
+	tp.numOfBitStreams = numOfBitStreams;
+	printf("\n");
+}
+
+
+void
+invokeTestSuite(int option, char *streamFile)
+{
+	fprintf(freqfp, "________________________________________________________________________________\n\n");
+	fprintf(freqfp, "\t\tALPHA = %6.4f\n", ALPHA);
+	fprintf(freqfp, "________________________________________________________________________________\n\n");
+	if ( option != 0 )
+		printf("     Statistical Testing In Progress.........\n\n");
+	switch( option ) {
+		case 0:
+			fileBasedBitStreams(streamFile);
+			break;
+		case 1:
+			lcg();
+			break;
+		case 2:
+			quadRes1();
+			break;
+		case 3:
+			quadRes2();
+			break;
+		case 4:
+			cubicRes();
+			break;
+		case 5:
+			exclusiveOR();
+			break;
+		case 6:
+			modExp();
+			break;
+		case 7:
+			bbs();
+			break;
+		case 8:
+			micali_schnorr();
+			break;
+		case 9:
+			SHA1();
+			break;
+		case 10:
+		    HASH_DRBG();
+		    break;
+			
+		/* INTRODUCE NEW PSEUDO RANDOM NUMBER GENERATORS HERE */
+			
+		default:
+			printf("Error in invokeTestSuite!\n");
+			break;
+	}
+	printf("     Statistical Testing Complete!!!!!!!!!!!!\n\n");
+}
+
+
+void
+nist_test_suite()
+{
+	if ( (testVector[0] == 1) || (testVector[TEST_FREQUENCY] == 1) ) 
+		Frequency(tp.n);
+	
+	if ( (testVector[0] == 1) || (testVector[TEST_BLOCK_FREQUENCY] == 1) ) 
+		BlockFrequency(tp.blockFrequencyBlockLength, tp.n);
+	
+	if ( (testVector[0] == 1) || (testVector[TEST_CUSUM] == 1) )
+		CumulativeSums(tp.n);
+	
+	if ( (testVector[0] == 1) || (testVector[TEST_RUNS] == 1) )
+		Runs(tp.n); 
+	
+	if ( (testVector[0] == 1) || (testVector[TEST_LONGEST_RUN] == 1) )
+		LongestRunOfOnes(tp.n);
+	
+	if ( (testVector[0] == 1) || (testVector[TEST_RANK] == 1) )
+		Rank(tp.n);
+	
+	if ( (testVector[0] == 1) || (testVector[TEST_FFT] == 1) )
+	    {
+        // Disable Fast Fourier Transform Test.
+		// NIST has discovered a problem with the Fast Fourier Transform test. 
+		// At this time NIST advises disregarding the results of this test until 
+		// a further update is posted.
+		// Link: http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html
+		//
+		// When the FFT test is fixed remove the following 3 printf lines and uncomment the 4th line.
+        printf("  Please Note: NIST has discovered a problem with the DFT test and hence\n");
+        printf("  the DFT results are invalid currently.\n");
+        printf("  So all tests except DFT will run until futher notification from NIST \n \n");   
+        //DiscreteFourierTransform(tp.n);
+	    }
+	    	
+	if ( (testVector[0] == 1) || (testVector[TEST_NONPERIODIC] == 1) )
+		NonOverlappingTemplateMatchings(tp.nonOverlappingTemplateBlockLength, tp.n);
+	
+	if ( (testVector[0] == 1) || (testVector[TEST_OVERLAPPING] == 1) )
+		OverlappingTemplateMatchings(tp.overlappingTemplateBlockLength, tp.n);
+	
+	if ( (testVector[0] == 1) || (testVector[TEST_UNIVERSAL] == 1) )
+		Universal(tp.n);
+	
+	if ( (testVector[0] == 1) || (testVector[TEST_APEN] == 1) )
+		ApproximateEntropy(tp.approximateEntropyBlockLength, tp.n);
+	
+	if ( (testVector[0] == 1) || (testVector[TEST_RND_EXCURSION] == 1) )
+		RandomExcursions(tp.n);
+	
+	if ( (testVector[0] == 1) || (testVector[TEST_RND_EXCURSION_VAR] == 1) )
+		RandomExcursionsVariant(tp.n);
+	
+	if ( (testVector[0] == 1) || (testVector[TEST_SERIAL] == 1) )
+		Serial(tp.serialBlockLength,tp.n);
+	
+	if ( (testVector[0] == 1) || (testVector[TEST_LINEARCOMPLEXITY] == 1) )
+		LinearComplexity(tp.linearComplexitySequenceLength, tp.n);
+}
+
+void GetNextTemplateItem(BitSequence aBitSequence[])
+    {
+    int count = (TInt)pow(2, tp.overlappingTemplateBlockLength);
+    
+    for(bool isSuccess = false; (!isSuccess) && (gTemplateIndex < count); ++gTemplateIndex)
+        {
+        isSuccess = ConvertToAperiodicBits(aBitSequence, gTemplateIndex);
+        }
+    }
+
+
+bool ConvertToAperiodicBits(BitSequence aSequence[32], long value)
+    {
+    int bitMask = int(1U << (KMaxBit-1));
+
+    long count = tp.overlappingTemplateBlockLength;
+    
+    for(int c = 0; c < KMaxBit; c++) 
+        {
+        if (value & bitMask)
+            aSequence[c] = 1;
+        else
+            aSequence[c] = 0;
+        value <<= 1;
+        }
+
+    bool match = false;
+    
+    for(int i = 1; i < count; i++) 
+        {
+        match = false;
+        if ((aSequence[KMaxBit-count]!= aSequence[KMaxBit-1]) && ((aSequence[KMaxBit-count]!= aSequence[KMaxBit-2])||(aSequence[KMaxBit-count+1] != aSequence[KMaxBit-1]))) 
+            {
+            for(int c = KMaxBit-count; c <= (KMaxBit-1)-i; c++) 
+                {
+                if (aSequence[c] != aSequence[c+i]) 
+                    {
+                    match = true;
+                    break;
+                    }
+                }
+            }
+        
+        if (!match) 
+            {
+            break;
+            }
+        }
+
+    return match;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/utils/openc.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,616 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*/
+
+
+//------------------------------------ System Header Files ------------------------------------------------
+#include <e32cons.h>        // ConsoleBase
+//------------------------------------ Local Header Files -------------------------------------------------
+#include "openc.h"
+
+//-------------------------------- Constants, global variables and Macro Definitions ----------------------------------------
+_LIT(KConsoleName, "NIST Test Console");
+CConsoleBase* gConsole = NULL;
+
+
+int PrintToScreen(const char* aString);
+
+const TInt KIntStringLen = 10;
+RFs gFileSession;
+
+enum TDataType
+    {
+    EInteger,
+    EFloat,
+    EUnknownType = 0x10000
+    };
+
+const TInt KMaxReadSize = 50;
+const TInt KMaxScreenBufferSize = 100;
+
+TBuf<KMaxScreenBufferSize> gScreenBuffer;
+
+class GlobalInitilizer
+    {
+public:
+    GlobalInitilizer()
+        {
+        TInt err = gFileSession.Connect();
+
+        if(err != KErrNone)
+            {
+            User::Exit(err);
+            }
+
+        TRAP(err, gConsole = Console::NewL(KConsoleName, TSize(KConsFullScreen,KConsFullScreen)));
+        if(err != KErrNone)
+            {
+            User::Exit(err);
+            }
+        }
+    ~GlobalInitilizer()
+        {
+        gFileSession.Close();
+        delete gConsole;
+        }
+    };
+
+GlobalInitilizer globalObj;
+
+//------------------------------------ Function Definitions -----------------------------------------------
+
+double log(double aSource)
+    {
+    double result = 0.0;
+    Math::Ln(result, aSource);
+    return result;
+    }
+
+double exp(double aSource)
+    {
+    double result = 0.0;
+    Math::Exp(result, aSource);
+    return result;
+    }
+
+double fabs(double aSource)
+    {
+    return (aSource >= 0.0)? aSource: -aSource;
+    }
+
+
+double floor(double aSource)
+    {
+    if(aSource >= 0.0 || aSource == (TInt64)aSource)
+        {
+        return (double)(TInt64)aSource;
+        }
+   
+    return (double)((TInt64)aSource - 1);
+    }
+
+double sqrt(double aSource)
+    {
+    double result = 0.0;
+    Math::Sqrt(result, aSource);
+    return result;
+    }
+
+double pow(double aSource, double aPower)
+    {
+    double result = 0.0;
+    Math::Pow(result, aSource, aPower);
+    return result;
+    }
+
+// Math trigonometric functions
+double sin(double aSource)
+    {
+    double result = 0.0;
+    Math::Sin(result, aSource);
+    return result;
+    }
+
+double cos(double aSource)
+    {
+    double result = 0.0;
+    Math::Cos(result, aSource);
+    return result;
+    }
+
+// Stdio functions
+int printf(const char* aFormatString, ...)
+    {
+    TUint length = User::StringLength((TUint8*)aFormatString) + 100;
+    HBufC8* buffer = HBufC8::New(length);
+    if(NULL == buffer)
+        {
+        return KErrNoMemory;
+        }
+    
+    TPtr8 targetPtr = buffer->Des();
+    TPtrC8 formatPtr((TUint8*)aFormatString);
+
+    VA_LIST list;
+    VA_START(list, aFormatString);
+    
+    targetPtr.FormatList(formatPtr, list);
+    
+    PrintToScreen((const char*)targetPtr.PtrZ());
+
+    delete buffer;
+
+    return targetPtr.Length();
+    }
+
+int puts(const char* aString)
+    {
+    int ret = PrintToScreen(aString);
+    gConsole->Printf(_L("\n"));
+    
+    return ret;
+    }
+
+int putchar(int aChar)
+    {
+    gConsole->Printf(_L("%c"), aChar);
+    return aChar;
+    }
+
+char* strcpy(char* aDst, const char* aSrc)
+    {
+    char* cp = aDst;
+
+    while((*cp++ = *aSrc++) != 0)
+        ; // Copy src over dst
+
+    return(aDst);
+    }
+
+int scanf(const char* aFormatString, ...)
+    {
+    TDataType type = EUnknownType;
+    TBool byteRead = EFalse;
+    
+    if(Mem::Compare((const unsigned char*)aFormatString, 2, (const unsigned char*)"%d", 2) == 0)
+        {
+        type = EInteger;
+        }
+    else if(Mem::Compare((const unsigned char*)aFormatString, 2, (const unsigned char*)"%f", 2) == 0)
+        {
+        type = EFloat;
+        }
+    else if(Mem::Compare((const unsigned char*)aFormatString, 3, (const unsigned char*)"%1d", 3) == 0)
+        {
+        type = EInteger;
+        byteRead = ETrue;
+        }
+    else
+        {
+        User::Panic(_L("NIST TestSuit Error"), KErrArgument);
+        }
+    
+    if(!byteRead || (gScreenBuffer.Length() == 0))
+        {
+        ReadStringFromConsole(gScreenBuffer);
+        }
+
+    TLex parser(gScreenBuffer);
+    parser.SkipSpace();
+    
+    VA_LIST list;
+    VA_START(list, aFormatString);
+
+    switch(type)
+        {
+        case EInteger:
+            {
+            TInt* ptr = VA_ARG(list, TInt*);
+            if(byteRead)
+                {
+                TChar ch(gScreenBuffer[0]);
+                gScreenBuffer.Delete(0, 1);
+                *ptr = ch.GetNumericValue();
+                }
+            else
+                {
+                parser.Val(*ptr);
+                gScreenBuffer.Zero();
+                }
+            break;
+            }
+        case EFloat:
+            {
+            float* ptr = VA_ARG(list, float*);
+            parser.Val(*ptr);
+            gScreenBuffer.Zero();
+            break;
+            }
+        case EUnknownType:
+            {
+            User::Panic(_L("NIST TestSuit Error"), KErrArgument);
+            }
+        }
+
+    return 1;
+    }
+
+int sprintf(char *aBuffer, const char* aFormatString, ...)
+    {
+    TUint length = User::StringLength((TUint8*)aFormatString) + 100;
+    TPtr8 aTargetPtr((TUint8*)aBuffer, length);
+    TPtrC8 formatPtr((TUint8*)aFormatString);
+
+    VA_LIST list;
+    VA_START(list, aFormatString);
+    
+    aTargetPtr.FormatList(formatPtr, list);
+    aTargetPtr.ZeroTerminate();
+
+    return User::StringLength((TUint8*)aBuffer);;
+    }
+
+int GetFileMode(const char* aModeStr, TFileMode& aFileMode, TBool& aIsAppend)
+    {
+    aIsAppend = EFalse;
+    switch (*aModeStr)
+        {
+        case 'r':
+            aFileMode = EFileRead;
+            break;
+            
+        case 'w':
+            aFileMode = EFileWrite;
+            break;
+            
+        case 'a':
+            aFileMode = EFileWrite;
+            aIsAppend = ETrue;
+            break;
+            
+        default:
+            return KErrArgument;
+        } 
+      
+    return KErrNone;
+    }
+
+FILE *fopen(const char *aFileName, const char *aMode)
+    {
+    TPtrC8 fileNamePtr(reinterpret_cast<const unsigned char*>(aFileName));
+    TFileName fileName;
+    fileName.Copy(fileNamePtr);
+    RFile* file = new RFile;
+    if(NULL == file)
+        {
+        return NULL;
+        }
+
+    TFileMode mode = EFileRead;
+    TBool isAppend = EFalse;
+    GetFileMode(aMode, mode, isAppend);
+    int err = KErrArgument;
+    switch(mode)
+        {
+        case EFileRead:
+            {
+            err = file->Open(gFileSession, fileName, mode);
+            break;
+            }
+        case EFileWrite:
+            {
+            if(isAppend)
+                {
+                err = file->Open(gFileSession, fileName, mode);
+                if(err == KErrNone)
+                    {
+                    TInt offset = 0;
+                    err = file->Seek(ESeekEnd, offset);
+                    break;
+                    }
+                }
+            
+            err = file->Replace(gFileSession, fileName, mode);
+            break;
+            }
+        default:
+            err = KErrArgument;
+        }
+
+    if(KErrNone != err)
+        {
+        file->Close();
+        delete file;
+        file = NULL;
+        }
+    return file;
+    }
+
+
+
+int fclose(FILE *aFp)
+    {
+    if(NULL != aFp)
+        {
+        aFp->Close();
+        delete aFp;
+        }
+    return KErrNone;
+    }
+
+int fprintf(FILE* aFile, const char* aFormatString, ...)
+    {
+    TUint length = User::StringLength((TUint8*)aFormatString) + 100;
+    HBufC8* buffer = HBufC8::New(length);
+    if(NULL == buffer)
+        {
+        return KErrNoMemory;
+        }
+    
+    TPtr8 targetPtr = buffer->Des();
+    TPtrC8 formatPtr((TUint8*)aFormatString);
+
+    VA_LIST list;
+    VA_START(list, aFormatString);
+    
+    targetPtr.FormatList(formatPtr, list);
+    targetPtr.ZeroTerminate();
+    
+    aFile->Write(targetPtr);
+    
+    delete buffer;
+
+    return targetPtr.Length();
+    }
+
+int fscanf(FILE* aFp, const char * aFormatString, ...)
+    {
+    TDataType type = EUnknownType;
+    TBool byteRead = EFalse;
+    
+    if(Mem::Compare((const unsigned char*)aFormatString, 2, (const unsigned char*)"%d", 2) == 0)
+        {
+        type = EInteger;
+        }
+    else if(Mem::Compare((const unsigned char*)aFormatString, 2, (const unsigned char*)"%f", 2) == 0)
+        {
+        type = EFloat;
+        }
+    else if(Mem::Compare((const unsigned char*)aFormatString, 3, (const unsigned char*)"%1d", 3) == 0)
+        {
+        type = EInteger;
+        byteRead = ETrue;
+        }
+    else
+        {
+        User::Panic(_L("NIST TestSuit Error"), KErrArgument);
+        }
+    
+    TInt initialOffset = 0;
+    aFp->Seek(ESeekCurrent, initialOffset);
+    TBuf8<KMaxReadSize + 1> readBuffer;
+    aFp->Read(readBuffer, KMaxReadSize);
+    readBuffer.ZeroTerminate();
+    TLex8 parser(readBuffer);
+    parser.SkipSpace();
+    
+    VA_LIST list;
+    VA_START(list, aFormatString);
+
+    switch(type)
+        {
+        case EInteger:
+            {
+            TInt* ptr = VA_ARG(list, TInt*);
+            TChar ch = parser.Peek();
+            
+            if(!ch.IsDigit())
+                {
+                break;
+                }
+            
+            if(byteRead)
+                {
+                ch = parser.Get();
+                *ptr = ch.GetNumericValue();
+                }
+            else
+                {
+                parser.Val(*ptr);
+                }
+
+            break;
+            }
+        case EFloat:
+            {
+            float* ptr = VA_ARG(list, float*);
+            parser.Val(*ptr);
+            break;
+            }
+        case EUnknownType:
+            {
+            User::Panic(_L("NIST TestSuit Error"), KErrArgument);
+            }
+        }
+
+    TInt len = initialOffset + parser.Offset();
+    aFp->Seek(ESeekStart, len);
+    
+    return 1;
+    }
+
+TUint32 fread(void* aPtr, TUint32 aSize, TUint32 aCount, FILE* aFile)
+    {
+    TUint32 size = aSize * aCount;
+    TPtr8 dataPtr((TUint8*)aPtr, size);
+    TInt err = aFile->Read(dataPtr);
+    if(KErrNone != err)
+        {
+        size = (TUint32)dataPtr.Length();
+        }
+    return size;
+    }
+
+int fseek(FILE* aFile, long aOffset, int aWhence)
+    {
+    int ret = KErrNone;
+    int fileOffset = aOffset;
+    switch(aWhence)
+        {
+        case SEEK_SET:
+            {
+            ret = aFile->Seek(ESeekStart, fileOffset);
+            break;
+            }
+        case SEEK_CUR:
+            {
+            ret = aFile->Seek(ESeekCurrent, fileOffset);
+            break;
+            }
+        case SEEK_END:
+            {
+            ret = aFile->Seek(ESeekEnd, fileOffset);
+            break;
+            }
+        default:
+            User::Panic(_L("NIST TestSuit Error"), KErrArgument);
+        }
+    
+    return ret;
+    }
+
+
+
+int fflush(FILE *aFile)
+    {
+    TInt err = aFile->Flush();
+    if(err != KErrNone)
+        {
+        err = EOF;
+        }
+    return err;
+    }
+
+
+// Conio functions
+void* calloc(TUint32 aElementCount, TUint32 aSize)
+    {
+    aSize *= aElementCount;
+    return User::AllocZ(aSize);
+    }
+
+void free(void *aMemory)
+    {
+    User::Free(aMemory);
+    }
+
+TBool IsCharacterKey(TKeyCode aKey)
+    {
+    if(aKey > EKeyEscape && aKey < EKeyDelete)
+        {
+        return ETrue;
+        }
+    
+    return EFalse;
+    }
+
+_LIT(KLineBreaker, "\r\n");
+
+void ReadStringFromConsole(TDes& aString)
+    {
+    // This infinte loop terminates when user hits an "enter" key
+    FOREVER
+        {
+        // Get a key(character) from the console
+        TKeyCode ch = gConsole->Getch();
+        
+        switch(ch)
+            {
+            case EKeyEnter:
+                {
+                if(aString.Length() == 0)
+                    {
+                    break;// At least one character should be read.
+                    }
+                gConsole->Printf(KLineBreaker);
+                return;
+                }
+            case EKeyBackspace:
+                {
+                if(0 != aString.Length())
+                    {
+                    // Back-space only takes the cursor one position back
+                    // So to delete a character blank-space is inserted at
+                    // that position and later cursor is again adjusted.
+                    gConsole->Printf(_L("%c%c%c"), EKeyBackspace, 
+                                                   EKeySpace, 
+                                                   EKeyBackspace);
+                    // Delete the character from the target string also. 
+                    aString.Delete(aString.Length() - 1, 1);
+                    }
+                break;
+                }
+            default:
+                {
+                TInt maxBufferLength = aString.MaxLength();
+                // IsCharacterKey will return true if ch is a displayable
+                // character else it will return false.
+                if(IsCharacterKey(ch) && aString.Length() != maxBufferLength)
+                    {
+                    gConsole->Printf(_L("%c"), ch);
+                    aString.Append(ch);
+                    }
+                }
+            }
+        }
+    }
+  
+TInt ReadIntL(TInt& aValue)
+    {
+    TBuf<KIntStringLen> string;
+    ReadStringFromConsole(string);
+    TLex lexObj(string);
+    return lexObj.Val(aValue);
+    }
+
+int PrintToScreen(const char* aString)
+    {
+    TUint length = User::StringLength((TUint8*)aString);
+    HBufC* buffer = HBufC::New(length);
+    if(NULL == buffer)
+        {
+        return EOF;
+        }
+    
+    TPtr targetPtr = buffer->Des();
+
+    TPtrC8 stringPtr((TUint8*)aString);
+
+    targetPtr.Copy(stringPtr);
+    gConsole->Printf(targetPtr);
+    
+    delete buffer;
+    
+    return KErrNone;
+    }
+
+void exit ( int status )
+    {
+    User::Exit(status);
+    for(;;){} // So that GCC compiler don't complain about noreturn function returns.
+    }
+
+//------------------------------------------  E  O  F -----------------------------------------------------
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32utils/nistsecurerng/src/utils/qsort.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Map ANSI bsearch and qsort onto EPOC32 functions 
+*/
+
+#include <e32std.h>
+#include "openc.h"
+
+NONSHARABLE_CLASS(TAnsiKey) : public TKey
+	{
+public:
+	TAnsiKey(const TAny* key, const TAny* base, TInt length, TInt (*compar)(const TAny*, const TAny*))
+		: iSearchKey(key), iCmp(compar)
+		{ SetPtr(base); iKeyLength=length; }
+
+	virtual TInt Compare(TInt aLeft,TInt aRight) const;
+	virtual TAny *At(TInt anIndex) const;
+private:
+	const TAny* iSearchKey;
+	TInt (*iCmp)(const TAny*, const TAny*);
+	};
+
+TInt TAnsiKey::Compare (TInt aLeft,TInt aRight) const
+	{
+	if (aRight==KIndexPtr)
+		return (*iCmp)(At(aLeft),iSearchKey);
+	else
+		return (*iCmp)(At(aLeft),At(aRight));
+	}
+
+TAny* TAnsiKey::At (TInt aPos) const
+	{
+	return (TUint8*)iPtr+(aPos*iKeyLength);
+	}
+
+NONSHARABLE_CLASS(TAnsiSwap) : public TSwap
+	{
+public:
+	TAnsiSwap(const TAny* base, TInt length) : iPtr(base), iLength(length) {}
+
+	virtual void Swap(TInt aLeft,TInt aRight) const;
+private:
+	TUint8* At(TInt aPos) const {return (TUint8*)iPtr+(aPos*iLength);}
+
+	const TAny* iPtr;
+	TInt  iLength;
+	};
+
+void TAnsiSwap::Swap(TInt aLeft,TInt aRight) const
+	{
+	TUint8* left=At(aLeft);
+	TUint8* right=At(aRight);
+	TUint8 tmp;
+
+	for (TInt i=iLength; i>0; i--)
+		{
+		tmp=*left;
+		*left++=*right;
+		*right++=tmp;
+		}
+	}
+
+/*
+FUNCTION
+<<bsearch>>---binary search
+
+INDEX
+	bsearch
+
+ANSI_SYNOPSIS
+	#include <stdlib.h>
+	void *bsearch(const void *<[key]>, const void *<[base]>,
+		size_t <[nmemb]>, size_t <[size]>,
+		int (*<[compar]>)(const void *, const void *));
+
+TRAD_SYNOPSIS
+	#include <stdlib.h>
+	char *bsearch(<[key]>, <[base]>, <[nmemb]>, <[size]>, <[compar]>)
+	char *<[key]>;
+	char *<[base]>;
+	size_t <[nmemb]>, <[size]>;
+	int (*<[compar]>)();
+
+DESCRIPTION
+<<bsearch>> searches an array beginning at <[base]> for any element
+that matches <[key]>, using binary search.  <[nmemb]> is the element
+count of the array; <[size]> is the size of each element.
+
+The array must be sorted in ascending order with respect to the
+comparison function <[compar]> (which you supply as the last argument of
+<<bsearch>>).
+
+You must define the comparison function <<(*<[compar]>)>> to have two
+arguments; its result must be negative if the first argument is
+less than the second, zero if the two arguments match, and
+positive if the first argument is greater than the second (where
+``less than'' and ``greater than'' refer to whatever arbitrary
+ordering is appropriate).
+
+RETURNS
+Returns a pointer to an element of <[array]> that matches <[key]>.  If
+more than one matching element is available, the result may point to
+any of them. Returns NULL if no matching element is found.
+
+PORTABILITY
+<<bsearch>> is ANSI.
+
+No supporting OS subroutines are required.
+*/
+
+/**
+searches an array beginning at <[base]> for any element
+that matches <[key]>, using binary search
+@return a pointer to an element of <[array]> that matches <[key]>.  If
+more than one matching element is available, the result may point to
+any of them. Returns NULL if no matching element is found.
+@param key
+@param base
+@param nmemb
+@param size
+*/
+void* bsearch (const void* key, const void* base, TUint32 nmemb, TUint32 size,
+	int (*compar)(const void*, const void*))
+	{
+	TAnsiKey searchMe(key, base, size, compar);
+	TInt result=KIndexPtr;
+	TInt r=User::BinarySearch(nmemb, searchMe, result);
+	if (r==0)
+		return searchMe.At(result);
+	else
+		return NULL;
+	}
+
+/*
+FUNCTION
+<<qsort>>---sort an array
+
+INDEX
+	qsort
+
+ANSI_SYNOPSIS
+	#include <stdlib.h>
+	void qsort(void *<[base]>, size_t <[nmemb]>, size_t <[size]>,
+		   int (*<[compar]>)(const void *, const void *) );
+
+TRAD_SYNOPSIS
+	#include <stdlib.h>
+	qsort(<[base]>, <[nmemb]>, <[size]>, <[compar]> )
+	char *<[base]>;
+	size_t <[nmemb]>;
+	size_t <[size]>;
+	int (*<[compar]>)();
+
+DESCRIPTION
+<<qsort>> sorts an array (beginning at <[base]>) of <[nmemb]> objects.
+<[size]> describes the size of each element of the array.
+
+You must supply a pointer to a comparison function, using the argument
+shown as <[compar]>.  (This permits sorting objects of unknown
+properties.)  Define the comparison function to accept two arguments,
+each a pointer to an element of the array starting at <[base]>.  The
+result of <<(*<[compar]>)>> must be negative if the first argument is
+less than the second, zero if the two arguments match, and positive if
+the first argument is greater than the second (where ``less than'' and
+``greater than'' refer to whatever arbitrary ordering is appropriate).
+
+The array is sorted in place; that is, when <<qsort>> returns, the
+array elements beginning at <[base]> have been reordered.
+
+RETURNS
+<<qsort>> does not return a result.
+
+PORTABILITY
+<<qsort>> is required by ANSI (without specifying the sorting algorithm).
+*/
+
+/**
+Sort an array.
+@param base 
+@param nmemb
+@param size describes the size of each element of the array
+*/
+void qsort (void* base, TUint32 nmemb, TUint32 size,
+	int (*compar)(const void*, const void*))
+	{
+	TAnsiKey  searchMe(NULL, base, size, compar);
+	TAnsiSwap swapUs(base,size);
+	User::QuickSort(nmemb, searchMe, swapUs);
+	return;
+	}
+
Binary file kerneltest/e32utils/nistsecurerng/testdata/testdata.zip has changed
--- a/kerneltest/e32utils/trace/btracevw.pl	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1952 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of the License "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-#!/usr/bin/perl
-
-use File::Find;
-use File::Spec::Functions;
-
-
-	my $TraceFileName;
-	
-	my $PrintFlagFilePos = 0;
-	my $PrintFlagHdrLen = 0;
-	my $PrintFlagHdrFlags = 0;
-	my $PrintFlagFormatString = 0;
-	my $VerboseMode = 0;
-	my $RawMode = 0;
-	my $FormatIdIsSubCategory = 0;
-	my $OutputSawDictionaryMode = 0;
-	
-	# for the category range 0-191, the format string is indexed by the category & subcategory
-	%FormatTables = 
-		(
-		0 => 			# ERDebugPrintf
-			{
-			0 => "ThreadId %h, %s",
-			},
-	
-		1 => 			# ERKernPrintf
-			{
-			0 => "ThreadId %h, %s",
-			},
-
-		3 =>			# EThreadIdentification
-			{	
-			0 => "ENanoThreadCreate, NThread %x",
-			1 => "ENanoThreadDestroy, NThread %x",
-			2 => "EThreadCreate, NThread %x, DProcess %x, name %s",
-			3 => "EThreadDestroy, NThread %x, DProcess %x, Id %x",
-			4 => "EThreadName, NThread %x, DProcess %x, name %s",
-			5 => "EProcessName, NThread %x, DProcess %x, name %s",
-			6 => "EThreadId, NThread %x, DProcess %x, Id %x",
-			7 => "EProcessCreate, DProcess %x",
-			8 => "EProcessDestroy, DProcess %x",
-			},
-		);
-
-	my @typedefs;
-	my @members;
-	my %values	= (
-#		UTF::KInitialClientFormat		=>	{type=>"TFormatId", size=>2, value=>512}
-		KMaxTUint8						=> {type=>"TUint8", size=>1, value=>255},
-		KMaxTUint16						=> {type=>"TUint16", size=>2, value=>65535}
-	);
-	my %macros;
-	my @classes;
-	my @enums;
-	my %formatStrings;		# each enum may have it's own format string
-	my %formatCategories;	# each enum may have it's own format category
-	
-	my %filescope;
-	$filescope{file}=1;
-	undef $filescope{name};	
-
-	$filescope{typedefs}=\@typedefs;
-	$filescope{members}=\@members;
-	$filescope{values}=\%values;
-	$filescope{macros} = \%macros;
-	$filescope{FormatTables} = \%FormatTables;
-	
-	$filescope{classes} = \@classes;
-	$filescope{enums} = \@enums;
-
-	$filescope{formatStrings} =\%formatStrings;
-	$filescope{formatCategories} = \%formatCategories;
-	
-		
-		
-	if (@ARGV == 0)
-  		{
-  		print "BTraceVw.pl \n";
-  		print "An unsupported utility which extracts UTrace-style format-strings\n";
-  		print "from header files & uses these to decode a BTrace output file\n";
-  		print "Syntax : BTraceVw.pl [-v] [-r] [-sd] [-i <IncFilePath>] [<BTrace file>]\n";
-  		print "where  : -v  = verbose mode\n";
-  		print "       : -r  = raw output mode\n";
-  		print "       : -sd = produce SAW trace viewer dictionary file\n";
-  		print "       :       this file then needs to be merged into the 'com.symbian.analysis.trace.ui.prefs' file\n";
-  		print "       :       located under the carbide workspace directory\n";
-		print "\n";
-  		
-		print "e.g. (this decodes a trace file & produces a comma-separated output file) : \n";
-		print "btracevw.pl -i /os/kernelhwsrv/userlibandfileserver/fileserver/inc/f32tracedef.h -i /os/kernelhwsrv/userlibandfileserver/fileserver/inc/utraceefsrv.h -i /os/kernelhwsrv/userlibandfileserver/fileserver/inc/utraceefile.h trace.utf >trace.csv\n";
-		print "\n";
-		print "e.g. (this overwrites the SAW dictioany file) : \n";
-		print "btracevw.pl -sd -i /os/kernelhwsrv/userlibandfileserver/fileserver/inc/f32tracedef.h -i /os/kernelhwsrv/userlibandfileserver/fileserver/inc/utraceefsrv.h -i /os/kernelhwsrv/userlibandfileserver/fileserver/inc/utraceefile.h >com.symbian.analysis.trace.ui.prefs\n";
-  		
-		exit;
-		}
-
-	while (@ARGV > 0)
-		{
-		
-		if ($ARGV[0] eq "-i")
-	        {
-	        shift @ARGV;
-		    ($FilePath) = @ARGV;
-	        shift @ARGV;
-
-	        undef @incFiles;
-		    @incFiles;
-		
-		    find sub { push @incFiles, $File::Find::name if m/\.h$/i;}, $FilePath ;
-		    foreach $incFile (@incFiles)
-		        {
-				H2Trace($incFile, \%filescope);
-		        }
-	        }
-		elsif ($ARGV[0] eq "-r")
-	        {
-		    $RawMode = 1;
-   	        shift @ARGV;
-	        }
-		elsif ($ARGV[0] eq "-sd")
-	        {
-		    $OutputSawDictionaryMode = 1;
-   	        shift @ARGV;
-	        }
-		elsif ($ARGV[0] eq "-v")
-	        {
-		    $VerboseMode = 1;
-   	        shift @ARGV;
-	        }
-	    else
-	    	{
-			$TraceFileName = "$ARGV[0]";
-	        shift @ARGV;
-	    	}
-        }
-		
-	if ($VerboseMode)
-		{
-		dump_scope(\%filescope);
-		PrintFormatTables(\%FormatTables);
-		}
-	if ($OutputSawDictionaryMode)
-		{
-		OutputSawDictionary(\%FormatTables);
-		}
-
-    if (defined ($TraceFileName))
-        {
-        ReadTraceFile($RawMode);
-        }
-
-        
-        
-        
-sub ReadTraceFile($)
-    {
-	(my $RawMode) = @_;
-#	print "Trace file is $TraceFileName, RawMode $RawMode, VerboseMode $VerboseMode\n\n";
-
-	open (LOGFILE, "<$TraceFileName") or die "Can't open $TraceFileName: $!\n";
-	binmode (LOGFILE);
-
-	my $val = 0;
-
-
-	# enum TFlags from e32btrace.h
-	$EHeader2Present	= 1<<0;
-	$ETimestampPresent	= 1<<1;
-	$ETimestamp2Present	= 1<<2;
-	$EContextIdPresent	= 1<<3;
-	$EPcPresent			= 1<<4;
-	$EExtraPresent		= 1<<5;
-	$ERecordTruncated	= 1<<6;
-	$EMissingRecord		= 1<<7;
-	
-	# enum TFlags2 from e32btrace.h
-	$EMultipartFlagMask	= 3<<0;
-	$ECpuIdMask			= 0xfff<<20;
-
-	# enum TMultiPart from e32btrace.h
-	$EMultipartFirst	= 1;
-	$EMultipartMiddle	= 2;
-	$EMultipartLast		= 3;
-	
-	$EMaxBTraceDataArray = 80;
-	
-	# enum TCategory from e32btrace.h
-	$EThreadIdentification = 3;
-	
-	# enum TThreadIdentification from e32btrace.h
-	$EThreadCreate = 2;
-	$EThreadName = 4;
-	$EProcessName = 5;
-	$EThreadId = 6;
-	
-	# Context Id bits from e32btrace.h
-	$EContextIdMask = 0x00000003;
-	$EContextIdThread = 0;
-	$EContextIdFIQ = 0x1;
-	$EContextIdIRQ = 0x2;
-	$EContextIdIDFC = 0x3;
-
-	# enum TClassificationRange from e32btraceu.h
-	$EAllRangeFirst = 192;
-	$EAllRangeLast = 222;
-
-	%TCategoryIdToString = 
-		(
-		0 => "ERDebugPrintf",
-		1 => "EKernPrintf",
-		2 => "EPlatsecPrintf",
-		3 => "EThreadIdentification",
-		4 => "ECpuUsage",
-        5 => "EKernPerfLog",
-        6 => "EClientServer",
-        7 => "ERequests",
-        8 => "EChunks",
-        9 => "ECodeSegs",
-		10 => "EPaging",
-		11 => "EThreadPriority",
-		12 => "EPagingMedia",
-		13 => "EKernelMemory",
-		14 => "EHeap",
-		15 => "EMetaTrace",
-		16 => "ERamAllocator",
-		17 => "EFastMutex",
-		18 => "EProfiling", 
-        19 => "EResourceManager",
-        20 => "EResourceManagerUs",
-		21 => "ERawEvent ",
-		128 => "EPlatformSpecificFirst",
-		191 => "EPlatformSpecificLast",
-		192 => "ESymbianExtentionsFirst",
-
-		# UTrace "ALL" range 
-		192 => "EPanic",
-		193 => "EError",
-		194 => "EWarning", 
-		195 => "EBorder", 
-		196 => "EState", 
-		197 => "EInternals", 
-		198 => "EDump", 
-		199 => "EFlow", 
-		200 => "ESystemCharacteristicMetrics", 
-		201 => "EAdhoc",
-
-		253 => "ESymbianExtentionsLast",
-		254 => "ETest1",
-		255 => "ETest2",
-		);
-
-
-	%ProcessNames;
-	%ThreadNames;
-	%ThreadIds;
-	
-	
-	# print column titles
-	if ($PrintFlagFilePos) {printf "FilePos, ";}	# col #0
-	if ($PrintFlagHdrLen) {	printf "Len, ";}		# col #1
-	if ($PrintFlagHdrFlags) {printf "Flags, "; }	# col #2
-	printf "Category, ";			# col #3
-	printf "TimeStamp, ";			# col #4
-	printf "Delta, ";				# col #5
-	printf "context Id, ";			# col #6
-	printf "PC, ";					# col #7
-	printf "UID, ";					# col #8
-	if ($PrintFlagFormatString){printf "Format string, ";}	# col #9
-	printf "Formatted text, ";		# col #10
-	print "\n\n";
-
-	
-	while (1)
-		{
-		my $pos = tell (LOGFILE);
-		
-		# print file pos (col #0)
-		if ($PrintFlagFilePos){	printf ("0x%08X, ", $pos);}
-		
-		my $category;
-		my $subCategory;
-		my $multipartFlags = 0;
-		my $recordData = "";
-		my $recordLen;
-		my $recordPos = 0;
-		
-		$recordLen = ReadRecord(LOGFILE, \$pos, \$recordData, \$category, \$subCategory, \$multipartFlags, $RawMode);
-		if ($recordLen == -1)
-			{last;}
-
-			
-		if (!$RawMode && ($multipartFlags == $EMultipartMiddle || $multipartFlags == $EMultipartLast))
-			{next;}
-					
-#		print record contents
-#		my $buf;
-#					for (my $i=0; $i < $recordLen; $i+=4)
-#						{
-#		$buf.= sprintf ("%08X ", unpack("V", substr($recordData, $recordPos+$i, 4)));
-#						}
-#		printf "\n[$buf\n]";				
-
-
-		# for UTrace "ALL" range, read UID 
-		if ($category >= $EAllRangeFirst && $category <= $EAllRangeLast && 
-			(!$RawMode) && $multipartFlags != $EMultipartMiddle && $multipartFlags != $EMultipartLast)
-			{
-			$uid = unpack("V", substr($recordData, $recordPos, 4));
-			$recordPos+= 4;	
-
-			# then read formatID			
-			$FormatIdIsSubCategory = ($subCategory != 0) ? 1 : 0;
-			if ($FormatIdIsSubCategory)
-				{
-				$formatId = $subCategory
-				}
-			else				
-				{
-				$formatId = unpack("V", substr($recordData, $recordPos, 4));
-  				$recordPos+= 4;
-				}
-			}
-		
-					
-		# print UID (col #8)
-		printf "0x%08X, ", $uid;
-
-			
-		my $formatTable;
-		my $formatString;
-		if ($category >= $EAllRangeFirst && $category <= $EAllRangeLast)
-			{
-			$formatString = $FormatTables{$uid}{$formatId};
-			}
-		else
-			{
-			$formatString = $FormatTables{$category}{$subCategory};
-			}
-
-
-		# Get thread names
-		if ($category == $EThreadIdentification)
-			{
-			if ($subCategory == $EProcessName)
-				{
-				my $process = unpack("V", substr($recordData, 4, 4));
-				my $processName = substr($recordData, 8, $recordLen - 8);	
-#				printf ("\nprocess [%08X] processName [$processName]\n", $process);
-				$ProcessNames{$process} = $processName;
-				}
-			elsif ($subCategory == $EThreadCreate || $subCategory == $EThreadName)
-				{
-				my $thread = unpack("V", substr($recordData, 0, 4));
-				my $process = unpack("V", substr($recordData, 4, 4));
-				my $threadName = substr($recordData, 8, $recordLen - 8);	
-#				printf ("\nprocess [%08X] thread [%08X] threadName [$threadName]\n", $process, $thread, $threadName);
-				$ThreadNames{$thread} = $ProcessNames{$process} . "::" . $threadName;
-				}
-			elsif ($subCategory == $EThreadId)
-				{
-				my $thread = unpack("V", substr($recordData, 0, 4));
-				my $process = unpack("V", substr($recordData, 4, 4));
-				my $threadId = unpack("V", substr($recordData, 8, 4));
-#				printf ("\nprocess [%08X] thread [%08X] threadId [%08X]\n", $process, $thread, $threadId);
-				$ThreadIds{$thread} = $threadId;
-				}
-			}
-			
-			
-		# print Format string (col #9)
-		if ($PrintFlagFormatString)
-			{
-			my $formatStringWithoutCommas = $formatString;
-			$formatStringWithoutCommas=~ s/,/ /g;
-			printf "%s, ", $formatStringWithoutCommas;
-			}
-
-		my $formattedText;
-		
-		my $lenFormatString = length($formatString);
-		if ($lenFormatString && !$RawMode && $multipartFlags != $EMultipartMiddle && $multipartFlags != $EMultipartLast)
-			{
-			for (my $i=0; $i<$lenFormatString; $i++)
-				{
-				my $c = (substr ($formatString, $i, 1));
-#				printf "$c\n";
-				if ($c eq "%")
-					{
-					undef my $fieldLen;
-					$i++;
-	        		$c = (substr ($formatString, $i, 1));
-					if ($c eq "%")
-						{
-						$formattedText.= substr ($formatString, $i, 1);
-						next;
-						}
-					if ($c eq "*")	## take length from buffer
-						{
-						$fieldLen = unpack("V", substr($recordData, $recordPos, 4));
-						if ($fieldLen > $recordLen-$recordPos)
-							{
-							$formattedText.= "*** Invalid field length ***";
-							last;
-							}
-						$recordPos+= 4;
-						$i++;
-		        		$c = (substr ($formatString, $i, 1));
-						}
-					if (lc $c eq "x" || $c eq "h")
-						{
-						if (defined $fieldLen)
-							{
-							if (($fieldLen & 3) == 0)
-								{
-								for (my $i=0; $i< $fieldLen; $i+= 4)
-									{
-									$formattedText.= sprintf ("%08X ", unpack("V", substr($recordData, $recordPos, 4)));
-									$recordPos+= 4;
-									}
-								}
-							else
-								{
-								for (my $i=0; $i< $fieldLen; $i++)
-									{
-									$formattedText.= sprintf ("%02X ", unpack("C", substr($recordData, $recordPos, 1)));
-									$recordPos++;
-									}
-								}
-							}
-						else
-							{
-							$formattedText.= sprintf ("0x%08X", unpack("V", substr($recordData, $recordPos, 4)));
-							$recordPos+= 4;
-							}
-						$recordPos = ($recordPos + 3) & ~3;
-						next;
-						}
-					# display "%ld" as hex for now as don't know how to get perl to use or display a 64 decimal value
-					elsif (lc $c eq "l" && substr ($formatString, $i+1, 1) eq "d")
-						{
-						$i++;
-						my $loWord = unpack("V", substr($recordData, $recordPos, 4));
-						$recordPos+= 4;
-						my $hiWord = unpack("V", substr($recordData, $recordPos, 4));
-						$recordPos+= 4;
-						$formattedText.= sprintf ("0x%X:%08X", $hiWord, $loWord);
-						}
-					elsif (lc $c eq "l" && substr ($formatString, $i+1, 1) eq "x")
-						{
-						$i++;
-						my $loWord = unpack("V", substr($recordData, $recordPos, 4));
-						$recordPos+= 4;
-						my $hiWord = unpack("V", substr($recordData, $recordPos, 4));
-						$recordPos+= 4;
-						$formattedText.= sprintf ("0x%X:%08X", $hiWord, $loWord);
-						}
-					elsif (lc $c eq "d")
-						{
-						$formattedText.= sprintf ("%d", unpack("V", substr($recordData, $recordPos, 4)));
-						$recordPos+= 4;
-						$recordPos = ($recordPos + 3) & ~3;
-						next;
-						}
-					elsif ($c eq "s")
-						{
-						if (!defined $fieldLen) 
-							{$fieldLen = $recordLen - $recordPos;}
-						$formattedText.= substr($recordData, $recordPos, $fieldLen);
-						$recordPos+= $fieldLen; 
-						$recordPos = ($recordPos + 3) & ~3;
-						next;
-						}
-					elsif ($c eq "S")
-						{
-						if (!defined $fieldLen) 
-							{$fieldLen = $recordLen-$recordPos;}
-						for (my $j=0; $j < $fieldLen; $j+=2)
-							{
-					        my $byte = unpack("c", substr ($recordData, $recordPos+$j, 1));
- 							$formattedText.= sprintf ("%c", $byte);
-							}
-						$recordPos+= $fieldLen; 
-						$recordPos = ($recordPos + 3) & ~3;
-						next;
-						}
-					elsif ($c eq "c")
-						{
-				        my $byte = unpack("c", substr ($recordData, $recordPos, 1));
-						$formattedText.= sprintf ("%c", $byte);
-						}
-					}
-				else
-					{
-					$formattedText.= $c;
-					}
-				}
-			}
-		else	# no format string : print as hex
-			{
-			for (my $i=0; $i < $recordLen; $i+=4)
-				{
-				$formattedText.= sprintf ("%08X ", unpack("V", substr($recordData, $i, 4)));
-				}
-			$recordPos+= $recordLen; $recordLen = 0;
-			
-			}
-		
-
-		# print Formatted text (col #10)
-		$formattedText=~ s/,/;/g;
-		$formattedText=~ s/\r//g;
-		$formattedText=~ s/\n/,/g;
-		printf "%s", $formattedText;
-
-		printf("\n");
-
-		if ($len < 0 || $recordLen < 0)	{die "truncated file";}
-  
-
-		$pos+= ($len +3) & ~3;
-		seek (LOGFILE, $pos, SEEK_SET) or die "truncated file";
-		$i++;
-		}
-
-	close (LOGFILE);
-
-	if ($VerboseMode)
-		{
-		print "*** Processes ***\n";
-		for $id ( keys %ProcessNames )
-			{
-			printf ("process %08X ProcessName %s\n", $id, $ProcessNames{$id});
-			}
-		print "*** Thread ***\n";
-		for $id ( keys %ThreadNames )
-			{
-			printf ("thread %08X ThreadName %s::%X\n", $id, $ThreadNames{$id}, $ThreadIds{$id});
-			}
-		}
-
-    }
-
-    
-sub ReadSingleRecord
-	{
-	($fh, $data, $dataLen, $recordLen, $category, $subCategory, $multipartFlags, $extraN, $totalLen, $offset, $RawMode) = @_;	
-	
-	my $hdr;
-	my $flags;
-	my $header2;
-	my $timestamp;
-	my $timestamp2;
-	my $contextId;
-	my $programConter;	
-	
-	my $recordOffset = 0;
-	
-	$timestampLast;	
-	my $timestampDelta = 0;	
-	
-	my $bytesRead = read($fh, $hdr, 4);
-	
-	
-	if ($bytesRead < 4)	
-		{return -1;}
-
-	($$recordLen,$flags,$$category,$$subCategory) = unpack("CCCC", $hdr);
-	$$dataLen = $$recordLen-4;
-	
-	if ($flags & $EHeader2Present)
-		{$$multipartFlags = (ReadDword($fh) & $EMultipartFlagMask); $$dataLen-= 4}
-	else
-		{$$multipartFlags = 0;}
-	if ($flags & $ETimestampPresent)
-		{$timestamp = ReadDword($fh); $$dataLen-= 4;}
-	if ($flags & $ETimestamp2Present)
-		{$timestamp2 = ReadDword($fh); $$dataLen-= 4;}
-	if ($flags & $EContextIdPresent)
-		{$contextId = ReadDword($fh); $$dataLen-= 4;}
-	if ($flags & $EPcPresent)
-		{$programConter = ReadDword($fh); $$dataLen-= 4;}
-	if ($flags & $EExtraPresent)
-		{$$extraN = ReadDword($fh); $$dataLen-= 4;}
-	if ($$multipartFlags != 0)
-		{
-		$$totalLen = ReadDword($fh);  $$dataLen-= 4;
-		if ($$multipartFlags == $EMultipartMiddle || $$multipartFlags == $EMultipartLast)
-			{$$offset = ReadDword($fh);  $$totalLen-= 4; $$dataLen-= 4;}
-		}				
-
-	$timestampDelta = $timestamp - $timestampLast;
-	$timestampLast = $timestamp;
-
-	read($fh, $$data, ($$dataLen + 3) & ~3);
-
-
-	if ($RawMode || $$multipartFlags == $EMultipartFirst || $$multipartFlags == 0)
-		{
-		# print header len (col #1)
-		if ($PrintFlagHdrLen){printf ("0x%02X, ", $$recordLen);}
-	
-		# print header flags (col #2)
-		if ($PrintFlagHdrFlags)
-			{
-			printf ("%02X ", $flags);
-			if ($flags & $EHeader2Present) {printf "EHeader2Present ";}
-			if ($flags & $ETimestampPresent) {printf "ETimestampPresent ";}
-			if ($flags & $ETimestamp2Present) {printf "ETimestamp2Present ";}
-			if ($flags & $EContextIdPresent) {printf "EContextIdPresent ";}
-			if ($flags & $EPcPresent) {printf "EPcPresent ";}
-			if ($$multipartFlags != 0)
-				{
-				printf "EExtraPresent ";
-				if ($$multipartFlags == $EMultipartFirst) {print "EMultipartFirst ";}
-				elsif ($$multipartFlags == $EMultipartMiddle) {print "EMultipartMiddle ";}
-				elsif ($$multipartFlags == $EMultipartLast) {print "EMultipartLast ";}
-				printf ("ExtraN(0x%08X) ", $$extraN);
-				}
-			if ($flags & $ERecordTruncated) {printf "ERecordTruncated ";}
-			if ($flags & $EMissingRecord) {printf "EMissingRecord ";}
-			print ",";
-			}
-				
-		# print category (col #3)
-		printf "(%d;%d) $categoryString  , ", $$category, $$subCategory;
-	
-		# print timestamp(s) (col #4)
-		printf "0x";
-		if (defined $timestamp2) {printf "%08X : ", $timestamp2;}
-		printf "%08X", $timestamp;
-		printf ", ";;
-	
-		# print timestamp delta (col #5)
-		printf "0x%08X, ", $timestampDelta;
-
-		# print context Id (col #6)
-		if (!$RawMode && defined $ThreadNames{$contextId})
-			{
-			printf ("%s::%X, ", $ThreadNames{$contextId}, $ThreadIds{$contextId});
-			}
-		else			
-			{
-			if ((($contextId & $EContextIdMask) == $EContextIdThread) || $RawMode)
-				{printf "0x%08X, ", $contextId;}
-			elsif (($contextId & $EContextIdMask) == $EContextIdFIQ)
-				{printf "FIQ, ";}
-			elsif (($contextId & $EContextIdMask) == $EContextIdIRQ)
-				{printf "IRQ, ";}
-			elsif (($contextId & $EContextIdMask) == $EContextIdIDFC)
-				{printf "IDFC, ";}
-			}
-	
-		# print Program Counter (col #7)
-		printf "0x%08X, ", $programConter;
-		}
-
-		
-	
-	
-#########################################################
-#	my $hex;
-#	for (my $i=0; $i < $$dataLen; $i+=4)
-#		{
-#		$hex.= sprintf ("%08X ", unpack("V", substr($$data, $i, 4)));
-#		}
-#	printf "\nadding [$hex]\n";
-#########################################################
-	return $bytesRead
-	}
-
-	      
-sub ReadRecord 
-	{
-	($fh, $recordPos, $recordData, $category, $subCategory, $multipartFlags, $RawMode) = @_;
-#	printf "CurrentPos %08X\n", $pos;
-
-
-
-	seek ($fh, $$recordPos, SEEK_SET) or die "truncated file";
-	my $recordLen;
-	my $extraN;
-	my $totalLen;
-	my $offset;
-	my $dataLen;
-	my $data;
-	my $bytesRead;
-	
-	
-	$bytesRead = ReadSingleRecord($fh,  \$data, \$dataLen, \$recordLen, \$$category, \$$subCategory, \$$multipartFlags, \$extraN, \$totalLen, \$offset, $RawMode);
-
-	if ($bytesRead == -1)	# eof ?
-		{return -1; }
-	$$recordPos+= ($recordLen +3) & ~3;
-	
-	$$recordData = $data;
-    $offset = $dataLen;
-
-	$offset-= 4;		# subtract 4 bytes for UID ?????????
-    
-    if ($RawMode || $$multipartFlags != $EMultipartFirst)
-    	{return $dataLen;}
-
-    $pos = $$recordPos;
-
-	while (1)
-		{
-		
-		# find next record, i.e. look for a record which matches $extraN 
-		
-		seek ($fh, $pos, SEEK_SET) or die "truncated file";
-
-		my $recordLen;
-		
-		my $category;
-		my $subCategory;
-		my $multipartFlags;
-		my $currentExtraN;
-		my $currentOffset;
-		
-		my $totalLen;
-		my $currentDataLen;
-		my $data;
-		$bytesRead = ReadSingleRecord($fh, \$data, \$currentDataLen, \$recordLen, \$category, \$subCategory, \$multipartFlags, \$currentExtraN, \$totalLen, \$currentOffset, $RawMode);
-		if ($bytesRead == -1)	# eof ?
-			{return -1; }
-		$pos+= ($recordLen +3) & ~3;
-		
-#		printf "\npos %08X, Seaching for (extra %08X, offset %08X), found (extra %08X, offset %08X)\n",
-#			$pos, $extraN, $offset, $currentExtraN, $currentOffset;
-
-		if ($currentExtraN == $extraN && $currentOffset == $offset)
-			{
-			$$recordData.= $data;
-			$offset+= $currentDataLen;
-			$dataLen+= $currentDataLen;
-			}
-			
-		if ($multipartFlags == $EMultipartLast)
-			{last;}
-		}
-	
-	return $dataLen;
-	}	
-
-sub ReadDword {
-	(my $fh) = @_;
-	my $buffer;
-
-	$bytesRead = read($fh, $buffer, 4);
-	if ($bytesRead < 4) 	{die "truncated file";}
-
-	my $dword = unpack("V", $buffer);
-
-	return $dword
-	};
-
-sub ReadByte {
-	(my $fh) = @_;
-	my $buffer;
-
-	$bytesRead = read($fh, $buffer, 1);
-	if ($bytesRead < 1) 	{die "truncated file";}
-
-	my $byte = unpack("C", $buffer);
-
-	return $byte
-	};
-
-    
-	
-sub PrintFormatTables($)
-	{
-	my ($formatTables) = @_;
-		
-	for $tableIndex ( sort keys %$formatTables )
-		{
-		printf ("SYMTraceFormatCategory %08X:\n", $tableIndex);
-		for $formatId (sort keys %{ $$formatTables{$tableIndex} } )
-			{
-			printf ("%08X => %s\n", $formatId, $$formatTables{$tableIndex}{$formatId});
-			}
-			print "\n";
-		}
-	}
-        
-
-
-sub OutputSawDictionary($)
-	{
-	my ($formatTables) = @_;
-
-
-	# SAW enums
-	$EFieldTypeHexDump = 0;
-	$EFieldTypeHex = 1;
-	$EFieldTypeDecimal = 2;
-	$EFieldTypeStringToEnd = 3;
-	$EFieldTypeNullTerminatedString = 4;
-	$EFieldTypeHexDumpToEnd = 5;
-	$EFieldTypeUnicodeToEnd = 6;
-	$EFieldTypeNullTerminatedUnicode = 7;
-	$EFieldTypeCountedUnicode = 8;
-	$EFieldTypeCountedHexDump = 9;
-	$EFieldTypeCountedString = 10;
-
-	my $moduleIds;	# string containg all UIDs separared by semi-colons
-		
-	for $tableIndex ( sort keys %$formatTables )
-		{
-		if ($tableIndex < 256)
-			{
-			next;
-			}
-		$moduleIds.= sprintf ("%08X;", $tableIndex);
-		
-		printf ("MODULEID_%08X_DESC=\n", $tableIndex);
-		printf ("MODULEID_%08X_NAME=%08X\n", $tableIndex, $tableIndex);
-		
-		my $formatIds;
-		$formatIds = sprintf ("MODULEID_%08X_FORMATIDS=", $tableIndex);
-		
-		for $formatId  (sort keys %{ $$formatTables{$tableIndex} } )
-			{
-			$formatIds.= sprintf ("%d;", $formatId);
-			}
-		printf ("$formatIds\n");
-		
-		
-		for $formatId (sort keys %{ $$formatTables{$tableIndex} } )
-			{
-			my $fieldCount = 0;
-			my $formatString = $$formatTables{$tableIndex}{$formatId};
-			
-#printf ("formatString = (%s)\n", $formatString);
-
-			# format name is the first format string up until the first space or '%' character or end-of line ...
-			$formatString=~ m/^[^%\s]*/;
-			my $formatName = $&;
-			
-			# thow the format name away
-			$formatString = $';
-			
-			# strip the leading space
-			$formatString=~ s/\s*//;
-
-			printf ("MODULEID_%08X_FORMATID_%d_NAME=%s\n", $tableIndex, $formatId, $formatName);
-#printf ("MODULEID_%08X_FORMATID_%d_DESC=\n", $tableIndex, $formatId);
-
-			my $lenFormatString = length($formatString);
-			
-			my $formattedText;
-			my $fieldType = $EFieldTypeHex;
-			my $fieldLen = 0;
-			while (length($formatString))
-				{
-				my $c = (substr ($formatString, 0, 1));
-#print ("[$formatString][$c]\n");				
-				$formatString=~ s/.//;	# strip the leading space
-				if ($c eq "%")
-					{
-#print "found %\n";							
-					my $fieldLenSpecified = 0;
-	        		$c = (substr ($formatString, 0, 1));
-					$formatString=~ s/.//;	# discard char
-#print "c2=$c\n";							
-					if ($c eq "%")
-						{
-						$formattedText.= substr ($formatString, 0, 1);
-						next;
-						}
-					if ($c eq "*")	## take length from buffer
-						{
-						$fieldLenSpecified = 1;
-		        		$c = (substr ($formatString, 0, 1));
-						$formatString=~ s/.//;	# discard char
-						}
-					if (lc $c eq "x" || $c eq "h")
-						{
-						## deal wilth $fieldLenSpecified
-						if ($fieldLenSpecified)
-							{
-							$fieldType = $EFieldTypeCountedHexDump;
-							$fieldLen = 0;
-							}
-						else
-							{
-							$fieldType = $EFieldTypeHex;
-							$fieldLen = 4;
-							}
-						}
-					elsif (lc $c eq "l" && substr ($formatString, 0, 1) eq "d")
-						{
-						$formatString=~ s/.//;	# discard char
-						$fieldType = $EFieldTypeDecimal;
-						$fieldLen = 8;
-						}
-					elsif (lc $c eq "l" && substr ($formatString, 0, 1) eq "x")
-						{
-						$formatString=~ s/.//;	# discard char
-						$fieldType = $EFieldTypeHex;
-						$fieldLen = 8;
-						}
-					elsif (lc $c eq "d")
-						{
-						$fieldType = $EFieldTypeDecimal;
-						$fieldLen = 4;
-						}
-					elsif ($c eq "s")
-						{
-						## deal wilth $fieldLenSpecified
-						if ($fieldLenSpecified)
-							{
-							$fieldType = $EFieldTypeCountedString;
-							$fieldLen = 0;
-							}
-						else
-							{
-							$fieldType = $EFieldTypeStringToEnd;
-							$fieldLen = 0;
-							}
-						}
-					elsif ($c eq "S")
-						{
-						## deal wilth $fieldLenSpecified
-						if ($fieldLenSpecified)
-							{
-							$fieldType = $EFieldTypeCountedUnicode;
-							$fieldLen = 0;
-							}
-						else
-							{
-							$fieldType = EFieldTypeUnicodeToEnd;
-							$fieldLen = 0;
-							}
-						}
-					elsif ($c eq "c")
-						{
-						$fieldType = $EFieldTypeHex;
-						$fieldLen = 1;
-						}
-					printf ("MODULEID_%08X_FORMATID_%d_FIELD_%d_NAME=%s\n", $tableIndex, $formatId, $fieldCount, $formattedText);
-					printf ("MODULEID_%08X_FORMATID_%d_FIELD_%d_TYPE=%s\n", $tableIndex, $formatId, $fieldCount, $fieldType);
-					if ($fieldLen > 0)
-						{printf ("MODULEID_%08X_FORMATID_%d_FIELD_%d_LENGTH=%s\n", $tableIndex, $formatId, $fieldCount, $fieldLen);}
-					$fieldCount++;
-					$formattedText="";
-					
-					$formatString=~ s/\s//;	# strip the leading space
-					}
-				else
-					{
-#					if ($c eq ":") {$formattedText.= '\\'; }
-					$formattedText.= $c;
-					}
-				}
-			printf ("MODULEID_%08X_FORMATID_%d_FIELDS=%d\n", $tableIndex, $formatId, $fieldCount);
-			
-			}
-		print "MODULEIDS=$moduleIds\n";
-		}
-	}
-	
-	
-	
-	
-	
-	
-	        
-        
-sub H2Trace($$)
-{
-	%basictypes = (
-		TInt8		=>	1,
-		TUint8		=>	1,
-		TInt16		=>	2,
-		TUint16		=>	2,
-		TInt32		=>	4,
-		TUint32		=>	4,
-		TInt		=>	4,
-		TUint		=>	4,
-		TBool		=>	4,
-		TInt64		=>	8,
-		TUint64		=>	8,
-		TLinAddr	=>	4,
-		TVersion	=>	4,
-		TPde		=>	4,
-		TPte		=>	4,
-		TProcessPriority => 4,
-		TFormatId	=>  2,
-	);
-	
-	if (scalar(@_)!= 2) {
-		die "perl h2trace.pl <input.h>\n";
-	}
-	my ($infile, $filescope) = @_;
-	
-	if ($VerboseMode)
-		{print "\nOpening $infile\n";}
-	
-	open IN, $infile or die "Can't open $infile for input\n";
-	my $in;
-	while (<IN>) {
-		$in.=$_;
-	}
-	close IN;
-	
-	# First remove any backslash-newline combinations
-	$in =~ s/\\\n//gms;
-	
-	# Remove any character constants
-	$in =~  s/\'(.?(${0})*?)\'//gms;
-	
-	# Strip comments beginning with //
-	$in =~ s/\/\/(.*?)\n/\n/gms;    #//(.*?)\n
-	
-	# Strip comments (/* */) but leave doxygen comments (/** */)
-	$in =~ s/\/\*[^*](.*?)\*\//\n/gms;  #/*(.*?)*/
-	
-	
-	# Collapse whitespace into a single space or newline
-	$in =~ s/\t/\ /gms;
-	$in =~ s/\r/\ /gms;
-	
-	# Tokenize on non-identifier characters
-	my @tokens0 = split(/(\W)/,$in);
-	my @tokens;
-	my $inString = 0;
-	my $inComment = 0;
-	my $string;
-	foreach $t (@tokens0) {
-		next if ($t eq "");
-		next if (!$inString && ($t eq " " or $t eq ""));
-		if ($inComment == 0) 
-			{
-			if ($t eq "/")
-				{$inComment = 1;}
-			}
-		elsif ($inComment == 1) 
-			{
-			if ($t eq "*")
-				{$inComment = 2;}
-			else
-				{$inComment = 0;}
-			}
-		elsif ($inComment == 2) 
-			{
-			if ($t eq "*")
-				{$inComment = 3;}
-			}
-		elsif ($inComment == 3) 
-			{
-			if ($t eq "/")
-				{
-				$inComment = 0;
-		        # if we were in a string, need to push previous '*'
-		        if ($inString)
-		          {
-		          push @tokens, "*";
-		          }
-				$inString = 0;	# end of comment aborts a string
-				$string = "";
-				}
-			else
-				{$inComment = 2;}
-			}
-			
-		if ($t eq "\"")
-			{
-			if (!$inString) 
-				{
-				$inString=1;
-				next;
-				}
-			else
-				{
-				$inString=0;
-				$t = $string;
-				$string = "";
-#				if ($VerboseMode) {print "string : [$t]\n";	}
-				}
-			}
-			
-		if ($inString)
-			{
-			$string.= $t;
-			next;
-			}
-		push @tokens, $t;
-	}
-	
-	my $CurrentTraceFormatString;
-	my $CurrentTraceFormatCategory;
-	# format Key as specified by the @TraceFormatCategory tag is either the current category 
-	# or the current UID
-	my $CurrentFormatTableKey;	
-	
-	
-	my $line=1;
-	parse_scope($filescope, \@tokens, \$line);
-
-	#print $in;
-	#print join (" ", @tokens);
-}	# end of     H2Trace
-	
-
-
-	sub parse_scope($$$) {
-		my ($scope, $tokens, $line) = @_;
-		my $state = 1;
-		
-		my @classes;
-		my $curr_offset=0;
-		my $overall_align=0;
-#		print ">parse_scope $scope->{name}\n";
-		
-		while (scalar(@$tokens))
-			{
-			my $t = shift @$tokens;
-#			printf "t: [$t] [$$line]\n";
-	    	if (!defined ($t)) {
-	      		printf "undefined !";
-	      		next;
-	      	}
-			if ($state>=-1 and $t eq "\n") {
-				++$$line;
-				$state=1;
-				next;
-			} elsif ($state==-1 and $t ne "\n") {
-				next;
-			} elsif ($state==-2 and $t ne ';') {
-				next;
-			}
-			
-			if ($state>0 and $t eq '#') {
-				$t = shift @$tokens;
-				if ($t eq 'define') {
-					my $ident = shift @$tokens;
-					my $defn = shift @$tokens;
-					if ($defn ne '(') {	# don't do macros with parameters
-#					print "MACRO: $ident :== $defn\n";
-					$macros{$ident} = $defn;
-					}
-				}
-				$state=-1;	# skip to next line
-				next;
-			}
-			
-			
-			if (parse_doxygen($scope,$tokens, $line, $t) == 1)
-				{next;}
-	
-			if ($t eq "namespace" ) {
-				$state=0;
-				my %cl;
-				$cl{specifier}=$t;
-				$cl{scope}=$scope;
-				$cl{values}=$scope->{values};
-				$cl{members}=\$scope->{members};
-				$cl{typedefs}=\$scope->{typedefs};
-				$cl{FormatTables}=$scope->{FormatTables};
-				$cl{formatStrings} =$scope->{formatStrings};
-				$cl{formatCategories} =$scope->{formatCategories};
-				
-				my $new_namespace = \%cl;
-				my $n = get_token($scope,$tokens,$line);
-				if ($n !~ /\w+/) {
-					warn "Unnamed $t not supported at line $$line\n";
-					return;
-				}
-				$new_namespace->{name}=$n;
-				my @class_match = grep {$_->{name} eq $n} @classes;
-				my $exists = scalar(@class_match);
-				my $b = get_token($scope,$tokens,$line);
-				if ($b eq ':') {
-					die "Inheritance not supported at line $$line\n";
-				} elsif ($b eq ';') {
-					# forward declaration
-					push @classes, $new_namespace unless ($exists);
-					next;
-				} elsif ($b ne '{') {
-					warn "Syntax error#1 at line $$line\n";
-					return;
-				}
-				if ($exists) {
-					$new_namespace = $class_match[0];
-					if ($new_namespace->{complete}) {
-						warn "Duplicate definition of $cl{specifier} $n\n";
-					}
-				}
-				push @classes, $new_namespace unless ($exists);
-				parse_scope($new_namespace, $tokens, $line);
-				next;
-			}
-			
-			if ($t eq "struct" or $t eq "class" or $t eq "NONSHARABLE_CLASS") {
-				next if ($state==0);
-				$state=0;
-				my %cl;
-				$cl{specifier}=$t;
-				$cl{scope}=$scope;
-				my @members;
-				my @typedefs;
-				$cl{members}=\@members;
-				$cl{typedefs}=\@typedefs;
-				$cl{FormatTables}=$scope->{FormatTables};
-				my $new_class = \%cl;
-				my $n;
-
-				if ($t eq "NONSHARABLE_CLASS")
-					{
-					my $b = get_token($scope,$tokens,$line);
-					if ($b !~ /\(/) {die "Syntax error at line $$line\n";}
-					$n = get_token($scope,$tokens,$line);
-  				$b = get_token($scope,$tokens,$line);
-					if ($b !~ /\)/) {die "Syntax error at line $$line\n";}
-					}
-				else					
-					{
-					$n = get_token($scope,$tokens,$line);
-					}
-								
-				
-				if ($n !~ /\w+/) {
-					warn "Unnamed $t not supported at line $$line\n";
-					return;
-				}
-				$new_class->{name}=$n;
-				my @class_match = grep {$_->{name} eq $n} @classes;
-				my $exists = scalar(@class_match);
-				my $b = get_token($scope,$tokens,$line);
-				#skip inheritance etc until we get to a '{' or \ ';'
-				while ($b ne '{' && $b ne ';')
-					{
-			        $b = get_token($scope,$tokens,$line);
-			        die "Syntax error#2 at line $$line\n" if  (!defined $b);
-					}
-				if ($b eq ';') {
-					# forward declaration
-					push @classes, $new_class unless ($exists);
-					next;
-				} 
-				if ($exists) {
-					$new_class = $class_match[0];
-					if ($new_class->{complete}) {
-						warn "Duplicate definition of $cl{specifier} $n\n";
-					}
-				}
-				push @classes, $new_class unless ($exists);
-				parse_scope($new_class, $tokens, $line);
-				next;
-			} elsif ($t eq "enum") {
-				$state=0;
-				my $n = get_token($scope,$tokens,$line);
-				my $name="";
-				if ($n =~ /\w+/) {
-					$name = $n;
-					$n = get_token($scope,$tokens,$line);
-				}
-				push @enums, $name;
-				if ($n ne '{') {
-					die "Syntax error#4 at line $$line\n";
-				}
-				parse_enum($scope, $tokens, $line, $name);
-				next;
-			} elsif ($t eq '}') {
-				$state=0;
-				if ($scope->{scope}) {
-			        if ($scope->{specifier} eq "namespace")
-			        	{
-						$scope->{complete}=1;
-#						print "Scope completed\n";
-						last;
-						}
-					$t = get_token($scope,$tokens,$line);
-					# skip to next ';'
-					while (defined ($t) and $t ne ';')
-						{$t = get_token($scope,$tokens,$line);}
-					die "Syntax error#5 at line $$line\n" if ($t ne ';');
-					$scope->{complete}=1;
-#					print "Scope completed\n";
-					last;
-				}
-				warn "Syntax error#5 at line $$line\n";
-				return;
-			}
-			$state=0;
-			if ($scope->{scope}) {
-				if ($t eq "public" or $t eq "private" or $t eq "protected") {
-					if (shift (@$tokens) eq ':') {
-						next;	# ignore access specifiers
-					}
-				die "Syntax error#6 at line $$line\n";
-				}
-			}
-			unshift @$tokens, $t;
-			
-			my @currdecl = parse_decl_def($scope, $tokens, $line);
-#			print scalar (@currdecl), "\n";
-			if ($t eq 'static') {
-				next;	# skip static members
-			}
-			my $typedef;
-			if ($t eq 'typedef') {
-#			print "TYPEDEF\n";
-				$typedef = 1;
-				$t = shift @currdecl;
-				$t = $currdecl[0];
-			} else {
-#			print "NOT TYPEDEF\n";
-				$typedef = 0;
-			}
-#			print "$currdecl[0]\n";
-			next if (scalar(@currdecl)==0);
-			
-			if ($t eq "const") {
-				# check for constant declaration
-#				print "CONST $currdecl[1] $currdecl[2] $currdecl[3]\n";
-				my $ctype = lookup_type($scope, $currdecl[1]);
-#				print "$ctype->{basic}    $ctype->{size}\n";
-				if ($ctype->{basic} and $currdecl[2]=~/^\w+$/ and $currdecl[3] eq '=') {
-					if ($typedef!=0) {
-						die "Syntax error#7 at line $$line\n";
-					}
-					shift @currdecl;
-					shift @currdecl;
-					my $type = $ctype->{name};
-					my $name;		#### = shift @currdecl;
-
-					if ($scope->{name})
-						{	
-						$name = $scope->{name} . "::" . shift @currdecl;
-						}
-					else
-						{
-						$name = shift @currdecl;
-						}
-#					printf "[$name,$scope->{name}]";
-					my $size = $ctype->{size};
-					shift @currdecl;
-					my $value = get_constant_expr($scope,\@currdecl,$line);
-					$values{$name} = {type=>$type, size=>$size, value=>$value};
-					next;
-				}
-			}
-			
-			
-			
-		}
-	}
-	
-	sub get_token($$$) {
-		my ($scope,$tokenlist,$line) = @_;
-		while (scalar(@$tokenlist)) {
-			my $t = shift @$tokenlist;
-			return $t if (!defined($t));
-			if (parse_doxygen($scope,$tokenlist, $line, $t) == 1)
-				{next;}
-			if ($t !~ /^[\s]*$/)
-				{
-				if ($$tokenlist[0] eq ":" and $$tokenlist[1] eq ":")
-					{
-					$t.= shift @$tokenlist;
-					$t.= shift @$tokenlist;
-					$t.= shift @$tokenlist;
-#					print "Colon-separated token";
-					}
-				return $t
-				}
-			++$$line;
-		}
-  		return undef;
-	}
-	
-	sub skip_qualifiers($) {
-		my ($tokens) = @_;
-		my $f=0;
-		my %quals = (
-			EXPORT_C => 1,
-			IMPORT_C => 1,
-			inline => 1,
-			virtual => 0,
-			const => 0,
-			volatile => 0,
-			static => 0,
-			extern => 0,
-			LOCAL_C => 0,
-			LOCAL_D => 0,
-			GLDEF_C => 0,
-			GLREF_C => 0,
-			GLDEF_D => 0,
-			GLREF_D => 0
-			);
-		for (;;) {
-			my $t = $$tokens[0];
-			my $q = $quals{$t};
-			last unless (defined ($q));
-			$f |= $q;
-			shift @$tokens;
-		}
-		return $f;
-	}
-	
-	sub parse_indirection($) {
-		my ($tokens) = @_;
-		my $level = 0;
-		for (;;) {
-			my $t = $$tokens[0];
-			if ($t eq '*') {
-				++$level;
-				shift @$tokens;
-				next;
-			}
-			last if ($t ne "const" and $t ne "volatile");
-			shift @$tokens;
-		}
-		return $level;
-	}
-	
-	sub get_operand($$$) {
-		my ($scope,$tokens,$line) = @_;
-		my $t = get_token($scope,$tokens,$line);
-		if ($t eq '-') {
-			my $x = get_operand($scope,$tokens,$line);
-			return -$x;
-		} elsif ($t eq '+') {
-			my $x = get_operand($scope,$tokens,$line);
-			return $x;
-		} elsif ($t eq '~') {
-			my $x = get_operand($scope,$tokens,$line);
-			return ~$x;
-		} elsif ($t eq '!') {
-			my $x = get_operand($scope,$tokens,$line);
-			return $x ? 0 : 1;
-		} elsif ($t eq '(') {
-			my $x = get_constant_expr($scope,$tokens,$line);
-			my $t = get_token($scope,$tokens,$line);
-			if ($t ne ')') {
-				warn "Missing ) at line $$line\n";
-				return undefined;
-			}
-			return $x;
-		} elsif ($t eq "sizeof") {
-			my $ident = get_token($scope,$tokens,$line);
-			if ($ident eq '(') {
-				$ident = get_token($scope,$tokens,$line);
-				my $cb = get_token($scope,$tokens,$line);
-				if ($cb ne ')') {
-					warn "Bad sizeof() syntax at line $$line\n";
-					return undefined;
-				}
-			}
-			$ident = look_through_macros($ident);
-			if ($ident !~ /^\w+$/) {
-				warn "Bad sizeof() syntax at line $$line\n";
-				return undefined;
-			}
-			my $type = lookup_type($scope, $ident);
-			if (!defined $type) {
-				warn "Unrecognised type $ident at line $$line\n";
-				return undefined;
-			}
-			if ($type->{basic}) {
-				return $type->{size};
-			} elsif ($type->{enum}) {
-				return 4;
-			} elsif ($type->{ptr}) {
-				return 4;
-			} elsif ($type->{fptr}) {
-				return 4;
-			}
-			my $al = $type->{class}->{align};
-			my $sz = $type->{class}->{size};
-			return ($sz+$al-1)&~($al-1);
-		}
-		$t = look_through_macros($t);
-		if ($t =~ /^0x/i) {
-			return oct($t);
-		} elsif ($t =~ /^\d/) {
-			return $t;
-		} elsif ($t =~ /^\w+$/) {
-			my $x = lookup_value($scope,$t);
-#			die "Unrecognised identifier '$t' at line $$line\n" unless defined($x);
-			if (!defined($x)) {
-				print "Unrecognised identifier '$t' at line $$line\n" ;
-			}
-			return $x;
-		} elsif ($t =~ /^\w+::\w+$/) {
-			my $x = lookup_value($scope,$t);
-#			die "Unrecognised identifier '$t' at line $$line\n" unless defined($x);
-			if (!defined($x)) {
-				print "Unrecognised identifier '$t' at line $$line\n" ;
-			}
-			return $x;
-		} else {
-			warn "Syntax error#10 at line $$line\n";
-			return undefined;
-		}
-	}
-	
-	sub look_through_macros($) {
-		my ($ident) = @_;
-		while ($ident and $macros{$ident}) {
-			$ident = $macros{$ident};
-		}
-		return $ident;
-	}
-	
-	sub lookup_value($$) {
-		my ($scope,$ident) = @_;
-		while ($scope) {
-			my $vl = $scope->{values};
-			if (defined($vl->{$ident})) {
-				return $vl->{$ident}->{value};
-			}
-			$scope = $scope->{scope};
-		}
-		return undef();
-	}
-	
-	sub lookup_type($$) {
-		my ($scope,$ident) = @_;
-		if ($basictypes{$ident}) {
-			return {scope=>$scope, basic=>1, name=>$ident, size=>$basictypes{$ident} };
-		}
-		while ($scope) {
-			if ($basictypes{$ident}) {
-				return {scope=>$scope, basic=>1, name=>$ident, size=>$basictypes{$ident} };
-			}
-			my $el = $scope->{enums};
-			my $cl = $scope->{classes};
-			my $td = $scope->{typedefs};
-			if (grep {$_ eq $ident} @$el) {
-				return {scope=>$scope, enum=>1, name=>$ident, size=>4 };
-			}
-			my @match_class = (grep {$_->{name} eq $ident} @$cl);
-			if (scalar(@match_class)) {
-				return {scope=>$scope, class=>$match_class[0]};
-			}
-			my @match_td = (grep {$_->{name} eq $ident} @$td);
-			if (scalar(@match_td)) {
-				my $tdr = $match_td[0];
-				my $cat = $tdr->{category};
-				if ($cat eq 'basic' or $cat eq 'enum' or $cat eq 'class') {
-					$ident = $tdr->{alias};
-					next;
-				} else {
-					return { scope=>$scope, $cat=>1, $size=>$tdr->{size} };
-				}
-			}
-			$scope = $scope->{scope};
-		}
-		return undef();
-	}
-	
-	sub get_mult_expr($$$) {
-		my ($scope,$tokens,$line) = @_;
-		my $x = get_operand($scope,$tokens,$line);
-		my $t;
-		for (;;) {
-			$t = get_token($scope,$tokens,$line);
-			if ($t eq '*') {
-				my $y = get_operand($scope,$tokens,$line);
-				$x = $x * $y;
-			} elsif ($t eq '/') {
-				my $y = get_operand($scope,$tokens,$line);
-				if ($y != 0)
-					{$x = int($x / $y);}
-			} elsif ($t eq '%') {
-				my $y = get_operand($scope,$tokens,$line);
-				if ($y != 0)
-					{$x = int($x % $y);}
-			} else {
-				last;
-			}
-		}
-		unshift @$tokens, $t;
-		return $x;
-	}
-	
-	sub get_add_expr($$$) {
-		my ($scope,$tokens,$line) = @_;
-		my $x = get_mult_expr($scope,$tokens,$line);
-		my $t;
-		for (;;) {
-			$t = get_token($scope,$tokens,$line);
-			if ($t eq '+') {
-				my $y = get_mult_expr($scope,$tokens,$line);
-				$x = $x + $y;
-			} elsif ($t eq '-') {
-				my $y = get_mult_expr($scope,$tokens,$line);
-				$x = $x - $y;
-			} else {
-				last;
-			}
-		}
-		unshift @$tokens, $t;
-		return $x;
-	}
-	
-	sub get_shift_expr($$$) {
-		my ($scope,$tokens,$line) = @_;
-		my $x = get_add_expr($scope,$tokens,$line);
-		my $t, $t2;
-		for (;;) {
-			$t = get_token($scope,$tokens,$line);
-			if ($t eq '<' or $t eq '>') {
-				$t2 = get_token($scope,$tokens,$line);
-				if ($t2 ne $t) {
-					unshift @$tokens, $t2;
-					last;
-				}
-			}
-			if ($t eq '<') {
-				my $y = get_add_expr($scope,$tokens,$line);
-				$x = $x << $y;
-			} elsif ($t eq '>') {
-				my $y = get_add_expr($scope,$tokens,$line);
-				$x = $x >> $y;
-			} else {
-				last;
-			}
-		}
-		unshift @$tokens, $t;
-		return $x;
-	}
-	
-	sub get_and_expr($$$) {
-		my ($scope,$tokens,$line) = @_;
-		my $x = get_shift_expr($scope,$tokens,$line);
-		my $t;
-		for (;;) {
-			$t = get_token($scope,$tokens,$line);
-			if ($t eq '&') {
-				my $y = get_shift_expr($scope,$tokens,$line);
-				$x = $x & $y;
-			} else {
-				last;
-			}
-		}
-		unshift @$tokens, $t;
-		return $x;
-	}
-	
-	sub get_xor_expr($$$) {
-		my ($scope,$tokens,$line) = @_;
-		my $x = get_and_expr($scope,$tokens,$line);
-		my $t;
-		for (;;) {
-			$t = get_token($scope,$tokens,$line);
-			if ($t eq '^') {
-				my $y = get_and_expr($scope,$tokens,$line);
-				$x = $x ^ $y;
-			} else {
-				last;
-			}
-		}
-		unshift @$tokens, $t;
-		return $x;
-	}
-	
-	sub get_ior_expr($$$) {
-		my ($scope,$tokens,$line) = @_;
-		my $x = get_xor_expr($scope,$tokens,$line);
-		my $t;
-		for (;;) {
-			$t = get_token($scope,$tokens,$line);
-			if ($t eq '|') {
-				my $y = get_xor_expr($scope,$tokens,$line);
-				$x = $x | $y;
-			} else {
-				last;
-			}
-		}
-		unshift @$tokens, $t;
-		return $x;
-	}
-	
-	sub get_constant_expr($$$) {
-		my ($scope,$tokens,$line) = @_;
-		my $x = get_ior_expr($scope,$tokens,$line);
-		return $x;
-	}
-	
-	sub parse_enum($$$$) {
-		my ($scope,$tokens,$line,$enum_name) = @_;
-		my $vl = $scope->{values};
-		my $fstr = $scope->{formatStrings};
-		my $fcat = $scope->{formatCategories};
-		my $fmtTable = $scope->{FormatTables};
-		
-		my $x = 0;
-		for (;;) {
-			my $t = get_token($scope,$tokens,$line);
-			last if ($t eq '}');
-			if (!defined($t)) {
-				die "Unexpected end of file #2 at line $$line\n";
-			}
-			
-			if ($t eq '#') {
-				next;
-				}
-			
-			if ($t !~ /^\w+$/) {
-				warn "Syntax error#11 at line $$line\n";
-				next;
-			}
-
-			if ($scope->{name})
-				{	
-				$t = $scope->{name} . "::" . $t;
-				}
-
-			if (defined($vl->{$t})) {
-				warn "Duplicate identifier [$t] at line $$line\n";
-			}
-			my $t2 = get_token($scope,$tokens,$line);
-			if ($t2 eq ',') {
-				$vl->{$t} = {type=>$enum_name, size=>4, value=>$x, enum=>1};
-				$fstr->{$t} = $CurrentTraceFormatString; 
-				$fcat->{$t} = $CurrentTraceFormatCategory; 
-				if (defined $CurrentTraceFormatCategory && defined $CurrentTraceFormatString)
-					{ $fmtTable->{$CurrentTraceFormatCategory}{$x} = $CurrentTraceFormatString; }
-				undef $CurrentTraceFormatString;
-				++$x;
-			} elsif ($t2 eq '}') {
-				$vl->{$t} = {type=>$enum_name, size=>4, value=>$x, enum=>1};
-				$fstr->{$t} = $CurrentTraceFormatString; 
-				$fcat->{$t} = $CurrentTraceFormatCategory; 
-				if (defined $CurrentTraceFormatCategory && defined $CurrentTraceFormatString)
-					{ $fmtTable->{$CurrentTraceFormatCategory}{$x} = $CurrentTraceFormatString; }
-				undef $CurrentTraceFormatString;
-				++$x;
-				last;
-			} elsif ($t2 eq '=') {
-				$x = get_constant_expr($scope, $tokens, $line);
-				$vl->{$t} = {type=>$enum_name, size=>4, value=>$x, enum=>1};
-				$fstr->{$t} = $CurrentTraceFormatString; 
-				$fcat->{$t} = $CurrentTraceFormatCategory;
-				if (defined $CurrentTraceFormatCategory && defined $CurrentTraceFormatString)
-					{ $fmtTable->{$CurrentTraceFormatCategory}{$x} = $CurrentTraceFormatString; }
-				undef $CurrentTraceFormatString; 
-				++$x;
-				$t2 = get_token($scope,$tokens,$line);
-				last if ($t2 eq '}');
-				next if ($t2 eq ',');
-				warn "Syntax error#12 at line $$line\n";
-			} else {
-				unshift @$tokens, $t2;
-			}
-		}
-		my $t = get_token($scope,$tokens,$line);
-		if ($t ne ';') {
-			warn "Missing ; at line $$line\n";
-		}
-	}
-	
-	
-	sub  parse_decl_def($$$) {
-		my ($scope,$tokens,$line) = @_;
-		my $level=0;
-		my @decl;
-		while ( scalar(@$tokens) ) {
-			my $t = get_token($scope,$tokens, $line);
-			if ( (!defined ($t) || $t eq ';') and ($level==0)) {
-				return @decl;
-			}
-	
-			if ($t eq "static")
-				{
-				next;
-				}
-	
-			push @decl, $t;
-			if ($t eq '{') {
-				++$level;
-			}
-			if ($t eq '}') {
-				if ($level==0) {
-					warn "Syntax error#13 at line $$line\n";
-					unshift @$tokens, $t;
-					return @decl;
-					
-				}
-				if (--$level==0) {
-					return ();	# end of function definition reached
-				}
-			}
-		}
-		die "Unexpected end of file #3 at line $$line\n";
-	}
-	
-	sub dump_scope($) {
-		my ($scope) = @_;
-		my $el = $scope->{enums};
-		my $cl = $scope->{classes};
-		my $vl = $scope->{values};
-		my $fstr = $scope->{formatStrings};
-		my $fcat = $scope->{formatCategories};
-		print "SCOPE: $scope->{name}\n";
-		if (scalar(@$el)) {
-			print "\tenums:\n";
-			foreach (@$el) {
-				print "\t\t$_\n";
-			}
-		}
-		if (scalar(keys(%$vl))) {
-			print "\tvalues:\n";
-			foreach $vname (keys(%$vl)) {
-				my $v = $vl->{$vname};
-				my $x = $v->{value};
-				my $t = $v->{type};
-				my $sz = $v->{size};
-				my $fstring = $fstr->{$vname};
-				my $fcategory = $fcat->{$vname};
-				if ($v->{enum}) {
-					printf ("\t\t$vname\=$x (enum $t) size=$sz fcat=[0x%x] fstr=[%s]\n", $fcategory,$fstring);
-				} else {
-					printf ("\t\t$vname\=$x (type $t) size=$sz fcat=[0x%x] fstr=[%s]\n", $fcategory, $fstring);
-				}
-			}
-		}
-		if ($scope->{scope}) {
-			my $members = $scope->{members};
-			foreach (@$members) {
-				my $n = $_->{name};
-				my $sz = $_->{size};
-				my $off = $_->{offset};
-				my $spc = $_->{spacing};
-				if (defined $spc) {
-					print "\t$n\[\]\: spacing $spc size $sz offset $off\n";
-				} else {
-					print "\t$n\: size $sz offset $off\n";
-				}
-			}
-			print "\tOverall size : $scope->{size}\n";
-			print "\tOverall align: $scope->{align}\n";
-		}
-		foreach $s (@$cl) {
-			dump_scope($s);
-		}
-	}
-	
-	
-	
-		
-	sub parse_doxygen($$$$) {
-		my ($scope,$tokens,$line,$t) = @_;
-	
-		if ($t ne "/")
-			{
-			return 0;	# not a doxygen comment
-			}
-		if ($t eq "/") {
-			$state=0;
-			my $t2 = shift @$tokens;
-			my $t3 = shift @$tokens;
-	
-			if ($t2 ne "*" || $t3 ne "*")
-				{
-				unshift @$tokens, $t3;
-				unshift @$tokens, $t2;
-				return 0;	# not a doxygen comment
-				}
-		}
-#		printf "doxygen start on line %d\n", $$line;
-		for (;;) {
-			my $t = shift @$tokens;
-			if (!defined($t)) 
-					{
-					warn "Unexpected end of file #4 at line $$line\n";	
-					return
-					}
-			
-			if ($t eq "\n"){++$$line };
-			
-			if ($t eq '*')
-				{
-				my $t2 = shift @$tokens;
-				last if ($t2 eq '/');
-				unshift @$tokens, $t2;
-				}
-			
-			if ($t eq '@')
-				{
-				my $t2 = shift @$tokens;
-				if ($t2 eq 'SYMTraceFormatString')
-					{
-					my $t3 = shift @$tokens;
-#					if ($VerboseMode){print "SYMTraceFormatString = [$t3]\n";}
-					$CurrentTraceFormatString = $t3;
-					}
-				if ($t2 eq 'SYMTraceFormatCategory')
-					{
-					$CurrentTraceFormatCategory = get_operand($scope,$tokens,$line);
-#					if ($VerboseMode){printf ("SYMTraceFormatCategory = 0x%x\n", $CurrentTraceFormatCategory);}
-					}
-				else
-					{
-					unshift @$tokens, $t2;
-					}
-				}
-	
-		}
-#		printf ("doxygen end  on line %d\n", $$line);
-		return 1;	# is a doxygen comment
-	}
-	
-
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-                
--- a/kerneltest/f32test/demandpaging/t_nandpaging.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/demandpaging/t_nandpaging.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -277,7 +277,6 @@
 					Drive.ControlIO(KNandGetDeferStats,statsBuf,0);
 					test.Printf(_L("PG %d PO %d(%d%%) NG %d NO %d\n"),stats.iPageGarbage,  stats.iPageOther, (TInt) ((stats.iPageOther*100)/cCount), stats.iNormalGarbage,  stats.iNormalOther);
 
-					test(stats.iPageOther>0);
 				 	pageGarbageCount+=stats.iPageGarbage; 
 				 	pageOtherCount+=stats.iPageOther;			 	
 				 	normalGarbageCount+=stats.iNormalGarbage; 
@@ -301,6 +300,7 @@
 			{
 			test.Printf(_L("\nTotals: Avg %2d %d%% CC=%4d \n"), fullTot/fullcCount, (TInt)(totChangeCount*100)/fullcCount, totChangeCount);
 			test.Printf(_L("PG %d PO %d(%d%%) NG %d NO %d\n"),pageGarbageCount,  pageOtherCount,(TInt) (pageOtherCount*100/fullcCount), normalGarbageCount,  normalOtherCount );
+			test(pageOtherCount > 0);	// Ensure at least one paging conflict occurred during the test.
 			}
 
 		// If totChangeCount does not change, nand maybe busy waiting.
@@ -511,15 +511,14 @@
 	TUint8* start = (TUint8*)romHeader+romHeader->iPageableRomStart;
 	TUint size = romHeader->iPageableRomSize;
 	TUint8* addr=NULL;
-	TBool flush;
 	while (Testing)
 		{
 			PageSemaphore.Wait(); // wait for main thread to want paging.
-			flush = (PagesBeingPaged==0);
 			addr=start+((TInt64(Random())*TInt64(size))>>32);	
-			PageDoneSemaphore.Signal(); // Acknolage request.
+			PageDoneSemaphore.Signal(); // Acknowledge request.
 
 			PageMutex.Wait();
+			TBool flush = (PagesBeingPaged==0);	// Ensure only one thread is flushing the cache at a time.
 			PagesBeingPaged++;
 			PageMutex.Signal();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/f32test/ext/t_bitproxydrive.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,305 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// f32test\ext\bitproxydrive.cpp
+// extension to do XOR on every byte on 32 byte boundary read or written to media subsystem in same thread
+// therefore RFile::Read/Write does not have this operation carried out on it
+// 
+//
+
+#include <f32fsys.h>
+
+class CBitExtProxyDrive : public CExtProxyDrive
+	{
+public:
+	CBitExtProxyDrive(CMountCB* aMount, CExtProxyDriveFactory* aDevice);
+	~CBitExtProxyDrive();
+
+public:
+	virtual TInt Initialise();
+	virtual TInt Dismounted();
+	virtual TInt Enlarge(TInt aLength);
+	virtual TInt ReduceSize(TInt aPos, TInt aLength);
+	virtual TInt Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aThreadHandle, TInt aOffset, TInt aFlags);
+	virtual TInt Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aThreadHandle, TInt anOffset);
+	virtual TInt Read(TInt64 aPos, TInt aLength, TDes8& aTrg);
+	virtual TInt Write(TInt64 aPos, TInt aLength,const TAny* aSrc, TInt aThreadHandle, TInt aOffset, TInt aFlags);
+	virtual TInt Write(TInt64 aPos, TInt aLength, const TAny* aSrc, TInt aThreadHandle, TInt anOffset);
+	virtual TInt Write(TInt64 aPos,const TDesC8& aSrc);
+	virtual TInt Caps(TDes8& anInfo);
+	virtual TInt Format(TFormatInfo& aInfo);
+	virtual TInt Format(TInt64 aPos,TInt aLength);
+	virtual TInt SetInfo(const RMessage2 &msg, TAny* aMessageParam2, TAny* aMessageParam3);
+	virtual TInt NotifyChange(TDes8 &aChanged,TRequestStatus* aStatus);
+	virtual void NotifyChangeCancel();
+
+    TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle);
+    TInt ForceRemount(TUint aFlags = 0);
+    TInt Unlock(TMediaPassword& aPassword, TBool aStorePassword);
+    TInt Lock(TMediaPassword& aOldPassword, TMediaPassword& aNewPassword, TBool aStorePassword);
+    TInt Clear(TMediaPassword& aPassword);
+    TInt ErasePassword();
+
+	TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
+
+private:
+
+	TBusLocalDrive iDrive;
+	TInt iLocalDriveNumber;
+	TBool iChanged;
+
+	TRequestStatus* iNotifyChangeStatus;
+	};
+
+
+
+class CBitProxyDriveFactory : public CExtProxyDriveFactory
+	{
+public:
+	CBitProxyDriveFactory();
+	~CBitProxyDriveFactory();
+	virtual TInt Install();
+	virtual TInt CreateProxyDrive(CProxyDrive*& aMountProxyDrive,CMountCB* aMount);
+	};
+
+
+
+
+CBitExtProxyDrive::CBitExtProxyDrive(CMountCB* aMount, CExtProxyDriveFactory* aDevice)
+:   CExtProxyDrive(aMount,aDevice)
+	{
+	}
+
+CBitExtProxyDrive::~CBitExtProxyDrive()
+	{
+	iDrive.Disconnect();
+	}
+
+/**
+Initialise the proxy drive.
+@return system wide error code.
+*/
+TInt CBitExtProxyDrive::Initialise()
+	{
+	TInt r = KErrNone;
+    return r;
+	}
+
+TInt CBitExtProxyDrive::SetInfo(const RMessage2 &msg, TAny* /*aMessageParam2*/, TAny* /*aMessageParam3*/)
+    {
+	TInt r = KErrNone;
+
+    TPckg<TInt> infoPckg(iLocalDriveNumber);
+	TRAP(r, msg.ReadL(2, infoPckg));
+
+	if(r != KErrNone)
+		{
+		RDebug::Print(_L("CBitExtProxyDrive::SetInfo(): cant read from the RMessage %d"), r);
+		return r;
+		}
+
+	r = iDrive.Connect(iLocalDriveNumber, iChanged);
+
+	if(r != KErrNone)
+		{
+		RDebug::Print(_L("CBitExtProxyDrive::SetInfo(): failed to connect to drive %d, r %d"), iDriveNumber, r);
+		return r;
+		}
+
+    return r;
+    }
+
+TInt CBitExtProxyDrive::Dismounted()
+	{
+	TInt r = KErrNone;
+    return r;
+	}
+
+TInt CBitExtProxyDrive::Enlarge(TInt /*aLength*/)
+	{
+	return KErrNotSupported;
+	}
+
+
+TInt CBitExtProxyDrive::ReduceSize(TInt /*aPos*/, TInt /*aLength*/)
+	{
+	return KErrNotSupported;
+	}
+
+
+TInt CBitExtProxyDrive::Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aThreadHandle, TInt aOffset)
+	{
+	TInt r = iDrive.Read(aPos, aLength, aTrg, aThreadHandle, aOffset);
+    return r;
+	}
+
+
+TInt CBitExtProxyDrive::Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aThreadHandle, TInt aOffset, TInt aFlags)
+	{
+	TInt r = iDrive.Read(aPos, aLength, aTrg, aThreadHandle, aOffset, aFlags);
+    return r;
+	}
+
+TInt CBitExtProxyDrive::Read(TInt64 aPos, TInt aLength, TDes8& aTrg)
+	{
+	TInt r = iDrive.Read(aPos, aLength, aTrg);
+    return r;
+	}
+
+TInt CBitExtProxyDrive::Write(TInt64 aPos, TInt aLength, const TAny* aSrc, TInt aThreadHandle, TInt aOffset)
+	{
+	TInt r = iDrive.Write(aPos, aLength, aSrc, aThreadHandle, aOffset);
+    return r;
+	}
+
+
+TInt CBitExtProxyDrive::Write(TInt64 aPos, TInt aLength, const TAny* aSrc, TInt aThreadHandle, TInt aOffset, TInt aFlags)
+	{
+	TInt r = iDrive.Write(aPos, aLength, aSrc, aThreadHandle, aOffset, aFlags);
+    return r;
+	}
+
+TInt CBitExtProxyDrive::Write(TInt64 aPos,const TDesC8& aSrc)
+	{
+	TInt r = iDrive.Write(aPos, aSrc);
+    return r;
+	}
+
+
+TInt CBitExtProxyDrive::Caps(TDes8& anInfo)
+	{
+	TLocalDriveCapsV6Buf caps;
+    caps.FillZ();
+
+//    TLocalDriveCapsV6& c = caps();
+
+	TInt r = iDrive.Caps(caps);
+	caps.SetLength( Min(caps.Length(), anInfo.MaxLength()) );
+
+	anInfo.Copy(caps);
+    
+	return r;
+	}
+
+
+
+TInt CBitExtProxyDrive::Format(TInt64 aPos, TInt aLength)
+	{
+	TInt r = iDrive.Format(aPos, aLength);
+    return r;
+	}
+
+
+TInt CBitExtProxyDrive::Format(TFormatInfo& aInfo)
+	{
+	TInt r = iDrive.Format(aInfo);
+    return r;
+    }
+
+
+TInt CBitExtProxyDrive::NotifyChange(TDes8& /*aChanged*/, TRequestStatus* aStatus)
+	{
+//	iDrive.NotifyChange(aStatus);
+	iNotifyChangeStatus = aStatus;
+	return KErrNone;
+	}
+
+void CBitExtProxyDrive::NotifyChangeCancel()
+	{
+//	iDrive.NotifyChangeCancel();
+	if (iNotifyChangeStatus)
+		User::RequestComplete(iNotifyChangeStatus, KErrCancel);
+	}
+
+TInt CBitExtProxyDrive::SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle)
+    {
+	TInt r = iDrive.SetMountInfo(aMountInfo, aMountInfoThreadHandle);
+    return r;
+    }
+
+TInt CBitExtProxyDrive::ForceRemount(TUint aFlags)
+    {
+	TInt r = iDrive.ForceRemount(aFlags);
+    return r;
+    }
+
+TInt CBitExtProxyDrive::Unlock(TMediaPassword& aPassword, TBool aStorePassword)
+    {
+	TInt r = iDrive.Unlock(aPassword, aStorePassword);
+    return r;
+    }
+
+TInt CBitExtProxyDrive::Lock(TMediaPassword& aOldPassword, TMediaPassword& aNewPassword, TBool aStorePassword)
+    {
+	TInt r = iDrive.SetPassword(aOldPassword, aNewPassword, aStorePassword);
+    return r;
+    }
+
+TInt CBitExtProxyDrive::Clear(TMediaPassword& aPassword)
+    {
+	TInt r = iDrive.Clear(aPassword);
+    return r;
+    }
+
+TInt CBitExtProxyDrive::ErasePassword()
+    {
+	TInt r = iDrive.ErasePassword();
+    return r;
+    }
+
+TInt CBitExtProxyDrive::GetInterface(TInt aInterfaceId, TAny*& /*aInterface*/, TAny* /*aInput*/)
+	{
+	switch(aInterfaceId)
+		{
+		case ELocalBufferSupport:
+			return KErrNone;
+		default:
+			return KErrNotSupported;
+		}
+	}
+
+
+
+CBitProxyDriveFactory::CBitProxyDriveFactory()
+	{
+	}
+
+CBitProxyDriveFactory::~CBitProxyDriveFactory()
+	{
+	}
+
+TInt CBitProxyDriveFactory::Install()
+	{
+	_LIT(KProxyName,"bitproxydrive");
+	return SetName(&KProxyName);
+	}
+
+TInt CBitProxyDriveFactory::CreateProxyDrive(CProxyDrive*& aMountProxyDrive,CMountCB* aMount)
+	{
+    aMountProxyDrive = new CBitExtProxyDrive(aMount,this);
+    return (aMountProxyDrive==NULL) ? KErrNoMemory : KErrNone;
+	}
+
+
+extern "C" {
+
+
+/* 
+Create the proxy drive factory object for the usbhost mass storage proxy
+*/
+EXPORT_C CExtProxyDriveFactory* CreateFileSystem()
+	{
+	return new CBitProxyDriveFactory();
+	}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/f32test/filesystem/automounter/automounter.inf	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,30 @@
+// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// 
+// Test code for file server
+// 
+//
+
+/**
+ @file
+*/
+
+
+PRJ_PLATFORMS
+
+BASEUSERDEFAULT
+
+PRJ_TESTMMPFILES
+t_automounter
+
--- a/kerneltest/f32test/filesystem/automounter/bld.inf	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// 
-// Test code for file server
-// 
-//
-
-/**
- @file
-*/
-
-
-PRJ_PLATFORMS
-
-BASEUSERDEFAULT
-
-PRJ_TESTMMPFILES
-t_automounter
-
--- a/kerneltest/f32test/fileutils/inc/f32_test_utils.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/fileutils/inc/f32_test_utils.h	Thu Jul 22 16:46:39 2010 +0100
@@ -138,11 +138,14 @@
 
 
 
-TBool Is_Lffs(RFs &aFs, TInt aDrive);   //-- returns ETrue if "lffs" FS is mounted on this drive 
-TBool Is_Win32(RFs &aFs, TInt aDrive);  //-- returns ETrue if "win32" FS is mounted on this drive (i.e this is emulator's drive c:)
-TBool Is_ExFat(RFs &aFs, TInt aDrive);  //-- returns ETrue if "exFAT" FS is mounted on this drive 
-TBool Is_Automounter(RFs &aFs, TInt aDrive);  //-- returns ETrue if "Automounter" FS is mounted on this drive 
+TBool Is_Lffs(RFs &aFs, TInt aDrive);	//-- returns ETrue if "lffs" FS is mounted on this drive 
+TBool Is_Win32(RFs &aFs, TInt aDrive);	//-- returns ETrue if "Win32" FS is mounted on this drive (i.e this is emulator's drive C:)										
+TBool Is_ExFat(RFs &aFs, TInt aDrive);	//-- returns ETrue if "exFAT" FS is mounted on this drive 
+TBool Is_Automounter(RFs &aFs, TInt aDrive);	//-- returns ETrue if "Automounter" FS is mounted on this drive 
 
+TBool Is_HVFS(RFs &aFs, TInt aDrive);			//-- returns ETrue if "HVFS" is mounted on this drive (i.e PlatSim's drive C:)
+TBool Is_SimulatedSystemDrive(RFs &aFs, TInt aDrive);	//-- returns ETrue if "HVFS" or "Win32" FS is mounted on this drive
+														//	 (i.e drive C: of PlatSim or the emulator)
 
 TBool Is_Fat(RFs &aFs, TInt aDrive);    //-- returns ETrue if "FAT" FS (FAT12/16/32) is mounted on this drive 
 
--- a/kerneltest/f32test/fileutils/src/f32_test_utils.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/fileutils/src/f32_test_utils.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -248,6 +248,7 @@
 _LIT(KFsName_Win32, "Win32");
 _LIT(KFsName_ExFAT, "ExFat");
 _LIT(KFsName_AutoMonuter, "automounter");
+_LIT(KFsName_HVFS, "HVFS");
 
 /**  @return ETrue if "Automounter" FS is mounted on this drive */
 TBool F32_Test_Utils::Is_Automounter(RFs &aFs, TInt aDrive)
@@ -273,7 +274,7 @@
 
 }
    
-/** @return ETrue if "Win32" FS is mounted on this drive (i.e this is emulator's drive c:) */
+/** @return ETrue if "Win32" FS is mounted on this drive (i.e this is emulator's drive C:) */
 TBool F32_Test_Utils::Is_Win32(RFs &aFs, TInt aDrive)   
 {
 	ASSERT(aDrive >= EDriveA && aDrive <= EDriveZ);
@@ -284,6 +285,29 @@
     return (f.CompareF(KFsName_Win32) == 0 );
 }
 
+/** @return ETrue if "HVFS" is mounted on this drive (i.e PlatSim's drive C:) */
+TBool F32_Test_Utils::Is_HVFS(RFs &aFs, TInt aDrive)
+{
+	ASSERT(aDrive >= EDriveA && aDrive <= EDriveZ);
+    TFSName f;
+	TInt r = aFs.FileSystemName(f, aDrive);
+    __ASSERT_ALWAYS((r==KErrNone) && (f.Length()>0), User::Invariant());
+
+    return (f.CompareF(KFsName_HVFS) == 0);
+}
+
+/** @return ETrue if "HVFS" or "Win32" FS is mounted on this drive
+ * 			(i.e drive C: of PlatSim or the emulator) */
+TBool F32_Test_Utils::Is_SimulatedSystemDrive(RFs &aFs, TInt aDrive)
+{
+	ASSERT(aDrive >= EDriveA && aDrive <= EDriveZ);
+    TFSName f;
+	TInt r = aFs.FileSystemName(f, aDrive);
+    __ASSERT_ALWAYS((r==KErrNone) && (f.Length()>0), User::Invariant());
+
+    return (f.CompareF(KFsName_HVFS) == 0 || f.CompareF(KFsName_Win32) == 0);
+}
+
 /** @return ETrue if the filesystem if FAT (fat12/16/32) */
 TBool F32_Test_Utils::Is_Fat(RFs &aFs, TInt aDrive)
 {
--- a/kerneltest/f32test/group/b_file.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/b_file.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -15,12 +15,13 @@
 // 
 //
 
-TARGET         b_file.exe        
+TARGET         b_file.exe
 TARGETTYPE     EXE
 SOURCEPATH     ../server
 SOURCE         b_file.cpp
 SOURCE         t_main.cpp 
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/b_mtst.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/b_mtst.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,7 +21,8 @@
 SOURCE         b_mtst.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
-SOURCE         t_chlffs.cpp 
+SOURCE         f32_test_utils.cpp
+SOURCE         t_chlffs.cpp
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 USERINCLUDE    ../server
--- a/kerneltest/f32test/group/b_open.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/b_open.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         b_open.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/b_osfil.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/b_osfil.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,7 +21,8 @@
 SOURCE         b_osfil.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
-SOURCE         t_chlffs.cpp 
+SOURCE         f32_test_utils.cpp
+SOURCE         t_chlffs.cpp
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 USERINCLUDE    ../server
--- a/kerneltest/f32test/group/b_rand.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/b_rand.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,7 +21,8 @@
 SOURCE         b_rand.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
-SOURCE         t_chlffs.cpp 
+SOURCE         f32_test_utils.cpp
+SOURCE         t_chlffs.cpp
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 USERINCLUDE    ../server
--- a/kerneltest/f32test/group/b_rep.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/b_rep.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,7 +21,8 @@
 SOURCE         b_rep.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
-SOURCE         t_chlffs.cpp 
+SOURCE         f32_test_utils.cpp
+SOURCE         t_chlffs.cpp
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 USERINCLUDE    ../server
--- a/kerneltest/f32test/group/base_f32test.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/base_f32test.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "File Server Tests"
 
 component	base_f32test
--- a/kerneltest/f32test/group/bld.inf	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/bld.inf	Thu Jul 22 16:46:39 2010 +0100
@@ -33,6 +33,9 @@
 PRJ_TESTMMPFILES
 ../../e32test/mediaext/t_nfe
 
+// this should ideally be run early on as it enables 'simulated lock failure mode' in the file cache for udeb builds
+t_filecache 
+
 // These tests must be run early on so they do not time out on LFFS disks.
 
 #ifdef WINS
@@ -177,8 +180,6 @@
 t_blockmap
 #endif
 
-t_filecache 
-
 t_fsched
 t_rcache
 t_wcache
@@ -252,7 +253,7 @@
 
 t_swapfsys manual
 #include "../filesystem/fat/group/fatfs.inf"
-#include "../filesystem/automounter/bld.inf"
+#include "../filesystem/automounter/automounter.inf"
 
 
 #include "perf_test.inf"
@@ -263,17 +264,19 @@
 
 t_localtime 
 
+t_dircache
+
 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
 t_file64bit manual
 fhserver64bit       support
 #include "../plugins/version_2/file64bit/group/file64bit_plugin.inf"
 #endif
 
-t_ftrace
-
 t_surrogatepair
 
 // this test loads a actual codepage dll (cp932.dll),  should be the last test.
 t_cp932dll      support
 t_cp_plugin
 
+t_bitproxydrive    support
+t_proxydrive1
--- a/kerneltest/f32test/group/clean_prepdc.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/clean_prepdc.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,7 +21,8 @@
 SOURCE         clean_prepdc.cpp
 SOURCE         t_main.cpp 
 SOURCEPATH     ../fileutils/src
-SOURCE         t_chlffs.cpp 
+SOURCE         f32_test_utils.cpp
+SOURCE         t_chlffs.cpp
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 USERINCLUDE    ../server
--- a/kerneltest/f32test/group/t_alert.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_alert.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_alert.cpp
 SOURCE         t_main.cpp 
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp 
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_appins.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_appins.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -20,7 +20,8 @@
 SOURCEPATH	../server
 SOURCE         t_appins.cpp t_main.cpp
 SOURCEPATH     ../fileutils/src
-SOURCE         t_chlffs.cpp 
+SOURCE         f32_test_utils.cpp
+SOURCE         t_chlffs.cpp
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 USERINCLUDE    ../server
--- a/kerneltest/f32test/group/t_bigfile.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_bigfile.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         T_BIGFILE.CPP
 SOURCE         T_MAIN.CPP
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp 
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/f32test/group/t_bitproxydrive.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,33 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// f32test/group/t_bitext.mmp
+// 
+//
+
+TARGET			t_bitproxydrive.pxy
+TARGETTYPE		fsy
+
+SOURCEPATH		../ext
+SOURCE			t_bitproxydrive.cpp
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY			euser.lib efile.lib
+
+UID		0x100039df 0x10000CEE
+VENDORID 0x70000001
+
+#include "../../../userlibandfileserver/fileserver/group/f32caps.mmh"  // Capabilities of File Server process
+
+SMPSAFE
--- a/kerneltest/f32test/group/t_blockmap.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_blockmap.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE		t_blockmap.cpp
 SOURCE		t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp 
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_cfileman.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_cfileman.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -24,6 +24,7 @@
 SOURCEPATH     ../server
 SOURCE	       t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 USERINCLUDE    ../server
--- a/kerneltest/f32test/group/t_chkuid.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_chkuid.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_chkuid.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp 
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_clobbr.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_clobbr.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,6 +22,7 @@
 SOURCEPATH	../server
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp 
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_dcallcaps.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_dcallcaps.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_dcallcaps.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp 
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_dcallfiles.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_dcallfiles.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_dcallfiles.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp 
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_dcdiskadmin.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_dcdiskadmin.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,7 +21,8 @@
 SOURCE         t_dcdiskadmin.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
-SOURCE         t_chlffs.cpp 
+SOURCE         f32_test_utils.cpp
+SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_dcdiskadminallfiles.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_dcdiskadminallfiles.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_dcdiskadminallfiles.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_dcnone.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_dcnone.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,7 +21,8 @@
 SOURCE         t_dcnone.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
-SOURCE         t_chlffs.cpp 
+SOURCE         f32_test_utils.cpp
+SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_dctcb.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_dctcb.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,7 +21,8 @@
 SOURCE         	t_dctcb.cpp
 SOURCE         	t_main.cpp
 SOURCEPATH      ../fileutils/src
-SOURCE          t_chlffs.cpp 
+SOURCE          f32_test_utils.cpp
+SOURCE          t_chlffs.cpp
 
 LIBRARY        	euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_dctcballfiles.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_dctcballfiles.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,7 +21,8 @@
 SOURCE         t_dctcballfiles.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
-SOURCE         t_chlffs.cpp 
+SOURCE         f32_test_utils.cpp
+SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_dctcbdiskadmin.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_dctcbdiskadmin.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,7 +21,8 @@
 SOURCE         t_dctcbdiskadmin.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
-SOURCE         t_chlffs.cpp 
+SOURCE         f32_test_utils.cpp
+SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/f32test/group/t_dircache.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,34 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// f32test/group/t_dircache.mmp
+//
+//
+
+target		t_dircache.exe
+targettype	exe
+sourcepath	../server
+source		t_main.cpp t_dircache.cpp
+sourcepath	../fileutils/src
+source 		t_chlffs.cpp f32_test_utils.cpp fat_utils.cpp
+
+library		euser.lib efsrv.lib hal.lib efile.lib
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+USERINCLUDE 	../server
+userinclude     ../fileutils/inc
+epocstacksize	0x4000
+capability		tcb diskadmin allfiles
+vendorid		0x70000001
+
+SMPSAFE
+
--- a/kerneltest/f32test/group/t_dlocl.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_dlocl.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -20,7 +20,8 @@
 SOURCEPATH	../server
 SOURCE         t_dlocl.cpp t_main.cpp
 SOURCEPATH     ../fileutils/src
-SOURCE         t_chlffs.cpp 
+SOURCE         f32_test_utils.cpp
+SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib ektran.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_dspace.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_dspace.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,7 +21,8 @@
 SOURCE         t_dspace.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
-SOURCE         t_chlffs.cpp 
+SOURCE         f32_test_utils.cpp
+SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_fman.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_fman.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 source		t_fman.cpp
 source		t_main.cpp
 sourcepath      ../fileutils/src
+source          f32_test_utils.cpp
 source          t_chlffs.cpp
 
 library		euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_fnames.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_fnames.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_fnames.cpp
 SOURCE         t_main.cpp 
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_fragmentdp.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_fragmentdp.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,6 +22,7 @@
 SOURCEPATH     ../server
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_fsched.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_fsched.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -20,9 +20,12 @@
 
 SOURCEPATH		../server
 SOURCE			t_fsched.cpp
+SOURCEPATH		../fileutils/src
+SOURCE			f32_test_utils.cpp
 
 LIBRARY			euser.lib efsrv.lib hal.lib 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+USERINCLUDE		../fileutils/inc
 EPOCSTACKSIZE	0x10000
 EPOCHEAPSIZE	0x1000 0x02000000
 
--- a/kerneltest/f32test/group/t_fsrvbm.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_fsrvbm.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,6 +22,7 @@
 SOURCEPATH     ../server
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_fsy2k.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_fsy2k.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_fsy2k.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_fsysbm.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_fsysbm.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,6 +22,7 @@
 SOURCEPATH     ../server
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_ftrace.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// f32test/group/t_ftrace.mmp
-//
-//
-
-TARGET         t_ftrace.exe
-TARGETTYPE     EXE
-SOURCEPATH	../server
-SOURCE         t_ftrace.cpp
-SOURCE         t_main.cpp
-SOURCEPATH     ../fileutils/src
-SOURCE         t_chlffs.cpp
-
-LIBRARY        euser.lib efsrv.lib hal.lib btracec.lib
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-USERINCLUDE    ../server
-USERINCLUDE    ../fileutils/inc
-
-CAPABILITY		TCB DISKADMIN ALLFILES
-VENDORID 0x70000001
-
-SMPSAFE
--- a/kerneltest/f32test/group/t_gdir.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_gdir.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_gdir.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_gen.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_gen.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -20,6 +20,7 @@
 SOURCEPATH     ../server
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 SOURCEPATH     ../math
 SOURCE         t_gen.cpp
--- a/kerneltest/f32test/group/t_gen32.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_gen32.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -20,6 +20,7 @@
 SOURCEPATH     ../server
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 SOURCEPATH	../math
 SOURCE         t_gen32.cpp
--- a/kerneltest/f32test/group/t_handshare.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_handshare.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,6 +22,7 @@
 SOURCEPATH 	../server
 SOURCE         	t_main.cpp
 SOURCEPATH      ../fileutils/src
+SOURCE          f32_test_utils.cpp
 SOURCE          t_chlffs.cpp
 
 LIBRARY        	euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_localtime.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_localtime.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -20,6 +20,7 @@
 SOURCEPATH	../server
 SOURCE		t_localtime.cpp t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_locate.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_locate.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_locate.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY         euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_lock.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_lock.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_lock.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY         euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_misc.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_misc.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE          t_misc.cpp
 SOURCE          t_main.cpp
 SOURCEPATH      ../fileutils/src
+SOURCE          f32_test_utils.cpp
 SOURCE          t_chlffs.cpp
 
 LIBRARY         euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_nmbs.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_nmbs.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_nmbs.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY         euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_notifier.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_notifier.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -20,8 +20,9 @@
 sourcepath		../server
 source			t_notifier.cpp
 source			t_main.cpp 
-sourcepath      ../fileutils/src
-source          t_chlffs.cpp
+sourcepath		../fileutils/src
+source			f32_test_utils.cpp
+source			t_chlffs.cpp
 library			euser.lib efsrv.lib hal.lib
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_notify.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_notify.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 source	       t_notify.cpp
 source	       t_main.cpp
 SOURCEPATH     ../fileutils/src
+source         f32_test_utils.cpp
 source         t_chlffs.cpp
 
 library		euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_notify_mfs.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_notify_mfs.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,8 +22,9 @@
 source			t_notify_perf_impl.cpp t_notify_perf_util.cpp
 sourcepath		../server
 source			t_notify_mfs.cpp t_main.cpp
-sourcepath      ../fileutils/src
-source          t_chlffs.cpp
+sourcepath		../fileutils/src
+source			f32_test_utils.cpp
+source			t_chlffs.cpp
 
 library			euser.lib efsrv.lib hal.lib
 
--- a/kerneltest/f32test/group/t_notify_perf.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_notify_perf.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -23,7 +23,8 @@
 sourcepath		../server
 source			t_main.cpp
 sourcepath		../fileutils/src
-source          t_chlffs.cpp
+source			f32_test_utils.cpp
+source			t_chlffs.cpp
 
 library			euser.lib efsrv.lib hal.lib
 
--- a/kerneltest/f32test/group/t_notifydismount.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_notifydismount.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -20,6 +20,7 @@
 SOURCEPATH     ../server
 SOURCE         t_notifydismount.cpp t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY         euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_oom.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_oom.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,6 +22,7 @@
 SOURCEPATH     ../server
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_open.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_open.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_open.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY         euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_parse.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_parse.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -20,6 +20,7 @@
 SOURCEPATH     ../server
 SOURCE         t_parse.cpp t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY         euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_proc.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_proc.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -20,8 +20,9 @@
 SOURCEPATH     ../server
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
-SOURCEPATH	   ../manager
+SOURCEPATH     ../manager
 SOURCE         t_proc.cpp
 
 LIBRARY         euser.lib efsrv.lib hal.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/f32test/group/t_proxydrive1.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,35 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// f32test/group/t_proxydrive1.mmp
+// 
+//
+
+TARGET         t_proxydrive1.exe        
+TARGETTYPE     EXE
+SOURCEPATH	../server
+SOURCE         t_proxydrive1.cpp
+SOURCE         t_main.cpp
+SOURCEPATH     ../fileutils/src
+SOURCE         t_chlffs.cpp f32_test_utils.cpp
+
+
+LIBRARY        euser.lib efsrv.lib hal.lib
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+USERINCLUDE    ../server
+USERINCLUDE    ../fileutils/inc
+
+CAPABILITY		TCB DISKADMIN ALLFILES
+VENDORID 0x70000001
+
+SMPSAFE
--- a/kerneltest/f32test/group/t_ramstr.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_ramstr.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,6 +22,7 @@
 SOURCEPATH     ../server
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_rand.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_rand.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_rand.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_rcount.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_rcount.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_rcount.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_rdsect.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_rdsect.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -20,6 +20,7 @@
 SOURCEPATH     ../server
 SOURCE         t_rdsect.cpp t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_resize.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_resize.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_resize.cpp
 SOURCE	       t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_romg.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_romg.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,6 +22,7 @@
 SOURCEPATH     ../SERVER
 SOURCE         T_MAIN.CPP
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         T_CHLFFS.CPP
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_scan.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_scan.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_scan.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_sess.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_sess.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -23,6 +23,7 @@
 SOURCEPATH     ../server
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_soak1.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_soak1.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,6 +22,7 @@
 SOURCEPATH	../server
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_vfat.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_vfat.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,7 @@
 SOURCE         t_vfat.cpp
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 LIBRARY        euser.lib efsrv.lib hal.lib
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/kerneltest/f32test/group/t_virus.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_virus.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,6 +22,7 @@
 SOURCEPATH     ../server
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_whet.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_whet.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,6 +22,7 @@
 SOURCEPATH     ../server
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/t_whetvfp.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/t_whetvfp.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,6 +22,7 @@
 SOURCEPATH     ../server
 SOURCE         t_main.cpp
 SOURCEPATH     ../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/group/wintest.bat	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/group/wintest.bat	Thu Jul 22 16:46:39 2010 +0100
@@ -28,6 +28,9 @@
 call :GetParentDirPath F32TEST_PATH
 echo F32TEST_PATH = %F32TEST_PATH%
 set EPOC32_DIR=%EPOCROOT%EPOC32\
+set F32TEST_BUILD_PATH=%EPOC32_DIR%BUILD%F32TEST_PATH%GROUP\
+if exist %EPOC32_DIR%data\z\test\f32test set F32TEST_BUILD_PATH=%EPOC32_DIR%data\z\test\f32test\
+echo F32TEST_BUILD_PATH = %F32TEST_BUILD_PATH%
 echo EPOC32_DIR = %EPOC32_DIR%
 set EMUL_MEDIA_PATH=%EPOC32_DIR%DATA\MEDIA\
 echo EMUL_MEDIA_PATH = %EMUL_MEDIA_PATH%
@@ -100,7 +103,7 @@
 copy %F32TEST_PATH%\SERVER\T_FILE.CPP %EMUL_Z%\TEST\T_FILE.CPP
 copy %F32TEST_PATH%\SERVER\T_FSRV.CPP %EMUL_Z%\TEST\T_FSRV.CPP
 copy %F32TEST_PATH%\SERVER\T_RDSECT.TXT %EMUL_Z%\TEST\T_RDSECT.TXT
-copy %EPOC32_DIR%BUILD%F32TEST_PATH%\GROUP\%1.AUTO.BAT %EMUL_Z%\TEST\%1.AUTO.BAT
+copy %F32TEST_BUILD_PATH%\%1.AUTO.BAT %EMUL_Z%\TEST\%1.AUTO.BAT
 copy %REL_DIR%\T_CHKUID.EXE %EMUL_Z%\TEST\T_CHKUID.EXE
 
 REM Use both Sys and System directories until the switch has been made
--- a/kerneltest/f32test/loader/base_loader.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/loader/base_loader.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,16 +1,1 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # dummy MRP so that the tools put the build output directory in a place consistant with other components
--- a/kerneltest/f32test/loader/dlltree.pl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/loader/dlltree.pl	Thu Jul 22 16:46:39 2010 +0100
@@ -57,6 +57,16 @@
 my $copy_end=$year+1900;
 
 my $argc=scalar(@ARGV);
+
+# check whether its raptor specific  
+my $is_raptor = 0;
+if ($ARGV[$argc-1] eq "raptor") # change "raptor" to something you want.
+{
+	pop(@ARGV);
+	$is_raptor = 1;
+	$argc--;
+}
+
 ($argc==1 or $argc==2 or $argc==3) or die "Usage: perl dlltree.pl <filename> <dir> [-allowbad]\n";
 my $infile=$ARGV[0];
 open IN, $infile or die "Cannot open input file $infile\n";
@@ -795,13 +805,20 @@
 open OUT, ">$dlltreename" or die "Could not open $dlltreename for output\n";
 print OUT @dlltree;
 close OUT;
-my $testbatch = "$ENV{EPOCROOT}epoc32\\build";
-$destpath =~ s/\//\\/go;
-$testbatch.="\\" unless ($destpath =~ /^\\/);
-$testbatch.=$destpath;
-$testbatch.="##MAIN##.auto.bat";
-if (!$allowbad) {
-	push @iby, "data=$testbatch\t\ttest\\loader.auto.bat\n";
+
+my $testbatch ='';
+if($is_raptor) {
+	$testbatch="$ENV{EPOCROOT}\\epoc32\\data\\z\\test\\gen\\##MAIN##.auto.bat";
+}
+else {
+	$testbatch = "$ENV{EPOCROOT}epoc32\\build";
+	$destpath =~ s/\//\\/go;
+	$testbatch.="\\" unless ($destpath =~ /^\\/);
+	$testbatch.=$destpath;
+	$testbatch.="##MAIN##.auto.bat";
+	}
+if (!$allowbad){
+	push @iby, "data=$testbatch\t\ttest\\loader.auto.bat\n";	
 }
 open OUT, ">$ibyname" or die "Could not open $ibyname for output\n";
 print OUT @iby;
--- a/kerneltest/f32test/loader/ldrtst.flm	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/loader/ldrtst.flm	Thu Jul 22 16:46:39 2010 +0100
@@ -20,7 +20,7 @@
 	cp -u $$(filter-out %generated,$$^) $$@
 
 $(TO_BLDINF)/$(GDIR)/generated: $(TO_BLDINF)/dlltree.pl $(TO_BLDINF)/dlltree.txt
-	perl $(TO_BLDINF)/dlltree.pl $(TO_BLDINF)/dlltree.txt $(TO_BLDINF)/$(GDIR)
+	perl $(TO_BLDINF)/dlltree.pl $(TO_BLDINF)/dlltree.txt $(TO_BLDINF)/$(GDIR) raptor
 	touch $$@
 endif
 
--- a/kerneltest/f32test/loader/security/t_ldrcheck.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/loader/security/t_ldrcheck.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -588,7 +588,7 @@
     RFile corrFile;
     CleanupClosePushL(corrFile);	
 
-    TInt r=corrFile.Open(TheFs, aFileName, EFileWrite);
+    TInt r=corrFile.Open(TheFs, aFileName, EFileWrite|EFileWriteDirectIO);
 	if(r != KErrNone)
         return r;
 	
--- a/kerneltest/f32test/locl/CodepageUtils/src/t_cputils_cp932.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/locl/CodepageUtils/src/t_cputils_cp932.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,3 +1,16 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
 //
 // Auto-generated by the FatConversiontable tool - Do not edit!!!
 //
--- a/kerneltest/f32test/locl/localeutils/elocl32_japan/src/t_tlocl32_lat1.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/locl/localeutils/elocl32_japan/src/t_tlocl32_lat1.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -2,7 +2,7 @@
 * Copyright (c) 1995-1999 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
+* under the terms of the License "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
--- a/kerneltest/f32test/locl/t_filematch.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/locl/t_filematch.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -114,7 +114,8 @@
 	r = dir.Open(TheFs, name, KEntryAttNormal);
 	test_KErrNone(r);
 	TEntry entry;
-	test(dir.Read(entry) == KErrNone);
+	r = dir.Read(entry);
+	test_KErrNone(r);
 	dir.Close();
 	}
 
@@ -128,7 +129,8 @@
 	r = dir.Open(TheFs, name, KEntryAttNormal);
 	test_KErrNone(r);
 	TEntry entry;
-	test(dir.Read(entry) == KErrEof);
+	r = dir.Read(entry);
+	test_Equal(KErrEof, r);
 	dir.Close();
 	}
 
@@ -184,11 +186,11 @@
     F32_Test_Utils::SetConsole(test.Console()); 
     
     TInt nRes=TheFs.CharToDrive(gDriveToTest, gDriveNum);
-    test(nRes==KErrNone);
+    test_KErrNone(nRes);
     
     PrintDrvInfo(TheFs, gDriveNum);
 
-    if(Is_Win32(TheFs, gDriveNum) || Is_Fat(TheFs, gDriveNum) || Is_Lffs(TheFs, gDriveNum))
+    if(Is_SimulatedSystemDrive(TheFs, gDriveNum) || Is_Fat(TheFs, gDriveNum) || Is_Lffs(TheFs, gDriveNum))
         {
 	    TestFilenameMatches();
         }
--- a/kerneltest/f32test/plugins/version_2/crypto_encryption/group/t_encplugin.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/plugins/version_2/crypto_encryption/group/t_encplugin.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,6 +22,7 @@
 SOURCEPATH     ../../../../server
 SOURCE         t_main.cpp
 SOURCEPATH     ../../../../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp 
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/plugins/version_2/file64bit/group/t_file64bit_plugin.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/plugins/version_2/file64bit/group/t_file64bit_plugin.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -26,6 +26,7 @@
 SOURCEPATH     ../../../../server
 SOURCE         t_main.cpp
 SOURCEPATH     ../../../../fileutils/src
+SOURCE         f32_test_utils.cpp
 SOURCE         t_chlffs.cpp
 
 LIBRARY        euser.lib efsrv.lib hal.lib
--- a/kerneltest/f32test/plugins/version_2/group/t_plugin_v2.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/plugins/version_2/group/t_plugin_v2.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -27,6 +27,7 @@
 SOURCEPATH	../../../server
 SOURCE		t_main.cpp
 SOURCEPATH	../../../fileutils/src
+SOURCE          f32_test_utils.cpp
 SOURCE          t_chlffs.cpp
 
 USERINCLUDE	../../../server
--- a/kerneltest/f32test/plugins/version_2beta/t_plugin_v2beta.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/plugins/version_2beta/t_plugin_v2beta.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -172,7 +172,7 @@
 
 		}
 	else
-		if ((gFileSystemExtensionLoaded || name.CompareF(_L("Win32"))==0)&& r == KErrNotSupported)
+		if ((gFileSystemExtensionLoaded || F32_Test_Utils::Is_Win32(TheFs,driveNum)) && r == KErrNotSupported)
 			{
 			test.Printf(_L("File system extension does not support local buffers\n"));
 			file.Close();
@@ -449,7 +449,7 @@
 	// run T_FILE with trace plugin installed
 
 #if defined(__WINS__)	// only in WINS to save time
-TestLoadingOfTracePlugin();
+	TestLoadingOfTracePlugin();
 
 	RProcess p;
 
@@ -464,11 +464,11 @@
 	p.Logon(status);
 	p.Resume();
 	User::WaitForRequest(status);
-TestUnloadingOfTracePlugin();
+	TestUnloadingOfTracePlugin();
 #endif // __WINS__
 
 	// Cannot format drive C: so skip this test on that drive
-	if (!F32_Test_Utils::Is_Win32(TheFs, EDriveC))
+	if (!F32_Test_Utils::Is_SimulatedSystemDrive(TheFs, EDriveC))
 	    {
         TestLoadingOfFormatPlugin();
         TestFormatDriveIntercept();
--- a/kerneltest/f32test/server/b_gen.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/server/b_gen.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -693,12 +693,12 @@
     
     PrintDrvInfo(TheFs, gDriveNum);
 
-    //-- quick format the drive, if it isn't the emulator's C:  
-    if(!Is_Win32(TheFs, gDriveNum))
-    {
+    //-- quick format the drive, if it isn't drive C: of the emulator or PlatSim
+    if(!Is_SimulatedSystemDrive(TheFs, gDriveNum))
+    	{
         nRes = FormatDrive(TheFs, gDriveNum, ETrue); 
         test_KErrNone(nRes);
-    }
+    	}
 
     //-----------------------------------
 	TInt c;
--- a/kerneltest/f32test/server/b_open.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/server/b_open.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -23,6 +23,9 @@
 #include <f32dbg.h>
 #include "t_server.h"
 #include "t_chlffs.h"
+#include "f32_test_utils.h"
+
+using namespace F32_Test_Utils;
 
 #ifdef __WINS__
 #define WIN32_LEAN_AND_MEAN
@@ -344,15 +347,15 @@
 // Call tests that may leave
 //
 	{
+    if (Is_SimulatedSystemDrive(TheFs, CurrentDrive()))
+        {
+		// These tests try to create a huge file to fill up the drive.
+		// This fails on WINS with drives with > 1/2G free because
+		// RFile::SetSize() (among other things) only takes a TInt.
+		test.Printf(_L("Skipping B_OPEN on PlatSim/Emulator drive %C:\n"), gSessionPath[0]);
+		return;
+        }
 
-#ifdef __WINS__
-// These tests try to create a huge file to fill up the drive.
-// This fails on WINS with drives with > 1/2G free because
-// RFile::SetSize() (among other things) only takes a TInt.
-//
-	if (gSessionPath.Left(1).CompareF(_L("C")) == 0)
-		return;
-#endif
 	CreateTestDirectory(_L("\\B_OPEN\\"));
 	InitTest();
 	testOpenFiles();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/f32test/server/t_dircache.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,612 @@
+// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// f32test\server\t_dircache.cpp
+// 
+//
+#define __E32TEST_EXTENSION__
+#include <f32file.h>
+#include <f32fsys.h>
+#include <e32test.h>
+#include <f32dbg.h>
+#include "t_server.h"
+#include "t_chlffs.h"
+#include "f32_test_utils.h"
+#include "fat_utils.h"
+#include "d_pagestress.h"
+
+RTest test(_L("T_DIRCACHE"));
+
+/*
+ * This whole test execute on UDEB mode only.
+ */
+#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
+
+TInt gDrive=-1;
+const TInt32 KDef_KLeafDirCacheSize = 32;                    // default leaf dir cache number
+const TInt32 KDef_DynamicDirCacheMinInBytes = 128 << 10;     // default minimum fat dir cache size in bytes
+const TInt32 KDef_DynamicDirCacheMaxInBytes = 256 << 10;     // default maximum fat dir cache size in bytes
+const TInt32 KDef_MaxDynamicDirCachePageSzLog2 = 14;         // default value for directory cache single page 
+                                                              //  maximal size Log2, 2^14 (16K) by default
+const TInt32 KMaxThreadCount = 1;                            // the maximum number of multiple threads that can
+                                                              //  access dir cache concurrently.
+const TInt32 KSegmentSize = 1 << 12;                            // the smallest memory unit that Kernel manages  
+
+template <class C>
+TInt controlIo(RFs &fs, TInt drv, TInt fkn, C &c)
+    {
+    TPtr8 ptrC((TUint8 *)&c, sizeof(C), sizeof(C));
+
+    TInt r = fs.ControlIo(drv, fkn, ptrC);
+
+    return r;
+    }
+
+// See f32\sfile\sf_memory_man.cpp for the default value settings
+const TInt  KDefaultGlobalCacheMemorySize = (8 << 10) << 10;
+const TInt  KDefaultLowMemoryThreshold = 10;
+//----------------------------------------------------------------------------------------------
+//@SYMTestCaseID      PBASE-XXXX 
+//@SYMTestType        FT
+//@SYMPREQ            PREQ1885
+//@SYMTestCaseDesc    Check global cache settings. The global cache should be either:
+//                      1. 0 (disabled)
+//                      2. no less than the sum of all per-drive settings
+//----------------------------------------------------------------------------------------------
+void TestGlobalSettings()
+    {
+    test.Next(_L("Test global cache settings"));
+    // read global cache settings from estart.txt
+    TGlobalCacheConfig globalCacheConfig;
+    TInt r = controlIo(TheFs,gDrive, KControlIoGlobalCacheConfig, globalCacheConfig);
+	test_KErrNone(r);
+    test_Value (globalCacheConfig.iGlobalCacheSizeInBytes,
+				globalCacheConfig.iGlobalCacheSizeInBytes > 0 || globalCacheConfig.iGlobalCacheSizeInBytes == KErrNotFound);
+    test_Value (globalCacheConfig.iGlobalLowMemoryThreshold,
+				globalCacheConfig.iGlobalLowMemoryThreshold >= 0 || globalCacheConfig.iGlobalLowMemoryThreshold == KErrNotFound);
+
+    const TInt32 globalCacheSize = globalCacheConfig.iGlobalCacheSizeInBytes > 0 ? 
+                                       globalCacheConfig.iGlobalCacheSizeInBytes : KDefaultGlobalCacheMemorySize;
+
+    // test if global cache is enabled, it is configured in the way that its figure is no less
+    //  than the sum of per-drive max size settings (taking default values into account). 
+    TInt32 sumDirCacheMaxSize = 0;
+    for (TInt i = 0; i < KMaxDrives; i++)
+        {
+        TBuf<0x20>  fsName;
+        r = TheFs.FileSystemName(fsName, i);
+
+        if (r == KErrNone && (F32_Test_Utils::Is_Fat(TheFs, i) || F32_Test_Utils::Is_ExFat(TheFs, i)))
+            {
+            test.Printf(_L("drive[%C:] file system: (\"%S\")\n"), 'A' + i, &fsName);
+            TDirCacheConfig dirCacheConfig;
+            r = controlIo(TheFs,gDrive, KControlIoDirCacheConfig, dirCacheConfig);
+            test_KErrNone(r);
+            if(dirCacheConfig.iDirCacheSizeMax > 0)
+                {
+                sumDirCacheMaxSize += (dirCacheConfig.iDirCacheSizeMax > KDef_DynamicDirCacheMaxInBytes ? dirCacheConfig.iDirCacheSizeMax : KDef_DynamicDirCacheMaxInBytes);
+                }
+            else
+                {
+                sumDirCacheMaxSize += KDef_DynamicDirCacheMaxInBytes;
+                }
+            test.Printf(_L("++sumDirCacheMaxSize = %d\n"), sumDirCacheMaxSize);
+            }
+        }
+    test_Compare(globalCacheSize, >=, sumDirCacheMaxSize);
+    }
+
+//----------------------------------------------------------------------------------------------
+//@SYMTestCaseID      PBASE-XXXX 
+//@SYMTestType        FT
+//@SYMPREQ            PREQ1885
+//@SYMTestCaseDesc    Test current drive's dir cache configurations, the current dir cache info should
+//                      match the configurations read from estart.txt file.
+//----------------------------------------------------------------------------------------------
+void TestDirCacheSettings()
+    {
+    test.Next(_L("Test current drive's dir cache settings"));
+    
+    // test global cache config is ON 
+    TGlobalCacheConfig globalCacheConfig;
+    TInt r = controlIo(TheFs,gDrive, KControlIoGlobalCacheConfig, globalCacheConfig);
+    test_KErrNone(r);
+    test_Value (globalCacheConfig.iGlobalCacheSizeInBytes,
+				globalCacheConfig.iGlobalCacheSizeInBytes > 0 || globalCacheConfig.iGlobalCacheSizeInBytes == KErrNotFound);
+    test_Value (globalCacheConfig.iGlobalLowMemoryThreshold,
+				globalCacheConfig.iGlobalLowMemoryThreshold >= 0 || globalCacheConfig.iGlobalLowMemoryThreshold == KErrNotFound);
+    
+    // test global cache info is corresponding to the configurations
+    TGlobalCacheInfo globalCacheInfo;
+    r = controlIo(TheFs,gDrive, KControlIoGlobalCacheInfo, globalCacheInfo);
+    test_KErrNone(r);
+
+    if (globalCacheConfig.iGlobalCacheSizeInBytes == KErrNotFound)
+        {
+        test_Equal(KDefaultGlobalCacheMemorySize, globalCacheInfo.iGlobalCacheSizeInBytes);
+        }
+    else
+        {
+        test_Equal(globalCacheConfig.iGlobalCacheSizeInBytes, globalCacheInfo.iGlobalCacheSizeInBytes);
+        }
+
+    if (globalCacheConfig.iGlobalLowMemoryThreshold == KErrNotFound)
+        {
+        test_Equal(KDefaultLowMemoryThreshold, globalCacheInfo.iGlobalLowMemoryThreshold);
+        }
+    else
+        {
+        test_Equal(globalCacheConfig.iGlobalLowMemoryThreshold, globalCacheInfo.iGlobalLowMemoryThreshold);
+        }
+    
+    // read per-drive settings from estart.txt
+    TDirCacheConfig dirCacheConfig;
+    r = controlIo(TheFs,gDrive, KControlIoDirCacheConfig, dirCacheConfig);
+    test_KErrNone(r);
+    test_Value (dirCacheConfig.iLeafDirCacheSize,
+				dirCacheConfig.iLeafDirCacheSize >= 0 || dirCacheConfig.iLeafDirCacheSize == KErrNotFound);
+    test_Value (dirCacheConfig.iDirCacheSizeMin,
+				dirCacheConfig.iDirCacheSizeMin >= 0 || dirCacheConfig.iDirCacheSizeMin == KErrNotFound);
+    test_Value (dirCacheConfig.iDirCacheSizeMax,
+				dirCacheConfig.iDirCacheSizeMax >= 0 || dirCacheConfig.iDirCacheSizeMax == KErrNotFound);
+    
+    // caculate expected settings according to the readings from estart.txt
+    if (dirCacheConfig.iLeafDirCacheSize == 0)
+        dirCacheConfig.iLeafDirCacheSize = 1;
+    if (dirCacheConfig.iLeafDirCacheSize == KErrNotFound)
+        dirCacheConfig.iLeafDirCacheSize = KDef_KLeafDirCacheSize;
+    if (dirCacheConfig.iDirCacheSizeMin < KDef_DynamicDirCacheMinInBytes)
+        dirCacheConfig.iDirCacheSizeMin = KDef_DynamicDirCacheMinInBytes;
+    if (dirCacheConfig.iDirCacheSizeMax < KDef_DynamicDirCacheMaxInBytes)
+        dirCacheConfig.iDirCacheSizeMax = KDef_DynamicDirCacheMaxInBytes;
+    
+    TVolumeIOParamInfo ioParam;
+    r = TheFs.VolumeIOParam(gDrive, ioParam);
+    test_KErrNone(r);
+    const TInt32 KClusterSize = ioParam.iClusterSize;
+    test.Printf(_L("DRV[%C:] cluster = %d\n"), gDrive + 'A', ioParam.iClusterSize); 
+
+    const TInt32 KDefMaxCachePageSize = 1 << KDef_MaxDynamicDirCachePageSzLog2;
+    const TInt32 KPageSizeInData = KClusterSize < KDefMaxCachePageSize ? KClusterSize : KDefMaxCachePageSize;
+    const TInt32 KPageSizeInMem = KPageSizeInData < KSegmentSize ? KSegmentSize : KPageSizeInData;
+    const TInt32 KCacheSizeMinInPages = dirCacheConfig.iDirCacheSizeMin / KPageSizeInMem;
+    const TInt32 KCacheSizeMaxInPages = dirCacheConfig.iDirCacheSizeMax / KPageSizeInMem;
+    const TInt32 KUnlockedPageNum = 0;
+    
+    // remount drive, get current dir cache info and test
+    r = F32_Test_Utils::RemountFS (TheFs, CurrentDrive(), NULL);
+    test_KErrNone(r);
+
+    TDirCacheInfo dirCacheInfo;
+    r = controlIo(TheFs,gDrive, KControlIoDirCacheInfo, dirCacheInfo);
+    test_KErrNone(r);
+    
+    test_Equal(KSegmentSize, dirCacheInfo.iMemorySegmentSize);
+    test_Equal(KPageSizeInMem, dirCacheInfo.iPageSizeInMemory);
+    test_Equal(KPageSizeInData, dirCacheInfo.iPageSizeInData);
+    test_Equal(KCacheSizeMinInPages, dirCacheInfo.iMinCacheSizeInPages);
+    test_Equal(KCacheSizeMaxInPages, dirCacheInfo.iMaxCacheSizeInPages);
+    test_Equal(KMaxThreadCount, dirCacheInfo.iLockedPageNumber);
+    test_Equal(KUnlockedPageNum, dirCacheInfo.iUnlockedPageNumber);
+    }
+
+//----------------------------------------------------------------------------------------------
+//@SYMTestCaseID      PBASE-XXXX 
+//@SYMTestType        FT
+//@SYMPREQ            PREQ1885
+//@SYMTestCaseDesc    Test populating dir cache under normal memory conditions.
+//----------------------------------------------------------------------------------------------
+void TestPopulateCache()
+    {
+    test.Next(_L("Test populating dir cache under normal memory conditions"));
+    
+    CFileMan* fileMan = CFileMan::NewL(TheFs);
+    test_NotNull(fileMan);
+    TInt r = fileMan->RmDir(_L("\\TEST_DIRCACHE\\"));
+    test_Value(r, r==KErrNone || r==KErrPathNotFound);
+
+    // remount drive, get current dir cache info
+    r = F32_Test_Utils::RemountFS (TheFs, CurrentDrive(), NULL);
+    test_KErrNone(r);
+
+    /*
+     * Test populating dir cache 
+     */
+    TVolumeIOParamInfo ioParam;
+    r = TheFs.VolumeIOParam(gDrive, ioParam);
+    test_KErrNone(r);
+    const TInt32 KClusterSize = ioParam.iClusterSize;
+
+    TFileName dirPath = _L("\\TEST_DIRCACHE\\");
+    r = TheFs.MkDirAll(dirPath);
+    test_KErrNone(r);
+
+    TDirCacheInfo dirCacheInfo;
+    r = controlIo(TheFs,gDrive, KControlIoDirCacheInfo, dirCacheInfo);
+    test_KErrNone(r);
+
+    // this calculation is for volumes that have a large cluster size, larger than the allowed maximum
+    //  page size. on this case, creating a new directory will generate two or more new pages in the 
+    //  dir cache 
+    const TUint pagesPerDir = KClusterSize > dirCacheInfo.iPageSizeInMemory ? 
+                            KClusterSize / dirCacheInfo.iPageSizeInMemory : 1;
+    
+    // should be KMaxThreadCount + root dir (1 page) + "\\TEST_DIRCACHE\\" (number of pages that are 
+    //  needed for new directories, i.e. pagesPerDir)
+    test_Equal(KMaxThreadCount + 1 + pagesPerDir, dirCacheInfo.iLockedPageNumber);
+
+    const TInt initialUnlockedPage = dirCacheInfo.iUnlockedPageNumber;
+
+    const TInt createdNewDirs = dirCacheInfo.iMinCacheSizeInPages - dirCacheInfo.iLockedPageNumber;
+    // create directories so that it grows to KCacheSizeMinInPages
+    for (TInt i = 1; i <= createdNewDirs; i++)
+        {
+        dirPath = _L("\\TEST_DIRCACHE\\");
+        TFileName dirName;
+        dirName.Format(_L("DIR%d\\"), i);
+        dirPath += dirName;
+        r = TheFs.MkDirAll(dirPath);
+        test_KErrNone(r);
+        }
+    
+    const TInt KFatDirEntrySize = 32;
+    const TInt subDirNum = dirCacheInfo.iMinCacheSizeInPages - dirCacheInfo.iLockedPageNumber;
+    // calculate the extra pages needed for the newly created sub dir entries (plus the original 
+    //  "." and ".." entries)
+    TInt extraPagesForLeafdir = ((subDirNum + 2) * KFatDirEntrySize / dirCacheInfo.iPageSizeInData) - 1;
+    if (((subDirNum + 2) * KFatDirEntrySize) % dirCacheInfo.iPageSizeInData > 0)
+        extraPagesForLeafdir++;
+    test.Printf(_L("!!Extra pages needed for leafdir = %d\n"), extraPagesForLeafdir);   //kk
+
+    r = controlIo(TheFs,gDrive, KControlIoDirCacheInfo, dirCacheInfo);
+    test_KErrNone(r);
+    r = controlIo(TheFs,gDrive, 15, dirCacheInfo);
+    test_KErrNone(r);
+
+    test_Equal(dirCacheInfo.iMinCacheSizeInPages, dirCacheInfo.iLockedPageNumber);
+    
+    const TInt maxUnlockedPage = dirCacheInfo.iMaxCacheSizeInPages - dirCacheInfo.iMinCacheSizeInPages;
+    // calculating the expected unlocked page number here.
+    TInt newUnlockedPage = initialUnlockedPage;
+    newUnlockedPage += extraPagesForLeafdir;                // if any extra pages are created for the leafdir
+    newUnlockedPage += createdNewDirs * (pagesPerDir - 1);   // if more than one page is needed for each dir creation 
+    test_Equal((newUnlockedPage > maxUnlockedPage ? maxUnlockedPage : newUnlockedPage), dirCacheInfo.iUnlockedPageNumber);
+
+    // create directories so that it grows to KCacheSizeMinInPages + KCacheSizeMaxInPages
+    if (dirCacheInfo.iMaxCacheSizeInPages > dirCacheInfo.iMinCacheSizeInPages)
+        {
+        for (TInt i = 1; i <= dirCacheInfo.iMaxCacheSizeInPages - dirCacheInfo.iMinCacheSizeInPages; i++)
+            {
+            dirPath = _L("\\TEST_DIRCACHE\\");
+            TFileName dirName;
+            dirName.Format(_L("DIR_UNLOCKED%d\\"), i);
+            dirPath += dirName;
+            r = TheFs.MkDirAll(dirPath);
+            test_KErrNone(r);
+            }
+        r = controlIo(TheFs,gDrive, KControlIoDirCacheInfo, dirCacheInfo);
+        test_KErrNone(r);
+        r = controlIo(TheFs,gDrive, 15, dirCacheInfo);
+        test_KErrNone(r);
+
+        test_Equal(dirCacheInfo.iMinCacheSizeInPages, dirCacheInfo.iLockedPageNumber);
+        
+        test_Equal(dirCacheInfo.iMaxCacheSizeInPages - dirCacheInfo.iMinCacheSizeInPages, dirCacheInfo.iUnlockedPageNumber);
+        }
+    
+    // create more directories and check that dir cache doesn't grow beyond KCacheSizeMaxInPages
+    for (TInt j = 1; j <= dirCacheInfo.iMinCacheSizeInPages; j++)
+        {
+        dirPath = _L("\\TEST_DIRCACHE\\");
+        TFileName dirName;
+        dirName.Format(_L("DIR_MORE%d\\"), j);
+        dirPath += dirName;
+        r = TheFs.MkDirAll(dirPath);
+        test_KErrNone(r);
+        }
+    r = controlIo(TheFs,gDrive, KControlIoDirCacheInfo, dirCacheInfo);
+    test_KErrNone(r);
+    r = controlIo(TheFs,gDrive, 15, dirCacheInfo);
+    test_KErrNone(r);
+
+    test_Equal(dirCacheInfo.iMinCacheSizeInPages, dirCacheInfo.iLockedPageNumber);
+    test_Equal(dirCacheInfo.iMaxCacheSizeInPages - dirCacheInfo.iMinCacheSizeInPages, dirCacheInfo.iUnlockedPageNumber);
+
+    r = controlIo(TheFs,gDrive, KControlIoDirCacheInfo, dirCacheInfo);
+    test_KErrNone(r);
+
+    r = fileMan->RmDir(_L("\\TEST_DIRCACHE\\"));
+    test_KErrNone(r);
+    
+    delete fileMan;
+    }
+
+//----------------------------------------------------------------------------------------------
+//@SYMTestCaseID      PBASE-XXXX 
+//@SYMTestType        FT
+//@SYMPREQ            PREQ1885
+//@SYMTestCaseDesc    Test simulating low memory condition.
+//                    1. The cache should stop growing when it is at its minimum cache size in pages
+//                    2. The cache should function properly when it stops simulating low memory condition 
+//----------------------------------------------------------------------------------------------
+void TestSimulatingLowMemory()
+    {
+    // remount drive, get current dir cache info and test
+    test.Next(_L("Test dir cache growth when simulating low memory condition"));
+
+    CFileMan* fileMan = CFileMan::NewL(TheFs);
+    test(fileMan != NULL);
+    TInt r = fileMan->RmDir(_L("\\TEST_DIRCACHE\\"));
+    test_Value(r, r==KErrNone || r==KErrPathNotFound);
+
+    r = F32_Test_Utils::RemountFS (TheFs, CurrentDrive(), NULL);
+    test_KErrNone(r);
+
+    r = TheFs.ControlIo(gDrive, KControlIoSimulateMemoryLow);
+    test_KErrNone(r);
+
+    /*
+     * Test populating dir cache 
+     */
+    TFileName dirPath = _L("\\TEST_DIRCACHE\\");
+    r = TheFs.MkDirAll(dirPath);
+    test_KErrNone(r);
+
+    TDirCacheInfo dirCacheInfo;
+    r = controlIo(TheFs,gDrive, KControlIoDirCacheInfo, dirCacheInfo);
+    test_KErrNone(r);
+
+    // create directories so that it grows to KCacheSizeMaxInPages
+    for (TInt i = 1; i <= dirCacheInfo.iMaxCacheSizeInPages; i++)
+        {
+        dirPath = _L("\\TEST_DIRCACHE\\");
+        TFileName dirName;
+        dirName.Format(_L("DIR%d\\"), i);
+        dirPath += dirName;
+        r = TheFs.MkDirAll(dirPath);
+        test_KErrNone(r);
+        }
+
+    r = controlIo(TheFs,gDrive, KControlIoDirCacheInfo, dirCacheInfo);
+    test_KErrNone(r);
+
+    test_Equal(dirCacheInfo.iMinCacheSizeInPages, dirCacheInfo.iLockedPageNumber);
+    test_Equal(0, dirCacheInfo.iUnlockedPageNumber);
+    
+    r = fileMan->RmDir(_L("\\TEST_DIRCACHE\\"));
+    test_KErrNone(r);
+ 
+    // test when stop simulating the low memory condition, cache grows normally
+    test.Next(_L("Test dir cache growth when stop simulating low memory condition"));
+    r = TheFs.ControlIo(gDrive, KControlIoStopSimulateMemoryLow);
+    test_KErrNone(r);
+
+    r = F32_Test_Utils::RemountFS (TheFs, CurrentDrive(), NULL);
+    test_KErrNone(r);
+
+    /*
+     * Test populating dir cache 
+     */
+    dirPath = _L("\\TEST_DIRCACHE\\");
+    r = TheFs.MkDirAll(dirPath);
+    test_KErrNone(r);
+
+    // create directories so that it grows to KCacheSizeMaxInPages
+    for (TInt j = 1; j <= dirCacheInfo.iMaxCacheSizeInPages; j++)
+        {
+        dirPath = _L("\\TEST_DIRCACHE\\");
+        TFileName dirName;
+        dirName.Format(_L("DIR%d\\"), j);
+        dirPath += dirName;
+        r = TheFs.MkDirAll(dirPath);
+        test_KErrNone(r);
+        }
+
+    r = controlIo(TheFs,gDrive, KControlIoDirCacheInfo, dirCacheInfo);
+    test_KErrNone(r);
+
+    test_Equal(dirCacheInfo.iMinCacheSizeInPages, dirCacheInfo.iLockedPageNumber);
+    test_Equal(dirCacheInfo.iMaxCacheSizeInPages - dirCacheInfo.iMinCacheSizeInPages, dirCacheInfo.iUnlockedPageNumber);
+    
+    r = fileMan->RmDir(_L("\\TEST_DIRCACHE\\"));
+    test_KErrNone(r);
+
+    delete fileMan;
+    }
+
+//----------------------------------------------------------------------------------------------
+//@SYMTestCaseID      PBASE-XXXX 
+//@SYMTestType        FT
+//@SYMPREQ            PREQ1885
+//@SYMTestCaseDesc    Test low memory threshold on hardware platforms
+//                    1. Stress the system memory to below the low memory threshold configured
+//                    2. The cache should stop growing when it is at its minimum cache size in pages
+//                    3. Resume the system memory before step 1.
+//                    2. The cache should function properly when it stops simulating low memory condition 
+//----------------------------------------------------------------------------------------------
+void TestLowMemoryHW()
+    {
+    test.Next(_L("Test low memory threshold on hardware"));
+#if !defined(__WINS__)
+
+    CFileMan* fileMan = CFileMan::NewL(TheFs);
+    test_NotNull(fileMan);
+    TInt r = fileMan->RmDir(_L("\\TEST_DIRCACHE\\"));
+    test_Value(r, r==KErrNone || r==KErrPathNotFound);
+
+    r = F32_Test_Utils::RemountFS (TheFs, CurrentDrive(), NULL);
+    test_KErrNone(r);
+
+    RPageStressTestLdd PagestressLdd;
+    TMemoryInfoV1Buf memInfo;
+    r = UserHal::MemoryInfo(memInfo);
+    test_KErrNone(r);
+
+    TGlobalCacheInfo globalCacheInfo;
+    r = controlIo(TheFs,gDrive, KControlIoGlobalCacheInfo, globalCacheInfo);
+    test_KErrNone(r);
+
+    test.Printf(_L("Free RAM before setup %d\n"), memInfo().iFreeRamInBytes);
+    const TReal lowMemThreshold = globalCacheInfo.iGlobalLowMemoryThreshold / 200.00;
+    test.Printf(_L("Low memory threshold = %d%%\n"), globalCacheInfo.iGlobalLowMemoryThreshold);
+    test.Printf(_L("Current memory available = %d%%\n"), lowMemThreshold * 100);
+
+    const TInt totalRamInBytes = memInfo().iTotalRamInBytes;
+    const TInt setupFreeRamInBytes = (TInt) (lowMemThreshold * totalRamInBytes);
+    const TInt setupFreeRamInPages = setupFreeRamInBytes / KSegmentSize;
+    
+    r = User::LoadLogicalDevice(KPageStressTestLddName);
+    test_Value(r, r==KErrNone || r==KErrAlreadyExists);
+    r = PagestressLdd.Open();
+    test_KErrNone(r);
+    r = PagestressLdd.DoSetDebugFlag((TInt)ETrue);
+    test_KErrNone(r);
+    if (setupFreeRamInPages > 0 && setupFreeRamInBytes < totalRamInBytes)
+        {
+        r = PagestressLdd.DoConsumeRamSetup(setupFreeRamInPages, 1);
+        test_KErrNone(r);
+        r = UserHal::MemoryInfo(memInfo);
+        test_KErrNone(r);
+        test.Printf(_L("Free RAM after setup %d\n"), memInfo().iFreeRamInBytes);
+        }
+    else
+        {
+        test.Printf(_L("Current memory is already low: %d\n"), memInfo().iFreeRamInBytes);
+        }
+
+    /*
+     * Test populating dir cache 
+     */
+    TFileName dirPath = _L("\\TEST_DIRCACHE\\");
+    r = TheFs.MkDirAll(dirPath);
+    test_KErrNone(r);
+
+    TDirCacheInfo dirCacheInfo;
+    r = controlIo(TheFs,gDrive, KControlIoDirCacheInfo, dirCacheInfo);
+    test_KErrNone(r);
+
+    // create directories so that it grows to KCacheSizeMaxInPages
+    for (TInt i = 1; i <= dirCacheInfo.iMaxCacheSizeInPages; i++)
+        {
+        dirPath = _L("\\TEST_DIRCACHE\\");
+        TFileName dirName;
+        dirName.Format(_L("DIR%d\\"), i);
+        dirPath += dirName;
+        r = TheFs.MkDirAll(dirPath);
+        test_KErrNone(r);
+        }
+
+    r = controlIo(TheFs,gDrive, KControlIoDirCacheInfo, dirCacheInfo);
+    test_KErrNone(r);
+
+    test_Equal(dirCacheInfo.iMinCacheSizeInPages, dirCacheInfo.iLockedPageNumber);
+    test_Equal(0, dirCacheInfo.iUnlockedPageNumber);
+    
+    // release memory
+    PagestressLdd.DoConsumeRamFinish();
+    PagestressLdd.Close();
+    r = User::FreeLogicalDevice(KPageStressTestLddName);
+    test_KErrNone(r);
+    
+    r = UserHal::MemoryInfo(memInfo);
+    test_KErrNone(r);
+    test.Printf(_L("Free RAM after test %d\n"), memInfo().iFreeRamInBytes);
+
+    r = fileMan->RmDir(_L("\\TEST_DIRCACHE\\"));
+    test_KErrNone(r);
+    delete fileMan;
+#else
+    test.Printf(_L("This test step only runs on hardware!!\n"));
+#endif //#if !defined(__WINS__)
+    }
+
+#endif // #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
+
+GLDEF_C void CallTestsL()
+//
+// Test the file server.
+//
+    {
+#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
+    TInt nRes=TheFs.CharToDrive(gDriveToTest, gDrive);
+    test_KErrNone(nRes);
+
+    TDriveInfo  driveInfo;
+    nRes = TheFs.Drive(driveInfo, gDrive);
+    test.Printf(_L("MediaType: 0x%x\n"), driveInfo.iType);
+    test_KErrNone(nRes);
+    
+    if (F32_Test_Utils::Is_Fat(TheFs, gDrive) && driveInfo.iType != EMediaRam)
+        {
+        nRes = F32_Test_Utils::FormatDrive(TheFs, gDrive, ETrue);
+        test_KErrNone(nRes);
+        
+        F32_Test_Utils::PrintDrvInfo(TheFs, gDrive);
+        
+        TVolumeInfo v;
+        TInt r=TheFs.Volume(v, CurrentDrive());
+        test_KErrNone(r);
+        
+        CreateTestDirectory(_L("\\F32-TST\\TDIRCACHE\\"));
+        
+        TestGlobalSettings();
+        TestDirCacheSettings();
+        TestPopulateCache();
+        TestSimulatingLowMemory();
+        TestLowMemoryHW();
+        
+        DeleteTestDirectory();
+        }
+    else
+        {
+        test.Printf(_L("This test executes on FAT drives and non-RAM media only!!\n"));
+        }
+#else
+    test.Printf(_L("This test executes on DEBUG mode only!!\n"));
+#endif //#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
+    }
+
+/*
+void TestReadEstart()
+    {
+    TDirCacheConfig dirCacheConfig;
+    TInt r = controlIo(TheFs,gDrive, KControlIoDirCacheConfig, dirCacheConfig);
+    test_KErrNone(r);
+    test.Printf(_L("Dir cache: \n Drive %C \n iLeafDirCacheSize %d \n iDirCacheSizeMin %d \n iDirCacheSizeMax %d \n iGlobalCacheMemorySize %d \n iLowMemoryThreshold %%%d"), 
+            dirCacheConfig.iDrive + 'A',
+            dirCacheConfig.iLeafDirCacheSize,
+            dirCacheConfig.iDirCacheSizeMin,
+            dirCacheConfig.iDirCacheSizeMax);
+    }
+
+*/
+
+//          const TInt KControlIoGlobalCacheConfig=KMaxTInt-21;
+//          const TInt KControlIoGlobalCacheInfo=KMaxTInt-22;
+//          const TInt KControlIoDirCacheConfig=KMaxTInt-23;
+//          const TInt KControlIoDirCacheInfo=KMaxTInt-24;
+//
+//class TGlobalCacheConfig
+//class TGlobalCacheInfo
+//class TDirCacheConfig
+//class TDirCacheInfo 
+
+//  this test is for FAT only!!
+//if (F32_Test_Utils::Is_ExFat(TheFs, gDrive))
+//    {
+//    // test cluster size
+//    TVolumeIOParamInfo ioParam;
+//    TInt r = TheFs.VolumeIOParam(gDrive, ioParam);
+//    test.Printf(_L("TheFs.VolumeIOParam for EXFAT: (cluster = %d) = %d\n"), ioParam.iClusterSize, r); 
+//    }
+//
--- a/kerneltest/f32test/server/t_dlocl.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/server/t_dlocl.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -669,6 +669,7 @@
     eloclus.Append(TPtrC(KDLLExtension));
     r = locale.GetLocaleDllName(ELocaleLanguageSettings, dllName);
     test_KErrNone(r);
+	dllName.UpperCase();
     test.Printf(_L("dllName looking for %s (%s)\n"), dllName.Ptr(), eloclus.Ptr());
     test(dllName.Find(eloclus) != KErrNotFound);
     
@@ -676,18 +677,21 @@
 
     r = locale.GetLocaleDllName(ELocaleCollateSetting, dllName);
     test_KErrNone(r);
+	dllName.UpperCase();
     test(dllName.Find(eloclus) != KErrNotFound);
     
     dllName.FillZ();
 
     r = locale.GetLocaleDllName(ELocaleLocaleSettings, dllName);
     test_KErrNone(r);
+	dllName.UpperCase();
     test(dllName.Find(eloclus) != KErrNotFound);
     
     dllName.FillZ();
 
     r = locale.GetLocaleDllName(ELocaleTimeDateSettings, dllName);
     test_KErrNone(r);
+	dllName.UpperCase();
     test(dllName.Find(eloclus) != KErrNotFound);
     
     dllName.FillZ();
@@ -720,24 +724,28 @@
     eloclge.Append(KDLLExtension);
     r = locale.GetLocaleDllName(ELocaleLanguageSettings, dllName);
     test_KErrNone(r);
+	dllName.UpperCase();
     test(dllName.Find(eloclus) != KErrNotFound);
     
     dllName.FillZ();
 
     r = locale.GetLocaleDllName(ELocaleCollateSetting, dllName);
     test_KErrNone(r);
+	dllName.UpperCase();
     test(dllName.Find(eloclus) != KErrNotFound);
     
     dllName.FillZ();
 
     r = locale.GetLocaleDllName(ELocaleLocaleSettings, dllName);
     test_KErrNone(r);
+	dllName.UpperCase();
     test(dllName.Find(eloclge) != KErrNotFound);
     
     dllName.FillZ();
 
     r = locale.GetLocaleDllName(ELocaleTimeDateSettings, dllName);
     test_KErrNone(r);
+	dllName.UpperCase();
     test(dllName.Find(eloclge) != KErrNotFound);
     
     dllName.FillZ();
--- a/kerneltest/f32test/server/t_ext1.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/server/t_ext1.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -60,10 +60,10 @@
 	test_KErrNone(r);
 	test.Printf(_L("fsName=%S\n"),&fsName);
 
-#if defined(__WINS__)
-	if(drive==EDriveC)
+	if (Is_SimulatedSystemDrive(TheFs, drive))
 		{
-		// check that the extension cannot be mounted since not supported by the file system
+		// check that the extension cannot be mounted since it is not supported by the file system
+		test.Printf(_L("Test extension cannot be mounted"));
 		r=TheFs.AddExtension(KExtensionLog);
 		test_KErrNone(r);
 		r=TheFs.MountExtension(KExtensionLogName,drive);
@@ -72,7 +72,6 @@
 		test_KErrNone(r);
 		return;
 		}
-#endif
 
 	test.Next(_L("RFs::AddExtension()"));
 	r=TheFs.AddExtension(KExtensionLog);
@@ -279,10 +278,11 @@
 	TInt err=RFs::CharToDrive(gDriveToTest,drive);
 	test_KErrNone(err);
 
-#if defined(__WINS__)
-	if(drive==EDriveC)
+	if(Is_SimulatedSystemDrive(TheFs, drive))
+	    {
+		test.Printf(_L("Skipping TestPrimaryExtensions on PlatSim/Emulator drive %C:\n"), gSessionPath[0]);
 		return;
-#endif
+	    }
 
 	TPckgBuf<TBool> drvSyncBuf;
 	err = TheFs.QueryVolumeInfoExt(drive, EIsDriveSync, drvSyncBuf);
@@ -456,7 +456,7 @@
 	test_KErrNone(err);
 	if(!extensionsSupported)
 	    {
-        test.Printf(_L("Drive %d does not support file sys extensions. Skipping test."), drive);
+        test.Printf(_L("Drive %C: does not support file sys extensions. Skipping T_EXT1."), gSessionPath[0]);
         test.End();
         test.Close();
         return;
@@ -475,6 +475,7 @@
 	TheFs.Drive(driveInfo,drive);
 	if (driveInfo.iType == EMediaNANDFlash)
 		{
+		test.Printf(_L("Skipping T_EXT1 as drive %C: is NAND\n"), gSessionPath[0]);
 		return;
 		}
 #endif
--- a/kerneltest/f32test/server/t_falsespace.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/server/t_falsespace.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1049,11 +1049,106 @@
 	test_KErrNone(nRes);
     for(i=0; i<MaxDummyFiles; ++i)
 	    {
-        nRes = DeleteFileX(KBaseFN, i); 
+        nRes = DeleteFileX(KBaseFN, i);
         test_KErrNone(nRes);
 		}
 	}
 
+void TestRAMDriveNotification()
+	{
+	test.Next(_L("Verifying RFs::ReserveDriveSpace() triggers RFs::NotifyDiskSpace() events"));
+
+	TInt64 freeSpace;
+	GetFreeDiskSpace(freeSpace);
+	test.Printf(_L("free space: 0x%Lx bytes\n"), freeSpace);
+
+	// set a notification on half the amount we plan to reserve
+	TInt reserve = 4096;
+	TInt64 trigger = freeSpace - 2048;
+	test.Printf(_L("setting notification for space to fall below: 0x%Lx bytes ... "), trigger);
+	TRequestStatus stat;
+	TheFs.NotifyDiskSpace(trigger, gTestDrive, stat);
+	test_Value(stat.Int(), stat == KRequestPending);
+	test.Printf(_L("ok\n"));
+
+	// reserve the space and validate that this triggers the notification
+	test.Printf(_L("reserving 0x%x bytes ..."), reserve);
+	TInt r = TheFs.ReserveDriveSpace(gTestDrive, reserve);
+	test_KErrNone(r);
+	test.Printf(_L("ok\n"));
+
+	test.Printf(_L("validating that the disk space notification triggered ... "));
+	User::After(2000000);	// 2 seconds should be enough to cause the trigger
+	test_Value(stat.Int(), stat == KErrNone);
+	test.Printf(_L("ok\n"));
+	}
+
+
+//-----------------------------------------------------------------------------
+/**
+    Test that the reserving some drive space does not takes more space than required.
+*/
+void Test0()
+{
+    test.Next(_L("test ReserveDriveSpace threshold"));
+
+    TInt nRes;
+    TVolumeIOParamInfo volIop;
+    TInt64 freespace=0;
+
+    //-- 1. format the volume
+    FormatDrive();
+
+    GetFreeDiskSpace(freespace);
+    const TInt64 freeSpace1 = freespace; //-- initial amount of free space on the volume
+
+    nRes = TheFs.VolumeIOParam(gTestDrive, volIop);
+    test_KErrNone(nRes);
+    const TInt KClusterSz = volIop.iClusterSize;
+    if(!IsPowerOf2(KClusterSz))
+        {
+        test.Next(_L("The FS hasn't reported a cluster size. The test is inconsistent, skipping"));
+        return;
+        }
+
+    //-- reserve exactly 1 cluster worth drive space.
+    nRes = TheFs.ReserveDriveSpace(gTestDrive, KClusterSz);
+    test_KErrNone(nRes);
+
+    GetFreeDiskSpace(freespace);
+    const TInt64 freeSpace2 = freespace;
+    test((freeSpace1 - freeSpace2) == KClusterSz);
+
+    //-- fill up a drive (it has a reserved space)
+    FillUpDisk();
+
+    //-- delete 1 file; 
+    nRes = DeleteFileX(KBaseName, 0);
+    test_KErrNone(nRes);
+
+    //-- try to create a file with the size that is exacly the same as free space; it should succeed
+    GetFreeDiskSpace(freespace);
+    
+    nRes = CreateEmptyFile(TheFs, _L("\\aaa1"), freespace);
+    test_KErrNone(nRes);
+
+    GetFreeDiskSpace(freespace);
+    test(freespace == 0);
+
+    //-- return the drive space to the system
+	nRes = TheFs.ReserveDriveSpace(gTestDrive,0);
+	test_KErrNone(nRes); 
+
+    //-- release drive space
+    nRes = TheFs.ReleaseReserveAccess(gTestDrive);
+    test_KErrNone(nRes);
+
+    GetFreeDiskSpace(freespace);
+    test(freespace == KClusterSz);
+
+    FormatDrive();
+}
+
 //-----------------------------------------------------------------------------
 
 GLDEF_C void CallTestsL()
@@ -1061,60 +1156,57 @@
 // Do tests relative to session path
 //
 	{
-    //-- set up console output 
-    Fat_Test_Utils::SetConsole(test.Console()); 
-	
-	if (UserSvr::DebugMask(2)&0x00000002) // TESTFAST mode set? (for automated test builds)
-		if(IsTestingLFFS())
-			{
-			// Don't run on LFFS (to increase speed of automated testing)
-			test.Printf(_L("TEST NOT RUN FOR THIS DRIVE"));
-			return;
-			}
+	//-- set up console output
+	Fat_Test_Utils::SetConsole(test.Console());
+
+	// If TESTFAST mode (for automated test builds) is set, don't run LFFS tests.
+	if ((UserSvr::DebugMask(2) & 0x00000002) && IsTestingLFFS())
+		{
+		test.Printf(_L("TEST NOT RUN FOR LFFS DRIVE"));
+		return;
+		}
 
 	//get the number of the drive we are currently testing
 	TInt r=0;
 	r=RFs::CharToDrive(gSessionPath[0],gTestDrive);
-    test_KErrNone(r);
+	test_KErrNone(r);
 
 	r=RFs::DriveToChar(gTestDrive,gCh);
 	test_KErrNone(r);
 
-    TDriveInfo drv;
-    r = TheFs.Drive(drv, gTestDrive);
-    test_KErrNone(r);
+	TDriveInfo drv;
+	r = TheFs.Drive(drv, gTestDrive);
+	test_KErrNone(r);
 
-    if (Is_Win32(TheFs, gTestDrive))
-        {
-        test.Printf(_L("Skipping on emulator %C: drive\n"), gSessionPath[0]);
-        return;
-        }
+	//-- print drive information
+	PrintDrvInfo(TheFs, gTestDrive);
 
-    // do not run this test on RAM drive
-    if (drv.iType == EMediaRam)
-        {
-        test.Printf(_L("Test can't run on RAM drive %C:\n"), gSessionPath[0]);
-        return;
-        }
+	// do not run the remainder of this test on RAM drive
+	if (drv.iType == EMediaRam)
+		{
+		TestRAMDriveNotification();	// Test drive space reservations trigger disk space notifications
+		test.Printf(_L("Main tests can't run on RAM drive %C:\n"), gSessionPath[0]);
+		return;
+		}
 
-    //-- print drive information
-    PrintDrvInfo(TheFs, gTestDrive);
+	if (Is_SimulatedSystemDrive(TheFs, gTestDrive))
+		{
+		test.Printf(_L("Skipping T_FALSESPACE on PlatSim/Emulator drive %C:\n"), gSessionPath[0]);
+		return;
+		}
 
-	Test1();	//General test for new APIs
-	Test2();	//Test to ensure drive and session reserve limits are not exceeded
+    Test0();
+	Test1();	// General test for new APIs
+	Test2();	// Test to ensure drive and session reserve limits are not exceeded
 	Test3();
-	Test4();	//test filling the drive and that each checked API fails
+	Test4();	// Test filling the drive and that each checked API fails
 	Test5();
 	Test6();
 	Test7();
 	TestForDEF142554();
-	Test2();	//run this test to check reserves are being cleared correctly
+	Test2();	// Run this test to check reserves are being cleared correctly
 
 	TestFAT4G_Boundary();
-    
-    TurnAllocFailureOff();
+
+	TurnAllocFailureOff();
 	}
-
-
-
-
--- a/kerneltest/f32test/server/t_file.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/server/t_file.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1175,12 +1175,8 @@
 	err = TheFs.GetShortName(KOrigFileName, shortName);
 	test_KErrNone(err);
 
-	// Validate the generated shorname against the original filename.
-	if (Is_Win32(TheFs, gDriveNum))
-		{
-		test(shortName==_L("2222~1.JAR"));
-		}
-	else if(!IsTestingLFFS())
+	// Validate the generated shortname against the original filename.
+	if(!IsTestingLFFS())
 		{
 		// LFFS short names not the same as VFAT ones
 		test(shortName==_L("2222~1.JAR"));
@@ -1777,11 +1773,11 @@
 // Test max length filenames can be created/deleted
 //
 	{
-
-#if defined(__WINS__)
-	if (gSessionPath[0]=='C')
+	if(Is_SimulatedSystemDrive(TheFs, gDriveNum))
+		{
+		test.Printf(_L("Skipping TestMaxLengthFilenames() on PlatSim/Emulator drive %C:\n"), gSessionPath[0]);
 		return;
-#endif
+		}
 
 	test.Next(_L("Test max length filenames"));
 	TFileName bigName;
@@ -3040,7 +3036,7 @@
         gShortFileNamesSupported = ETrue;
     
     if(Is_Win32(TheFs, gDriveNum)) 
-    {//-- find out if this is NTFS and if it supports short names (this feature can be switched OFF)
+    	{//-- find out if this is NTFS and if it supports short names (this feature can be switched OFF)
         
         _LIT(KLongFN, "\\this is a long file name");
         nRes = CreateEmptyFile(TheFs, KLongFN, 10);   
@@ -3054,12 +3050,12 @@
         test_KErrNone(nRes);
 
         DeleteTestDirectory();
-    }
+    	}
     else
-    {
+    	{
         nRes = FormatDrive(TheFs, gDriveNum, ETrue);
         test_KErrNone(nRes);
-    }
+    	}
 
 	CreateTestDirectory(_L("\\F32-TST\\TFILE\\"));
 
--- a/kerneltest/f32test/server/t_file64bit.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/server/t_file64bit.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -5961,9 +5961,11 @@
         {
         KFileSizeMaxLargerThan4GBMinusOne = EFalse; //-- FAT doesn't support >= 4G files
         }
-    else if(Is_Win32(TheFs, aDrive))
-        {//-- this is the emulator's windows drive. The maximal file size depends on the Windows FS used for this drive.
-         //-- if it is NTFS, files >= 4G are supported.   
+    else if(Is_SimulatedSystemDrive(TheFs, aDrive))
+        {
+		 //-- This is the emulator's windows drive or PlatSim's HVFS.
+		 //-- The maximal file size depends on the Windows FS used for this drive.
+         //-- If it is NTFS, files >= 4G are supported.
         r = CreateEmptyFile(TheFs, _L("\\test_file"), K4GB);
         
         KFileSizeMaxLargerThan4GBMinusOne = (r == KErrNone);
--- a/kerneltest/f32test/server/t_filecache.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/server/t_filecache.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,6 +22,7 @@
 #include "t_server.h"
 #include <e32twin.h>
 #include <e32rom.h>
+#include <u32hal.h>
 
 
 //----------------------------------------------------------------------------------------------
@@ -250,6 +251,108 @@
 		}
 	}
 
+TInt FreeRam()
+	{
+	// wait for any async cleanup in the supervisor to finish first...
+	UserSvr::HalFunction(EHalGroupKernel, EKernelHalSupervisorBarrier, 0, 0);
+
+	TMemoryInfoV1Buf meminfo;
+	UserHal::MemoryInfo(meminfo);
+	return meminfo().iFreeRamInBytes;
+	}
+
+void LowMemoryTest()
+	{
+	TInt fileSize = 0;
+	
+	const TInt KWriteLen = 128*1024;
+	test.Next(_L("Test appending to a file with low memory"));
+	gBufPtr.SetLength(KBufSize);
+
+	RFile f;
+	TFileName testFile   = _L("TEST.BIN");
+
+	TInt r = f.Replace(TheFs, testFile, EFileWrite | EFileWriteBuffered);
+	test_KErrNone(r);
+
+	TInt pos = 0;
+
+	TPtrC8 writePtr;
+	writePtr.Set(gBufPtr.MidTPtr(pos, KWriteLen));
+
+	r = f.Write(pos, writePtr);
+	test_KErrNone(r);
+	pos+= writePtr.Length();
+
+	r = f.Size(fileSize);
+	test_KErrNone(r);
+	test_Equal(fileSize,pos);
+
+
+
+	TUint freeRam = FreeRam();
+	const TInt KPageSize=4096;
+	freeRam = (freeRam + KPageSize -1) & ~(KPageSize-1);
+	test.Printf(_L("FreeRam = %d"), freeRam);
+
+	RChunk chunk;
+	TChunkCreateInfo chunkInfo;
+	chunkInfo.SetDisconnected(0, 0, freeRam);
+	chunkInfo.SetPaging(TChunkCreateInfo::EUnpaged);
+	test_KErrNone(chunk.Create(chunkInfo));
+
+	test.Printf(_L("Gobbling all of memory..."));
+	
+	TUint commitEnd;
+	for (commitEnd = 0; commitEnd < freeRam; commitEnd += KPageSize) 
+		{
+		r = chunk.Commit(commitEnd,KPageSize);
+		if (r != KErrNone)
+			break;
+		
+		}
+	test.Printf(_L("commitEnd %d, r %d"), commitEnd, r);
+	test_Value(r, r == KErrNoMemory || r == KErrNone);
+
+	test.Printf(_L("FreeRam = %d"), FreeRam());
+
+	pos-= KSegmentSize;
+	writePtr.Set(gBufPtr.MidTPtr(pos, KWriteLen));
+
+	test.Printf(_L("Writing to file..."));
+
+	// now we have gobbled all or most of memory, the next write can fail
+	// if it does keep decommitting memory until it succeeds and then test that the file size is correct
+	commitEnd = 0;
+	do {
+
+		r = f.Write(pos, writePtr);
+		test_Value(r, r == KErrNoMemory || r == KErrNone);
+		if (r == KErrNoMemory)
+			{
+			chunk.Decommit(commitEnd,KPageSize);
+			commitEnd += KPageSize;
+			}
+		}
+	while (r == KErrNoMemory);
+
+	pos+= writePtr.Length();
+
+	test.Printf(_L("Gsetting size of file ..."));
+	r = f.Size(fileSize);
+	test_KErrNone(r);
+	test_Equal(fileSize,pos);
+
+	test.Printf(_L("Closing file ..."));
+	f.Close();
+
+	test.Printf(_L("Closing chunk ..."));
+	chunk.Close();
+
+	test.Printf(_L("FreeRam = %d"), FreeRam());
+	}
+
+
 
 LOCAL_C void UnitTests()
 //
@@ -299,6 +402,8 @@
 	TInt uncachedPacketsRead;
 #endif
 
+	LowMemoryTest();
+
 	// create an empty file, so that any writes overlapping segemt boundaries
 	// need a read first
 	// create a test file using directIO and then re-open it in buffered mode, 
@@ -457,6 +562,9 @@
 	r = f.Replace(TheFs, testFile, EFileReadBuffered | EFileWrite | EFileWriteBuffered);
 	test_KErrNone(r);
 
+	r = f.SetSize(gFileCacheConfig.iCacheSize);
+	test_KErrNone(r);
+
 	RTimer timer;
 	timer.CreateLocal();
 	TRequestStatus reqStat;
@@ -1796,6 +1904,10 @@
 //TheFs.SetDebugRegister(KCACHE);
 			DoTests(gDrive);
 //TheFs.SetDebugRegister(0);
+
+		if ((gVolInfo.iDrive.iMediaAtt & KMediaAttFormattable))
+			Format(gDrive);
+
 			test.End();
 //			}
 		}
--- a/kerneltest/f32test/server/t_format.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/server/t_format.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -695,9 +695,9 @@
     test_KErrNone(nRes);
 
     //-- this will mark the current Mount as "Dismounted" and will instantiate another CMountCB for formatting
-    fmtMode = EQuickFormat | EForceFormat; 
+    fmtMode = EQuickFormat | EForceFormat;
 
-    nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt); 
+    nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt);
     test_KErrNone(nRes);
     
     nRes = DoFormatSteps(format, fmtCnt);
@@ -877,8 +877,11 @@
     
     PrintDrvInfo(TheFs, gDrive);
 
-    if(Is_Win32(TheFs, gDrive))
-        return; //-- emulator drive c:
+    if(Is_SimulatedSystemDrive(TheFs, gDrive))
+    	{
+		test.Printf(_L("Skipping T_FORMAT on PlatSim/Emulator drive %C:\n"), gSessionPath[0]);
+		return;
+    	}
 
 
 	SetSessionPath(_L("\\"));
--- a/kerneltest/f32test/server/t_fsched.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/server/t_fsched.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -29,6 +29,9 @@
 #include "t_server.h"
 #include <e32twin.h>
 #include <e32cmn.h>
+#include "f32_test_utils.h"
+
+using namespace F32_Test_Utils;
 
 //----------------------------------------------------------------------------------------------
 //! @SYMTestCaseID      PBASE-T_FSCHED-0191
@@ -930,9 +933,9 @@
 	test.Printf(_L("\nSync read done %d ms before the write ended\n"),I64LOW(timeTaken.Int64() / KuStomS));
 	TReal time=I64LOW(timeTaken.Int64() / KuStomS); 
 	#if !defined(__WINS__)
-	// If this condition fails, means that writing the sync file while fairscheduling a small sync read takes too long
+		// If this condition fails, it means that writing the sync file while fairscheduling a small sync read takes too long
 		test.Printf(_L("time: %f\n"), time);
-//		test((time > 0) && (((gTotalTimeSync[0]-time)>0) || ((gTotalTimeSync[1]-time)>0)) );  
+		// test((time > 0) && (((gTotalTimeSync[0]-time)>0) || ((gTotalTimeSync[1]-time)>0)) );  
 		test(time > 0);
 	#endif 
 	
@@ -959,11 +962,14 @@
 	time = I64LOW(timeTaken.Int64() / KuStomS); 
 
 	#if !defined(__WINS__)
-	// If this condition fails, means that writing the async file while fairscheduling a small async read takes too long
+	if (!Is_HVFS(TheFs, gDrive))
+		{
+		// If this condition fails, it means that writing the async file while fairscheduling a small async read takes too long
 		test.Printf(_L("time: %f\n"), time);
 		test.Printf(_L("gTotalTimeAsync[0] = %d , gTotalTimeAsync[1] = %d\n"),gTotalTimeAsync[0],gTotalTimeAsync[1] );
-//		test((time > 0) && (((gTotalTimeAsync[0]-time)>0) || ((gTotalTimeAsync[1]-time)>0)) );
+		// test((time > 0) && (((gTotalTimeAsync[0]-time)>0) || ((gTotalTimeAsync[1]-time)>0)) );
 		test(time > 0);
+		}
 	#endif
 }
 
@@ -998,9 +1004,9 @@
 	test.Printf(_L("\nSync write done %d ms before the big write ended\n"),I64LOW(timeTaken.Int64() / KuStomS));
 	TReal time=I64LOW(timeTaken.Int64() / KuStomS); 
 	#if !defined(__WINS__)
-	// If this condition fails, means that writing the sync file while fairscheduling a small sync write takes too long
+		// If this condition fails, it means that writing the sync file while fairscheduling a small sync write takes too long
 		test.Printf(_L("time: %f\n"), time);
-// 		test((time > 0) && (((gTotalTimeSync[0]-time)>0) || ((gTotalTimeSync[1]-time)>0)) ); 
+		// test((time > 0) && (((gTotalTimeSync[0]-time)>0) || ((gTotalTimeSync[1]-time)>0)) ); 
 		test(time > 0);
 	#endif 
 
@@ -1018,13 +1024,16 @@
 	
 	timeTaken = time2.MicroSecondsFrom(time1);
 	test.Printf(_L("\nAsync write done %d ms before the big write ended\n"),I64LOW(timeTaken.Int64() / KuStomS));
-	time=I64LOW(timeTaken.Int64() / KuStomS); 
+	time=I64LOW(timeTaken.Int64() / KuStomS);
 	#if !defined(__WINS__)
-	// If this condition fails, means that writing the async file while fairscheduling a small async write takes too long
+	if (!Is_HVFS(TheFs, gDrive))
+		{
+		// If this condition fails, it means that writing the async file while fairscheduling a small async write takes too long
 		test.Printf(_L("time: %f\n"), time);
 		test.Printf(_L("gTotalTimeAsync[0] = %d , gTotalTimeAsync[1] = %d\n"),gTotalTimeAsync[0],gTotalTimeAsync[1] );
-//		test((time > 0) && (((gTotalTimeAsync[0]-time)>0) || ((gTotalTimeAsync[1]-time)>0)) ); 
+		// test((time > 0) && (((gTotalTimeAsync[0]-time)>0) || ((gTotalTimeAsync[1]-time)>0)) );
 		test(time > 0);
+		}
 	#endif
 	bigFile.Close();
 	smallFile.Close();	
@@ -1336,9 +1345,9 @@
 	TestWriteOrder();
 	
 	// Format the drive to make sure no blocks are left to be erased in LFFS
-	#if !defined(__WINS__)
+	if (!Is_Win32(TheFs, gDrive))
 		Format(gDrive);	
-	#endif
+	
 	r = TheFs.MkDirAll(gSessionPath);
 	
 	TimeTakenToWriteBigFile(1);  
@@ -1505,10 +1514,9 @@
 		test.Printf(_L("%c: Media corruption; previous test may have aborted; else, check hardware\n"), (TUint)gDrive + 'A');
 		}
 	TESTERROR(r);
-#if !defined(__WINS__)
-	if ((volInfo.iDrive.iMediaAtt & KMediaAttFormattable))
+	
+	if (!Is_Win32(TheFs, gDrive) && (volInfo.iDrive.iMediaAtt & KMediaAttFormattable))
 		Format(gDrive);
-#endif
 
 	if(CheckForDiskSize())
 		{
--- a/kerneltest/f32test/server/t_fsrv.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/server/t_fsrv.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1682,10 +1682,8 @@
 			break;
 		test_KErrNone(r);
 		count++;
-#if defined(__WINS__)
-		if (count==32 && sessionPath[0]=='C')
-			break;
-#endif
+		if (Is_SimulatedSystemDrive(TheFs,gDrive) && count==32)
+			break;	// Limit on disk size for emulator/PlatSim
 		}
 
 	r=TheFs.CheckDisk(fileName);
--- a/kerneltest/f32test/server/t_ftrace.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,424 +0,0 @@
-// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// f32test\server\t_ftrace.cpp
-// 
-//
-
-#define __E32TEST_EXTENSION__
-#include <f32file.h>
-#include <f32tracedef.h>
-#include <e32test.h>
-#include "t_server.h"
-
-#include "../../../kernel/eka/include/d32btrace.h"
-#include "../../../kernel/eka/include/e32btrace.h"
-#include <utraceefsrv.h>
-
-RTest test(_L("T_FTRACE"));
-
-RBTrace Trace;
-
-void SetBTraceFilter(const TUint32* aNew,TUint32* aOld)
-	{
-	TUint category = 0;
-	do
-		{
-		TUint32 newBits = *aNew++;
-		TUint32 oldBits = 0;
-		do
-			{
-			oldBits >>= 1;
-			if(Trace.SetFilter(category,newBits&1))
-				oldBits |= 0x80000000u;
-			newBits >>= 1;
-			++category;
-			}
-		while(category&31);
-		if(aOld)
-			*aOld++ = oldBits;
-		}
-	while(category<256);
-	}
-
-
-
-//---------------------------------------------------------------------------------------------------------------------
-//! @SYMTestCaseID				KBASE-T_FTRACE-0001
-//! @SYMTestCaseDesc			Test File Server Tracing of RFile::Replace()
-//! @SYMTestType				UT
-//! @SYMPREQ					PREQ1617
-//! @SYMTestPriority			Medium
-//! @SYMTestActions				
-//! 	1.	Call RFile::Replace() to create a file
-//! 	2.	Get trace data from BTrace and verify that the expected trace data is present
-//! 
-//! @SYMTestExpectedResults
-//! 	1.	Trace data payload should be as expected, i.e. it should contain the file name, mode etc.
-//---------------------------------------------------------------------------------------------------------------------
-void TestRFileReplace()
-	{
-	test.Start(_L("Test trace output from creating a file"));
-	RFile file;
-	TFileName testFileName = _L("File.txt");
-
-	TheFs.Delete(testFileName);
-
-	Trace.Empty();
-
-	TInt r = file.Replace(TheFs,testFileName,EFileStreamText);
-	test_KErrNone(r);
-
-
-	TBool funcInFound = EFalse;
-	TBool funcOutFound = EFalse;
-
-	TBuf8<1024> buf;
-	for(;;)
-		{
-		TUint8* record;
-		TInt dataSize = Trace.GetData(record);
-		if(!dataSize)
-			break;
-		TUint8* end = record+dataSize;
-
-		while(record<end)
-			{
-			TUint size = record[BTrace::ESizeIndex];
-			TUint flags = record[BTrace::EFlagsIndex];
-			TUint category = record[BTrace::ECategoryIndex];
-			TUint subCategory = record[BTrace::ESubCategoryIndex];
-			TUint8* data = record+4;
-			size -= 4;
-
-			buf.Zero();
-			if(flags&(BTrace::EHeader2Present))
-				{
-				data += 4;
-				size -= 4;
-				}
-
-			if((flags&(BTrace::ETimestampPresent|BTrace::ETimestamp2Present))==(BTrace::ETimestampPresent|BTrace::ETimestamp2Present))
-				{
-				buf.AppendFormat(_L8("time:%08x:%08x "),((TUint32*)data)[1],*(TUint32*)data);
-				data += 8;
-				size -= 8;
-				}
-			else if(flags&(BTrace::ETimestampPresent|BTrace::ETimestamp2Present))
-				{
-				buf.AppendFormat(_L8("time:%08x "),*(TUint32*)data);
-				data += 4;
-				size -= 4;
-				}
-
-			if(flags&(BTrace::EContextIdPresent))
-				{
-				buf.AppendFormat(_L8("context:%08x "),*(TUint32*)data);
-				data += 4;
-				size -= 4;
-				}
-			else
-				{
-				buf.AppendFormat(_L8("                 "));
-				}
-
-			if(flags&(BTrace::EPcPresent))
-				{
-				buf.AppendFormat(_L8("pc:%08x "),*(TUint32*)data);
-				data += 4;
-				size -= 4;
-				}
-
-			if(flags&(BTrace::EExtraPresent))
-				{
-				data += 4;
-				size -= 4;
-				}
-
-			TUint32 data0 = (size>0) ? *(TUint32*)(data) : 0;
-			TUint32 data1 = (size>4) ? *(TUint32*)(data+4) : 0;
-			TPtrC8 des(0,0);
-			if(size>=8)
-				des.Set(data+8,size-8);
-
-			buf.AppendFormat(_L8("size:%d flags:%02x cat:%d,%d data: "),size,flags,category,subCategory);
-			for(TUint i=0; i<size; i+=4)
-				buf.AppendFormat(_L8("%08x "),*(TUint32*)(data+i));
-			buf.Append('\r');
-			buf.Append('\n');
-			test(buf.MaxLength() >= (buf.Length()*2));
-			RDebug::RawPrint(buf.Expand());
-
-
-			if (category == UTF::EBorder && subCategory == 0 && data0 == EF32TraceUidEfsrv)
-				{
-				if (data1 == UTraceModuleEfsrv::EFileReplace)
-					{
-					TInt sessionHandle = (size>8) ? *(TUint32*)(data+8) : 0;
-					TUint32 fileMode = (size>12) ? *(TUint32*)(data+12) : 0;
-					TInt fileNameLen = (size>16) ? *(TUint32*)(data+16) : 0;
-					fileNameLen/= 2;	// convert to unicode length
-					TText16* fileName = (TText16*) ((size>20) ? (data+20) : NULL);
-
-					test(sessionHandle == TheFs.Handle());
-					test(fileMode == EFileStreamText);
-					test(fileNameLen == testFileName.Length());
-					TPtrC16 fileNamePtr (fileName, fileNameLen);
-					test(fileName != NULL);
-					test(testFileName.Compare(fileNamePtr) == 0);
-					funcInFound = ETrue;
-					}
-				else if (data1 == UTraceModuleEfsrv::EFileReplaceReturn)
-					{
-					TInt retCode = (size>8) ? *(TUint32*)(data+8) : 0;
-					TInt subsessionHandle = (size>12) ? *(TUint32*)(data+12) : 0;
-
-					test(retCode == KErrNone);
-					test(subsessionHandle == file.SubSessionHandle());
-					funcOutFound = ETrue;
-					}
-				}
-
-			record = BTrace::NextRecord(record);
-			}
-		Trace.DataUsed();
-		}
-
-	file.Close();
-	TheFs.Delete(testFileName);
-
-	test (funcInFound);
-	test (funcOutFound);
-	}
-
-//---------------------------------------------------------------------------------------------------------------------
-//! @SYMTestCaseID				KBASE-T_FTRACE-0002
-//! @SYMTestCaseDesc			Test File Server Tracing of RFs::Rename()
-//! @SYMTestType				UT
-//! @SYMPREQ					PREQ1617
-//! @SYMTestPriority			Medium
-//! @SYMTestActions				
-//! 	1.	Call RFile::Replace() to create a file
-//! 	2.	Close the file
-//! 	3.	Call RFs::Rename to rename the file
-//! 	4.	Get trace data from BTrace and verify that the expected trace data is present
-//! 
-//! @SYMTestExpectedResults
-//! 	1.	Trace data payload should be as expected, i.e. it should contain both file names, etc.
-//---------------------------------------------------------------------------------------------------------------------
-void TestRFsRename()
-	{
-	test.Start(_L("Test trace output from renaming a file"));
-	RFile file;
-	TFileName testFileName1 = _L("File1.txt");
-	TFileName testFileName2 = _L("File2.txt");
-
-	TheFs.Delete(testFileName1);
-	TheFs.Delete(testFileName2);
-
-	TInt r = file.Replace(TheFs,testFileName1,EFileStreamText);
-	test_Value(r, r == KErrNone || r == KErrAlreadyExists);
-	file.Close();
-
-	Trace.Empty();
-
-	r = TheFs.Rename(testFileName1, testFileName2);
-	test_KErrNone(r);
-
-
-	TBool funcInFound = EFalse;
-	TBool funcOutFound = EFalse;
-
-	TBuf8<1024> buf;
-	for(;;)
-		{
-		TUint8* record;
-		TInt dataSize = Trace.GetData(record);
-		if(!dataSize)
-			break;
-		TUint8* end = record+dataSize;
-
-		while(record<end)
-			{
-			TUint size = record[BTrace::ESizeIndex];
-			TUint flags = record[BTrace::EFlagsIndex];
-			TUint category = record[BTrace::ECategoryIndex];
-			TUint subCategory = record[BTrace::ESubCategoryIndex];
-			TUint8* data = record+4;
-			size -= 4;
-
-			buf.Zero();
-			if(flags&(BTrace::EHeader2Present))
-				{
-				data += 4;
-				size -= 4;
-				}
-
-			if((flags&(BTrace::ETimestampPresent|BTrace::ETimestamp2Present))==(BTrace::ETimestampPresent|BTrace::ETimestamp2Present))
-				{
-				buf.AppendFormat(_L8("time:%08x:%08x "),((TUint32*)data)[1],*(TUint32*)data);
-				data += 8;
-				size -= 8;
-				}
-			else if(flags&(BTrace::ETimestampPresent|BTrace::ETimestamp2Present))
-				{
-				buf.AppendFormat(_L8("time:%08x "),*(TUint32*)data);
-				data += 4;
-				size -= 4;
-				}
-
-			if(flags&(BTrace::EContextIdPresent))
-				{
-				buf.AppendFormat(_L8("context:%08x "),*(TUint32*)data);
-				data += 4;
-				size -= 4;
-				}
-			else
-				{
-				buf.AppendFormat(_L8("                 "));
-				}
-
-			if(flags&(BTrace::EPcPresent))
-				{
-				buf.AppendFormat(_L8("pc:%08x "),*(TUint32*)data);
-				data += 4;
-				size -= 4;
-				}
-
-			if(flags&(BTrace::EExtraPresent))
-				{
-				data += 4;
-				size -= 4;
-				}
-
-			TUint32 data0 = (size>0) ? *(TUint32*)(data) : 0;
-			TUint32 data1 = (size>4) ? *(TUint32*)(data+4) : 0;
-			TPtrC8 des(0,0);
-			if(size>=8)
-				des.Set(data+8,size-8);
-
-			buf.AppendFormat(_L8("size:%d flags:%02x cat:%d,%d data: "),size,flags,category,subCategory);
-			for(TUint i=0; i<size; i+=4)
-				buf.AppendFormat(_L8("%08x "),*(TUint32*)(data+i));
-			buf.Append('\r');
-			buf.Append('\n');
-			test(buf.MaxLength() >= (buf.Length()*2));
-			RDebug::RawPrint(buf.Expand());
-
-
-			if (category == UTF::EBorder && subCategory == 0 && data0 == EF32TraceUidEfsrv)
-				{
-				TUint8* recData = data+8;
-				if (data1 == UTraceModuleEfsrv::EFsRename)
-					{
-					TInt sessionHandle = *(TUint32*) recData; recData+= 4;
-
-					TInt fileNameLen1 = *(TUint32*) recData; recData+= 4;
-					TText16* fileName1 = (TText16*) recData; recData+= ((fileNameLen1 +4) & ~3);
-
-					TInt fileNameLen2 = *(TUint32*) recData; recData+= 4;
-					TText16* fileName2 = (TText16*) recData; recData+= fileNameLen2;
-
-					fileNameLen1/= 2;	// convert to unicode length
-					fileNameLen2/= 2;	// convert to unicode length
-
-
-					test(sessionHandle == TheFs.Handle());
-					
-					test(fileNameLen1 == testFileName1.Length());
-					TPtrC16 fileNamePtr1 (fileName1, fileNameLen1);
-					test(fileName1 != NULL);
-					test(testFileName1.Compare(fileNamePtr1) == 0);
-
-					test(fileNameLen2 == testFileName2.Length());
-					TPtrC16 fileNamePtr2 (fileName2, fileNameLen2);
-					test(fileName2 != NULL);
-					test(testFileName2.Compare(fileNamePtr2) == 0);
-
-					funcInFound = ETrue;
-					}
-				else if (data1 == UTraceModuleEfsrv::EFsRenameReturn)
-					{
-					TInt retCode = (size>8) ? *(TUint32*)(data+8) : 0;
-
-					test(retCode == KErrNone);
-
-					funcOutFound = ETrue;
-					}
-				}
-
-			record = BTrace::NextRecord(record);
-			}
-		Trace.DataUsed();
-		}
-
-
-	test (funcInFound);
-	test (funcOutFound);
-
-	TheFs.Delete(testFileName1);
-	TheFs.Delete(testFileName2);
-	}
-
-void CallTestsL()
-	{
-
-// By default, file server trace-points are only compiled in in debug mode
-#if defined(_DEBUG)
-	test.Title();
-	TInt r;
-
-	test.Start(_L("Open LDD"));
-	r = Trace.Open();
-	test_KErrNone(r);
-
-
-	TUint32 OldTraceFilter[8] = {0};
-
-	TUint savedMode = Trace.Mode();
-	SetBTraceFilter(OldTraceFilter,OldTraceFilter);
-
-	Trace.ResizeBuffer(0x100000);
-	Trace.Empty();
-
-	Trace.SetMode(RBTrace::EEnable | RBTrace::EFreeRunning);
-
-	TBool b;
-//	b = Trace.SetFilter(BTrace::EThreadIdentification, ETrue);
-//	test(b >= 0);
-	b = Trace.SetFilter(UTF::EPanic, ETrue);
-	test(b >= 0);
-	b = Trace.SetFilter(UTF::EError, ETrue);
-	test(b >= 0);
-	b = Trace.SetFilter(UTF::EBorder, ETrue);
-	test(b >= 0);
-
-	b = Trace.SetFilter2(EF32TraceUidEfsrv, ETrue);
-	test(b >= 0);
-
-	TestRFileReplace();
-	TestRFsRename();
-
-	// restore trace settings...
-	Trace.SetMode(0);
-	SetBTraceFilter(OldTraceFilter,OldTraceFilter);
-	Trace.SetMode(savedMode);
-
-
-	test.Next(_L("Close LDD"));
-	Trace.Close();
-
-	test.End();
-#endif
-	}
-
--- a/kerneltest/f32test/server/t_main.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/server/t_main.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -24,6 +24,7 @@
 #include <f32dbg.h>
 #include "t_server.h"
 #include "t_chlffs.h"
+#include "f32_test_utils.h"
 
 GLDEF_D	RFs TheFs;
 GLDEF_D TFileName gSessionPath;
@@ -157,14 +158,11 @@
 
 		while(illegalChar)
 			{
-#if defined(__WINS__)
-			if (gSessionPath[0]=='C')
+			if (F32_Test_Utils::Is_SimulatedSystemDrive(TheFs, CurrentDrive()))
 				letter=(TChar)('A'+Math::Rand(aSeed)%26);
 			else
 				letter=(TChar)Math::Rand(aSeed)%256;
-#else
-			letter=(TChar)Math::Rand(aSeed)%256;
-#endif
+
 			TBool space=letter.IsSpace();
 			if (space && spaceChar==-1)
 				spaceChar=i;
--- a/kerneltest/f32test/server/t_notify.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/server/t_notify.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,9 @@
 #include <e32svr.h>
 #include <hal.h>
 #include "t_server.h"
+#include "f32_test_utils.h"
+
+using namespace F32_Test_Utils;
 
 const TInt KHeapSize=0x200;
 
@@ -139,7 +142,7 @@
 		{
 		TRequestStatus s;
 		fs.NotifyChange(ENotifyAll,s);
-		test(s==KRequestPending);
+		test_Value(s.Int(), s==KRequestPending);
 		gSleepThread.Signal();
 		User::After(100000000);
 		}
@@ -216,7 +219,7 @@
 		TRequestStatus s;
 		TFileName path=_L("\\F32-TST\\NOTIFY\\");
 		fs.NotifyChange(ENotifyAll,s,path);
-		test(s==KRequestPending);
+		test_Value(s.Int(), s==KRequestPending);
 		gSleepThread.Signal();
 		User::After(100000000);
 		}
@@ -293,21 +296,21 @@
 	thread.Logon(thrdStat);
 	thread.Resume();
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	thread.Close();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 	RFile file;
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite|EFileShareExclusive);
 	test_KErrNone(r);
 	file.Write(_L8("Somewhere over the rainbow..."),reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	TBuf8<256> buf;
 	file.Read(0, buf,reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	file.Close();
 
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareExclusive);
@@ -319,28 +322,28 @@
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
 	test_KErrNone(r);
 	file.Read(0, buf, 100, reqStat);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	file.Close();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
 	test_KErrNone(r);
 	file.Read(0, buf, 100, reqStat);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	file.ReadCancel(reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 	file.Close();
 
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny);
 	test_KErrNone(r);
 	file.Read(0, buf, 100, reqStat);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	file.SetSize(100);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
-	test(buf.Length() == 100);
+	test_KErrNone(reqStat.Int());
+	test_Equal(100, buf.Length());
 	file.Close();
 
 	test.Next(_L("Repeat Test notification of an entry change"));
@@ -349,15 +352,10 @@
 	thread.Logon(thrdStat);
 	thread.Resume();
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	thread.Close();
 	User::WaitForRequest(reqStat);
-	if (reqStat!=KErrNone)
-		{
-		test.Printf(_L("ReqStat=%d\n"),reqStat.Int());
-		//test.Getch();
-		}
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 	test.Next(_L("Test Notify cancel"));
 	TheFs.NotifyChange(ENotifyEntry,reqStat);
@@ -370,10 +368,10 @@
 	thread.Logon(thrdStat);
 	thread.Resume();
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	thread.Close();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	}
 
 static void Test2()
@@ -396,14 +394,14 @@
 	test_KErrNone(r);
 	fs2.NotifyChange(ENotifyEntry,reqStat2);
 
-	test(reqStat1==KRequestPending);
-	test(reqStat2==KRequestPending);
+	test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NEWFILE.TXT"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat1);
 	User::WaitForRequest(reqStat2);
-	test(reqStat1==KErrNone);
-	test(reqStat2==KErrNone);
+	test_KErrNone(reqStat1.Int());
+	test_KErrNone(reqStat2.Int());
 	}
 
 static void Test3()
@@ -428,25 +426,25 @@
 	fs1.NotifyChange(ENotifyAll,status3);
 	fs1.NotifyChange(ENotifyAll,status4);
 	fs1.NotifyChange(ENotifyAll,status5);
-	test(status1==KRequestPending);
-	test(status2==KRequestPending);
-	test(status3==KRequestPending);
-	test(status4==KRequestPending);
-	test(status5==KRequestPending);
+	test_Value(status1.Int(), status1==KRequestPending);
+	test_Value(status2.Int(), status2==KRequestPending);
+	test_Value(status3.Int(), status3==KRequestPending);
+	test_Value(status4.Int(), status4==KRequestPending);
+	test_Value(status5.Int(), status5==KRequestPending);
 
 	test.Next(_L("RFs::NotifyCancel()"));
 //	Test that one call to RFs::NotifyCancel() cancels all outstanding requests
 	fs1.NotifyChangeCancel();
 	User::WaitForRequest(status1);
-	test(status1==KErrCancel);
+	test_Value(status1.Int(), status1==KErrCancel);
 	User::WaitForRequest(status2);
-	test(status2==KErrCancel);
+	test_Value(status2.Int(), status2==KErrCancel);
 	User::WaitForRequest(status3);
-	test(status3==KErrCancel);
+	test_Value(status3.Int(), status3==KErrCancel);
 	User::WaitForRequest(status4);
-	test(status4==KErrCancel);
+	test_Value(status4.Int(), status4==KErrCancel);
 	User::WaitForRequest(status5);
-	test(status5==KErrCancel);
+	test_Value(status5.Int(), status5==KErrCancel);
 //	Call the cancel function again to check no further action
 	fs1.NotifyChangeCancel();
 
@@ -457,49 +455,49 @@
 	fs1.NotifyChange(ENotifyAll,status3);
 	fs1.NotifyChange(ENotifyAll,status4);
 	fs1.NotifyChange(ENotifyAll,status5);
-	test(status1==KRequestPending);
-	test(status2==KRequestPending);
-	test(status3==KRequestPending);
-	test(status4==KRequestPending);
-	test(status5==KRequestPending);
+	test_Value(status1.Int(), status1==KRequestPending);
+	test_Value(status2.Int(), status2==KRequestPending);
+	test_Value(status3.Int(), status3==KRequestPending);
+	test_Value(status4.Int(), status4==KRequestPending);
+	test_Value(status5.Int(), status5==KRequestPending);
 
 //	Cancel the outstanding request with status5
 	test.Next(_L("RFs::NotifyCancel()"));
 	fs1.NotifyChangeCancel(status5);
 	User::WaitForRequest(status5);
-	test(status1==KRequestPending);
-	test(status2==KRequestPending);
-	test(status3==KRequestPending);
-	test(status4==KRequestPending);
-	test(status5==KErrCancel);
+	test_Value(status1.Int(), status1==KRequestPending);
+	test_Value(status2.Int(), status2==KRequestPending);
+	test_Value(status3.Int(), status3==KRequestPending);
+	test_Value(status4.Int(), status4==KRequestPending);
+	test_Value(status5.Int(), status5==KErrCancel);
 
 	fs1.NotifyChangeCancel(status2);
 	User::WaitForRequest(status2);
 
-	test(status1==KRequestPending);
-	test(status2==KErrCancel);
-	test(status3==KRequestPending);
-	test(status4==KRequestPending);
+	test_Value(status1.Int(), status1==KRequestPending);
+	test_Value(status2.Int(), status2==KErrCancel);
+	test_Value(status3.Int(), status3==KRequestPending);
+	test_Value(status4.Int(), status4==KRequestPending);
 
 	fs1.NotifyChangeCancel(status4);
 	User::WaitForRequest(status4);
-	test(status1==KRequestPending);
-	test(status3==KRequestPending);
-	test(status4==KErrCancel);
-
-	fs1.NotifyChangeCancel(status4);	//	Test no side effects on trying to cancel a request
-	test(status4==KErrCancel);			//	that has already been cancelled
+	test_Value(status1.Int(), status1==KRequestPending);
+	test_Value(status3.Int(), status3==KRequestPending);
+	test_Value(status4.Int(), status4==KErrCancel);
+
+	fs1.NotifyChangeCancel(status4);				//	Test no side effects on trying to cancel a request
+	test_Value(status4.Int(), status4==KErrCancel);	//	that has already been cancelled
 
 	fs1.NotifyChangeCancel(status1);
 	User::WaitForRequest(status1);
-	test(status1==KErrCancel);
-	test(status3==KRequestPending);
+	test_Value(status1.Int(), status1==KErrCancel);
+	test_Value(status3.Int(), status3==KRequestPending);
 	fs1.NotifyChangeCancel(status1);	//	Test no side effects on trying to cancel a request
-	test(status1==KErrCancel);			//	that has already been cancelled
+	test_Value(status1.Int(), status1==KErrCancel);			//	that has already been cancelled
 
 	fs1.NotifyChangeCancel(status3);
 	User::WaitForRequest(status3);
-	test(status3==KErrCancel);
+	test_Value(status3.Int(), status3==KErrCancel);
 
 	fs1.Close();
 	}
@@ -560,7 +558,7 @@
 
 	TRequestStatus reqStat=0;
 	TheFs.NotifyChange(ENotifyEntry,reqStat);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 	r=gSleepThread.CreateLocal(0);
 	test_KErrNone(r);
@@ -569,12 +567,12 @@
 	test_KErrNone(r);
 	clientThread.Resume();
 	gSleepThread.Wait();
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt"));
 	test_KErrNone(r);
@@ -605,7 +603,7 @@
         TRequestStatus reqStat=0;
         TInt r;
         TheFs.NotifyChange(ENotifyEntry,reqStat);
-        test(reqStat==KRequestPending);
+        test_Value(reqStat.Int(), reqStat==KRequestPending);
         r=gSleepThread.CreateLocal(0);
         test_KErrNone(r);
         RThread clientThread;
@@ -614,7 +612,7 @@
         clientThread.Resume();
         gSleepThread.Wait();
         TInt reqInt=reqStat.Int();
-        test(reqInt==KErrNone);
+        test_KErrNone(reqInt);
         User::WaitForRequest(reqStat);
         WaitForMediaChange();
         gSleepThread.Close();
@@ -641,7 +639,7 @@
 	MakeFile(_L("NewFile.TXT"));
 	TInt r;
 	TheFs.NotifyChange(ENotifyEntry,reqStat);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 	r=gSleepThread.CreateLocal(0);
 	test_KErrNone(r);
@@ -650,7 +648,7 @@
 	test_KErrNone(r);
 	clientThread.Resume();
 	gSleepThread.Wait();
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 	r=TheFs.Delete(_L("Newfile.txt"));
 	test_KErrNone(r);
@@ -679,7 +677,7 @@
 		TFileName path = _L("\\F32-tst\\NOTIFY\\");
 		TInt r;
 		TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-		test(reqStat==KRequestPending);
+		test_Value(reqStat.Int(), reqStat==KRequestPending);
 		r=gSleepThread.CreateLocal(0);
 		test_KErrNone(r);
 		RThread clientThread;
@@ -689,7 +687,7 @@
 		clientThread.Resume();
 		gSleepThread.Wait();
 		User::WaitForRequest(reqStat);
-		test(reqStat==KErrNone);
+		test_KErrNone(reqStat.Int());
 		WaitForMediaChange();
 		gSleepThread.Close();
 		clientThread.Close();
@@ -701,7 +699,7 @@
 
 
 		TheFs.NotifyChange(ENotifyDisk,reqStat,path);
-		test(reqStat==KRequestPending);
+		test_Value(reqStat.Int(), reqStat==KRequestPending);
 		r=gSleepThread.CreateLocal(0);
 		test_KErrNone(r);
 		r=clientThread.Create(_L("Test6Thread2"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6);
@@ -709,7 +707,7 @@
 		clientThread.Resume();
 		gSleepThread.Wait();
 		User::WaitForRequest(reqStat);
-		test(reqStat==KErrNone);
+		test_KErrNone(reqStat.Int());
 		WaitForMediaChange();
 		gSleepThread.Close();
 		clientThread.Close();
@@ -720,7 +718,7 @@
 	    test_KErrNone(r);
 
 		TheFs.NotifyChange(ENotifyWrite,reqStat,path);
-		test(reqStat==KRequestPending);
+		test_Value(reqStat.Int(), reqStat==KRequestPending);
 		r=gSleepThread.CreateLocal(0);
 		test_KErrNone(r);
 		r=clientThread.Create(_L("Test6Thread3"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest6);
@@ -728,7 +726,7 @@
 		clientThread.Resume();
 		gSleepThread.Wait();
 		User::WaitForRequest(reqStat);
-		test(reqStat==KErrNone);
+		test_KErrNone(reqStat.Int());
 		WaitForMediaChange();
 		gSleepThread.Close();
 		clientThread.Close();
@@ -756,17 +754,17 @@
 	TFileName path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\");
 	TRequestStatus reqStat(KRequestPending);
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"));
 	test_KErrNone(r);
 
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 	path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man");
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 	RFile file;
 	r=file.Replace(TheFs,path,EFileStream);
@@ -774,130 +772,130 @@
 	file.Close();
 
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 	r=TheFs.Delete(path);
 	test_KErrNone(r);
 
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 //	Now cancel the outstanding request
 	TheFs.NotifyChangeCancel(reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 
 //	Repeat with a ENotifyFile request
 	TheFs.NotifyChange(ENotifyFile,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 	r=file.Replace(TheFs,path,EFileStream);
 	test_KErrNone(r);
 	file.Close();
 
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 	r=TheFs.Delete(path);
 	test_KErrNone(r);
 
 	TheFs.NotifyChange(ENotifyFile,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 //	Now cancel the outstanding request
 	TheFs.NotifyChangeCancel(reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 
 //	Repeat with an ENotifyAttributes request
 	TheFs.NotifyChange(ENotifyAttributes,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 	r=file.Replace(TheFs,path,EFileStream);
 	test_KErrNone(r);
 	file.Close();
 
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);	//	Monitoring attributes but informed anyway
+	test_KErrNone(reqStat.Int());	//	Monitoring attributes but informed anyway
 
 	r=TheFs.Delete(path);
 	test_KErrNone(r);
 
 	TheFs.NotifyChange(ENotifyAttributes,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 //	Now cancel the outstanding request
 	TheFs.NotifyChangeCancel(reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 
 //	Repeat with an ENotifyWrite request
 	TheFs.NotifyChange(ENotifyWrite,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 	r=file.Replace(TheFs,path,EFileStream);
 	test_KErrNone(r);
 	file.Close();
 
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);	//	Monitoring file writing but informed anyway
+	test_KErrNone(reqStat.Int());	//	Monitoring file writing but informed anyway
 
 	r=TheFs.Delete(path);
 	test_KErrNone(r);
 
 	TheFs.NotifyChange(ENotifyWrite,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 //	Now cancel the outstanding request
 	TheFs.NotifyChangeCancel(reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 
 //	Repeat with an ENotifyDisk request
 	TheFs.NotifyChange(ENotifyDisk,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 	r=file.Replace(TheFs,path,EFileStream);
 	test_KErrNone(r);
 	file.Close();
 
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);	//	Monitoring disk activity but informed anyway
+	test_KErrNone(reqStat.Int());	//	Monitoring disk activity but informed anyway
 
 	r=TheFs.Delete(path);
 	test_KErrNone(r);
 
 	TheFs.NotifyChange(ENotifyAttributes,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 //	Now cancel the outstanding request
 	TheFs.NotifyChangeCancel(reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 
 //	Now do much the same with directory monitoring
 	path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\");
 	TheFs.RmDir(path);
 
 	TheFs.NotifyChange(ENotifyDir,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 	TheFs.MkDir(path);
 	test_KErrNone(r);
 
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 	TheFs.RmDir(path);
 	test_KErrNone(r);
 
 	TheFs.NotifyChange(ENotifyDir,reqStat,path);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 //	Now cancel the outstanding request
 	TheFs.NotifyChangeCancel(reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 
 	TheFs.NotifyChange(ENotifyDir,reqStat,path);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 //	Get a separate thread to create the directory
 	RThread thread;
@@ -908,9 +906,9 @@
 	thread.Close();
 
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 	TheFs.RmDir(path);
 	test_KErrNone(r);
@@ -920,7 +918,7 @@
 	path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man");
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 	thread.Create(_L("RequestAheadThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest10);
 	thread.Logon(thrdStat);
@@ -928,31 +926,31 @@
 	thread.Close();
 
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
-	test(reqStat==KRequestPending);
+	test_KErrNone(thrdStat.Int());
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 //	Now get a thread to create the file
 	thread.Create(_L("RequestAhead"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest11);
 	thread.Logon(thrdStat);
 	thread.Resume();
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	thread.Close();
 
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 	TheFs.Delete(path);
 	test_KErrNone(r);
 
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 //	Now cancel the outstanding request
 	TheFs.NotifyChangeCancel(reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 
 	path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\");
 	TheFs.RmDir(path);
@@ -972,52 +970,52 @@
 	TFileName path=(_L("\\F32-TST\\"));
 
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	RThread thread;
 	TInt r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
 	test_KErrNone(r);
 	thread.Logon(thrdStat);
 	thread.Resume();
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	thread.Close();
 
 //	Repeat the test
 	test.Next(_L("Repeat Test notification of an entry change"));
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=thread.Create(_L("MyThread2"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
 	test_KErrNone(r);
 	thread.Logon(thrdStat);
 	thread.Resume();
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	thread.Close();
 
 //	Test it can be cancelled
 	test.Next(_L("Test Notify cancel"));
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	TheFs.NotifyChangeCancel();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 
 //	Test it can be notified again
 	test.Next(_L("Test notification still works"));
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=thread.Create(_L("MyThread3"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
 	test_KErrNone(r);
 	thread.Logon(thrdStat);
 	thread.Resume();
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	thread.Close();
 
 //	Test notification doesn't occur when a change occurs above the directory monitored
@@ -1028,53 +1026,53 @@
 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
 	path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=thread.Create(_L("MyThread4"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
 	test_KErrNone(r);
 	thread.Logon(thrdStat);
 	thread.Resume();
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	User::After(500000);
 	thread.Close();
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	TheFs.NotifyChangeCancel();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 
 //	Test notification occurs when a change is made to the subdirectory monitored
 	test.Next(_L("Create a file in monitored subdirectory"));
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=thread.Create(_L("MyThread5"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest2);
 	test_KErrNone(r);
 	thread.Logon(thrdStat);
 	thread.Resume();
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	thread.Close();
 
 	test.Next(_L("Create a directory in monitored subdirectory"));
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=thread.Create(_L("MyThread6"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest3);
 	test_KErrNone(r);
 	thread.Logon(thrdStat);
 	thread.Resume();
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	thread.Close();
 
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\TINMAN\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 
 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\TINMAN\\"));
@@ -1089,28 +1087,28 @@
 	path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
 
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=thread.Create(_L("MyThread7"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
 	test_KErrNone(r);
 	thread.Logon(thrdStat);
 	thread.Resume();
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	User::After(500000);
 	thread.Close();
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	TheFs.NotifyChangeCancel();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 
 //	Test notification occurs when a change is made to the subdirectory monitored
 	test.Next(_L("Delete a file in monitored subdirectory"));
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 	RFile file;
 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg"),EFileStream);
@@ -1121,104 +1119,104 @@
 	test.Next(_L("Monitor changes to a specific file"));
 	path+=_L("WickedWitch.msg");
 	TheFs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=thread.Create(_L("MyThread8"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest8);
 	test_KErrNone(r);
 	thread.Logon(thrdStat);
 	thread.Resume();
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	thread.Close();
 
 //	Test notification does not occur if a change is made above the file
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	thread.Create(_L("MyThread9"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest2);
 	thread.Logon(thrdStat);
 	thread.Resume();
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	User::After(500000);
 	thread.Close();
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	TheFs.NotifyChangeCancel();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 
 //	Test notification occurs when a change is made to the file
 	test.Next(_L("Delete monitored file"));
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.Msg"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	Test notification request is now submitted on the non existent path successfully
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	TheFs.NotifyChangeCancel(reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 
 	path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc");
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 	path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	Submit a request for a path which does not yet exist
 	path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\");
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 //	Now create the directory we are waiting on
 	r=TheFs.MkDir(path);
 	test_KErrNone(r);
 //	Make sure the notification has now been received
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	Submit a request for a file which does not yet exist
 	path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\Red-Shoes.red");
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 //	Now create the file we are waiting on
 	r=file.Replace(TheFs,path,EFileStream);
 	test_KErrNone(r);
 	file.Close();
 //	Make sure the notification has now been received
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 //	Submit another notification request and delete the file
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.Delete(path);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\");
 	TheFs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.RmDir(path);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	// test passing in an empty string
 	TheFs.NotifyChange(ENotifyEntry,reqStat,_L(""));
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrArgument);
+	test_Value(reqStat.Int(), reqStat==KErrArgument);
 	}
 
 static void Test9()
@@ -1296,12 +1294,12 @@
 	test_KErrNone(r);
 	fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
 
-	test(reqStat1==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
-	test(reqStat5==KRequestPending);
-	test(reqStat6==KRequestPending);
+	test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+	test_Value(reqStat5.Int(), reqStat5==KRequestPending);
+	test_Value(reqStat6.Int(), reqStat6==KRequestPending);
 
 //	Make a change a the top level and check that only the session monitoring
 //	that level is notified
@@ -1310,13 +1308,13 @@
 	test_KErrNone(r);
 	file.Close();
 	User::WaitForRequest(reqStat1);
-	test(reqStat1==KErrNone);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
-	test(reqStat5==KRequestPending);
+	test_KErrNone(reqStat1.Int());
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+	test_Value(reqStat5.Int(), reqStat5==KRequestPending);
 	User::WaitForRequest(reqStat6);
-	test(reqStat6==KErrNone);
+	test_KErrNone(reqStat6.Int());
 
 	r=TheFs.Delete(_L("\\F32-TST\\NewFile.txt"));
 	test_KErrNone(r);
@@ -1324,8 +1322,8 @@
 //	Renew the notify request at the top level and make a change one step lower
 	fs1.NotifyChange(ENotifyEntry,reqStat1,path1);
 	fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
-	test(reqStat1==KRequestPending);
-	test(reqStat6==KRequestPending);
+	test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+	test_Value(reqStat6.Int(), reqStat6==KRequestPending);
 
 	test.Next(_L("Test clients monitoring levels 1 and 2 are notified"));
 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileStream);
@@ -1334,13 +1332,13 @@
 
 	User::WaitForRequest(reqStat1);
 	User::WaitForRequest(reqStat2);
-	test(reqStat1==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
-	test(reqStat5==KRequestPending);
+	test_KErrNone(reqStat1.Int());
+	test_KErrNone(reqStat2.Int());
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+	test_Value(reqStat5.Int(), reqStat5==KRequestPending);
 	User::WaitForRequest(reqStat6);
-	test(reqStat6==KErrNone);
+	test_KErrNone(reqStat6.Int());
 
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NewFile.txt"));
 	test_KErrNone(r);
@@ -1350,9 +1348,9 @@
 	fs1.NotifyChange(ENotifyEntry,reqStat1,path1);
 	fs2.NotifyChange(ENotifyEntry,reqStat2,path2);
 	fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
-	test(reqStat1==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat6==KRequestPending);
+	test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat6.Int(), reqStat6==KRequestPending);
 
 	test.Next(_L("Test clients monitoring levels 1,2 and 3 are notified"));
 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\ANIMAL\\NewFile.txt"),EFileStream);
@@ -1362,13 +1360,13 @@
 	User::WaitForRequest(reqStat1);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
-	test(reqStat1==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);
-	test(reqStat5==KRequestPending);
+	test_KErrNone(reqStat1.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+	test_Value(reqStat5.Int(), reqStat5==KRequestPending);
 	User::WaitForRequest(reqStat6);
-	test(reqStat6==KErrNone);
+	test_KErrNone(reqStat6.Int());
 
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\NewFile.txt"));
 	test_KErrNone(r);
@@ -1379,10 +1377,10 @@
 	fs2.NotifyChange(ENotifyEntry,reqStat2,path2);
 	fs3.NotifyChange(ENotifyEntry,reqStat3,path3);
 	fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
-	test(reqStat1==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat6==KRequestPending);
+	test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat6==KRequestPending);
 
 	test.Next(_L("Test clients monitoring levels 1 - 4 are notified"));
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\cat.txt"));
@@ -1391,13 +1389,13 @@
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
 	User::WaitForRequest(reqStat4);
-	test(reqStat1==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KErrNone);
-	test(reqStat5==KRequestPending);
+	test_KErrNone(reqStat1.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
+	test_KErrNone(reqStat4.Int());
+	test_Value(reqStat5.Int(), reqStat5==KRequestPending);
 	User::WaitForRequest(reqStat6);
-	test(reqStat6==KErrNone);
+	test_KErrNone(reqStat6.Int());
 
 //	Renew the notify request at the top, second and third levels and on the file deleted above
 //	which will be successful, but will not complete (for obvious reasons)
@@ -1408,11 +1406,11 @@
 	fs3.NotifyChange(ENotifyEntry,reqStat3,path3);
 	fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
 	fs4.NotifyChange(ENotifyEntry,reqStat4,path4);
-	test(reqStat1==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
-	test(reqStat6==KRequestPending);
+	test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+	test_Value(reqStat6.Int(), reqStat6==KRequestPending);
 
 	test.Next(_L("Test clients monitoring levels 1 - 3 and 5 are notified"));
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\dog.txt"));
@@ -1423,16 +1421,16 @@
 //	Don't wait for reqStat4
 	User::WaitForRequest(reqStat5);
 	User::WaitForRequest(reqStat6);
-	test(reqStat1==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);	//	File does not exist
-	test(reqStat5==KErrNone);
-	test(reqStat6==KErrNone);
+	test_KErrNone(reqStat1.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);	//	File does not exist
+	test_KErrNone(reqStat5.Int());
+	test_KErrNone(reqStat6.Int());
 
 	fs4.NotifyChangeCancel(reqStat4);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrCancel);
+	test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 //	Renew the notify request at the top, second and third levels and attempt to renew
 //	the request on the files deleted above (which will fail).
 
@@ -1443,25 +1441,25 @@
 	fs4.NotifyChange(ENotifyEntry,reqStat4,path4);
 	fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
 	fs5.NotifyChange(ENotifyEntry,reqStat5,path5);
-	test(reqStat1==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
-	test(reqStat5==KRequestPending);
-	test(reqStat6==KRequestPending);
+	test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+	test_Value(reqStat5.Int(), reqStat5==KRequestPending);
+	test_Value(reqStat6.Int(), reqStat6==KRequestPending);
 
 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\ANIMAL\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat1);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
-	test(reqStat1==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);
-	test(reqStat5==KRequestPending);
+	test_KErrNone(reqStat1.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+	test_Value(reqStat5.Int(), reqStat5==KRequestPending);
 	User::WaitForRequest(reqStat6);
-	test(reqStat6==KErrNone);
+	test_KErrNone(reqStat6.Int());
 
 //	Renew the notify request at the top and second levels on the third level
 //	which was removed - it'll succeed but won't complete.
@@ -1473,12 +1471,12 @@
 	fs3.NotifyChange(ENotifyEntry,reqStat3,path3);
 	fs6.NotifyChange(ENotifyEntry,reqStat6,path6);
 
-	test(reqStat1==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
-	test(reqStat5==KRequestPending);
-	test(reqStat6==KRequestPending);
+	test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+	test_Value(reqStat5.Int(), reqStat5==KRequestPending);
+	test_Value(reqStat6.Int(), reqStat6==KRequestPending);
 
 	fs1.NotifyChangeCancel();
 	fs2.NotifyChangeCancel();
@@ -1525,25 +1523,25 @@
 	fs1.NotifyChange(ENotifyAll,status3,path);
 	fs1.NotifyChange(ENotifyAll,status4,path);
 	fs1.NotifyChange(ENotifyAll,status5,path);
-	test(status1==KRequestPending);
-	test(status2==KRequestPending);
-	test(status3==KRequestPending);
-	test(status4==KRequestPending);
-	test(status5==KRequestPending);
+	test_Value(status1.Int(), status1==KRequestPending);
+	test_Value(status2.Int(), status2==KRequestPending);
+	test_Value(status3.Int(), status3==KRequestPending);
+	test_Value(status4.Int(), status4==KRequestPending);
+	test_Value(status5.Int(), status5==KRequestPending);
 
 	test.Next(_L("RFs::NotifyCancel()"));
 //	Test that one call to RFs::NotifyCancel() cancels all outstanding requests
 	fs1.NotifyChangeCancel();
 	User::WaitForRequest(status1);
-	test(status1==KErrCancel);
+	test_Value(status1.Int(), status1==KErrCancel);
 	User::WaitForRequest(status2);
-	test(status2==KErrCancel);
+	test_Value(status2.Int(), status2==KErrCancel);
 	User::WaitForRequest(status3);
-	test(status3==KErrCancel);
+	test_Value(status3.Int(), status3==KErrCancel);
 	User::WaitForRequest(status4);
-	test(status4==KErrCancel);
+	test_Value(status4.Int(), status4==KErrCancel);
 	User::WaitForRequest(status5);
-	test(status5==KErrCancel);
+	test_Value(status5.Int(), status5==KErrCancel);
 //	Call the cancel function again to check no further action
 	fs1.NotifyChangeCancel();
 
@@ -1554,62 +1552,62 @@
 	fs1.NotifyChange(ENotifyAll,status3,path);
 	fs1.NotifyChange(ENotifyAll,status4,path);
 	fs1.NotifyChange(ENotifyAll,status5,path);
-	test(status1==KRequestPending);
-	test(status2==KRequestPending);
-	test(status3==KRequestPending);
-	test(status4==KRequestPending);
-	test(status5==KRequestPending);
+	test_Value(status1.Int(), status1==KRequestPending);
+	test_Value(status2.Int(), status2==KRequestPending);
+	test_Value(status3.Int(), status3==KRequestPending);
+	test_Value(status4.Int(), status4==KRequestPending);
+	test_Value(status5.Int(), status5==KRequestPending);
 
 //	Cancel the outstanding request with status5
 	test.Next(_L("RFs::NotifyCancel()"));
 	fs1.NotifyChangeCancel(status5);
 	User::WaitForRequest(status5);
-	test(status1==KRequestPending);
-	test(status2==KRequestPending);
-	test(status3==KRequestPending);
-	test(status4==KRequestPending);
-	test(status5==KErrCancel);
+	test_Value(status1.Int(), status1==KRequestPending);
+	test_Value(status2.Int(), status2==KRequestPending);
+	test_Value(status3.Int(), status3==KRequestPending);
+	test_Value(status4.Int(), status4==KRequestPending);
+	test_Value(status5.Int(), status5==KErrCancel);
 
 	r=TheFs.MkDir(_L("\\F32-TST\\TROPICANA\\"));
 	test_KErrNone(r);
-	test(status1==KRequestPending);
-	test(status2==KRequestPending);
-	test(status3==KRequestPending);
-	test(status4==KRequestPending);
+	test_Value(status1.Int(), status1==KRequestPending);
+	test_Value(status2.Int(), status2==KRequestPending);
+	test_Value(status3.Int(), status3==KRequestPending);
+	test_Value(status4.Int(), status4==KRequestPending);
 
 	fs1.NotifyChangeCancel(status2);
 	User::WaitForRequest(status2);
 
-	test(status1==KRequestPending);
-	test(status2==KErrCancel);
-	test(status3==KRequestPending);
-	test(status4==KRequestPending);
+	test_Value(status1.Int(), status1==KRequestPending);
+	test_Value(status2.Int(), status2==KErrCancel);
+	test_Value(status3.Int(), status3==KRequestPending);
+	test_Value(status4.Int(), status4==KRequestPending);
 
 	r=TheFs.RmDir(_L("\\F32-TST\\TROPICANA\\"));
 	test_KErrNone(r);
-	test(status1==KRequestPending);
-	test(status3==KRequestPending);
-	test(status4==KRequestPending);
+	test_Value(status1.Int(), status1==KRequestPending);
+	test_Value(status3.Int(), status3==KRequestPending);
+	test_Value(status4.Int(), status4==KRequestPending);
 
 	fs1.NotifyChangeCancel(status4);
 	User::WaitForRequest(status4);
-	test(status1==KRequestPending);
-	test(status3==KRequestPending);
-	test(status4==KErrCancel);
+	test_Value(status1.Int(), status1==KRequestPending);
+	test_Value(status3.Int(), status3==KRequestPending);
+	test_Value(status4.Int(), status4==KErrCancel);
 
 	fs1.NotifyChangeCancel(status4);	//	Test no side effects on trying to cancel a request
-	test(status4==KErrCancel);			//	that has already been cancelled
+	test_Value(status4.Int(), status4==KErrCancel);			//	that has already been cancelled
 
 	fs1.NotifyChangeCancel(status1);
 	User::WaitForRequest(status1);
-	test(status1==KErrCancel);
-	test(status3==KRequestPending);
+	test_Value(status1.Int(), status1==KErrCancel);
+	test_Value(status3.Int(), status3==KRequestPending);
 	fs1.NotifyChangeCancel(status1);	//	Test no side effects on trying to cancel a request
-	test(status1==KErrCancel);			//	that has already been cancelled
+	test_Value(status1.Int(), status1==KErrCancel);			//	that has already been cancelled
 
 	fs1.NotifyChangeCancel(status3);
 	User::WaitForRequest(status3);
-	test(status3==KErrCancel);
+	test_Value(status3.Int(), status3==KErrCancel);
 
 	fs1.Close();
 	}
@@ -1693,9 +1691,9 @@
 	test_KErrNone(r);
 	fs3.NotifyChange(ENotifyEntry,reqStat3,path);
 
-	test(reqStat1==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
+	test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
 
 	r=gSleepThread.CreateLocal(0);
 	test_KErrNone(r);
@@ -1705,18 +1703,18 @@
 	thread1.Resume();
 	gSleepThread.Wait();
 
-	test(reqStat1==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
+	test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
 
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat1);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
-	test(reqStat1==KErrNone);	//	All three notifications occur because they
-	test(reqStat2==KErrNone);	//	are all monitoring the top level directory
-	test(reqStat3==KErrNone);	//	Later, we'll test monitoring individual files...
+	test_KErrNone(reqStat1.Int());	//	All three notifications occur because they
+	test_KErrNone(reqStat2.Int());	//	are all monitoring the top level directory
+	test_KErrNone(reqStat3.Int());	//	Later, we'll test monitoring individual files...
 
 	gSleepThread.Close();
 	thread1.Close();
@@ -1730,9 +1728,9 @@
 	fs2.NotifyChange(ENotifyAll,reqStat2,path);
 	fs3.NotifyChange(ENotifyAll,reqStat3,path);
 
-	test(reqStat1==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
+	test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
 
 	r=gSleepThread.CreateLocal(0);
 	test_KErrNone(r);
@@ -1745,9 +1743,9 @@
 	User::WaitForRequest(reqStat1);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
-	test(reqStat1==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
+	test_KErrNone(reqStat1.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
 
 	gSleepThread.Close();
 	thread2.Close();
@@ -1764,9 +1762,9 @@
 	fs2.NotifyChange(ENotifyEntry,reqStat2,path2);
 	fs3.NotifyChange(ENotifyAll,reqStat3,path3);
 
-	test(reqStat1==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
+	test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
 
 	r=gSleepThread.CreateLocal(0);
 	test_KErrNone(r);
@@ -1777,15 +1775,15 @@
 	gSleepThread.Wait();
 
 	User::WaitForRequest(reqStat1);
-	test(reqStat1==KErrNone);
-	test(reqStat2==KRequestPending);	//	Monitoring with ENotifyEntry
+	test_KErrNone(reqStat1.Int());
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);	//	Monitoring with ENotifyEntry
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrNone);
+	test_KErrNone(reqStat3.Int());
 
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat2);
-	test(reqStat2==KErrNone);
+	test_KErrNone(reqStat2.Int());
 
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
 	test_KErrNone(r);
@@ -1826,40 +1824,40 @@
 	TRequestStatus reqStat(KRequestPending);
 	TRequestStatus thrdStat(KRequestPending);
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	RThread thread;
 	r=thread.Create(_L("MyThread7"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest8);
 	test_KErrNone(r);
 	thread.Logon(thrdStat);
 	thread.Resume();
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	thread.Close();
 //	Test notification does not occur if a change is made above the file
 	fs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=thread.Create(_L("MyThread8"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1);
 	test_KErrNone(r);
 	thread.Logon(thrdStat);
 	thread.Resume();
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	User::After(500000);
 	thread.Close();
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NEWFILE.TXT"));
 	test_KErrNone(r);
 
 //	Test notification does not occur if a change is made to another file
 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Lion.log"),EFileStream);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	file.Close();
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Lion.log"));
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 
 //	Test notification occurs when a change is made to the file
@@ -1867,7 +1865,7 @@
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.Msg"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 	fs.Close();
 	}
@@ -1893,178 +1891,178 @@
 	RFile file;
 
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
 	test_KErrNone(r);
 	file.Close();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFile::Read() a file within the monitored directory - no notification for reads
 	path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
 	TBuf8<100> temp;
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=file.Read(0,temp,100);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 //	RFile::SetAtt() of a file within the monitored directory
 	test.Next(_L("RFile::SetAtt()"));
 	r=file.SetAtt(KEntryAttSystem,KEntryAttNormal);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 //	RFile::SetSize() of a file within the monitored directory
 	test.Next(_L("RFile::SetSize()"));
 	r=file.SetSize(256);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	file.Close();
 
 //	RFile::Temp() to create a temp file within the monitored directory
 	test.Next(_L("RFile::Temp()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	TFileName fileName;
 	r=file.Temp(TheFs,path,fileName,EFileWrite);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	file.Close();
 
 //	RFile::SetModified() to change modification time of a file within monitored dir
 	test.Next(_L("RFile::SetModified()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	TTime now;
 	now.HomeTime();
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	file.SetModified(now);
 	file.Close();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFs::SetEntry() to change a directory entry within the monitored directory
 	test.Next(_L("RFs::SetEntry()"));
 	TEntry entry;
 	fs.NotifyChange(ENotifyAll,reqStat,path);
 	r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	now.HomeTime();
 	r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFile::Set() to change file's modification time and attributes
 	test.Next(_L("RFile::Set()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	now.HomeTime();
 	r=file.Set(now,KEntryAttNormal,KEntryAttHidden);
 	file.Close();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFs::SetDriveName()
 	test.Next(_L("RFs::SetDriveName()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	User::After(KNotifyChangeAfter);
 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	fs.NotifyChange(ENotifyEntry,reqStat,path);
 	User::After(KNotifyChangeAfter);
 	r=TheFs.SetDriveName(KDefaultDrive,_L("TEST"));
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	fs.NotifyChangeCancel(reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 	fs.NotifyChange(ENotifyDisk,reqStat,path);
 	User::After(KNotifyChangeAfter);
 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE"));
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	fs.NotifyChangeCancel(reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 
 
 //	RFs::MkDir()
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	test.Next(_L("RFs::MkDir()"));
 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFs::RmDir()
 	test.Next(_L("RFs::RmDir()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFile::Create()
 	test.Next(_L("RFile::Create()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	file.Close();
 
 //	RFs::Delete()
 	test.Next(_L("RFs::Delete()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFile::Replace()
 	test.Next(_L("RFile::Replace()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	file.Close();
 
 //	RFs::Delete()
 	test.Next(_L("RFs::Delete()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFs::SetVolumeLabel() - should only be notification when monitoring relevant TNotifyTypes
 	test.Next(_L("RFs::SetVolumeLabel"));
@@ -2076,24 +2074,24 @@
 
 	r=TheFs.Volume(volInfo,driveNum);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	currentVolName=volInfo.iName;
 
 	r=TheFs.SetVolumeLabel(_L("VOL"),driveNum);
 	if (r==KErrNone)
 		{
 		User::WaitForRequest(reqStat);
-		test(reqStat==KErrNone);
+		test_KErrNone(reqStat.Int());
 		r=TheFs.Volume(volInfo,driveNum);
 		test_KErrNone(r);
 		test(volInfo.iName==_L("VOL"));
 	//	Test notification occurs under ENotifyDisk
 		fs.NotifyChange(ENotifyDisk,reqStat,path);
-		test(reqStat==KRequestPending);
+		test_Value(reqStat.Int(), reqStat==KRequestPending);
 		r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
 		test_KErrNone(r);
 		User::WaitForRequest(reqStat);
-		test(reqStat==KErrNone);
+		test_KErrNone(reqStat.Int());
 		r=TheFs.Volume(volInfo,driveNum);
 		test_KErrNone(r);
 
@@ -2103,7 +2101,7 @@
 		fs.NotifyChange(ENotifyAttributes,reqStat,path);
 		r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum);
 		test_KErrNone(r);
-		test(reqStat==KRequestPending);
+		test_Value(reqStat.Int(), reqStat==KRequestPending);
 		r=TheFs.Volume(volInfo,driveNum);
 		test_KErrNone(r);
 
@@ -2111,14 +2109,14 @@
 
 		fs.NotifyChangeCancel(reqStat);
 		User::WaitForRequest(reqStat);
-		test(reqStat==KErrCancel);
+		test_Value(reqStat.Int(), reqStat==KErrCancel);
 	//	Test notification occurs under ENotifyEntry
 		fs.NotifyChange(ENotifyEntry,reqStat,path);
-		test(reqStat==KRequestPending);
+		test_Value(reqStat.Int(), reqStat==KRequestPending);
 		r=TheFs.SetVolumeLabel(currentVolName,driveNum);
 		test_KErrNone(r);
 		User::WaitForRequest(reqStat);
-		test(reqStat==KErrNone);
+		test_KErrNone(reqStat.Int());
 		r=TheFs.Volume(volInfo,driveNum);
 		test_KErrNone(r);
 		test(volInfo.iName==currentVolName);
@@ -2136,19 +2134,17 @@
 
 	test.Next(_L("RFs::Rename()"));
 	fs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Toto.doc"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Toto.doc"),_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"));
 	test_KErrNone(r);
 
-#if defined(__WINS__)
-	if(gSessionPath[0]=='Y'||gSessionPath[0]=='X')
-#endif
-		{
+	if(!Is_SimulatedSystemDrive(TheFs,driveNum))
+		{// Skip emulator/PlatSim drive C:
 		test.Next(_L("RFs::Rename() with max path length"));
 		TFileName longName=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\");
 		while(longName.Length()<(KMaxFileName-2))
@@ -2156,11 +2152,11 @@
 		r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),longName);
 		test_KErrNone(r);
 		fs.NotifyChange(ENotifyEntry,reqStat,longName);
-		test(reqStat==KRequestPending);
+		test_Value(reqStat.Int(), reqStat==KRequestPending);
 		r=TheFs.Rename(longName,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"));
 		test_KErrNone(r);
 		User::WaitForRequest(reqStat);
-		test(reqStat==KErrNone);
+		test_KErrNone(reqStat.Int());
 		}
 
 	fs.Close();
@@ -2189,47 +2185,47 @@
 	RFile file;
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
 	file.Close();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFile::Read() a file within the monitored directory - no notification for reads
 	fs.NotifyChange(ENotifyAll,reqStat,path);
 	TBuf8<100> temp;
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=file.Read(0,temp,100);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 //	RFile::SetAtt() of a file within the monitored directory
 	test.Next(_L("RFile::SetAtt()"));
 	r=file.SetAtt(KEntryAttNormal,KEntryAttHidden);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFile::SetSize() of a file within the monitored directory
 	test.Next(_L("RFile::SetSize()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=file.SetSize(256);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	file.Close();
 
 //	RFile::Temp() to create a temp file in the subtree
 	test.Next(_L("RFile::Temp()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	TFileName fileName;
 	r=file.Temp(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"),fileName,EFileWrite);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	file.Close();
 
 //	RFile::SetModified() to change modification time of a file within monitored dir
@@ -2239,117 +2235,117 @@
 	now.HomeTime();
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	file.SetModified(now);
 	file.Close();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFs::Entry() to change a directory entry within the monitored directory
 	test.Next(_L("RFs::Entry()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
 	TEntry entry;
 	r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	now.HomeTime();
 	r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFile::Set() to change file's modification time and attributes
 	test.Next(_L("RFile::Set()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	now.HomeTime();
 	r=file.Set(now,KEntryAttNormal,KEntryAttHidden);
 	file.Close();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFs::SetDriveName()
 	test.Next(_L("RFs::SetDriveName()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	User::After(KNotifyChangeAfter);
 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	fs.NotifyChange(ENotifyEntry,reqStat,path);
 	r=TheFs.SetDriveName(KDefaultDrive,_L("TEST"));
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	User::After(KNotifyChangeAfter);
 	fs.NotifyChangeCancel(reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 	fs.NotifyChange(ENotifyDisk,reqStat,path);
 	User::After(KNotifyChangeAfter);
 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE"));
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	fs.NotifyChangeCancel(reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 
 //	RFs::MkDir()
 	test.Next(_L("RFs::MkDir()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFs::RmDir()
 	test.Next(_L("RFs::RmDir()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFile::Create()
 	test.Next(_L("RFile::Create()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	file.Close();
 
 //	RFs::Delete()
 	test.Next(_L("RFs::Delete()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFile::Replace()
 	test.Next(_L("RFile::Replace()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	file.Close();
 
 //	RFs::Delete()
 	test.Next(_L("RFs::Delete()"));
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFs::SetVolumeLabel() - should be notification under relevant TNotifyType monitoring
 //	The operation is non-path specific so all outstanding interested requests are notified
@@ -2362,24 +2358,24 @@
 	TFileName currentVolName;
 	r=TheFs.Volume(volInfo,driveNum);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	currentVolName=volInfo.iName;
 
 	r=TheFs.SetVolumeLabel(_L("VOL"),driveNum);
 	if (r==KErrNone)
 		{
 		User::WaitForRequest(reqStat);
-		test(reqStat==KErrNone);
+		test_KErrNone(reqStat.Int());
 		r=TheFs.Volume(volInfo,driveNum);
 		test_KErrNone(r);
 		test(volInfo.iName==_L("VOL"));
 	//	Test notification occurs under ENotifyDisk
 		fs.NotifyChange(ENotifyDisk,reqStat,path);
-		test(reqStat==KRequestPending);
+		test_Value(reqStat.Int(), reqStat==KRequestPending);
 		r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
 		test_KErrNone(r);
 		User::WaitForRequest(reqStat);
-		test(reqStat==KErrNone);
+		test_KErrNone(reqStat.Int());
 		r=TheFs.Volume(volInfo,driveNum);
 		test_KErrNone(r);
 
@@ -2389,7 +2385,7 @@
 		fs.NotifyChange(ENotifyAttributes,reqStat,path);
 		r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum);
 		test_KErrNone(r);
-		test(reqStat==KRequestPending);
+		test_Value(reqStat.Int(), reqStat==KRequestPending);
 		r=TheFs.Volume(volInfo,driveNum);
 		test_KErrNone(r);
 
@@ -2397,14 +2393,14 @@
 
 		fs.NotifyChangeCancel(reqStat);
 		User::WaitForRequest(reqStat);
-		test(reqStat==KErrCancel);
+		test_Value(reqStat.Int(), reqStat==KErrCancel);
 	//	Test notification occurs under ENotifyEntry
 		fs.NotifyChange(ENotifyEntry,reqStat,path);
-		test(reqStat==KRequestPending);
+		test_Value(reqStat.Int(), reqStat==KRequestPending);
 		r=TheFs.SetVolumeLabel(currentVolName,driveNum);
 		test_KErrNone(r);
 		User::WaitForRequest(reqStat);
-		test(reqStat==KErrNone);
+		test_KErrNone(reqStat.Int());
 		r=TheFs.Volume(volInfo,driveNum);
 		test_KErrNone(r);
 		test(volInfo.iName==currentVolName);
@@ -2421,18 +2417,18 @@
 
 //	Test that notification is made when change is made to monitored directory
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	fs.Close();
 	}
 
@@ -2458,34 +2454,34 @@
 	RFile file;
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
 	file.Close();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFile::Read() a file within the monitored directory - no notification for reads
 	fs.NotifyChange(ENotifyAll,reqStat,path);
 	TBuf8<100> temp;
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=file.Read(0,temp,100);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 //	RFile::SetAtt() of a file within the monitored directory
 	r=file.SetAtt(KEntryAttNormal,KEntryAttHidden);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFile::SetSize() of a file within the monitored directory
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=file.SetSize(256);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	file.Close();
 
 
@@ -2495,108 +2491,108 @@
 	now.HomeTime();
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	file.SetModified(now);
 	file.Close();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFs::Entry() to change a directory entry within the monitored directory
 	fs.NotifyChange(ENotifyAll,reqStat,path);
 	TEntry entry;
 	r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	now.HomeTime();
 	r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFile::Set() to change file's modification time and attributes
 	fs.NotifyChange(ENotifyAll,reqStat,path);
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	now.HomeTime();
 	r=file.Set(now,KEntryAttNormal,KEntryAttHidden);
 	file.Close();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFs::SetDriveName() - should be no notification ever with extended notification
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	User::After(KNotifyChangeAfter);
 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	fs.NotifyChange(ENotifyEntry,reqStat,path);
 	User::After(KNotifyChangeAfter);
 	r=TheFs.SetDriveName(KDefaultDrive,_L("TEST"));
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	fs.NotifyChangeCancel(reqStat);
 	User::WaitForRequest(reqStat);
 	fs.NotifyChange(ENotifyDisk,reqStat,path);
 	User::After(KNotifyChangeAfter);
 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE"));
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	fs.NotifyChangeCancel(reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 
 
 //	RFs::MkDir()
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFs::RmDir()
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFile::Create()
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	file.Close();
 
 //	RFs::Delete()
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFile::Replace()
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	file.Close();
 
 //	RFs::Delete()
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	RFs::SetVolumeLabel()
 //	Not path specific, so all outstanding requests of correct TNotifyType are notified
@@ -2606,24 +2602,24 @@
 	TFileName currentVolName;
 	r=TheFs.Volume(volInfo,driveNum);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	currentVolName=volInfo.iName;
 
 	r=TheFs.SetVolumeLabel(_L("VOL"),driveNum);
 	if (r==KErrNone)
 		{
 		User::WaitForRequest(reqStat);
-		test(reqStat==KErrNone);
+		test_KErrNone(reqStat.Int());
 		r=TheFs.Volume(volInfo,driveNum);
 		test_KErrNone(r);
 		test(volInfo.iName==_L("VOL"));
 	//	Test notification occurs under ENotifyDisk
 		fs.NotifyChange(ENotifyDisk,reqStat,path);
-		test(reqStat==KRequestPending);
+		test_Value(reqStat.Int(), reqStat==KRequestPending);
 		r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
 		test_KErrNone(r);
 		User::WaitForRequest(reqStat);
-		test(reqStat==KErrNone);
+		test_KErrNone(reqStat.Int());
 		r=TheFs.Volume(volInfo,driveNum);
 		test_KErrNone(r);
 
@@ -2633,7 +2629,7 @@
 		fs.NotifyChange(ENotifyAttributes,reqStat,path);
 		r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum);
 		test_KErrNone(r);
-		test(reqStat==KRequestPending);
+		test_Value(reqStat.Int(), reqStat==KRequestPending);
 		r=TheFs.Volume(volInfo,driveNum);
 		test_KErrNone(r);
 
@@ -2641,14 +2637,14 @@
 
 		fs.NotifyChangeCancel(reqStat);
 		User::WaitForRequest(reqStat);
-		test(reqStat==KErrCancel);
+		test_Value(reqStat.Int(), reqStat==KErrCancel);
 	//	Test notification occurs under ENotifyEntry
 		fs.NotifyChange(ENotifyEntry,reqStat,path);
-		test(reqStat==KRequestPending);
+		test_Value(reqStat.Int(), reqStat==KRequestPending);
 		r=TheFs.SetVolumeLabel(currentVolName,driveNum);
 		test_KErrNone(r);
 		User::WaitForRequest(reqStat);
-		test(reqStat==KErrNone);
+		test_KErrNone(reqStat.Int());
 		r=TheFs.Volume(volInfo,driveNum);
 		test_KErrNone(r);
 		test(volInfo.iName==currentVolName);
@@ -2663,26 +2659,26 @@
 
 //	RFs::Rename()
 	fs.NotifyChange(ENotifyEntry,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Toto.doc"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 //	Test that notification is made when change is made to monitored directory
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 	fs.Close();
 	}
 
@@ -2767,59 +2763,59 @@
 	thread1.Resume();
 	gSleepThread.Wait();
 
-	test(status1==KRequestPending);
-	test(status2==KRequestPending);
-	test(status3==KRequestPending);
-	test(status4==KRequestPending);
-	test(status5==KRequestPending);
-	test(status6==KRequestPending);
-
-	test(statusExtended1==KRequestPending);
-	test(statusExtended2==KRequestPending);
-	test(statusExtended3==KRequestPending);
-	test(statusExtended4==KRequestPending);
-	test(statusExtended5==KRequestPending);
-	test(statusExtended6==KRequestPending);
-
-	test(reqStat1==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(status1.Int(), status1==KRequestPending);
+	test_Value(status2.Int(), status2==KRequestPending);
+	test_Value(status3.Int(), status3==KRequestPending);
+	test_Value(status4.Int(), status4==KRequestPending);
+	test_Value(status5.Int(), status5==KRequestPending);
+	test_Value(status6.Int(), status6==KRequestPending);
+
+	test_Value(statusExtended1.Int(), statusExtended1==KRequestPending);
+	test_Value(statusExtended2.Int(), statusExtended2==KRequestPending);
+	test_Value(statusExtended3.Int(), statusExtended3==KRequestPending);
+	test_Value(statusExtended4.Int(), statusExtended4==KRequestPending);
+	test_Value(statusExtended5.Int(), statusExtended5==KRequestPending);
+	test_Value(statusExtended6.Int(), statusExtended6==KRequestPending);
+
+	test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat1);
-	test(reqStat1==KErrNone);
+	test_KErrNone(reqStat1.Int());
 	User::WaitForRequest(status1);
-	test(status1==KErrNone);
+	test_KErrNone(status1.Int());
 	User::WaitForRequest(status2);
-	test(status2==KErrNone);
+	test_KErrNone(status2.Int());
 	User::WaitForRequest(status3);
-	test(status3==KErrNone);
+	test_KErrNone(status3.Int());
 	User::WaitForRequest(status4);
-	test(status4==KErrNone);
+	test_KErrNone(status4.Int());
 	User::WaitForRequest(status5);
-	test(status5==KErrNone);
+	test_KErrNone(status5.Int());
 	User::WaitForRequest(status6);
-	test(status6==KErrNone);
+	test_KErrNone(status6.Int());
 
 	User::WaitForRequest(statusExtended1);
-	test(statusExtended1==KErrNone);
+	test_KErrNone(statusExtended1.Int());
 	User::WaitForRequest(statusExtended2);
-	test(statusExtended2==KErrNone);
+	test_KErrNone(statusExtended2.Int());
 	User::WaitForRequest(statusExtended3);
-	test(statusExtended3==KErrNone);
+	test_KErrNone(statusExtended3.Int());
 	User::WaitForRequest(statusExtended4);
-	test(statusExtended4==KErrNone);
+	test_KErrNone(statusExtended4.Int());
 	User::WaitForRequest(statusExtended5);
-	test(statusExtended5==KErrNone);
+	test_KErrNone(statusExtended5.Int());
 	User::WaitForRequest(statusExtended6);
-	test(statusExtended6==KErrNone);
+	test_KErrNone(statusExtended6.Int());
 
 	User::WaitForRequest(reqStat2);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_KErrNone(reqStat2.Int());
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 	fs.NotifyChangeCancel();	//	Cancels both remaining notification requests
 
 	User::WaitForRequest(reqStat3);
@@ -2837,10 +2833,10 @@
 	fs.NotifyChange(ENotifyEntry,reqStat2,path2);
 	fs.NotifyChange(ENotifyAll,reqStat3,path3);
 	fs.NotifyChange(ENotifyEntry,reqStat4,path4);
-	test(reqStat1==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=gSleepThread.CreateLocal(0);
 	test_KErrNone(r);
@@ -2851,11 +2847,11 @@
 	gSleepThread.Wait();
 
 	User::WaitForRequest(reqStat1);
-	test(reqStat1==KErrNone);
-	test(reqStat2==KRequestPending);
+	test_KErrNone(reqStat1.Int());
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	gSleepThread.Close();
 	thread2.Close();
@@ -2863,10 +2859,10 @@
 	fs.NotifyChange(ENotifyAll,reqStat1,path1);
 	fs.NotifyChange(ENotifyAll,reqStat3,path3);
 
-	test(reqStat1==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat1.Int(), reqStat1==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=gSleepThread.CreateLocal(0);
 	test_KErrNone(r);
@@ -2877,11 +2873,11 @@
 	gSleepThread.Wait();
 
 	User::WaitForRequest(reqStat1);
-	test(reqStat1==KErrNone);
-	test(reqStat2==KRequestPending);	//	Monitoring with ENotifyEntry
+	test_KErrNone(reqStat1.Int());
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);	//	Monitoring with ENotifyEntry
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);	//	Monitoring with ENotifyEntry
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);	//	Monitoring with ENotifyEntry
 
 	RFs fs2;
 	r=fs2.Connect();
@@ -2891,27 +2887,27 @@
 
 	TRequestStatus reqStat(KRequestPending);
 	fs2.NotifyChange(ENotifyEntry,reqStat);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat2);
-	test(reqStat2==KErrNone);
-	test(reqStat4==KRequestPending);
+	test_KErrNone(reqStat2.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
+	test_KErrNone(reqStat.Int());
 
 	fs2.NotifyChange(ENotifyAll,reqStat);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
-	test(reqStat4==KRequestPending);
+	test_KErrNone(reqStat.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\dingo.txt"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrNone);
+	test_KErrNone(reqStat4.Int());
 
 	gSleepThread.Close();
 	thread3.Close();
@@ -2958,40 +2954,40 @@
 	fs.NotifyChange(ENotifyDisk,reqStat7,path);
 
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrArgument); //	Cannot monitor a file with ENotifyDir
-	test(reqStat5==KRequestPending);
-	test(reqStat6==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KErrArgument); //	Cannot monitor a file with ENotifyDir
+	test_Value(reqStat5.Int(), reqStat5==KRequestPending);
+	test_Value(reqStat6.Int(), reqStat6==KRequestPending);
 	fs.NotifyChange(ENotifyEntry,reqStat4,path);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=file.Write(0,_L8("Pay no attention to the man behind the curtain"));
 	file.Close();
 
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
-	test(reqStat2==KRequestPending);	//	Monitoring with ENotifyFile
+	test_KErrNone(reqStat.Int());
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);	//	Monitoring with ENotifyFile
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);	//	Monitoring with ENotifyEntry
-	test(reqStat5==KRequestPending);
-	test(reqStat6==KRequestPending);
-	test(reqStat7==KRequestPending);
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);	//	Monitoring with ENotifyEntry
+	test_Value(reqStat5.Int(), reqStat5==KRequestPending);
+	test_Value(reqStat6.Int(), reqStat6==KRequestPending);
+	test_Value(reqStat7.Int(), reqStat7==KRequestPending);
 	fs.NotifyChangeCancel();			//	Cancels all outstanding notification requests
 
 	User::WaitForRequest(reqStat2);
-	test(reqStat2==KErrCancel);
+	test_Value(reqStat2.Int(), reqStat2==KErrCancel);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrCancel);
+	test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 	User::WaitForRequest(reqStat5);
-	test(reqStat5==KErrCancel);
+	test_Value(reqStat5.Int(), reqStat5==KErrCancel);
 	User::WaitForRequest(reqStat6);
-	test(reqStat6==KErrCancel);
+	test_Value(reqStat6.Int(), reqStat6==KErrCancel);
 	User::WaitForRequest(reqStat7);
-	test(reqStat7==KErrCancel);
+	test_Value(reqStat7.Int(), reqStat7==KErrCancel);
 
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite);
 	test_KErrNone(r);
@@ -3005,57 +3001,57 @@
 	fs.NotifyChange(ENotifyWrite,reqStat6,path);
 	fs.NotifyChange(ENotifyDisk,reqStat7,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 	User::WaitForRequest(reqStat5);
-	test(reqStat5==KErrArgument);
-	test(reqStat6==KRequestPending);
-	test(reqStat7==KRequestPending);
+	test_Value(reqStat5.Int(), reqStat5==KErrArgument);
+	test_Value(reqStat6.Int(), reqStat6==KRequestPending);
+	test_Value(reqStat7.Int(), reqStat7==KRequestPending);
 
 	test.Next(_L("RFile::SetAtt()"));
 	r=file.SetAtt(KEntryAttSystem,KEntryAttNormal);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat4);
-	test(reqStat==KErrNone);
-	test(reqStat2==KRequestPending);	//	Monitoring with ENotifyFile
-	test(reqStat3==KRequestPending);	//	Monitoring with ENotifyEntry
-	test(reqStat4==KErrNone);				//	Monitoring a file - can't use ENotifyDir
-	test(reqStat6==KRequestPending);
-	test(reqStat7==KRequestPending);
+	test_KErrNone(reqStat.Int());
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);	//	Monitoring with ENotifyFile
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);	//	Monitoring with ENotifyEntry
+	test_KErrNone(reqStat4.Int());				//	Monitoring a file - can't use ENotifyDir
+	test_Value(reqStat6.Int(), reqStat6==KRequestPending);
+	test_Value(reqStat7.Int(), reqStat7==KRequestPending);
 
 	fs.NotifyChange(ENotifyWrite,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	fs.NotifyChange(ENotifyDir,reqStat4,path);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrArgument);
+	test_Value(reqStat4.Int(), reqStat4==KErrArgument);
 	r=file.SetAtt(KEntryAttNormal,KEntryAttSystem);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);		//	Monitoring with ENotifyWrite
+	test_Value(reqStat.Int(), reqStat==KRequestPending);		//	Monitoring with ENotifyWrite
 	fs.NotifyChangeCancel();	//	Cancel outstanding notification request
 
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 	User::WaitForRequest(reqStat2);
-	test(reqStat2==KErrCancel);
+	test_Value(reqStat2.Int(), reqStat2==KErrCancel);
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrCancel);
+	test_Value(reqStat3.Int(), reqStat3==KErrCancel);
 	User::WaitForRequest(reqStat6);
-	test(reqStat6==KErrCancel);
+	test_Value(reqStat6.Int(), reqStat6==KErrCancel);
 	User::WaitForRequest(reqStat7);
-	test(reqStat7==KErrCancel);
+	test_Value(reqStat7.Int(), reqStat7==KErrCancel);
 
 	fs.NotifyChange(ENotifyAll,reqStat,path);
 	fs.NotifyChange(ENotifyFile,reqStat2,path);
 	fs.NotifyChange(ENotifyEntry,reqStat3,path);
 	fs.NotifyChange(ENotifyAttributes,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 //	RFile::SetSize() of a file within the monitored directory
 	test.Next(_L("RFile::SetSize()"));
@@ -3063,30 +3059,30 @@
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat4);
-	test(reqStat==KErrNone);
-	test(reqStat2==KRequestPending);	//	Monitoring with ENotifyFile
-	test(reqStat3==KRequestPending);	//	Monitoring with ENotifyEntry
-	test(reqStat4==KErrNone);
+	test_KErrNone(reqStat.Int());
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);	//	Monitoring with ENotifyFile
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);	//	Monitoring with ENotifyEntry
+	test_KErrNone(reqStat4.Int());
 
 	fs.NotifyChange(ENotifyWrite,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	fs.NotifyChange(ENotifyDir,reqStat4,path);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrArgument);
+	test_Value(reqStat4.Int(), reqStat4==KErrArgument);
 	r=file.SetSize(200);
 	test_KErrNone(r);
 	User::After(1000000);
-	test(reqStat==KRequestPending);		//	Monitoring with ENotifyWrite
+	test_Value(reqStat.Int(), reqStat==KRequestPending);		//	Monitoring with ENotifyWrite
 
 	file.Close();
 	fs.NotifyChangeCancel();			//	Cancels all outstanding notification requests
 
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 	User::WaitForRequest(reqStat2);
-	test(reqStat2==KErrCancel);
+	test_Value(reqStat2.Int(), reqStat2==KErrCancel);
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrCancel);
+	test_Value(reqStat3.Int(), reqStat3==KErrCancel);
 
 //	RFile::Temp() to create a temp file within the monitored directory
 	test.Next(_L("RFile::Temp()"));
@@ -3097,47 +3093,47 @@
 	fs.NotifyChange(ENotifyEntry,reqStat3,path);
 	fs.NotifyChange(ENotifyAttributes,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	TFileName fileName;
 	r=file.Temp(TheFs,path,fileName,EFileWrite);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);	//	Monitoring ENotifyEntry
-	test(reqStat4==KRequestPending);	//	Monitoring ENotifyAttributes
+	test_KErrNone(reqStat.Int());
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);	//	Monitoring ENotifyEntry
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);	//	Monitoring ENotifyAttributes
 	file.Close();
 	fs.NotifyChangeCancel();
 
 	User::WaitForRequest(reqStat2);
-	test(reqStat2==KErrCancel);
+	test_Value(reqStat2.Int(), reqStat2==KErrCancel);
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrCancel);
+	test_Value(reqStat3.Int(), reqStat3==KErrCancel);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrCancel);
+	test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 
 	fs.NotifyChange(ENotifyFile,reqStat,path);
 	fs.NotifyChange(ENotifyDisk,reqStat2,path);
 	fs.NotifyChange(ENotifyWrite,reqStat3,path);
 	r=file.Temp(TheFs,path,fileName,EFileWrite);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);		//	Monitoring ENotifyFile
-	test(reqStat2==KRequestPending);	//	Monitoring ENotifyDisk
-	test(reqStat3==KRequestPending);	//	Monitoring ENotifyWrite
+	test_Value(reqStat.Int(), reqStat==KRequestPending);	//	Monitoring ENotifyFile
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);	//	Monitoring ENotifyDisk
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);	//	Monitoring ENotifyWrite
 	file.Close();
 
 	fs.NotifyChangeCancel();	//	Cancels all outstanding notification requests
 
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 	User::WaitForRequest(reqStat2);
-	test(reqStat2==KErrCancel);
+	test_Value(reqStat2.Int(), reqStat2==KErrCancel);
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrCancel);
+	test_Value(reqStat3.Int(), reqStat3==KErrCancel);
 
 //	RFile::SetModified() to change modification time of a file within monitored dir
 	test.Next(_L("RFile::SetModified()"));
@@ -3147,30 +3143,30 @@
 	fs.NotifyChange(ENotifyAttributes,reqStat3,path);
 	fs.NotifyChange(ENotifyFile,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	TTime now;
 	now.HomeTime();
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	file.SetModified(now);
 	file.Close();
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
-	test(reqStat2==KRequestPending);
+	test_KErrNone(reqStat.Int());
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 	fs.NotifyChangeCancel();
 
 	User::WaitForRequest(reqStat2);
-	test(reqStat2==KErrCancel);
+	test_Value(reqStat2.Int(), reqStat2==KErrCancel);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrCancel);
+	test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 
 //	RFs::SetEntry() to change a directory entry within the monitored directory
 	test.Next(_L("RFs::SetEntry()"));
@@ -3180,28 +3176,28 @@
 	fs.NotifyChange(ENotifyAttributes,reqStat3,path);
 	fs.NotifyChange(ENotifyDisk,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\NewFile.txt"),entry);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	now.HomeTime();
 	r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\NewFile.txt"),now,KEntryAttHidden,KEntryAttNormal);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat3);
-	test(reqStat==KErrNone);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);
+	test_KErrNone(reqStat.Int());
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 	fs.NotifyChangeCancel();
 
 	User::WaitForRequest(reqStat2);
-	test(reqStat2==KErrCancel);
+	test_Value(reqStat2.Int(), reqStat2==KErrCancel);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrCancel);
+	test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 
 //	RFile::Set() to change file's modification time and attributes
 	test.Next(_L("RFile::Set()"));
@@ -3210,29 +3206,29 @@
 	fs.NotifyChange(ENotifyAttributes,reqStat3,path);
 	fs.NotifyChange(ENotifyWrite,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	now.HomeTime();
 	r=file.Set(now,KEntryAttNormal,KEntryAttHidden);
 	file.Close();
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat3);
-	test(reqStat==KErrNone);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);
+	test_KErrNone(reqStat.Int());
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 	fs.NotifyChangeCancel();
 
 	User::WaitForRequest(reqStat2);
-	test(reqStat2==KErrCancel);
+	test_Value(reqStat2.Int(), reqStat2==KErrCancel);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrCancel);
+	test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 
 //	RFs::SetDriveName()
 
@@ -3242,27 +3238,27 @@
 	fs.NotifyChange(ENotifyDisk,reqStat3,path);
 	fs.NotifyChange(ENotifyAttributes,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 	User::After(KNotifyChangeAfter);
 
 	r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrNone);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_KErrNone(reqStat.Int());
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 	fs.NotifyChangeCancel();
 
 	User::WaitForRequest(reqStat2);
-	test(reqStat2==KErrCancel);
+	test_Value(reqStat2.Int(), reqStat2==KErrCancel);
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrCancel);
+	test_Value(reqStat3.Int(), reqStat3==KErrCancel);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrCancel);
+	test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 
 //	RFs::MkDir()
 	test.Next(_L("RFs::MkDir()"));
@@ -3273,20 +3269,20 @@
 	fs.NotifyChange(ENotifyDir,reqStat3,path);
 	fs.NotifyChange(ENotifyFile,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 //	RFs::RmDir()
 	test.Next(_L("RFs::RmDir()"));
@@ -3294,24 +3290,24 @@
 	fs.NotifyChange(ENotifyDir,reqStat2,path);
 	fs.NotifyChange(ENotifyWrite,reqStat3,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
 
 	r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 	fs.NotifyChangeCancel();
 
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrCancel);
+	test_Value(reqStat3.Int(), reqStat3==KErrCancel);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrCancel);
+	test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 
 //	RFile::Create()
 	test.Next(_L("RFile::Create()"));
@@ -3320,20 +3316,20 @@
 	fs.NotifyChange(ENotifyDir,reqStat3,path);
 	fs.NotifyChange(ENotifyFile,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"),EFileRead|EFileWrite);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat4);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KRequestPending);	//	Monitoring ENotifyDir
-	test(reqStat4==KErrNone);
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);	//	Monitoring ENotifyDir
+	test_KErrNone(reqStat4.Int());
 	file.Close();
 	fs.NotifyChangeCancel(reqStat3);
 	User::WaitForRequest(reqStat3);
@@ -3343,26 +3339,26 @@
 	fs.NotifyChange(ENotifyDisk,reqStat3,path);
 	fs.NotifyChange(ENotifyWrite,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Bad_Witch.bat"),EFileRead|EFileWrite);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 	file.Close();
 	fs.NotifyChangeCancel();
 
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrCancel);
+	test_Value(reqStat3.Int(), reqStat3==KErrCancel);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrCancel);
+	test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 
 //	RFs::Delete()
 	test.Next(_L("RFs::Delete()"));
@@ -3371,46 +3367,46 @@
 	fs.NotifyChange(ENotifyDir,reqStat3,path);
 	fs.NotifyChange(ENotifyFile,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat4);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KRequestPending);	//	Monitoring ENotifyDir
-	test(reqStat4==KErrNone);
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);	//	Monitoring ENotifyDir
+	test_KErrNone(reqStat4.Int());
 	fs.NotifyChangeCancel(reqStat3);
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrCancel);
+	test_Value(reqStat3.Int(), reqStat3==KErrCancel);
 
 	fs.NotifyChange(ENotifyAll,reqStat,path);
 	fs.NotifyChange(ENotifyEntry,reqStat2,path);
 	fs.NotifyChange(ENotifyAttributes,reqStat3,path);
 	fs.NotifyChange(ENotifyAll,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Bad_Witch.bat"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat4);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KErrNone);
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_KErrNone(reqStat4.Int());
 	fs.NotifyChangeCancel(reqStat3);
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrCancel);
+	test_Value(reqStat3.Int(), reqStat3==KErrCancel);
 
 //	RFile::Replace()
 	test.Next(_L("RFile::Replace()"));
@@ -3419,28 +3415,28 @@
 	fs.NotifyChange(ENotifyFile,reqStat3,path);
 	fs.NotifyChange(ENotifyDir,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"),EFileRead|EFileWrite);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 	file.Close();
 	fs.NotifyChangeCancel();
 
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrCancel);
+	test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 
 //	RFs::Delete()
 	test.Next(_L("RFs::Delete()"));
@@ -3450,21 +3446,21 @@
 	fs.NotifyChange(ENotifyFile,reqStat3,path);
 	fs.NotifyChange(ENotifyDir,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrArgument);
+	test_Value(reqStat4.Int(), reqStat4==KErrArgument);
 
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KErrArgument);
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KErrArgument);
 
 //	RFs::SetVolumeLabel()
 	test.Next(_L("RFs::SetVolumeLabel()"));
@@ -3477,20 +3473,20 @@
 	fs.NotifyChange(ENotifyAttributes,reqStat6,path);
 	fs.NotifyChange(ENotifyDisk,reqStat7,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
-	test(reqStat5==KRequestPending);
-	test(reqStat6==KRequestPending);
-	test(reqStat7==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+	test_Value(reqStat5.Int(), reqStat5==KRequestPending);
+	test_Value(reqStat6.Int(), reqStat6==KRequestPending);
+	test_Value(reqStat7.Int(), reqStat7==KRequestPending);
 
 	TInt driveNum=CurrentDrive();
 	TVolumeInfo volInfo;
 	TFileName currentVolName;
 	r=TheFs.Volume(volInfo,driveNum);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	currentVolName=volInfo.iName;
 
 	r=TheFs.SetVolumeLabel(_L("VOL"),driveNum);
@@ -3500,21 +3496,21 @@
 		User::WaitForRequest(reqStat2);
 		User::WaitForRequest(reqStat7);
 
-		test(reqStat==KErrNone);
-		test(reqStat2==KErrNone);
-		test(reqStat3==KRequestPending);
-		test(reqStat4==KRequestPending);
-		test(reqStat5==KRequestPending);
-		test(reqStat6==KRequestPending);
-		test(reqStat7==KErrNone);
+		test_KErrNone(reqStat.Int());
+		test_KErrNone(reqStat2.Int());
+		test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+		test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+		test_Value(reqStat5.Int(), reqStat5==KRequestPending);
+		test_Value(reqStat6.Int(), reqStat6==KRequestPending);
+		test_KErrNone(reqStat7.Int());
 
 		fs.NotifyChange(ENotifyAll,reqStat,path);
 		fs.NotifyChange(ENotifyEntry,reqStat2,path);
 		fs.NotifyChange(ENotifyDisk,reqStat7,path);
 
-		test(reqStat==KRequestPending);
-		test(reqStat2==KRequestPending);
-		test(reqStat7==KRequestPending);
+		test_Value(reqStat.Int(), reqStat==KRequestPending);
+		test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+		test_Value(reqStat7.Int(), reqStat7==KRequestPending);
 
 		r=TheFs.SetVolumeLabel(currentVolName,driveNum);
 		test_KErrNone(r);
@@ -3523,13 +3519,13 @@
 		User::WaitForRequest(reqStat2);
 		User::WaitForRequest(reqStat7);
 
-		test(reqStat==KErrNone);
-		test(reqStat2==KErrNone);
-		test(reqStat3==KRequestPending);
-		test(reqStat4==KRequestPending);
-		test(reqStat5==KRequestPending);
-		test(reqStat6==KRequestPending);
-		test(reqStat7==KErrNone);
+		test_KErrNone(reqStat.Int());
+		test_KErrNone(reqStat2.Int());
+		test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+		test_Value(reqStat4.Int(), reqStat4==KRequestPending);
+		test_Value(reqStat5.Int(), reqStat5==KRequestPending);
+		test_Value(reqStat6.Int(), reqStat6==KRequestPending);
+		test_KErrNone(reqStat7.Int());
 
 		r=TheFs.Volume(volInfo,driveNum);
 		test_KErrNone(r);
@@ -3538,13 +3534,13 @@
 		fs.NotifyChangeCancel();
 
 		User::WaitForRequest(reqStat3);
-		test(reqStat3==KErrCancel);
+		test_Value(reqStat3.Int(), reqStat3==KErrCancel);
 		User::WaitForRequest(reqStat4);
-		test(reqStat4==KErrCancel);
+		test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 		User::WaitForRequest(reqStat5);
-		test(reqStat5==KErrCancel);
+		test_Value(reqStat5.Int(), reqStat5==KErrCancel);
 		User::WaitForRequest(reqStat6);
-		test(reqStat6==KErrCancel);
+		test_Value(reqStat6.Int(), reqStat6==KErrCancel);
 		}
 
 	else	//	RFs::SetVolumeLabel() doesn't work on subst drives
@@ -3571,24 +3567,24 @@
 	fs.NotifyChange(ENotifyFile,reqStat3,path);
 	fs.NotifyChange(ENotifyDir,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=file.Rename(_L("\\F32-TST\\NOTIFY\\OldFile.abc"));
 	test_Value(r, r == KErrNone||r==KErrAlreadyExists);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);	//	Monitoring ENotifyDir
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);	//	Monitoring ENotifyDir
 	file.Close();
 	fs.NotifyChangeCancel();
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrCancel);
+	test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 
 	path=_L("\\F32-TST\\NOTIFY\\OldFile.abc");
 
@@ -3599,21 +3595,21 @@
 	fs.NotifyChange(ENotifyFile,reqStat3,path);
 	fs.NotifyChange(ENotifyDir,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrArgument);
+	test_Value(reqStat4.Int(), reqStat4==KErrArgument);
 
 	r=file.Rename(_L("\\F32-TST\\NOTIFY\\NewFile.xyz"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KErrArgument);
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KErrArgument);
 	file.Close();
 
 //	RFs::Rename()
@@ -3624,27 +3620,27 @@
 	fs.NotifyChange(ENotifyFile,reqStat3,path);
 	fs.NotifyChange(ENotifyDir,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\NewFile.xyz"),_L("\\F32-TST\\NOTIFY\\NewerFile.cat"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);	//	Changed a file not a directory entry
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);	//	Changed a file not a directory entry
 	fs.NotifyChangeCancel();
 
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrCancel);
+	test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 
 	path=_L("\\F32-TST\\NOTIFY\\NewerFile.cat");
 	fs.NotifyChange(ENotifyAll,reqStat,path);
@@ -3652,20 +3648,20 @@
 	fs.NotifyChange(ENotifyFile,reqStat3,path);
 	fs.NotifyChange(ENotifyDir,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrArgument);
+	test_Value(reqStat4.Int(), reqStat4==KErrArgument);
 
 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\NewerFile.cat"),_L("\\F32-TST\\NOTIFY\\Original.dog"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
 
 	path=_L("\\F32-TST\\NOTIFY\\");
 	fs.NotifyChange(ENotifyAll,reqStat,path);
@@ -3673,10 +3669,10 @@
 	fs.NotifyChange(ENotifyFile,reqStat3,path);
 	fs.NotifyChange(ENotifyDir,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\"),_L("\\F32-TST\\NOTIFY_TEMP\\"));
 	test_KErrNone(r);
@@ -3684,11 +3680,11 @@
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
 	User::WaitForRequest(reqStat4);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);	//	Changed a directory entry but notified anyway despite
-	test(reqStat4==KErrNone);	//	requesting file notification only because the path we
-								//	were monitoring has changed
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());	//	Changed a directory entry but notified anyway despite
+	test_KErrNone(reqStat4.Int());	//	requesting file notification only because the path we
+									//	were monitoring has changed
 
 	path=_L("\\F32-TST\\NOTIFY_TEMP\\Original.dog");
 	fs.NotifyChange(ENotifyAll,reqStat,path);
@@ -3696,102 +3692,102 @@
 	fs.NotifyChange(ENotifyFile,reqStat3,path);
 	fs.NotifyChange(ENotifyDir,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrArgument);
+	test_Value(reqStat4.Int(), reqStat4==KErrArgument);
 
 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY_TEMP\\"),_L("\\F32-TST\\NOTIFY\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
-	test(reqStat==KErrNone);			//	Modified a directory above the level at which we
-	test(reqStat2==KErrNone);			//	are monitoring for changes - we must be notified
-	test(reqStat3==KErrNone);			//	anyway because the path has changed
+	test_KErrNone(reqStat.Int());			//	Modified a directory above the level at which we
+	test_KErrNone(reqStat2.Int());			//	are monitoring for changes - we must be notified
+	test_KErrNone(reqStat3.Int());			//	anyway because the path has changed
 
 	fs.NotifyChange(ENotifyAll,reqStat,path);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	fs.NotifyChange(ENotifyEntry,reqStat2,path);
-	test(reqStat2==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
 	fs.NotifyChange(ENotifyFile,reqStat3,path);
-	test(reqStat3==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
 
 	fs.NotifyChangeCancel(reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 	fs.NotifyChangeCancel(reqStat2);
 	User::WaitForRequest(reqStat2);
-	test(reqStat2==KErrCancel);
+	test_Value(reqStat2.Int(), reqStat2==KErrCancel);
 	fs.NotifyChangeCancel(reqStat3);
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrCancel);
+	test_Value(reqStat3.Int(), reqStat3==KErrCancel);
 
 	path=_L("\\F32-TST\\NOTIFY\\Original.dog");
 	fs.NotifyChange(ENotifyAll,reqStat,path);
 	fs.NotifyChange(ENotifyEntry,reqStat2,path);
 	fs.NotifyChange(ENotifyFile,reqStat3,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
 
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Original.dog"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
 
 	path=_L("\\F32-TST\\NOTIFY\\");
 	fs.NotifyChange(ENotifyAll,reqStat,path);
 	fs.NotifyChange(ENotifyEntry,reqStat2,path);
 	fs.NotifyChange(ENotifyDir,reqStat3,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
 
 	r=TheFs.Rename(_L("\\F32-TST\\"),_L("\\F32-TEST\\"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
-	test(reqStat==KErrNone);			//	Modified a directory above the level at which we
-	test(reqStat2==KErrNone);			//	are monitoring for changes but we receive notification
-	test(reqStat3==KErrNone);			//	because the notification path has been changed
+	test_KErrNone(reqStat.Int());			//	Modified a directory above the level at which we
+	test_KErrNone(reqStat2.Int());			//	are monitoring for changes but we receive notification
+	test_KErrNone(reqStat3.Int());			//	because the notification path has been changed
 
 	fs.NotifyChange(ENotifyAll,reqStat,path);
 	//	Notification request is submitted, despite the subject's disappearance
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	fs.NotifyChange(ENotifyEntry,reqStat2,path);
 	//	Notification request is submitted, despite the subject's disappearance
-	test(reqStat2==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
 	fs.NotifyChange(ENotifyFile,reqStat3,path);
 	//	Notification request is submitted, despite the subject's disappearance
-	test(reqStat3==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
 
 	fs.NotifyChangeCancel(reqStat);
 	User::WaitForRequest(reqStat);
-	test(reqStat==KErrCancel);
+	test_Value(reqStat.Int(), reqStat==KErrCancel);
 	fs.NotifyChangeCancel(reqStat2);
 	User::WaitForRequest(reqStat2);
-	test(reqStat2==KErrCancel);
+	test_Value(reqStat2.Int(), reqStat2==KErrCancel);
 	fs.NotifyChangeCancel(reqStat3);
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrCancel);
+	test_Value(reqStat3.Int(), reqStat3==KErrCancel);
 
 	path=_L("\\F32-TEST\\NOTIFY\\");
 	fs.NotifyChange(ENotifyAll,reqStat,path);
 	fs.NotifyChange(ENotifyEntry,reqStat2,path);
 	fs.NotifyChange(ENotifyDir,reqStat3,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
 
 	r=TheFs.Rename(_L("\\F32-TEST\\NOTIFY\\"),_L("\\F32-TEST\\NOTIFY_CHANGED\\"));
 	test_KErrNone(r);
@@ -3800,9 +3796,9 @@
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
 
-	test(reqStat==KErrNone);			//	Rename the directory we were monitoring
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
+	test_KErrNone(reqStat.Int());			//	Rename the directory we were monitoring
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
 
 //	Tidy up the test directory before continuing (while testing notifications of renaming to the monitored directory)
 
@@ -3812,10 +3808,10 @@
 	fs.NotifyChange(ENotifyDir,reqStat3,path);
 	fs.NotifyChange(ENotifyFile,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=TheFs.Rename(_L("\\F32-TEST\\"),_L("\\F32-TST\\"));
 	test_KErrNone(r);
@@ -3824,14 +3820,14 @@
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
 
-	test(reqStat==KErrNone);			//	Renaming to (under) the directory we were monitoring
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);
+	test_KErrNone(reqStat.Int());			//	Renaming to (under) the directory we were monitoring
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	fs.NotifyChangeCancel(reqStat4);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrCancel);
+	test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 
 	path=_L("\\F32-TST\\NOTIFY\\");
 	fs.NotifyChange(ENotifyAll,reqStat,path);
@@ -3839,10 +3835,10 @@
 	fs.NotifyChange(ENotifyDir,reqStat3,path);
 	fs.NotifyChange(ENotifyFile,reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=TheFs.Rename(_L("\\F32-TST\\NOTIFY_CHANGED\\"),_L("\\F32-TST\\NOTIFY\\"));
 	test_KErrNone(r);
@@ -3851,14 +3847,14 @@
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
 
-	test(reqStat==KErrNone);			//	Renaming to the directory we were monitoring
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);
+	test_KErrNone(reqStat.Int());			//	Renaming to the directory we were monitoring
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	fs.NotifyChangeCancel(reqStat4);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrCancel);
+	test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 
 //	Test combinations of notify types
 	test.Next(_L("Test combinations of notify types"));
@@ -3869,24 +3865,24 @@
 	fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyFile),reqStat3,path);
 	fs.NotifyChange((TNotifyType)(ENotifyDisk|ENotifyAttributes),reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite);
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);	//	Monitoring ENotifyAttributes|ENotifyDisk
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);	//	Monitoring ENotifyAttributes|ENotifyDisk
 	file.Close();
 	fs.NotifyChangeCancel(reqStat4);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrCancel);
+	test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 
 //	RFile::SetModified()
 	fs.NotifyChange(ENotifyAll,reqStat,path);
@@ -3894,28 +3890,28 @@
 	fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyFile),reqStat3,path);
 	fs.NotifyChange((TNotifyType)(ENotifyDisk|ENotifyAttributes),reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	TTime nowTime;
 	nowTime.HomeTime();
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite);
 	test_KErrNone(r);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	file.SetModified(now);
 	file.Close();
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat4);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KErrNone);
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_KErrNone(reqStat4.Int());
 	fs.NotifyChangeCancel();
 	User::WaitForRequest(reqStat3);
-	test(reqStat3==KErrCancel);
+	test_Value(reqStat3.Int(), reqStat3==KErrCancel);
 
 //	RFile::Write()
 	fs.NotifyChange(ENotifyAll,reqStat,path);
@@ -3923,10 +3919,10 @@
 	fs.NotifyChange((TNotifyType)(ENotifyFile|ENotifyWrite),reqStat3,path);
 	fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyWrite),reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite);
 	test_KErrNone(r);
@@ -3935,13 +3931,13 @@
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat3);
 	User::WaitForRequest(reqStat4);
-	test(reqStat==KErrNone);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KErrNone);
+	test_KErrNone(reqStat.Int());
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_KErrNone(reqStat3.Int());
+	test_KErrNone(reqStat4.Int());
 	fs.NotifyChangeCancel(reqStat2);	//	Cancels all outstanding notification requests
 	User::WaitForRequest(reqStat2);
-	test(reqStat2==KErrCancel);
+	test_Value(reqStat2.Int(), reqStat2==KErrCancel);
 
 //	RFs::Delete()
 	test.Next(_L("RFs::Delete()"));
@@ -3950,23 +3946,23 @@
 	fs.NotifyChange((TNotifyType)(ENotifyFile|ENotifyWrite),reqStat3,path);
 	fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyWrite),reqStat4,path);
 
-	test(reqStat==KRequestPending);
-	test(reqStat2==KRequestPending);
-	test(reqStat3==KRequestPending);
-	test(reqStat4==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
+	test_Value(reqStat2.Int(), reqStat2==KRequestPending);
+	test_Value(reqStat3.Int(), reqStat3==KRequestPending);
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 
 	r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Munchkin.msg"));
 	test_KErrNone(r);
 	User::WaitForRequest(reqStat);
 	User::WaitForRequest(reqStat2);
 	User::WaitForRequest(reqStat3);
-	test(reqStat==KErrNone);
-	test(reqStat2==KErrNone);
-	test(reqStat3==KErrNone);
-	test(reqStat4==KRequestPending);
+	test_KErrNone(reqStat.Int());
+	test_KErrNone(reqStat2.Int());
+	test_KErrNone(reqStat3.Int());
+	test_Value(reqStat4.Int(), reqStat4==KRequestPending);
 	fs.NotifyChangeCancel(reqStat4);
 	User::WaitForRequest(reqStat4);
-	test(reqStat4==KErrCancel);
+	test_Value(reqStat4.Int(), reqStat4==KErrCancel);
 
 	fs.Close();
 	}
@@ -3998,12 +3994,12 @@
 
 	// ask the user to eject the media
 	TheFs.NotifyChange(ENotifyEntry,reqStat);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	test.Printf(_L("Please eject media on drive %C...\n"), 'A' + driveNum);
 	User::WaitForRequest(reqStat);
 	test.Printf(_L("Done.\n"));
 	TInt reqInt=reqStat.Int();
-	test(reqInt==KErrNone);
+	test_KErrNone(reqInt);
 	User::WaitForRequest(reqStat);
 
 	// verify TDriveInfo.iType == EMediaNotPresent
@@ -4015,12 +4011,12 @@
 
 	// ask the user to re-insert the media
 	TheFs.NotifyChange(ENotifyEntry,reqStat);
-	test(reqStat==KRequestPending);
+	test_Value(reqStat.Int(), reqStat==KRequestPending);
 	test.Printf(_L("Please re-insert media...\n"));
 	User::WaitForRequest(reqStat);
 	test.Printf(_L("Done.\n"));
 	reqInt = reqStat.Int();
-	test(reqInt==KErrNone);
+	test_KErrNone(reqInt);
 	User::WaitForRequest(reqStat);
 
 	// verify TDriveInfo.iType == EMediaHardDisk
@@ -4063,8 +4059,8 @@
 	TBuf8<596> readBuf;
 	reader.Read(0, readBuf, 100, readStat1);
 	User::WaitForRequest(readStat1);
-	test(readStat1==KErrNone);
-	test(readBuf.Length()==0);
+	test_KErrNone(readStat1.Int());
+	test_Equal(0, readBuf.Length());
 	reader.Close();
 
 	test.Next(_L("Test asynchronous read fails in EFileShareExclusive mode"));
@@ -4079,19 +4075,19 @@
 	r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
 	test_KErrNone(r);
 	reader.Read(0, readBuf, 100, readStat1);
-	test(readStat1==KRequestPending);
+	test_Value(readStat1.Int(), readStat1==KRequestPending);
 	reader.Close();
 	User::WaitForRequest(readStat1);
-	test(readStat1==KErrCancel);
+	test_Value(readStat1.Int(), readStat1==KErrCancel);
 
 	test.Next(_L("Test asynchronous read can be cancelled"));
 	r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny);
 	test_KErrNone(r);
 	reader.Read(0, readBuf, 100, readStat1);
-	test(readStat1==KRequestPending);
+	test_Value(readStat1.Int(), readStat1==KRequestPending);
 	reader.ReadCancel(readStat1);
 	User::WaitForRequest(readStat1);
-	test(readStat1==KErrCancel);
+	test_Value(readStat1.Int(), readStat1==KErrCancel);
 	reader.Close();
 
 	// DEF105438: File server thread safety issues
@@ -4103,11 +4099,11 @@
 	RThread	thisThread;
 	thisThread.SetPriority(EPriorityRealTime);
 	reader.Read(0, readBuf, 100, readStat1);
-	test(readStat1==KRequestPending);
+	test_Value(readStat1.Int(), readStat1==KRequestPending);
 	reader.ReadCancel(readStat1);
 	test.Printf(_L("readStat1 %d"), readStat1.Int());
 	User::WaitForRequest(readStat1);
-	test(readStat1==KErrCancel);
+	test_Value(readStat1.Int(), readStat1==KErrCancel);
 	reader.Close();
 	thisThread.SetPriority(EPriorityNormal);
 
@@ -4115,12 +4111,12 @@
 	r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny);
 	test_KErrNone(r);
 	reader.Read(0, readBuf, 100, readStat1);
-	test(readStat1==KRequestPending);
+	test_Value(readStat1.Int(), readStat1==KRequestPending);
 	r = reader.SetSize(100);
 	test_KErrNone(r);
 	User::WaitForRequest(readStat1);
-	test(readStat1==KErrNone);
-	test(readBuf.Length() == 100);
+	test_KErrNone(readStat1.Int());
+	test_Equal(100, readBuf.Length());
 	r=reader.SetSize(0);
 	test_KErrNone(r);
 	reader.Close();
@@ -4129,13 +4125,13 @@
 	r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny);
 	test_KErrNone(r);
 	reader.Read(0, readBuf, 26, readStat1);
-	test(readStat1==KRequestPending);
+	test_Value(readStat1.Int(), readStat1==KRequestPending);
 	RFile writer;
 	r=writer.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileWrite|EFileShareAny);
 	writer.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
 	User::WaitForRequest(readStat1);
-	test(readStat1==KErrNone);
-	test(readBuf.Length() == 26);
+	test_KErrNone(readStat1.Int());
+	test_Equal(26, readBuf.Length());
 	reader.Close();
 	writer.Close();
 
@@ -4150,8 +4146,8 @@
 	TBuf8<596> readBuf2;
 	test.Printf(_L(">Read%d[%d]\n"), 1, KReadLen);
 	reader.Read(KReadLen, readBuf2, KReadLen, readStat2);
-	test(readStat1==KRequestPending);
-	test(readStat2==KRequestPending);
+	test_Value(readStat1.Int(), readStat1==KRequestPending);
+	test_Value(readStat2.Int(), readStat2==KRequestPending);
 
 	RThread thread;
 	r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest12);
@@ -4164,7 +4160,7 @@
 	TRequestStatus timerStat(KRequestPending);
 	timer.CreateLocal();
 	timer.After(timerStat, 30000000);	// 30 seconds timeout (the following async test should take 10 seconds)
-	test(timerStat==KRequestPending);
+	test_Value(timerStat.Int(), timerStat==KRequestPending);
 
 	#define ODDPASS  (pass&0x01)
 	#define REQSTAT  (ODDPASS ? readStat2 : readStat1)
@@ -4178,13 +4174,13 @@
 	FOREVER
 		{
         User::WaitForRequest(REQSTAT, timerStat);
-		test(REQSTAT==KErrNone);
-		test(timerStat==KRequestPending);
-		test(READBUF.Length() == COMPLEN);
+		test_KErrNone(REQSTAT.Int());
+		test_Value(timerStat.Int(), timerStat==KRequestPending);
+		test_Equal(COMPLEN, READBUF.Length());
 		test(READBUF.Right(KReadLen) == _L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
 		test.Printf(_L(">Read%d[%d]\n"), pass&0x01, READLEN);
 		reader.Read(READPOS, READBUF, READLEN, REQSTAT);
-		test(REQSTAT==KRequestPending);
+		test_Value(REQSTAT.Int(), REQSTAT==KRequestPending);
 		if(++pass==10)
 			break;
 		}
@@ -4194,12 +4190,12 @@
 	User::WaitForRequest(timerStat);
 	reader.Close();
 	User::WaitForRequest(readStat1);
-	test(readStat1==KErrCancel);
+	test_Value(readStat1.Int(), readStat1==KErrCancel);
 	User::WaitForRequest(readStat2);
-	test(readStat2==KErrCancel);
+	test_Value(readStat2.Int(), readStat2==KErrCancel);
 
 	User::WaitForRequest(thrdStat);
-	test(thrdStat==KErrNone);
+	test_KErrNone(thrdStat.Int());
 	}
 
 
@@ -4219,7 +4215,7 @@
 
     //-- set up notifier
     TheFs.NotifyChange(ENotifyAll, reqStatNotify1, KTestPath);
-    test(reqStatNotify1.Int() == KRequestPending);
+    test_Value(reqStatNotify1.Int(), reqStatNotify1 == KRequestPending);
 
     //-- create a file in the root dir
     RFile       file;
@@ -4233,7 +4229,7 @@
 
     //-- check that the notifier worked
     User::WaitForRequest(reqStatNotify1);
-    test(reqStatNotify1.Int() == KErrNone);
+    test_KErrNone(reqStatNotify1.Int());
 
 }
 
@@ -4324,7 +4320,7 @@
 
 //	Test RFs::NotifyChange() extended notification
 	TInt uid;
-	test(HAL::Get(HAL::EMachineUid,uid)==KErrNone);
+	test_KErrNone(HAL::Get(HAL::EMachineUid,uid));
 	if(uid!=HAL::EMachineUid_Cogent && uid!=HAL::EMachineUid_IQ80310 &&
 				uid != HAL::EMachineUid_Integrator && uid!=HAL::EMachineUid_X86PC)
 		MediaChangeExtendedNotification();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/f32test/server/t_proxydrive1.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,169 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// f32test\ext\t_ext1.cpp
+// 
+//
+
+#include <f32file.h>
+#include <e32test.h>
+#include <e32svr.h>
+#include "t_server.h"
+#include "f32_test_utils.h"
+
+using namespace F32_Test_Utils;
+
+
+GLDEF_D RTest test(_L("T_PROXYDRIVE1"));
+
+
+TInt GetRemovableDrive(TInt aDriveNumber)
+	{
+	RLocalDrive d;
+	TBool flag=EFalse;
+
+	//Find the local drive number corresponding to aDriveNumber
+	TMediaSerialNumber serialNum;
+	TInt r = TheFs.GetMediaSerialNumber(serialNum, aDriveNumber);
+	if(r!= KErrNone)
+		return r;
+
+	TInt len = serialNum.Length();
+	test.Printf(_L("Serial number (len %d) :\n"), len);
+
+	for (TInt n=0; n<KMaxLocalDrives; n++)
+		{
+		r = d.Connect(n, flag);
+		if(r != KErrNone)
+			{
+			test.Printf(_L("drive %d: TBusLocalDrive::Connect() failed %d\n"), n, r);
+			continue;
+			}
+
+	    TLocalDriveCapsV5Buf capsBuf;
+	    TLocalDriveCapsV5& caps = capsBuf();
+		r = d.Caps(capsBuf);
+		if(r != KErrNone)
+			{
+			test.Printf(_L("drive %d: TBusLocalDrive::Caps() failed %d\n"), n, r);
+			continue;
+			}
+
+		if ((caps.iDriveAtt & KDriveAttRemovable) == 0)
+			{
+			continue;
+			}
+
+		TPtrC8 localSerialNum(caps.iSerialNum, caps.iSerialNumLength);
+		if (serialNum.Compare(localSerialNum) == 0)
+			{
+			d.Close();
+			test.Printf(_L("found removable drive: local drive number %d\n"), n);
+			return n;
+			}
+
+		d.Close();
+		}
+
+	return KErrNotFound;
+	}
+
+
+
+
+GLDEF_C void CallTestsL()
+	{
+    TInt drive;
+	TInt err=RFs::CharToDrive(gDriveToTest,drive);
+	test.Start(_L("Starting Test - T_PROXYDRIVE1"));
+	test(err==KErrNone);
+
+    PrintDrvInfo(TheFs, drive);
+
+
+	_LIT(KBitProxyDriveName, "t_bitproxydrive.pxy");
+	_LIT(KBitProxyDrive, "bitproxydrive");
+
+	TInt r;
+
+	TInt localDriveNumber = GetRemovableDrive(drive);
+	if (localDriveNumber < 0)
+		{
+		test.Printf(_L("Not a removable drive, skipping test\n"));
+		return;
+		}
+
+
+	test.Next(_L("Adding and then removing a proxy drive with an open subsession"));
+	r = TheFs.AddProxyDrive(KBitProxyDriveName);
+	test.Printf(_L("AddProxyDrive(%S) r %d\n"), &KBitProxyDriveName, r);
+	test(r == KErrNone || r == KErrAlreadyExists);
+
+	TPckgBuf<TInt> p1; p1() = localDriveNumber;
+	TBuf<1> p2;
+	TInt driveNumber = EDriveM;
+
+	r = TheFs.MountProxyDrive(driveNumber, KBitProxyDrive, &p1, &p2);
+	test.Printf(_L("MountProxyDrive(%d, %S) r %d\n"), driveNumber, &KBitProxyDrive, r);
+	test (r >= 0);
+
+	_LIT(KFileSystem, "FAT");
+	r = TheFs.MountFileSystem(KFileSystem, driveNumber);
+	test.Printf(_L("MountFileSystem(%S) r %d\n"), &KFileSystem, r);
+	test(r == KErrNone);
+
+
+	RFs fs;
+	r = fs.Connect();
+	test(r == KErrNone);
+
+
+	TPath dirPath = _L("?:\\*");
+	dirPath[0] = (TUint8) ('A' + driveNumber);
+	RDir dir;
+	r = dir.Open(fs, dirPath, KEntryAttNormal);
+	test.Printf(_L("RDir::Open(%S) r %d\n"), &dirPath, r);
+
+
+	r = TheFs.DismountFileSystem(KFileSystem, driveNumber);
+	test.Printf(_L("DismountFileSystem(%S) r %d\n"), &KFileSystem, r);
+	test (r == KErrInUse);
+
+	// dismount failed - attempt a forced dismount
+	TRequestStatus stat;
+	TheFs.NotifyDismount(driveNumber, stat, EFsDismountForceDismount);
+	User::WaitForRequest(stat);
+	r = stat.Int();
+	test.Printf(_L("DismountFileSystem(%S, EFsDismountForceDismount) r %d\n"), &KFileSystem, r);
+	test (r == KErrNone);
+
+	r = TheFs.DismountProxyDrive(driveNumber);
+	test.Printf(_L("DismountProxyDrive(%d) r %d\n"), driveNumber, r);
+	test (r == KErrNone);
+
+	test.Printf(_L("Calling RemoveProxyDrive()...\n"));
+	r = TheFs.RemoveProxyDrive(KBitProxyDrive);
+	test.Printf(_L("RemoveProxyDrive() r %d\n"), r);
+	test (r == KErrNone);
+	User::After(1000000);
+
+	test.Printf(_L("closing dir (%S)....\n"), &dirPath, r);
+	dir.Close();
+
+	test.Printf(_L("closing file session()....\n"));
+	fs.Close();
+
+
+	test.End();
+	test.Close();
+	}
--- a/kerneltest/f32test/smassstorage/scripts/usbinterop1.pl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/smassstorage/scripts/usbinterop1.pl	Thu Jul 22 16:46:39 2010 +0100
@@ -2,7 +2,7 @@
 # Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
+# under the terms of the License "Eclipse Public License v1.0"
 # which accompanies this distribution, and is available
 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
 #
@@ -279,8 +279,4 @@
  TestExpectedResults:  
 	Read data from files should match with written.
 
-=head1 COPYRIGHT
-
-Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
-
 =cut
--- a/kerneltest/f32test/smassstorage/scripts/usbinterop2.pl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/smassstorage/scripts/usbinterop2.pl	Thu Jul 22 16:46:39 2010 +0100
@@ -2,7 +2,7 @@
 # Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
+# under the terms of the License "Eclipse Public License v1.0"
 # which accompanies this distribution, and is available
 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
 #
@@ -163,8 +163,4 @@
  with written.  Sum of file size and free space should be close to
  drive size.
 
-=head1 COPYRIGHT
-
-Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
-
 =cut
--- a/kerneltest/f32test/smassstorage/scripts/usbperformance.pl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/smassstorage/scripts/usbperformance.pl	Thu Jul 22 16:46:39 2010 +0100
@@ -2,7 +2,7 @@
 # Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
+# under the terms of the License "Eclipse Public License v1.0"
 # which accompanies this distribution, and is available
 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
 #
@@ -174,8 +174,4 @@
 free space for the file that is going to be created. The default size is 400
 MB.
 
-=head1 COPYRIGHT
-
- Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
-
 =cut
--- a/kerneltest/f32test/smassstorage/scripts/usbperformance_multifile.pl	Wed Jul 21 14:46:58 2010 +0100
+++ b/kerneltest/f32test/smassstorage/scripts/usbperformance_multifile.pl	Thu Jul 22 16:46:39 2010 +0100
@@ -2,7 +2,7 @@
 # Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
+# under the terms of the License "Eclipse Public License v1.0"
 # which accompanies this distribution, and is available
 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
 #
@@ -186,8 +186,4 @@
 free space for the file that is going to be created. The default size is 400
 MB.
 
-=head1 COPYRIGHT
-
-Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
-
 =cut
--- a/package_definition.xml	Wed Jul 21 14:46:58 2010 +0100
+++ b/package_definition.xml	Thu Jul 22 16:46:39 2010 +0100
@@ -144,7 +144,7 @@
       <component id="kernelhwsrv_metadata" name="Kernel and Hardware Services Metadata" class="config" introduced="^2" purpose="development" target="desktop">
         <unit mrp="kernelhwsrv_info/kernelhwsrv_metadata/kernelhwsrv_metadata.mrp"/>
       </component>
-      <component id="kernelhwsrv_metadata" name="Kernel and Hardware Services Public Documentation" class="doc" introduced="^3" purpose="development">
+      <component id="kernelhwsrv_docpub" name="Kernel and Hardware Services Public Documentation" class="doc" introduced="^3" purpose="development">
         <unit mrp="kernelhwsrv_info/doc_pub/kernelhwsrv_doc_pub.mrp"/>
       </component>
     </collection>
--- a/userlibandfileserver/domainmgr/group/base_domain.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/domainmgr/group/base_domain.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Domain Manager"
 
 component	base_domain
--- a/userlibandfileserver/fileserver/automounter/base_f32_automounter.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/automounter/base_f32_automounter.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,19 +1,4 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
-# component name "exFAT File System"
+# component name "Automounter File System"
 
 component   base_f32_automounter
 
--- a/userlibandfileserver/fileserver/bmarm/efileu.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/bmarm/efileu.def	Thu Jul 22 16:46:39 2010 +0100
@@ -241,4 +241,4 @@
 	GetDriveInfo__FR10TDriveInfoi @ 240 NONAME R3UNUSED ; GetDriveInfo(TDriveInfo &, int)
 	Volume__C9RFsPluginR11TVolumeInfoi @ 241 NONAME R3UNUSED ; RFsPlugin::Volume(TVolumeInfo &, int) const
 	IsSequentialMode__C7CFileCB @ 242 NONAME R3UNUSED ; CFileCB::IsSequentialMode(void) const
-
+	DirectIOMode__7CFileCBRC12RMessagePtr2 @ 243 NONAME R3UNUSED ; CFileCB::DirectIOMode(RMessagePtr2 const &)
--- a/userlibandfileserver/fileserver/bwins/efileu.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/bwins/efileu.def	Thu Jul 22 16:46:39 2010 +0100
@@ -242,4 +242,4 @@
 	?GetDriveInfo@@YAXAAVTDriveInfo@@H@Z @ 241 NONAME ; void GetDriveInfo(class TDriveInfo &, int)
 	?Volume@RFsPlugin@@QBEHAAVTVolumeInfo@@H@Z @ 242 NONAME ; int RFsPlugin::Volume(class TVolumeInfo &, int) const
 	?IsSequentialMode@CFileCB@@QBEHXZ @ 243 NONAME ; int CFileCB::IsSequentialMode(void) const
-
+	?DirectIOMode@CFileCB@@QAEHABVRMessagePtr2@@@Z @ 244 NONAME ; int CFileCB::DirectIOMode(class RMessagePtr2 const &)
--- a/userlibandfileserver/fileserver/bx86/efileu.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/bx86/efileu.def	Thu Jul 22 16:46:39 2010 +0100
@@ -242,4 +242,5 @@
 	?GetDriveInfo@@YAXAAVTDriveInfo@@H@Z @ 241 NONAME ; void __cdecl GetDriveInfo(class TDriveInfo &,int)
 	?Volume@RFsPlugin@@QBEHAAVTVolumeInfo@@H@Z @ 242 NONAME ; public: int __thiscall RFsPlugin::Volume(class TVolumeInfo &,int)const 
 	?IsSequentialMode@CFileCB@@QBEHXZ @ 243 NONAME ; public: int __thiscall CFileCB::IsSequentialMode(void)const 
+	?DirectIOMode@CFileCB@@QAEHABVRMessagePtr2@@@Z @ 244 NONAME ; int CFileCB::DirectIOMode(class RMessagePtr2 const &)
 
--- a/userlibandfileserver/fileserver/eabi/efileu.def	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/eabi/efileu.def	Thu Jul 22 16:46:39 2010 +0100
@@ -314,4 +314,5 @@
 	_ZNK11CFileSystem9DriveInfoER10TDriveInfoi @ 313 NONAME
 	_ZNK9RFsPlugin6VolumeER11TVolumeInfoi @ 314 NONAME
 	_ZNK7CFileCB16IsSequentialModeEv @ 315 NONAME
+	_ZN7CFileCB12DirectIOModeERK12RMessagePtr2 @ 316 NONAME
 
--- a/userlibandfileserver/fileserver/estart/base_f32_estart.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/estart/base_f32_estart.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "EStart"
 
 component	base_f32_estart
--- a/userlibandfileserver/fileserver/etshell/base_f32_eshell.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/etshell/base_f32_eshell.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Text Shell"
 
 component	base_f32_eshell
--- a/userlibandfileserver/fileserver/etshell/ts_com.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/etshell/ts_com.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1996-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -31,9 +31,13 @@
 #include <nkern/nk_trace.h>
 #include "filesystem_fat.h"
 
+_LIT(KCrNl, "\r\n");
+_LIT(KNl, "\n");
+
     TPtrC ptrFormatHelp=_L("Drive:[\\] [fat12|fat16|fat32] [spc:X] [rs:Y] [ft:Z] [/Q][/S][/E][/F]\nfat12 or fat16 or fat32 specifies explicit FAT type\nspc:X specifies \"X\" sectors per cluster\nrs:Y specifies \"Y\" reserved sectors\nft:Z specifies \"Z\" FAT tables (1 or 2)\n\n/q - QuickFormat, /s - SpecialFormat, /e - ForcedErase\n/f - force formatting (ignore volume being in use)");
-    TPtrC ptrMountHelp=_L("Drive:[\\]  <fsy:X> <fs:Y> [pext:Z] [/S][/U][/F][/R]\n'X' *.fsy module name, like elocal.fsy\n'Y' file system name, like 'FAT'\n'Z' optional primary extension module name\n/U - dismount FS from the drive e.g 'mount d: /u' \n/F - force mounting with dismounting existing FS \n/S - mount drive as synchronous\n/R - remount the file system ");
-
+TPtrC ptrMountHelp=_L("Drive:[\\]  <fsy:X> <fs:Y> [pext:Z] [/S][/U][/F][/R]\n'X' *.fsy module name, like elocal.fsy\n'Y' file system name, like 'FAT'\n'Z' optional primary extension module name\n/U - dismount FS from the drive e.g 'mount d: /u' \n/U /F force dismounting the FS even if there are opened files on it \n/F - force mounting with dismounting existing FS \n/S - mount drive as synchronous\n/R - remount the file system ");
+
+TBool CShell::iDbgPrint = EFalse;
 
 //	lint -e40,e30
 const TShellCommand CShell::iCommand[ENoShellCommands]=
@@ -71,7 +75,7 @@
     TShellCommand(_L("DRVINFO"),_L("Print information about present drive(s) in the system"),_L("[DriveLetter:[\\]] [/p]\n/p - pause after each drive"),TShellCommand::EPSwitch,ShellFunction::DrvInfo),
 	TShellCommand(_L("SYSINFO"),_L("Print information about system features and status"),_L(""),0,ShellFunction::SysInfo),
     TShellCommand(_L("MOUNT"),_L("Mount / dismount file system on specified drive"),ptrMountHelp,TShellCommand::EUSwitch|TShellCommand::ESSwitch|TShellCommand::EFSwitch|TShellCommand::ERSwitch,ShellFunction::MountFileSystem),
-    TShellCommand(_L("ECHO"),_L("Print out the command line to the console and standard debug port."),_L("[line to print out]"),0,ShellFunction::ConsoleEcho),
+    TShellCommand(_L("ECHO"),_L("Print out the command line to the console and standard debug port."),_L("[line to print out] [/Y/N]\n /Y turn ON copying console output to debug port\n /N turn it OFF "),TShellCommand::EYSwitch|TShellCommand::ENSwitch,ShellFunction::ConsoleEcho),
 	TShellCommand(_L("RUNEXEC"),_L("Run a program in a loop"),_L("count filename[.exe] [/E/S/R]\n	/E - exit early on error\n	/S - count in seconds\n	     zero - run forever\n	/R - reset debug regs after each run"),TShellCommand::EESwitch|TShellCommand::ESSwitch|TShellCommand::ERSwitch,ShellFunction::RunExec),
 
     };
@@ -256,7 +260,7 @@
 			aPath.Insert(0,TheShell->currentPath.Left(2));
 		}
 
-	RFile file;
+	RFile64 file;
 	r=file.Open(CShell::TheFs,aPath,EFileStream);
 	if (r!=KErrNone)	//		File could not be opened
 		{
@@ -363,6 +367,7 @@
 	    if (nRes<0)
 		    return(nRes);
 
+	    //-- this is, actually, FAT FS specific error codes. Other file systems can report different values.
 	    switch(nRes)
 		    {
 	    case 0:
@@ -978,7 +983,11 @@
         default:                    aPrintBuf.Append(_L("??? Unknown Type"));   break;
         };
 
-
+        if (aDrvInfo.iConnectionBusType)
+            {
+            aPrintBuf.Append(_L(" USB"));
+            }
+        
         aPrintBuf.Append(_L("\n"));
     }
 
@@ -1049,8 +1058,8 @@
 */
 void FormatVolInfo(const TVolumeInfo& volInfo , TDes& aPrintBuf)
     {
-   	aPrintBuf.Format(_L("VolSz:%ld Free:%ld\n"),volInfo.iSize, volInfo.iFree);
-   	aPrintBuf.AppendFormat(_L("VolId:0x%x VolName:%S\n"),volInfo.iUniqueID, &volInfo.iName);
+   	aPrintBuf.Format(_L("VolSz:%ld Free:%ld"),volInfo.iSize, volInfo.iFree);
+   	aPrintBuf.AppendFormat(_L("\r\nVolId:0x%x VolName:%S\n"),volInfo.iUniqueID, &volInfo.iName);
     }
 
 //--------------------------------------------------------
@@ -1079,7 +1088,7 @@
 
     @return standard error code
 */
-TInt PrintDrvInfo(RFs& aFs, TInt aDrvNum, CConsoleBase* apConsole, TUint aFlags = EAll)
+TInt PrintDrvInfo(RFs& aFs, TInt aDrvNum, TUint aFlags = EAll)
     {
 	TInt        nRes;
 	TDriveInfo 	driveInfo;
@@ -1090,7 +1099,7 @@
 	nRes = aFs.Drive(driveInfo, aDrvNum);
 	if(nRes != KErrNone)
 		{
-		CShell::TheConsole->Printf(_L("Error: %d\n"), nRes);
+        CShell::Printf(_L("Error: %d\n"), nRes);
 		return nRes;   //-- can't get information about the drive
 		}
 
@@ -1099,10 +1108,10 @@
     const TBool bVolumeOK  = (nRes == KErrNone);
 	if(!bVolumeOK)
 	{//-- can't get information about the volume. It might be just corrupt/unformatted
-		CShell::TheConsole->Printf(_L("Error getting volume info. code: %d\n"), nRes);
+        CShell::Printf(_L("Error getting volume info. code: %d\n"), nRes);
         if(nRes == KErrCorrupt)
         {
-            CShell::TheConsole->Printf(_L("The volume might be corrupted or not formatted.\n"));
+            CShell::Printf(_L("The volume might be corrupted or not formatted.\n"));
         }
 	}
 
@@ -1111,14 +1120,14 @@
 	if(aFlags & EFSInfo)
     {
         //-- print out drive properties
-        Buf.Format(_L("\nDrive %c: No:%d"), 'A'+aDrvNum, aDrvNum);
+        Buf.Format(_L("Drive %c: No:%d"), 'A'+aDrvNum, aDrvNum);
         
         //-- find out if the drive is synchronous / asynchronous
         TPckgBuf<TBool> drvSyncBuf;
         nRes = aFs.QueryVolumeInfoExt(aDrvNum, EIsDriveSync, drvSyncBuf);
         if(nRes == KErrNone)
         {
-            Buf.AppendFormat(_L(", Sync:%d"), drvSyncBuf() ? 1:0);        
+            Buf.AppendFormat(_L(" Sync:%d"), drvSyncBuf() ? 1:0);        
         }
 
         //-- find out if drive runs a rugged FS (debug mode only)
@@ -1128,12 +1137,12 @@
         nRes=aFs.ControlIo(aDrvNum, KControlIoIsRugged, pRugged);
         if(nRes == KErrNone)
         {
-            Buf.AppendFormat(_L(", Rugged:%d"), ruggedFS ? 1:0);        
+            Buf.AppendFormat(_L(" Rugged:%d"), ruggedFS ? 1:0);        
         }
 
-        Buf.Append(_L("\n"));
-        apConsole->Printf(Buf);
-
+        CShell::Printf(KNl);
+        Buf.Append(KNl);
+        CShell::Printf(Buf);
 
 	    //-- print the FS name
 	    if(aFs.FileSystemName(Buf, aDrvNum) == KErrNone)
@@ -1153,8 +1162,7 @@
                  Buf.AppendFormat(_L(" PExt:%S"), &fsName);
             }
 
-
-            apConsole->Printf(_L("Mounted FS:%S\n"), &Buf);
+            CShell::Printf(_L("Mounted FS:%S\n"), &Buf);
 
             //-- print out the list of supported file systems if there are more than 1
             nRes = aFs.SupportedFileSystemName(fsName, aDrvNum, 0+1); //-- try to get 2nd child name
@@ -1170,8 +1178,8 @@
                     Buf.AppendFormat(_L("%S, "), &fsName);
                 }
             
-                Buf.Append(_L("\n"));
-                apConsole->Printf(Buf);
+                Buf.Append(KNl);
+                CShell::Printf(Buf);
             }
 
 
@@ -1195,15 +1203,27 @@
                 //-- print out cluster size that FS reported
                 TVolumeIOParamInfo volIoInfo;
                 nRes = aFs.VolumeIOParam(aDrvNum, volIoInfo);
-                if(nRes == KErrNone && volIoInfo.iClusterSize >= 512)
+                if(nRes == KErrNone)
                 {
-                    Buf.AppendFormat(_L(", Cluster Sz:%d"), volIoInfo.iClusterSize);
+                    if(volIoInfo.iBlockSize >= 0)
+                    {
+                        Buf.AppendFormat(_L("BlkSz:%d "), volIoInfo.iBlockSize);
+                    }
+                    
+                    if(volIoInfo.iClusterSize >= 0)
+                    {
+                        Buf.AppendFormat(_L("ClSz:%d "), volIoInfo.iClusterSize);
+                    }
+
+                    Buf.AppendFormat(_L("CacheFlags:0x%x "), volInfo.iFileCacheFlags);
+                
                 }
 
+
                 if(Buf.Length())
                 {
-                    Buf.Append(_L("\n"));
-                    apConsole->Printf(Buf);    
+                    Buf.Append(KNl);
+                    CShell::Printf(Buf);
                 }
 
             }
@@ -1214,22 +1234,21 @@
 	if(aFlags & EMediaTypeInfo)
     {
         FormatDrvMediaTypeInfo(driveInfo, Buf);
-	    apConsole->Printf(Buf);
-
+        CShell::Printf(Buf);
 	}
     
     //-- print drive attributes
 	if(aFlags & EDrvAttInfo)
     {
         FormatDriveAttInfo(driveInfo, Buf);
-	    apConsole->Printf(Buf);
+        CShell::Printf(Buf);
     }
 
     //-- print media attributes
 	if(aFlags & EMediaAttInfo)
     {
 	    FormatMediaAttInfo(driveInfo, Buf);
-	    apConsole->Printf(Buf);
+        CShell::Printf(Buf);
     }
 
 
@@ -1237,7 +1256,7 @@
 	if(bVolumeOK && (aFlags & EVolInfo))
     {
 	    FormatVolInfo(volInfo, Buf);
-	    apConsole->Printf(Buf);
+        CShell::Printf(Buf);
     }
 	
     return KErrNone;
@@ -1308,7 +1327,7 @@
 		nDrv = DoExtractDriveLetter(aArgs);
         if(nDrv < 0)
             {
-            CShell::TheConsole->Printf(_L("Invalid drive specifier!\n"));    
+            CShell::Printf(_L("Invalid drive specification\n"));    
             return KErrNone;
             }
 		}
@@ -1320,7 +1339,7 @@
 	nRes=TheShell->TheFs.DriveList(driveList);
 	if(nRes != KErrNone)
 		{
-		CShell::TheConsole->Printf(_L("\nError: %d"), nRes);
+        CShell::Printf(_L("\nError: %d"), nRes);
 		return nRes;
 		}
 
@@ -1328,11 +1347,11 @@
 		{//-- the drive is specified
 		if(!driveList[nDrv])
 			{
-			CShell::TheConsole->Printf(_L("Invalid drive specification\n"));
+            CShell::Printf(_L("Invalid drive specification\n"));
 			return KErrNone;
 			}
 
-		PrintDrvInfo(TheShell->TheFs, nDrv, CShell::TheConsole);
+		PrintDrvInfo(TheShell->TheFs, nDrv);
 		}
 	else
 		{//-- print information about all drives in the system
@@ -1341,11 +1360,11 @@
 			if(!driveList[nDrv])
 				continue;   //-- skip unexisting drive
 
-			PrintDrvInfo(TheShell->TheFs, nDrv, CShell::TheConsole);
+			PrintDrvInfo(TheShell->TheFs, nDrv);
 
 			if(aSwitches & TShellCommand::EPSwitch)
 				{//-- /p switch, pause after each drive
-				CShell::TheConsole->Printf(_L("\n--- press any key to continue or Esc to exit ---\n"));
+                CShell::Printf(_L("\n--- press any key to continue or Esc to exit ---\n"));
 
 				TKeyCode key = CShell::TheConsole->Getch();
 				if (key==EKeyEscape)
@@ -1353,7 +1372,9 @@
 				}
 			else
 				{
-				CShell::TheConsole->Printf(_L("\n----------\n"));
+				CShell::Printf(_L("\n----------\n"));
+                CShell::Printf(_L("\n--- press any key to continue or Esc to exit ---\n"));
+
 				}
 		}
 	}
@@ -1402,7 +1423,7 @@
 
 
 //-----------------------------------------------------------------------------------------------------------------------
-TInt DoDismountFS(RFs& aFs, TInt aDrvNum)
+TInt DoDismountFS(RFs& aFs, TInt aDrvNum, TBool aForceDismount)
 {
     TInt        nRes;
     TBuf<40>    fsName;
@@ -1412,6 +1433,8 @@
     if(nRes != KErrNone)
         return KErrNotFound;//-- nothing to dismount
         
+    if(!aForceDismount)    
+    {//-- gaceful attempt to dismount the FS
     nRes = aFs.DismountFileSystem(fsName, aDrvNum);
     if(nRes != KErrNone)
     {
@@ -1424,6 +1447,17 @@
     return KErrNone;
     }
 }
+    else
+    {//-- dismount by force
+        TRequestStatus rqStat;
+        aFs.NotifyDismount(aDrvNum, rqStat, EFsDismountForceDismount);  
+        User::WaitForRequest(rqStat);
+        
+        CShell::TheConsole->Printf(_L("'%S' filesystem Forcedly dismounted from drive %c:\n"), &fsName, 'A'+aDrvNum);
+
+        return rqStat.Int(); 
+    }
+}
 
 //-----------------------------------------------------------------------------------------------------------------------
 TInt DoRemountFS(RFs& aFs, TInt aDrvNum)
@@ -1467,7 +1501,7 @@
     }
 
     //-- 4. dismount the file system
-    nRes = DoDismountFS(aFs, aDrvNum);
+    nRes = DoDismountFS(aFs, aDrvNum, EFalse);
     if(nRes != KErrNone)
         return nRes;
 
@@ -1499,16 +1533,27 @@
 /**
     Mount or dismount the file system on the specified drive.
 
-    MOUNT <DriveLetter:[\]> <FSY:xxx> <FS:yyy> [PEXT:zzz] [/S] [/U]
+    MOUNT <DriveLetter:[\]> <FSY:xxx> <FS:yyy> [PEXT:zzz] [/S] [/U] [/F]
   
     xxx is the *.fsy file system plugin name, like "elocal.fsy" or "elocal"
     yyy is the file system name that the fsy module exports, like "FAT"
     zzz is the optional parameter that specifies primary extension name
 
     /u dismounts a filesystem on the specified drive; e.g. "mount d: /u"
-    /s for mounting FS specifies that the drive will be mounted as synchronous one.
-    /f for forcing mounting the FS; the previous one will be automatically dismounted
-    /r remount existing FS (dismount and mount it back)
+        additional switch /f in conjunction with /u will perform "forced unmounting" i.e. unmounting the FS 
+        even it has opened files and / or directories. E.g. "mount d: /u /f"
+
+    
+    /s for mounting FS specifies that the drive will be mounted as a synchronous one.
+        
+
+    /f for forcing mounting the FS; the previous one will be automatically dismounted. 
+        example: "mount d: /f fsy:exfat fs:exfat" this command will dismount whatever FS ic currently mounted and 
+        mount exFAT FS instead
+
+
+    
+    /r remount existing FS (dismount and mount it back); example: "mount d: /r"
 */
 TInt ShellFunction::MountFileSystem(TDes& aArgs, TUint aSwitches)
 {
@@ -1543,10 +1588,10 @@
         return nRes;
     }
     
-    //-- check if we dismounting the FS (/U switch)
+    //-- check if we dismounting the FS (/U switch).
     if(aSwitches & TShellCommand::EUSwitch)
-    {
-        nRes = DoDismountFS(fs, drvNum);
+    {//-- also take nto account "/f" switch for forced dismounting
+        nRes = DoDismountFS(fs, drvNum, (aSwitches & TShellCommand::EFSwitch));
         
         if(nRes == KErrNotFound)
         {//-- nothing to dismount
@@ -1560,7 +1605,7 @@
     //-- check if we need to forcedly dismount the existing FS (/F switch)
     if(aSwitches & TShellCommand::EFSwitch)
     {
-        nRes = DoDismountFS(fs, drvNum);
+        nRes = DoDismountFS(fs, drvNum, EFalse);
         
         if(nRes != KErrNotFound && nRes !=KErrNone)
             return nRes;
@@ -1646,7 +1691,7 @@
     }
 
 
-    PrintDrvInfo(fs, drvNum, CShell::TheConsole, EFSInfo | EVolInfo);
+    PrintDrvInfo(fs, drvNum, EFSInfo | EVolInfo);
 
     return KErrNone;
 }
@@ -1968,7 +2013,7 @@
 	ShellFunction::StripQuotes(aPath);
 
 	ParsePath(aPath);
-	RFile file;
+	RFile64 file;
 	TInt r=file.Open(TheShell->TheFs,aPath,EFileStream);
 	if (r!=KErrNone)
 		return(r);
@@ -3104,7 +3149,7 @@
 TInt ShellFunction::Type(TDes& aPath,TUint aSwitches)
 	{
 	ParsePath(aPath);
-	RFile file;
+	RFile64 file;
 	TInt r=file.Open(TheShell->TheFs,aPath,EFileStreamText|EFileShareReadersOnly);
 	if (r!=KErrNone)
 		return r;
@@ -3588,7 +3633,34 @@
 	return err;
 	}
 
-_LIT(KCrNl, "\r\n");
+
+
+//----------------------------------------------------------------------
+void CShell::Printf(TRefByValue<const TDesC16> aFmt, ...)
+{
+	TBuf<256> buf;
+	VA_LIST list;					
+	VA_START(list, aFmt);
+	// coverity[uninit_use_in_call]
+	buf.FormatList(aFmt, list);			
+
+    if(!buf.Length())
+        return;
+
+    TheConsole->Printf(buf);
+
+    if(iDbgPrint)
+    {
+        const TInt bufLen = buf.Length();
+        if(buf[bufLen-1] == '\n')
+        {
+            buf.Insert(bufLen-1, _L("\r"));
+        }
+    
+        RDebug::RawPrint(buf);
+    }
+
+}
 
 void SIPrintf(TRefByValue<const TDesC16> aFmt, ...)
 	{
@@ -3763,9 +3835,29 @@
 //-------------------------------------------------------------------------
 /**
     Print out the command line to the console and standard debug port.
+
+    echo [some text] [/y] [/n]
+
+		/Y : switches ON copying console output to the debug port
+		/N : switches OFF copying console output to the debug port
+
 */
-TInt ShellFunction::ConsoleEcho(TDes& aArgs, TUint /*aSwitches*/)
+TInt ShellFunction::ConsoleEcho(TDes& aArgs, TUint aSwitches)
 {
+    if(aSwitches & TShellCommand::EYSwitch)
+    {
+        CShell::SetDbgConsoleEcho(ETrue);
+    }
+    else
+    if(aSwitches & TShellCommand::ENSwitch)
+    {
+        CShell::SetDbgConsoleEcho(EFalse);
+    }
+
+    if(aArgs.Length())
     SIPrintf(aArgs);
+    
     return KErrNone;
 }
+
+
--- a/userlibandfileserver/fileserver/etshell/ts_std.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/etshell/ts_std.h	Thu Jul 22 16:46:39 2010 +0100
@@ -146,6 +146,10 @@
 	static TKeyCode OutputStringToConsole(TBool aPageSwitch,TRefByValue<const TDesC> aFmt,...);
 	static TKeyCode OutputStringToConsole(TBool aPageSwitch, const TDesC& aBuf);
 	static TKeyCode OutputStringToConsole(const TDesC& aNotification,TBool aPageSwitch,TRefByValue<const TDesC> aFmt,...);
+
+    static void Printf(TRefByValue<const TDesC16> aFmt, ...);
+    static void SetDbgConsoleEcho(TBool aOn) {iDbgPrint = aOn;}
+
 public:
 	static CConsoleBase* TheConsole;
 	static CFileMan* TheFileMan;
@@ -166,6 +170,7 @@
 	static TInt RunBatch(TDes& aCommand);
 	static TInt RunExecutable(TDes& aCommand,TBool aWaitForCompletion);
 	static TKeyCode PageSwitchDisplay(const TDesC& aBuf);
+
 private:
 	static TBuf<KMaxFileName> currentPath;
 	static TBuf<KMaxFileName> drivePaths[KMaxDrives];
@@ -174,6 +179,9 @@
 	static CLineEdit* TheEditor;
 	friend class ShellFunction;
 	friend class CDllChecker;
+	
+    static TBool iDbgPrint; ///< if ETrue, the output from CShell::Printf is copied to the debug port
+    
 	};
 
 
--- a/userlibandfileserver/fileserver/ftrace/d_ftrace.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-// D_FTRACE.CPP
-//
-//
-//
-#include "plat_priv.h"
-#include <kernel/kernel.h>
-
-#include "f32trace.h"
-
-DMutex* TheTraceMutex = NULL;
-_LIT(KLitTraceMutexName, "FTRACE_MUTEX");
-
-const TInt KMajorVersionNumber=1;
-const TInt KMinorVersionNumber=0;
-const TInt KBuildVersionNumber=0;
-
-
-class DLddFactoryFTrace : public DLogicalDevice
-	{
-public:
-	DLddFactoryFTrace();
-	virtual ~DLddFactoryFTrace();
-	virtual TInt Install();
-	virtual void GetCaps(TDes8 &aDes) const;
-	virtual TInt Create(DLogicalChannelBase*& aChannel); 	//overriding pure virtual
-	};
-
-class DLddFTrace : public DLogicalChannelBase
-	{
-public:
-	DLddFTrace();
-	~DLddFTrace();
-protected:
-	virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
-
-	virtual TInt Request(TInt aReqNo, TAny* a1, TAny* a2);
-
-private:
-	void DoCancel(TInt aReqNo);
-	TInt DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2);
-	TInt DoControl(TInt aFunction, TAny* a1, TAny* a2);
-
-private:
-    };
-
-DECLARE_STANDARD_LDD()
-	{
-	TInt r = Kern::MutexCreate(TheTraceMutex,  KLitTraceMutexName, KMutexOrdNone);
-	if (r != KErrNone)
-		return NULL;
-
-	return new DLddFactoryFTrace;
-	}
-
-DLddFactoryFTrace::DLddFactoryFTrace()
-	{
-
-    iParseMask=KDeviceAllowUnit;  // Pass stack number as unit
-	iUnitsMask=0xffffffff;
-	iVersion=TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);
-	}
-
-TInt DLddFactoryFTrace::Create(DLogicalChannelBase*& aChannel)
-	{
-	aChannel=new DLddFTrace;
-	return aChannel ? KErrNone : KErrNoMemory;
-	}
-
-TInt DLddFactoryFTrace::Install()
-	{
-    TPtrC name=_L("FTrace");
-	return(SetName(&name));
-	}
-
-void DLddFactoryFTrace::GetCaps(TDes8& /*aDes*/) const
-	{
-	}
-
-DLddFactoryFTrace::~DLddFactoryFTrace()
-	{
-	}
-
-DLddFTrace::DLddFTrace()
-	{
-    }
-
-DLddFTrace::~DLddFTrace()
-	{
-    }
-
-TInt DLddFTrace::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& aVer)
-	{
-
-	if (!Kern::QueryVersionSupported(TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber),aVer))
-		return(KErrNotSupported);
-
-    return(KErrNone);
-	}
-
-void DLddFTrace::DoCancel(TInt /*aReqNo*/)
-	{
-	}
-
-TInt DLddFTrace::Request(TInt aReqNo, TAny* a1, TAny* a2)
-	{
-	NKern::ThreadEnterCS();
-	Kern::MutexWait(*TheTraceMutex);
-	TInt r = DoControl(aReqNo, a1, a2);
-	Kern::MutexSignal(*TheTraceMutex);
-	NKern::ThreadLeaveCS();
-
-	return r;
-	}
-
-
-const TUint KTraceBufferSize = 4096;
-TUint8 gTraceBuffer[KTraceBufferSize];
-
-
-#define MIN(a,b)			((a) < (b) ? (a) : (b))
-
-TInt DLddFTrace::DoControl(TInt aFunction, TAny* a1, TAny* a2)
-//
-// Mostly requests (but some kernel server async ones)
-//
-	{
-	TInt r=KErrNotSupported;
-	switch (aFunction)
-		{
-        case RFTrace::ETraceMultiple:
-            {
-			typedef struct {
-				TClassification iCategory;
-				TUint8 iPadding1[sizeof(TUint) - sizeof(TClassification)];
-
-				TFormatId iFormatId;
-				TUint8 iPadding2[sizeof(TUint) - sizeof(TFormatId)];
-
-				TUint32 iUid;
-				TInt iDescriptorCount;
-				} TraceArgs;
-
-			TraceArgs args={0};
-
-			XTRAP(r, XT_DEFAULT, kumemget32(&args, a1, sizeof(args)));
-			if (r != KErrNone)
-				return r;
-
-			// current descriptor - MUST be either a TPtr8 or a TBuf8<4>
-			TUint32 desc[2] = {0, 0};
-			TUint32& desLength = desc[0];
-
-			TUint offset = 0;
-
-			*((TUint*) (gTraceBuffer+offset)) = args.iFormatId;
-			offset+= sizeof(TUint);
-
-			TDesC8* des = (TDesC8*) ((TUint8*) a2);
-			const TInt desSize = sizeof(TPtrC8);
-			for (TInt n=0; n< args.iDescriptorCount; n++, des = (TDesC8*) (((TUint8*) des) + desSize) )
-				{
-
-				XTRAP(r, XT_DEFAULT, kumemget32(desc, des, sizeof(desc)));
-				TUint32 desType = desLength >> KShiftDesType;
-				desLength &= (TUint) (KMaskDesLength);
-				if (desType == EPtrC)
-					{
-					*((TUint*) (gTraceBuffer+offset)) = desLength;
-					desLength = (desLength+3)&~3;
-					offset+= sizeof(TUint);
-					}
-				else if (desType == EBufC)
-					{
-					*((TUint*) (gTraceBuffer+offset)) = desc[1];
-					offset+= sizeof(TUint);
-					if (desLength > 4)
-						return KErrArgument;
-					desLength = 0;
-					continue;
-					}
-				else
-					return KErrArgument;
-
-				TUint len = MIN(KTraceBufferSize - offset, desLength);
-				XTRAP(r, XT_DEFAULT, kumemget(gTraceBuffer+offset, (const TUint8*) desc[1], len));
-				offset+= len;
-
-				}
-
-			BTrace::OutFilteredBig
-				(BTRACE_HEADER_C(8,args.iCategory, 0), args.iUid, gTraceBuffer, offset);
-
-			r=KErrNone;
-			break;
-            }
-		}
-	return(r);
-	}
-
--- a/userlibandfileserver/fileserver/ftrace/f32trace.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/ftrace/f32trace.h	Thu Jul 22 16:46:39 2010 +0100
@@ -22,20 +22,6 @@
 #if !defined(__FTRACE_H__)
 #define __FTRACE_H__
 
-#include <e32cmn.h>
-#include <e32btrace.h>
-
-
-#ifndef __KERNEL_MODE__
-	#include <e32std.h>
-#endif
-
-#include "f32tracedef.h"
-
-#if defined(__EABI__)
-#pragma diag_suppress 1446		// non-POD class type passed through ellipsis
-#endif
-
 /**
 @internalComponent
 @prototype
@@ -43,218 +29,41 @@
 
 #if ((defined (_DEBUG) && defined (SYMBIAN_FTRACE_ENABLE_UDEB)) ||		\
 	(!defined(_DEBUG) && defined (SYMBIAN_FTRACE_ENABLE_UREL)))
-	#define SYMBIAN_FTRACE_ENABLE
+	#include "OstTraceDefinitions.h"			// may or may not define OST_TRACE_COMPILER_IN_USE
+#else
+	#undef OST_TRACE_COMPILER_IN_USE
+	#undef OST_TRACE_CATEGORY
+	#define OST_TRACE_CATEGORY OST_TRACE_CATEGORY_NONE
+
+	#undef OstTrace0
+	#undef OstTrace1
+	#undef OstTraceData
+	#undef OstTraceExt1
+	#undef OstTraceExt2
+	#undef OstTraceExt3
+	#undef OstTraceExt4
+	#undef OstTraceExt5
+
+	#define OstTrace0( aGroupName, aTraceName, aTraceText )
+	#define OstTrace1( aGroupName, aTraceName, aTraceText, aParam )
+	#define OstTraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength )
+	#define OstTraceExt1( aGroupName, aTraceName, aTraceText, aParam )
+	#define OstTraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 )
+	#define OstTraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 )
+	#define OstTraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 )
+	#define OstTraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 )
 #endif
 
 
-
-inline TBool Trace1(TClassification aClassification, TFormatId aFormatId, TModuleUid aUid, TUint a1)
-	{
-	return BTraceFilteredContext12(
-		aClassification,					// Category
-		0,								// Sub-category
-		aUid,		// UID
-		aFormatId,
-		a1);							
-	}
-
-inline TBool TraceN(TClassification aClassification, TFormatId aFormatId,  TModuleUid aUid, TInt aArgCount, TUint a1, ...)
-	{
-	const TInt KMaxArgs = 8;
-	if (aArgCount > KMaxArgs)
-		return EFalse;
-	TUint args[KMaxArgs];
-	TInt argLen = aArgCount << 2;
-	memcpy(args, &a1, argLen);
-	
-	return BTraceFilteredContextN(
-		aClassification,					// Category
-		0,									// Sub-category
-		aUid,		// UID
-		aFormatId,
-		args,
-		argLen);								
-	}
-
-
-inline TBool TraceStr(TClassification aClassification, TFormatId aFormatId,  TModuleUid aUid, const TAny* aData, TInt aDataSize)
-	{
-	// NB This will truncate the data (!!!) - 
-	// we can't use BTraceFilteredContextBig for this as it doesn't have room for the format Id
-	return BTraceFilteredContextN(		
-		aClassification,					// Category
-		0,								// Sub-category
-		aUid,		// UID
-		aFormatId,
-		aData, 
-		aDataSize);							
-	}
-
-
-
-
-
-
-
-class RFTrace : public RBusLogicalChannel
-	{
-public:
-	enum {EMajorVersionNumber=1,EMinorVersionNumber=0,EBuildVersionNumber=1};
-	enum TControl
-        {
-		ETraceMultiple,
-		};
-
-#ifndef __KERNEL_MODE__
-
-public:
-	inline TInt Open(TOwnerType aType)
-		{return DoCreate(_L("FTrace"),TVersion(),0,NULL,NULL,aType);}
-
-	inline 	TBool TraceMultiple(TClassification aClassification, TFormatId aFormatId, TUint32 aUid, TInt aDescriptorCount, TUint64 aParam1, ...)
+#if defined (OST_TRACE_COMPILER_IN_USE)
+	// This class is used to reconstruct an RMessage2 object from a message handle so that we can 
+	// call RMessagePtr2::Client() and then RThread::Id() to retrieve the client's thread Id.
+	// This is useful for matching client requests to calls to the proxydrive
+	class RDummyMessage : public RMessage2
 		{
-		if (Handle() == NULL)
-			return EFalse;
-		// ARM passes first 4 parameters in registers, so....
-		// parcel-up the first four parameters in an array and pass a pointer to the array to the LDD; 
-		// the next parameter(s) should be on the stack, so we can just pass a pointer to the first element 
-		TUint args[4] = {aClassification, aFormatId, aUid, aDescriptorCount};
-		TUint64* pArg1 = &aParam1;
-		TInt r = DoControl(ETraceMultiple, (TAny*) args, pArg1);
-		if (r |= KErrNone)
-			User::Panic(_L("FSCLIENT Trace panic"), 0);
-		return ETrue;
-		}
-
-	static inline TUint64 PkgData(const TDesC16& aDes)	{return MAKE_TUINT64( ((TUint) aDes.Ptr()), (aDes.Length()<<1) | (EPtrC<<KShiftDesType));}
-	static inline TUint64 PkgData(const TDesC8& aDes)	{return MAKE_TUINT64( ((TUint) aDes.Ptr()), aDes.Length() | (EPtrC<<KShiftDesType));}
-
-	static inline TUint64 PkgData(TChar aVal)			{return MAKE_TUINT64(aVal, sizeof(aVal));}
-	static inline TUint64 PkgData(TUint8 aVal)			{return MAKE_TUINT64(aVal, sizeof(aVal));}
-	static inline TUint64 PkgData(TInt8 aVal)			{return MAKE_TUINT64(aVal, sizeof(aVal));}
-	static inline TUint64 PkgData(TUint16 aVal)			{return MAKE_TUINT64(aVal, sizeof(aVal));}
-	static inline TUint64 PkgData(TInt16 aVal)			{return MAKE_TUINT64(aVal, sizeof(aVal));}
-	static inline TUint64 PkgData(TUint32 aVal)			{return MAKE_TUINT64(aVal, sizeof(aVal));}
-	static inline TUint64 PkgData(TInt32 aVal)			{return MAKE_TUINT64(aVal, sizeof(aVal));}
-	static inline TUint64 PkgData(TUint aVal)			{return MAKE_TUINT64(aVal, sizeof(aVal));}
-	static inline TUint64 PkgData(TInt aVal)			{return MAKE_TUINT64(aVal, sizeof(aVal));}
-	
-#endif	// __KERNEL_MODE__
-
-private:
-
-	};
-
-// This class is used to reconstruct an RMessage2 object from a message handle so that we can 
-// call RMessagePtr2::Client() and then RThread::Id() to retrieve the client's thread Id.
-// This is useful for matching client requests to calls to the proxydrive
-class RDummyMessage : public RMessage2
-	{
-public:
-	inline RDummyMessage(TInt aHandle) {iHandle = aHandle; iFunction=-1;}
-	};
-
-
-
-#ifdef SYMBIAN_FTRACE_ENABLE
-
-	// Use these macros for tracing 1-8 TUints...
-	#define TRACE0(aClassification, aFormatId, aUid)								Trace1(aClassification, aFormatId, aUid, 0)
-	#define TRACE1(aClassification, aFormatId, aUid, a1)							Trace1(aClassification, aFormatId, aUid, (TUint) a1)
-	#define TRACE2(aClassification, aFormatId, aUid, a1, a2)						TraceN(aClassification, aFormatId, aUid, 2, (TUint) a1, (TUint) a2)
-	#define TRACE3(aClassification, aFormatId, aUid, a1, a2, a3)					TraceN(aClassification, aFormatId, aUid, 3, (TUint) a1, (TUint) a2, (TUint) a3)
-	#define TRACE4(aClassification, aFormatId, aUid, a1, a2, a3, a4)				TraceN(aClassification, aFormatId, aUid, 4, (TUint) a1, (TUint) a2, (TUint) a3, (TUint) a4)
-	#define TRACE5(aClassification, aFormatId, aUid, a1, a2, a3, a4, a5)			TraceN(aClassification, aFormatId, aUid, 5, (TUint) a1, (TUint) a2, (TUint) a3, (TUint) a4, (TUint) a5)
-	#define TRACE6(aClassification, aFormatId, aUid, a1, a2, a3, a4, a5, a6)		TraceN(aClassification, aFormatId, aUid, 6, (TUint) a1, (TUint) a2, (TUint) a3, (TUint) a4, (TUint) a5, (TUint) a6)
-	#define TRACE7(aClassification, aFormatId, aUid, a1, a2, a3, a4, a5, a6, a7)	TraceN(aClassification, aFormatId, aUid, 7, (TUint) a1, (TUint) a2, (TUint) a3, (TUint) a4, (TUint) a5, (TUint) a6, (TUint) a7)
-	#define TRACE8(aClassification, aFormatId, aUid, a1, a2, a3, a4, a5, a6, a7, a8)TraceN(aClassification, aFormatId, aUid, 8, (TUint) a1, (TUint) a2, (TUint) a3, (TUint) a4, (TUint) a5, (TUint) a6, (TUint) a7, (TUint) a8)
-
-	#define TRACESTR(aClassification, aFormatId, aUid, aData, aDataSize)			TraceStr(aClassification, aFormatId, aUid, aData, aDataSize)
-
-	#define RFTRACE_LOAD							\
-		User::LoadLogicalDevice(_L("D_FTRACE"));	
-
-	// macros for opening and closing the trace LDD, which is used for tracing arbitrary data types....
-#if defined(__DLL__)
-	#define RFTRACE_OPEN							\
-		RFTrace TheFtrace;							\
-		TheFtrace.SetHandle((TInt) Dll::Tls());		\
-		if (TheFtrace.Handle() == NULL)				\
-			{										\
-			TheFtrace.Open(EOwnerThread);			\
-			Dll::SetTls((TAny*) TheFtrace.Handle());\
-			}
-
-	#define RFTRACE_CLOSE							\
-		{											\
-		RFTrace ftrace;								\
-		TInt handle = (TInt) Dll::Tls();			\
-		ftrace.SetHandle(handle);					\
-		ftrace.Close();								\
-		Dll::SetTls(NULL);							\
-		}		
-#else
-	extern RFTrace TheFtrace;
-	#define RFTRACE_OPEN
-	#define RFTRACE_CLOSE 
-#endif
-	
-	// Use these macros for tracing 1-8 arbitrary data types....
-	#define TRACEMULT1(aClassification, aFormatId, aUid, a1)						\
-		if (BTrace::CheckFilter2(aClassification, aUid))								\
-			{																			\
-			RFTRACE_OPEN																\
-			TheFtrace.TraceMultiple(aClassification,aFormatId,aUid,1,RFTrace::PkgData(a1));	\
-			}
-
-	#define TRACEMULT2(aClassification, aFormatId, aUid, a1, a2)					\
-		if (BTrace::CheckFilter2(aClassification, aUid))								\
-			{																			\
-			RFTRACE_OPEN																\
-			TheFtrace.TraceMultiple(aClassification,aFormatId,aUid,2,RFTrace::PkgData(a1),RFTrace::PkgData(a2));	\
-			}
-
-	#define TRACEMULT3(aClassification, aFormatId, aUid, a1, a2, a3)				\
-		if (BTrace::CheckFilter2(aClassification, aUid))								\
-			{																			\
-			RFTRACE_OPEN																\
-			TheFtrace.TraceMultiple(aClassification,aFormatId,aUid,3,RFTrace::PkgData(a1),RFTrace::PkgData(a2),RFTrace::PkgData(a3)); \
-			}
-
-	#define TRACEMULT4(aClassification, aFormatId, aUid, a1, a2, a3, a4)			\
-		if (BTrace::CheckFilter2(aClassification, aUid))								\
-			{																			\
-			RFTRACE_OPEN																\
-			TheFtrace.TraceMultiple(aClassification,aFormatId,aUid,4,RFTrace::PkgData(a1),RFTrace::PkgData(a2),RFTrace::PkgData(a3),RFTrace::PkgData(a4)); \
-			}
-
-	#define TRACEMULT5(aClassification, aFormatId, aUid, a1, a2, a3, a4, a5)		\
-		if (BTrace::CheckFilter2(aClassification, aUid))								\
-			{																			\
-			RFTRACE_OPEN																\
-			TheFtrace.TraceMultiple(aClassification,aFormatId,aUid,5,RFTrace::PkgData(a1),RFTrace::PkgData(a2),RFTrace::PkgData(a3),RFTrace::PkgData(a4),RFTrace::PkgData(a5)); \
-			}
-
-	#define TRACEMULT6(aClassification, aFormatId, aUid, a1, a2, a3, a4, a5, a6)	\
-		if (BTrace::CheckFilter2(aClassification, aUid))								\
-			{																			\
-			RFTRACE_OPEN																\
-			TheFtrace.TraceMultiple(aClassification,aFormatId,aUid,6,RFTrace::PkgData(a1),RFTrace::PkgData(a2),RFTrace::PkgData(a3),RFTrace::PkgData(a4),RFTrace::PkgData(a5),RFTrace::PkgData(a6)); \
-			}
-
-	#define TRACEMULT7(aClassification, aFormatId, aUid, a1, a2, a3, a4, a5, a6, a7)\
-		if (BTrace::CheckFilter2(aClassification, aUid))								\
-			{																			\
-			RFTRACE_OPEN																\
-			TheFtrace.TraceMultiple(aClassification,aFormatId,aUid,7,RFTrace::PkgData(a1),RFTrace::PkgData(a2),RFTrace::PkgData(a3),RFTrace::PkgData(a4),RFTrace::PkgData(a5),RFTrace::PkgData(a6),RFTrace::PkgData(a7)); \
-			}
-
-	#define TRACEMULT8(aClassification, aFormatId, aUid, a1, a2, a3, a4, a5, a6, a7, a8)\
-		if (BTrace::CheckFilter2(aClassification, aUid))								\
-			{																			\
-			RFTRACE_OPEN																\
-			TheFtrace.TraceMultiple(aClassification,aFormatId,aUid,8,RFTrace::PkgData(a1),RFTrace::PkgData(a2),RFTrace::PkgData(a3),RFTrace::PkgData(a4),RFTrace::PkgData(a5),RFTrace::PkgData(a6),RFTrace::PkgData(a7),RFTrace::PkgData(a8)); \
-			}
+	public:
+		inline RDummyMessage(TInt aHandle) {iHandle = aHandle; iFunction=-1;}
+		};
 
 
 	// This macro retrieves the client thread ID from a message, which is useful for 
@@ -276,78 +85,18 @@
 		RDummyMessage msg(aMsgHandle);			\
 		TRACETHREADID(msg);		
 
-
-	// Use these macros for tracing a return code followed by 1-7 TUints...
-	// If the return code is negative the UTF::EError classification is used IF ENABLED  - otherwise the passed classification is used
-	#define TRACERET1(aClassification, aFormatId, aUid, r)								TRACE1( (TClassification) ((r < 0 && BTrace::CheckFilter2(UTF::EError, aUid)) ? UTF::EError : aClassification), aFormatId, aUid, r);
-	#define TRACERET2(aClassification, aFormatId, aUid, r, a2)							TRACE2( (TClassification) ((r < 0 && BTrace::CheckFilter2(UTF::EError, aUid)) ? UTF::EError : aClassification), aFormatId, aUid, r, a2)
-	#define TRACERET3(aClassification, aFormatId, aUid, r, a2, a3)						TRACE3( (TClassification) ((r < 0 && BTrace::CheckFilter2(UTF::EError, aUid)) ? UTF::EError : aClassification), aFormatId, aUid, r, a2, a3)
-	#define TRACERET4(aClassification, aFormatId, aUid, r, a2, a3, a4)					TRACE4( (TClassification) ((r < 0 && BTrace::CheckFilter2(UTF::EError, aUid)) ? UTF::EError : aClassification), aFormatId, aUid, r, a2, a3, a4)
-	#define TRACERET5(aClassification, aFormatId, aUid, r, a2, a3, a4, a5)				TRACE5( (TClassification) ((r < 0 && BTrace::CheckFilter2(UTF::EError, aUid)) ? UTF::EError : aClassification), aFormatId, aUid, r, a2, a3, a4, a5)
-	#define TRACERET6(aClassification, aFormatId, aUid, r, a2, a3, a4, a5, a6)			TRACE6( (TClassification) ((r < 0 && BTrace::CheckFilter2(UTF::EError, aUid)) ? UTF::EError : aClassification), aFormatId, aUid, r, a2, a3, a4, a5, a6)
-	#define TRACERET7(aClassification, aFormatId, aUid, r, a2, a3, a4, a5, a6, a7)		TRACE7( (TClassification) ((r < 0 && BTrace::CheckFilter2(UTF::EError, aUid)) ? UTF::EError : aClassification), aFormatId, aUid, r, a2, a3, a4, a5, a6, a7)
-	#define TRACERET8(aClassification, aFormatId, aUid, r, a2, a3, a4, a5, a6, a7, a8)	TRACE8( (TClassification) ((r < 0 && BTrace::CheckFilter2(UTF::EError, aUid)) ? UTF::EError : aClassification), aFormatId, aUid, r, a2, a3, a4, a5, a6, a7, a8)
-
-	// Use these macros for tracing a return code followed by 1-7 arbitrary data types....
-	// If the return code is negative the UTF::EError classification is used IF ENABLED  - otherwise the passed classification is used
-	#define TRACERETMULT1(aClassification, aFormatId, aUid, r)								TRACEMULT1( (TClassification) ((r < 0 && BTrace::CheckFilter2(UTF::EError, aUid)) ? UTF::EError : aClassification), aFormatId, aUid, r);
-	#define TRACERETMULT2(aClassification, aFormatId, aUid, r, a2)							TRACEMULT2( (TClassification) ((r < 0 && BTrace::CheckFilter2(UTF::EError, aUid)) ? UTF::EError : aClassification), aFormatId, aUid, r, a2)
-	#define TRACERETMULT3(aClassification, aFormatId, aUid, r, a2, a3)						TRACEMULT3( (TClassification) ((r < 0 && BTrace::CheckFilter2(UTF::EError, aUid)) ? UTF::EError : aClassification), aFormatId, aUid, r, a2, a3)
-	#define TRACERETMULT4(aClassification, aFormatId, aUid, r, a2, a3, a4)					TRACEMULT4( (TClassification) ((r < 0 && BTrace::CheckFilter2(UTF::EError, aUid)) ? UTF::EError : aClassification), aFormatId, aUid, r, a2, a3, a4)
-	#define TRACERETMULT5(aClassification, aFormatId, aUid, r, a2, a3, a4, a5)				TRACEMULT5( (TClassification) ((r < 0 && BTrace::CheckFilter2(UTF::EError, aUid)) ? UTF::EError : aClassification), aFormatId, aUid, r, a2, a3, a4, a5)
-	#define TRACERETMULT6(aClassification, aFormatId, aUid, r, a2, a3, a4, a5, a6)			TRACEMULT6( (TClassification) ((r < 0 && BTrace::CheckFilter2(UTF::EError, aUid)) ? UTF::EError : aClassification), aFormatId, aUid, r, a2, a3, a4, a5, a6)
-	#define TRACERETMULT7(aClassification, aFormatId, aUid, r, a2, a3, a4, a5, a6, a7)		TRACEMULT7( (TClassification) ((r < 0 && BTrace::CheckFilter2(UTF::EError, aUid)) ? UTF::EError : aClassification), aFormatId, aUid, r, a2, a3, a4, a5, a6, a7)
-	#define TRACERETMULT8(aClassification, aFormatId, aUid, r, a2, a3, a4, a5, a6, a7, a8)	TRACEMULT8( (TClassification) ((r < 0 && BTrace::CheckFilter2(UTF::EError, aUid)) ? UTF::EError : aClassification), aFormatId, aUid, r, a2, a3, a4, a5, a6, a7, a8)
-
+#else	// #if defined (OST_TRACE_COMPILER_IN_USE)
 
-#else		// #ifdef SYMBIAN_FTRACE_ENABLE
-	#define TRACE0(aClassification, aFormatId, aUid)
-	#define TRACE1(aClassification, aFormatId, aUid, a1)
-	#define TRACE2(aClassification, aFormatId, aUid, a1, a2)
-	#define TRACE3(aClassification, aFormatId, aUid, a1, a2, a3)
-	#define TRACE4(aClassification, aFormatId, aUid, a1, a2, a3, a4)
-	#define TRACE5(aClassification, aFormatId, aUid, a1, a2, a3, a4, a5)
-	#define TRACE6(aClassification, aFormatId, aUid, a1, a2, a3, a4, a5, a6)
-	#define TRACE7(aClassification, aFormatId, aUid, a1, a2, a3, a4, a5, a6, a7)
-	#define TRACE8(aClassification, aFormatId, aUid, a1, a2, a3, a4, a5, a6, a7, a8)
-	#define TRACESTR(aClassification, aFormatId, aUid, aData, aDataSize)
-
-	#define RFTRACE_LOAD
-	#define RFTRACE_OPEN
-	#define RFTRACE_CLOSE
-
-	#define TRACEMULT1(aClassification, aFormatId, aUid, a1)
-	#define TRACEMULT2(aClassification, aFormatId, aUid, a1, a2)
-	#define TRACEMULT3(aClassification, aFormatId, aUid, a1, a2, a3)
-	#define TRACEMULT4(aClassification, aFormatId, aUid, a1, a2, a3, a4)
-	#define TRACEMULT5(aClassification, aFormatId, aUid, a1, a2, a3, a4, a5)
-	#define TRACEMULT6(aClassification, aFormatId, aUid, a1, a2, a3, a4, a5, a6)
-	#define TRACEMULT7(aClassification, aFormatId, aUid, a1, a2, a3, a4, a5, a6, a7)
-	#define TRACEMULT8(aClassification, aFormatId, aUid, a1, a2, a3, a4, a5, a6, a7, a8)
 	#define TRACETHREADID(aMsg)
 	#define TRACETHREADIDH(aMsgHandle)
 
-	#define TRACERET1(aClassification, aFormatId, aUid, r)
-	#define TRACERET2(aClassification, aFormatId, aUid, r, a2)
-	#define TRACERET3(aClassification, aFormatId, aUid, r, a2, a3)
-	#define TRACERET4(aClassification, aFormatId, aUid, r, a2, a3, a4)
-	#define TRACERET5(aClassification, aFormatId, aUid, r, a2, a3, a4, a5)
-	#define TRACERET6(aClassification, aFormatId, aUid, r, a2, a3, a4, a5, a6)
-	#define TRACERET7(aClassification, aFormatId, aUid, r, a2, a3, a4, a5, a6, a7)
-	#define TRACERET8(aClassification, aFormatId, aUid, r, a2, a3, a4, a5, a6, a7, a8)
-
-	#define TRACERETMULT1(aClassification, aFormatId, aUid, r)
-	#define TRACERETMULT2(aClassification, aFormatId, aUid, r, a2)
-	#define TRACERETMULT3(aClassification, aFormatId, aUid, r, a2, a3)
-	#define TRACERETMULT4(aClassification, aFormatId, aUid, r, a2, a3, a4)
-	#define TRACERETMULT5(aClassification, aFormatId, aUid, r, a2, a3, a4, a5)
-	#define TRACERETMULT6(aClassification, aFormatId, aUid, r, a2, a3, a4, a5, a6)
-	#define TRACERETMULT7(aClassification, aFormatId, aUid, r, a2, a3, a4, a5, a6, a7)
-	#define TRACERETMULT8(aClassification, aFormatId, aUid, r, a2, a3, a4, a5, a6, a7, a8)
-#endif
+#endif	// #if defined (OST_TRACE_COMPILER_IN_USE)
 
 
 
 
-#endif
+
 
+#endif	// #if !defined(__FTRACE_H__)
+
+
--- a/userlibandfileserver/fileserver/group/base_f32.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/group/base_f32.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "File Server"
 
 component	base_f32
--- a/userlibandfileserver/fileserver/group/bld.inf	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/group/bld.inf	Thu Jul 22 16:46:39 2010 +0100
@@ -46,17 +46,13 @@
 ../inc/F32plugin.h								SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(f32plugin.h)
 ../inc/f32plugin.inl							SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(f32plugin.inl)
 
-../inc/f32tracedef.h							SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(f32tracedef.h)
-../inc/utraceefsrv.h							SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(utraceefsrv.h)
-../inc/utraceefile.h							SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(utraceefile.h)
 ../rom/f32.iby	 		/epoc32/rom/f32/f32.iby
 
 PRJ_MMPFILES
 
 #if !defined(SMP)
-efsrv
-efile
+../sfsrv/efsrv
+../sfile/efile
 runtests
 #endif
 
-ftrace
--- a/userlibandfileserver/fileserver/group/efile.mmh	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// f32\group\efile.mmp
-// efile.exe File Server
-// 
-//
-
-/**
- @file
-*/
-
-
-SOURCEPATH	../sfsrv
-USERINCLUDE	../sfsrv
-USERINCLUDE	../ftrace
-SOURCE			 cl_file.cpp
-SOURCE			 cl_cli.cpp
-SOURCE			 cl_dir.cpp
-
-SOURCEPATH	../sfile
-USERINCLUDE	.
-SOURCE			 sf_amh.cpp sf_dat.cpp sf_debug.cpp sf_dir.cpp
-SOURCE			 sf_drv.cpp sf_file.cpp sf_fmt.cpp
-SOURCE			 sf_ldr.cpp sf_main.cpp sf_nbs.cpp sf_ses.cpp
-SOURCE			 sf_svr.cpp sf_sys.cpp sf_utl.cpp sf_mnt.cpp
-SOURCE			 sf_raw.cpp sf_prel.cpp sf_disk.cpp
-SOURCE			 sf_request.cpp sf_ops.cpp sf_notify.cpp
-SOURCE			 sf_thread.cpp sf_local.cpp sf_obj.cpp
-SOURCE			 sf_ext.cpp sf_hash.cpp
-SOURCE			 sf_plugin.cpp sf_plugin_ops.cpp sf_plugin_man.cpp
-SOURCE			 Sf_plugin_util.cpp
-SOURCE			 sf_cache_man.cpp sf_cache_client.cpp
-SOURCE			 sf_file_cache.cpp
-SOURCE			 sf_memory_man.cpp sf_memory_client.cpp
-SOURCE			 sf_plugin_shim.cpp
-SOURCE			 sf_notifier_handlers.cpp
-#ifdef SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION
-SOURCE			 sf_pool.cpp sf_notifier.cpp
-#endif
-
-#ifdef WINS
-SOURCE			 sf_lwins.cpp
-
-library			emulator.lib
-#else
-SOURCE			 sf_lepoc.cpp  sf_inflate.cpp sf_cache.cpp sf_decomp.cpp
-SOURCE			 sf_pgcompr.cpp
-
-#ifdef MARM
-SOURCEPATH	../../../kernel/eka/kernel/arm
-SOURCE			 byte_pair.cia
-#else
-SOURCEPATH	../../../kernel/eka/kernel
-SOURCE			 byte_pair.cpp
-#endif
-
-
-SOURCEPATH	../srom
-SOURCE			 sr_rom.cpp
-#endif
-
-STRICTDEPEND
-
-SOURCEPATH	.
-DOCUMENT		 release.txt
-
-TARGETTYPE		exexp
-
-DEFFILE			efile.def
-
-USERINCLUDE	../inc
-#ifdef SYMBIAN_OLD_EXPORT_LOCATION
-SYSTEMINCLUDE	../inc
-#endif
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-USERINCLUDE	../../../kernel/eka/include
-
-LIBRARY			 efsrv.lib euser.lib hal.lib btracec.lib
-
-EPOCSTACKSIZE	0x6000
-EPOCHEAPSIZE	0x00001000	0x800000
-
-START WINS
-BASEADDRESS		0x62000000
-WIN32_LIBRARY	kernel32.lib
-END
-UID		0x1000008c 0x100039e3
-VENDORID 0x70000001
-
-unpagedcode
-unpageddata
-
-SMPSAFE
-
-
--- a/userlibandfileserver/fileserver/group/efile.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// f32/group/efile.mmp
-// efile.exe File Server
-// 
-//
-
-/**
- @file
-*/
-
-
-TARGET			efile.exe
-
-#include "f32caps.mmh"  // Capabilities of File Server process
-#include "f32.mmh"  	// Generic definitions for the whole f32 component
-
-MACRO			SYMBIAN_PRIVATE_EFSRV
-
-#ifdef SYMBIAN_TRACE_SYSTEM_INCLUDE
-	macro SYMBIAN_FTRACE_ENABLE_UDEB
-//	macro SYMBIAN_FTRACE_ENABLE_UREL
-#endif
-
-#include "efile.mmh"
-
-
-
-
-
--- a/userlibandfileserver/fileserver/group/efile_instrumented.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// f32/group/efile.mmp
-// efile_instrumented.exe Instrumented version of the File Server
-// 
-//
-
-/**
- @file
-*/
-
-
-TARGET			efile_instrumented.exe
-
-#include "f32caps.mmh"  // Capabilities of File Server process
-#include "f32.mmh"  	// Generic definitions for the whole f32 component
-
-MACRO			SYMBIAN_PRIVATE_EFSRV
-
-#ifdef SYMBIAN_TRACE_SYSTEM_INCLUDE
-	macro SYMBIAN_FTRACE_ENABLE_UDEB
-	macro SYMBIAN_FTRACE_ENABLE_UREL
-#endif
-
-#include "efile.mmh"
-
--- a/userlibandfileserver/fileserver/group/efsrv.mmh	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// f32\group\efsrv.mmp
-// efsrv.dll File Server client-side library
-// 
-//
-
-/**
- @file
-*/
-
-
-
-USERINCLUDE		../ftrace
-
-SOURCEPATH		../sfsrv
-SOURCE			 cl_cdir.cpp cl_cli.cpp cl_debug.cpp cl_dir.cpp
-SOURCE			 cl_drive.cpp cl_entry.cpp cl_file.cpp cl_find.cpp
-SOURCE			 cl_fman.cpp cl_fmt.cpp cl_fraw.cpp cl_ftext.cpp
-SOURCE			 cl_main.cpp cl_parse.cpp cl_scan.cpp cl_insecure.cpp
-SOURCE			 cl_plugin.cpp cl_blockmap.cpp cl_clamp.cpp
-SOURCE			 cl_shim.cpp
-SOURCE			 cl_notification.cpp
-SOURCEPATH	.
-DOCUMENT		 release.txt
-
-TARGETTYPE		dll
-
-DEFFILE			 efsrv.def
-
-USERINCLUDE	../inc
-#ifdef SYMBIAN_OLD_EXPORT_LOCATION
-SYSTEMINCLUDE	../inc
-#endif
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-
-LIBRARY			 euser.lib hal.lib
-
-START WINS
-BASEADDRESS		0x66000000
-END
-
-UID		0x1000008d 0x100039e4
-VENDORID 0x70000001
-CAPABILITY	All
-
-unpagedcode
-
-SMPSAFE
-
--- a/userlibandfileserver/fileserver/group/efsrv.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// f32/group/efsrv.mmp
-// efsrv.dll File Server client-side library
-// 
-//
-
-/**
- @file
-*/
-
-
-TARGET			efsrv.dll
-
-#include "f32.mmh"  	// Generic definitions for the whole f32 component
-
-#ifdef SYMBIAN_TRACE_SYSTEM_INCLUDE
-	macro SYMBIAN_FTRACE_ENABLE_UDEB
-//	macro SYMBIAN_FTRACE_ENABLE_UREL
-#endif
-
-
-#include "efsrv.mmh"
--- a/userlibandfileserver/fileserver/group/efsrv_instrumented.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// f32/group/efsrv.mmp
-// efsrv_instrumented.dll Instrumented version of the File Server client-side library
-// 
-//
-
-/**
- @file
-*/
-
-
-TARGET			efsrv_instrumented.dll
-
-#include "f32.mmh"  	// Generic definitions for the whole f32 component
-
-#ifdef SYMBIAN_TRACE_SYSTEM_INCLUDE
-	macro SYMBIAN_FTRACE_ENABLE_UDEB
-	macro SYMBIAN_FTRACE_ENABLE_UREL
-#endif
-
-
-#include "efsrv.mmh"
--- a/userlibandfileserver/fileserver/group/ftrace.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include "kernel/kern_ext.mmh"
-#include "f32.mmh"
-
-USERINCLUDE		../inc
-
-TARGET         d_ftrace.ldd
-TARGETTYPE     LDD
-SOURCEPATH	../ftrace
-SOURCE         d_ftrace.cpp
-
-epocallowdlldata
-
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-
-start wins
-win32_headers
-end
-
-capability	all
-VENDORID 0x70000001
-
-UNPAGED
-SMPSAFE
--- a/userlibandfileserver/fileserver/group/release.txt	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/group/release.txt	Thu Jul 22 16:46:39 2010 +0100
@@ -1,3 +1,157 @@
+Version 2.00.3049
+=================
+(Made by vfebvre 15/06/2010)
+
+1.	migubarr
+	1.	ou1cimx1#393016 Crash when usb memory is dismounted during copy
+
+2.	michcox
+	1.	ou1cimx1#419149 MCL fix CDirStack array panic
+
+
+Version 2.00.3048
+=================
+(Made by vfebvre 14/06/2010)
+
+1.	migubarr
+	1.	ou1cimx1#420772 File Server flushes FAT metadata too often
+
+
+Version 2.00.3047
+=================
+(Made by vfebvre 11/06/2010)
+
+1.	dlyokhin
+	1.	ou1cimx1#423683 IT__BITO_SSS - 92_201019_hw79- \sf\os\kernelhwsrv\- Bad usage of RXXX::Connect() derived from RSessionBase
+
+2.	paconway
+	1.	DEF144802 CDynamicDirCache tests should be automated
+	2.	DEF144801 CDynamicDirCache leaks cache pages occasionally
+
+
+Version 2.00.3046
+=================
+(Made by vfebvre 07/06/2010)
+
+1.	davegord
+	1.	ou1cimx1#414735 Occasional Loader crashes observed during T_WSD_TST_* tests
+		Crash caused by interrupt occurring during handling of SWI called from
+		SVC mode -- which is not supported. Fix is for Loader not to call RDebug
+		methods while executing in supervisor mode.
+
+
+Version 2.00.3045
+=================
+(Made by vfebvre 04/06/2010)
+
+1.	famustaf
+	1.	ou1cimx1#383105 Modify F32 Tests for Platsim's HVFS
+
+
+Version 2.00.3044
+=================
+(Made by vfebvre 27/05/2010)
+
+1.	vfebvre
+	1.	ou1cimx1#400806 Warnings reported by the Symbian Foundation license checker
+
+2.	h14jiang
+	1.	DEF145205 File server crash observed when running F32TEST T_PLUGIN_V2
+
+3.	michcox
+	1.	ou1cimx1#378866 MCL Symbian.org Bug 2544 -  Possible deadlocks on f32 plugin chains
+
+4.	vinjose
+	1.	ou1cimx1#394794 Raptor creates incorrect .iby files for f32test/loader
+
+
+Version 2.00.3043
+=================
+(Made by vfebvre 27/05/2010)
+
+1.	paconway
+	1.	REQ 417-56766 MBBMS over CMMB for TD-SCDMA Gen. 2 MobileTv
+		PackageReleaseID=497412 FeatureReleaseID=494378
+
+
+Version 2.00.3042
+=================
+(Made by vfebvre 14/05/2010)
+
+1.	migubarr
+	1.	REQ 428-1297 Migrate File Server Tracing from UTF to OST
+		PackageReleaseID=495120
+
+
+Version 2.00.3041
+=================
+(Made by vfebvre 13/05/2010)
+
+1.	famustaf
+	1.	ou1cimx1#380321 Build on Linux - Incorrect slash in #include in sf_sys.cpp
+
+
+Version 2.00.3040
+=================
+(Made by vfebvre 12/05/2010)
+
+1.	cnotton
+	1.	MINOR_CHANGE Corrected MRP comment text
+
+2.	hengrant
+	1.	ou1cimx1#370931 Memory card gets locked by itself MCL
+
+
+Version 2.00.3039
+=================
+(Made by vfebvre 06/05/2010)
+
+1.	famustaf
+	1.	ou1cimx1#372432 CFileMan malfunctioning in copying
+
+2.	dlyokhin
+	1.	ou1cimx1#372220 File server may request more free space on the volume than necessary
+
+
+Version 2.00.3038
+=================
+(Made by vfebvre 05/05/2010)
+
+1.	niccox
+	1.	ou1cimx1#371028 shostmassstorage capabilities are too high
+
+
+Version 2.00.3037
+=================
+(Made by vfebvre 30/04/2010)
+
+1.	vfebvre
+	1.	ou1cimx1#357360 Some test binaries are targeted by several bld.inf files
+
+2.	frhofman
+	1.	ou1cimx1#367552 BC Drivers: Os/KernelHwSrv: 2 failures in Base API on Vasco
+
+3.	michcox
+	1.	ou1cimx1#357494 Maps 3.04: File mode EFileWrite (defined in f32file.h) corrupts memory of other processes under certain conditions on 5.0 devices
+	2.	ou1cimx1#367062 Update T_filecache for ou1cimx1#357494
+
+
+Version 2.00.3036
+=================
+(Made by vfebvre 27/04/2010)
+
+1.	erifung
+	1.	DEF144399 Frequent T_LDRCHECK failures on the H4
+
+
+Version 2.00.3035
+=================
+(Made by vfebvre 23/04/2010)
+
+1.	niccox
+	1.	ou1cimx1#357492 Disconnecting memory card reader/writer from phone causes phone crash
+
+
 Version 2.00.3034
 =================
 (Made by vfebvre 20/04/2010)
--- a/userlibandfileserver/fileserver/inc/f32dbg.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/inc/f32dbg.h	Thu Jul 22 16:46:39 2010 +0100
@@ -188,6 +188,12 @@
 const TInt KControlIoObjectCount=KMaxTInt-22;
 
 const TInt KControlIoIsFileSequential=KMaxTInt-23;
+const TInt KControlIoGlobalCacheConfig=KMaxTInt-24;
+const TInt KControlIoGlobalCacheInfo=KMaxTInt-25;
+const TInt KControlIoDirCacheConfig=KMaxTInt-26;
+const TInt KControlIoDirCacheInfo=KMaxTInt-27;
+const TInt KControlIoSimulateMemoryLow=KMaxTInt-28;
+const TInt KControlIoStopSimulateMemoryLow=KMaxTInt-29;
 
 const TInt KNCDebugNotifierValue=-500000;	// between 0 and 1 second
 
@@ -256,6 +262,88 @@
 
 extern TBool EnableFatUtilityFunctions;
 
+class TGlobalCacheConfig
+    {
+public:
+    TInt32 iGlobalCacheSizeInBytes;      		// in bytes 
+    TInt32 iGlobalLowMemoryThreshold;         	// in percentage
+    };
+
+class TGlobalCacheInfo
+    {
+public:
+    TInt32 iGlobalCacheSizeInBytes;     		// in bytes 
+    TInt32 iGlobalLowMemoryThreshold;   		// in percentage
+    };
+
+class TDirCacheConfig
+    {
+public:
+    TInt iDrive;
+
+    TInt32 iLeafDirCacheSize;           // in number of most recently visited leaf directories
+    TInt32 iDirCacheSizeMin;            // in bytes
+    TInt32 iDirCacheSizeMax;            // in bytes
+    };
+
+class TDirCacheInfo
+    {
+public:
+    TInt iDrive;
+
+    /**
+    Segment size in bytes. A memory segment is the smallest memory unit that Kernel manages through RChunk.
+    */
+    TInt32 iMemorySegmentSize;
+
+    /**
+    Size of memory a page occupies, in bytes.
+    Note: following restrictions may result a difference between page size in memory & page size in data:
+        1. page size can not be smaller than segment size
+        2. one page can not contain data from two different clusters
+    */
+    TInt32 iPageSizeInMemory;
+
+    /**
+    Size of actual data a page contains, in bytes.
+    Note: following restrictions may result a difference between page size in memory & page size in data:
+        1. page size can not be smaller than segment size
+        2. one page can not contain data from two different clusters
+    */
+    TInt32 iPageSizeInData;
+    
+    /**
+    The minimum number of pages that the cache can contain, even under low memory conditions.
+    */
+    TInt32 iMinCacheSizeInPages;
+
+    /**
+    The maximum number of pages that the cache can contain, when there is enough free memory in the system.
+    */
+    TInt32 iMaxCacheSizeInPages;
+    
+    /**
+    The minimum cache size in memory. In bytes.
+    */
+    TInt32 iMinCacheSizeInMemory;
+
+    /**
+    The maximum cache size in memroy. In bytes.
+    */
+    TInt32 iMaxCacheSizeInMemory;
+    
+    /**
+    Current count of the locked pages.
+    */
+    TInt32 iLockedPageNumber;
+
+    /**
+    Current count of the unlocked pages.
+    */
+    TInt32 iUnlockedPageNumber;
+    
+    };
+
 #endif
 
 enum TLoaderDebugFunction
--- a/userlibandfileserver/fileserver/inc/f32file.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/inc/f32file.h	Thu Jul 22 16:46:39 2010 +0100
@@ -708,27 +708,28 @@
 	{
 public:
 	/**
-	The size of a block in bytes.
-	
-	Reads and writes that are aligned on block boundaries are up to twice as fast as when 
-	mis-aligned.	
-	
-	Read and write operations on certain underlying media is done in blocks.
-	A write operation that modifies only part of a block is less efficient, in general, than
-	one that modifies an entire block. Data throughput degrades linearly for reads and writes in smaller
-	sized units. 
+	The size of a media block in bytes. This is a physical property of a media and returned by the corresponding media driver.
+	This value is usually at least 512 bytes and always a power of 2. For some media types the meaning of this value is 
+    "the min. size of the aligned data buffer which write onto the media doesn't lead to read-modify-write operation."
+    Therefore, reads and writes that are aligned on block boundaries and with lenght of a multiple block size can be much faster.	
+	Read and write operations on certain underlying media is done in blocks. A write operation that modifies only part of a block is less efficient, 
+    in general, than one that modifies an entire block. Data throughput degrades linearly for reads and writes in smaller sized units. 
 	*/
 	TInt iBlockSize;
+	
 	/**
-	The size in bytes of a single disk cluster.
-	
-	Read and write operations that are aligned on cluster boundaries are more efficient.
-	
-	The file system organises and allocates the file data on the disk in clusters where each cluster is
-	one or more blocks. Files that are not zero length occupy at least one cluster of the disk, 
-	so large numbers of very small files use up more disk space than expected. 
+	The size in bytes of a single file system cluster. This is a logical property of the file system. 
+	The file system organises and allocates the data on the disk in clusters where each cluster usually consists of one or more blocks. 
+    Cluster is a minimal unit that the file system allocates on the volume. Thus, a file of 1 byte length occupies 1 cluster.
+
+	Read and write operations that are aligned on cluster boundaries are more efficient from the file system point of view.
+    In some circumstances cluster size can be less than a block size, but it is very inefficient.
+
+    This value is reported by a file system. The value less than 0 indicates a error.
 	*/
 	TInt iClusterSize;
+
+
 	/**
 	The recommended buffer size for optimised reading performance. 
 	
@@ -763,7 +764,7 @@
 
     /** 
     The maximum file size that is supported by the file system mounted on this volume. 
-    Not all file system may provide this parameter;  The value KMaxTUint64 (0xffffffffffffffff) means that this particular file system hasn't 
+    Not all file system may report this parameter;  The value KMaxTUint64 (0xffffffffffffffff) means that this particular file system hasn't 
     provided this information.
     */
     TUint64 iMaxSupportedFileSize;
--- a/userlibandfileserver/fileserver/inc/f32fsys.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/inc/f32fsys.h	Thu Jul 22 16:46:39 2010 +0100
@@ -508,7 +508,7 @@
 	void DoEntryL(const TDesC& aName,TEntry& anEntry);
 	void ReadSectionL(const TDesC& aName,TInt64 aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
 	TInt ValidateShare(CFileCB& aFile,TShare aReqShare);
-	TInt CheckAttributes(const TDesC& aName,TUint& aSetAttMask,TUint& aClearAttMask);
+	TInt CheckAttributes(TUint& aSetAttMask,TUint& aClearAttMask);
 	TBool IsExtensionMounted(CProxyDriveFactory* aFactory);
 	CFileCB* LocateFile(const TDesC& aName);
 	CFileCache* LocateClosedFile(const TDesC& aName, TBool aResurrect = ETrue);
@@ -1632,6 +1632,7 @@
 	IMPORT_C TInt64 Size64() const;
 	IMPORT_C void SetSize64(TInt64 aSize, TBool aDriveLocked);
     IMPORT_C void SetMaxSupportedSize(TUint64 aMaxFileSize);
+	IMPORT_C TBool DirectIOMode(const RMessagePtr2& aMessage);
 
 
     TInt64 CachedSize64() const;
@@ -2491,6 +2492,7 @@
 
 
 
+class CProxyDriveBody;	// fwd ref
 /**
 @publishedPartner
 @released
@@ -2516,6 +2518,10 @@
 	IMPORT_C virtual TInt GetLastErrorInfo(TDes8& aErrorInfo);
 
 	inline TInt LocalBufferSupport();
+
+	TInt SetAndOpenLibrary(RLibrary aLibrary);
+	RLibrary GetLibrary();
+
 	
 // pure virtual
 
@@ -2759,7 +2765,9 @@
 		
 private:
 	CMountCB* iMount;
-	TUint32 iReserved;				// Reserved for future expansion
+	CProxyDriveBody* iBody;
+
+friend class LocalDrives;
 	};
 
 
--- a/userlibandfileserver/fileserver/inc/f32tracedef.h	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-* WARNING: This file contains some APIs which are internal and are subject
-*          to change without notice. Such APIs should therefore not be used
-*          outside the Kernel and Hardware Services package.
-*/
-// F32TRACEDEF.H
-//
-
-#if !defined(__F32TRACEDEF_H__)
-#define __F32TRACEDEF_H__
-
-//*********************************
-// from e32utrace_basic_types.h
-//*********************************
-typedef TUint8  TClassification;	// same as BTrace::TCategory
-typedef TUint32 TModuleUid;			
-typedef TUint16 TFormatId;			// 2 bytes occupying first 32-bit word of data
-
-namespace UTF
-	{
-	const static TFormatId KInitialClientFormat = 512; 
-	const static TFormatId KMaxFormatId = KMaxTUint16;		// 0xFFFF
-
-	enum TClassificationAll
-		{
-		EPanic = 192,
-		EError = 193,
-		EWarning = 194, 
-		EBorder = 195, 
-		EState = 196, 
-		EInternals = 197, 
-		EDump = 198, 
-		EFlow = 199, 
-		ESystemCharacteristicMetrics = 200, 
-		EAdhoc = 201,
-		EClassificationAllHighWaterMark, 
-		};
-	}	// namespace UTF
-
-
-enum TF32TraceFormatUids
-	{
-	EF32TraceUidEfsrv		=	0x100039e4,	// 268450276
-	EF32TraceUidFirst		=	0x10286575,	// 271082869
-	EF32TraceUidLast		=	0x10286594,	// 271082900
-	
-	EF32TraceUidFileSys		=	0x10286575,	// 271082869
-	EF32TraceUidProxyDrive	=	0x10286576,	// 271082870
-
-    // Provided to allow the following compile time assert.
-    ETraceUidHighWaterMark,
-    };
-    __ASSERT_COMPILE(ETraceUidHighWaterMark <= (EF32TraceUidLast + 1));
-	
-
-#endif
-
--- a/userlibandfileserver/fileserver/inc/f32ver.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/inc/f32ver.h	Thu Jul 22 16:46:39 2010 +0100
@@ -58,6 +58,6 @@
 
 @see TVersion
 */
-const TInt KF32BuildVersionNumber=3034;
+const TInt KF32BuildVersionNumber=3049;
 //
 #endif
--- a/userlibandfileserver/fileserver/inc/utraceefile.h	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,603 +0,0 @@
-
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// File Server tracing
-// 
-//
-
-/**
- @file
- @publishedPartner
- @prototype
-*/
-
-#ifndef UTRACEEFILE_H
-#define UTRACEEFILE_H
-
-
-#include <f32tracedef.h>
-
-/**
-This defines trace attributes to be used by file-system tracing
-
-*/
-namespace UTraceModuleFileSys
-    {
-
-	/** 
-	@SYMTraceFormatCategory EF32TraceUidFileSys 
-    @SYMTraceFormatId
-    */
-    enum TFormatId
-        {
-		EReserved = UTF::KInitialClientFormat-1,
-
-        /** @SYMTraceFormatString "+CFileSystem::CFileSystem()" */
-		ECFileSystemConstructor,
-        /** @SYMTraceFormatString "-CFileSystem::CFileSystem()" */
-        ECFileSystemConstructorReturn,
-
-        /** @SYMTraceFormatString "+~CFileSystem::CFileSystem()" */
-		ECFileSystemDestructor,
-        /** @SYMTraceFormatString "-~CFileSystem::CFileSystem()" */
-        ECFileSystemDestructorReturn,
-
-        /** @SYMTraceFormatString "+CFileSystem::New() handle %x" */
-		ECFileSystemNew,
-        /** @SYMTraceFormatString "-CFileSystem::New() fileSystem %x" */
-        ECFileSystemNewRet,
-
-        /** @SYMTraceFormatString "+CFileSystem::Remove() this %x" */
-		ECFileSystemRemove,
-        /** @SYMTraceFormatString "-CFileSystem::Remove()" */
-        ECFileSystemRemoveRet,
-
-        /** @SYMTraceFormatString "CFileSystem::IsExtensionSupported() this %x r %d" */
-		ECFileSystemIsExtensionSupported,
-
-		/** @SYMTraceFormatString "+CFileSystem::Install() this %x" */
-		ECFileSystemInstall,
-        /** @SYMTraceFormatString "-CFileSystem::Install() r %d Name %*S" */
-        ECFileSystemInstallRet,
-
-		/** @SYMTraceFormatString "+CFileSystem::NewMountL() this %x drive %d" */
-		ECFileSystemNewMountL,
-        /** @SYMTraceFormatString "-CFileSystem::NewMountL() r %d CMountCB %x" */
-        ECFileSystemNewMountLRet,
-
-		/** @SYMTraceFormatString "+CFileSystem::NewFileL() this %x drive %d" */
-		ECFileSystemNewFileL,
-        /** @SYMTraceFormatString "-CFileSystem::NewFileL() r %d CFileCB %x" */
-        ECFileSystemNewFileLRet,
-
-		/** @SYMTraceFormatString "+CFileSystem::NewDirL() this %x drive %d" */
-		ECFileSystemNewDirL,
-        /** @SYMTraceFormatString "-CFileSystem::NewDirL() r %d CDirCB %x" */
-        ECFileSystemNewDirLRet,
-
-		/** @SYMTraceFormatString "+CFileSystem::NewFormatL() this %x drive %d" */
-		ECFileSystemNewFormatL,
-        /** @SYMTraceFormatString "-CFileSystem::NewFormatL() r %d CFormatCB %x" */
-        ECFileSystemNewFormatLRet,
-
-		/** @SYMTraceFormatString "+CFileSystem::DriveInfo() this %x aDriveNumber %d" */
-		ECFileSystemDriveInfo,
-        /** @SYMTraceFormatString "-CFileSystem::DriveInfo() type %d driveAtt %x mediaAtt %x" */
-        ECFileSystemDriveInfoRet,
-
-
-        
-		/** @SYMTraceFormatString "+CMountCB::ReMount() drive %d" */
-		ECMountCBReMount,
-        /** @SYMTraceFormatString "-CMountCB::ReMount() success %d" */
-        ECMountCBReMountRet,
-
-		/** @SYMTraceFormatString "+CMountCB::Dismounted() drive %d" */
-		ECMountCBDismounted,
-        /** @SYMTraceFormatString "-CMountCB::Dismounted()" */
-        ECMountCBDismountedRet,
-
-
-		/** @SYMTraceFormatString "+CMountCB::VolumeL() drive %d" */
-		ECMountCBVolumeL,
-        /** @SYMTraceFormatString "-CMountCB::VolumeL() r %d iUniqueID %x iSize %ld iFree %ld iFileCacheFlags %x" */
-        ECMountCBVolumeLRet,
-
-		/** @SYMTraceFormatString "+CMountCB::SetVolumeL() drive %d aName %*S" */
-		ECMountCBSetVolumeL,
-        /** @SYMTraceFormatString "-CMountCB::SetVolumeL() r %d" */
-        ECMountCBSetVolumeLRet,
-
-		/** @SYMTraceFormatString "+CMountCB::MkDirL() drive %d aName %*S" */
-		ECMountCBMkDirL,
-        /** @SYMTraceFormatString "-CMountCB::MkDirL() r %d" */
-        ECMountCBMkDirLRet,
-
-		/** @SYMTraceFormatString "+CMountCB::RmDirL() drive %d aName %*S" */
-		ECMountCBRmDirL,
-        /** @SYMTraceFormatString "-CMountCB::RmDirL() r %d" */
-        ECMountCBRmDirLRet,
-
-		/** @SYMTraceFormatString "+CMountCB::DeleteL() drive %d aName %*S" */
-		ECMountCBDeleteL,
-        /** @SYMTraceFormatString "-CMountCB::DeleteL() r %d" */
-        ECMountCBDeleteLRet,
-
-		/** @SYMTraceFormatString "+CMountCB::RenameL() drive %d anOldName %*S anNewName *S" */
-		ECMountCBRenameL,
-        /** @SYMTraceFormatString "-CMountCB::RenameL() r %d" */
-        ECMountCBRenameLRet,
-
-		/** @SYMTraceFormatString "+CMountCB::ReplaceL() drive %d anOldName %*S anNewName *S" */
-		ECMountCBReplaceL,
-        /** @SYMTraceFormatString "-CMountCB::ReplaceL() r %d" */
-        ECMountCBReplaceLRet,
-
-		/** @SYMTraceFormatString "+CMountCB::EntryL() drive %d aName %*S" */
-		ECMountCBEntryL,
-        /** @SYMTraceFormatString "-CMountCB::EntryL() r %d att %x modified %lx size %d" */
-        ECMountCBEntryLRet,
-
-		/** @SYMTraceFormatString "+CMountCB::SetEntryL() drive %d aName %*S aTime %lx aSetAttMask %x aClearAttMask %x" */
-		ECMountCBSetEntryL,
-        /** @SYMTraceFormatString "-CMountCB::SetEntryL() r %d" */
-        ECMountCBSetEntryLRet,
-
-        /** @SYMTraceFormatString "+CMountCB::FileOpenL() drive %d aName %*S aMode %x anOpen %d aFile %x" */
-		ECMountCBFileOpenL,
-        /** @SYMTraceFormatString "-CMountCB::FileOpenL() r %d" */
-        ECMountCBFileOpenLRet,
-
-        /** @SYMTraceFormatString "+CMountCB::DirOpenL() drive %d aName %*S aDir %x" */
-		ECMountCBDirOpenL,
-        /** @SYMTraceFormatString "-CMountCB::DirOpenL() r %d" */
-        ECMountCBDirOpenLRet,
-
-		/** @SYMTraceFormatString "+CMountCB::RawReadL() drive %d aPos %ld aLength %d aTrg %x anOffset %x threadId %x" */
-		ECMountCBRawReadL,
-        /** @SYMTraceFormatString "-CMountCB::RawReadL() r %d" */
-        ECMountCBRawReadLRet,
-
-		/** @SYMTraceFormatString "+CMountCB::RawWriteL() drive %d aPos %ld aLength %d aTrg %x anOffset %x threadId %x" */
-		ECMountCBRawWriteL,
-        /** @SYMTraceFormatString "-CMountCB::RawWriteL() r %d" */
-        ECMountCBRawWriteLRet,
-
-		/** @SYMTraceFormatString "+CMountCB::GetShortNameL() drive %d aLongName %*S" */
-		ECMountCBGetShortNameL,
-        /** @SYMTraceFormatString "-CMountCB::GetShortNameL() r %d aShortName %*S" */
-        ECMountCBGetShortNameLRet,
-
-		/** @SYMTraceFormatString "+CMountCB::GetLongNameL() drive %d aShortName %*S" */
-		ECMountCBGetLongNameL,
-        /** @SYMTraceFormatString "-CMountCB::GetLongNameL() r %d aLongName %*S" */
-        ECMountCBGetLongNameLRet,
-
-		/** @SYMTraceFormatString "+CMountCB::ReadFileSectionL() drive %d aName %*S aPos %ld aTrg %x aLength %d threadId %x" */
-		ECMountCBReadFileSectionL,
-        /** @SYMTraceFormatString "-CMountCB::ReadFileSectionL() r %d" */
-        ECMountCBReadFileSectionLRet,
-
-		/** @SYMTraceFormatString "+CMountCB::CheckDisk1() drive %d" */
-		ECMountCBCheckDisk1,
-        /** @SYMTraceFormatString "-CMountCB::CheckDisk1() r %d" */
-        ECMountCBCheckDisk1Ret,
-
-		/** @SYMTraceFormatString "+CMountCB::CheckDisk2() drive %d aOperation %d aParam1 %x aParam2 %x" */
-		ECMountCBCheckDisk2,
-        /** @SYMTraceFormatString "-CMountCB::CheckDisk2() r %d" */
-        ECMountCBCheckDisk2Ret,
-
-		/** @SYMTraceFormatString "+CMountCB::ScanDrive1() drive %d" */
-		ECMountCBScanDrive1,
-        /** @SYMTraceFormatString "-CMountCB::ScanDrive1() r %d" */
-        ECMountCBScanDrive1Ret,
-
-		/** @SYMTraceFormatString "+CMountCB::ScanDrive2() drive %d aOperation %d aParam1 %x aParam2 %x" */
-		ECMountCBScanDrive2,
-        /** @SYMTraceFormatString "-CMountCB::ScanDrive2() r %d" */
-        ECMountCBScanDrive2Ret,
-
-		/** @SYMTraceFormatString "+CMountCB::ControlIO() drive %d aCommand %d aParam1 %x aParam2 %x threadId %x" */
-		ECMountCBControlIO,
-        /** @SYMTraceFormatString "-CMountCB::ControlIO() r %d" */
-        ECMountCBControlIORet,
-
-		/** @SYMTraceFormatString "+CMountCB::Lock() drive %d aStore %d" */
-		ECMountCBLock,
-        /** @SYMTraceFormatString "-CMountCB::Lock() r %d" */
-        ECMountCBLockRet,
-
-		/** @SYMTraceFormatString "+CMountCB::Unlock() drive %d aStore %d" */
-		ECMountCBUnlock,
-        /** @SYMTraceFormatString "-CMountCB::Unlock() r %d" */
-        ECMountCBUnlockRet,
-
-		/** @SYMTraceFormatString "+CMountCB::ClearPassword() drive %d" */
-		ECMountCBClearPassword,
-        /** @SYMTraceFormatString "-CMountCB::ClearPassword() r %d" */
-        ECMountCBClearPasswordRet,
-
-		/** @SYMTraceFormatString "+CMountCB::ForceRemountDrive() drive %d aMountInfo %x aMountInfoMessageHandle %x aFlags %x" */
-		ECMountCBForceRemountDrive,
-        /** @SYMTraceFormatString "-CMountCB::ForceRemountDrive() r %d" */
-        ECMountCBForceRemountDriveRet,
-
-		/** @SYMTraceFormatString "+CMountCB::FinaliseMount1() drive %d" */
-		ECMountCBFinaliseMount1,
-        /** @SYMTraceFormatString "-CMountCB::FinaliseMount1() r %d" */
-        ECMountCBFinaliseMount1Ret,
-
-		/** @SYMTraceFormatString "+CMountCB::FinaliseMount2() drive %d" */
-		ECMountCBFinaliseMount2,
-        /** @SYMTraceFormatString "-CMountCB::FinaliseMount2() r %d" */
-        ECMountCBFinaliseMount2Ret,
-
-		/** @SYMTraceFormatString "+CMountCB::MountControl() drive %d aLevel %d aOption %x aParam %x" */
-		ECMountCBMountControl,
-        /** @SYMTraceFormatString "-CMountCB::MountControl() r %d" */
-        ECMountCBMountControlRet,
-
-		/** @SYMTraceFormatString "+CMountCB::ESQ_RequestFreeSpace() drive %d" */
-		ECMountCBFreeSpace,
-        /** @SYMTraceFormatString "-CMountCB::ESQ_RequestFreeSpace() r %d FreeSpace %ld" */
-        ECMountCBFreeSpaceRet,
-
-		/** @SYMTraceFormatString "+CMountCB::ESQ_GetCurrentFreeSpace() drive %d" */
-		ECMountCBCurrentFreeSpace,
-        /** @SYMTraceFormatString "-CMountCB::ESQ_GetCurrentFreeSpace() r %d FreeSpace %ld" */
-        ECMountCBCurrentFreeSpaceRet,
-
-		/** @SYMTraceFormatString "+CMountCB::ESQ_MountedVolumeSize() drive %d" */
-		ECMountCBVolumeSize,
-        /** @SYMTraceFormatString "-CMountCB::ESQ_MountedVolumeSize() r %d size %ld" */
-        ECMountCBVolumeSizeRet,
-
-		/** @SYMTraceFormatString "+CMountCB::ErasePassword() drive %d" */
-		ECMountCBErasePassword,
-        /** @SYMTraceFormatString "-CMountCB::ErasePassword() r %d" */
-        ECMountCBErasePasswordRet,
-
-		/** @SYMTraceFormatString "+CMountCB::GetInterface() drive %d aInterfaceId %d aInput %x" */
-		ECMountCBGetInterface,
-        /** @SYMTraceFormatString "-CMountCB::GetInterface() r %d aInterface %x" */
-        ECMountCBGetInterfaceRet,
-
-		/** @SYMTraceFormatString "+CFileCB::RenameL() this %x aNewName %*S" */
-		ECFileCBRenameL,
-        /** @SYMTraceFormatString "-CFileCB::RenameL() r %d" */
-        ECFileCBRenameLRet,
-
-		/** @SYMTraceFormatString "+CFileCB::ReadL() this %x aPos %ld aLength %d aDes %x threadId %x aOffset %x" */
-		ECFileCBReadL,
-        /** @SYMTraceFormatString "-CFileCB::ReadL() r %d" */
-        ECFileCBReadLRet,
-
-		/** @SYMTraceFormatString "+CFileCB::WriteL() this %x aPos %ld aLength %d aDes %x threadId %x aOffset %x" */
-		ECFileCBWriteL,
-        /** @SYMTraceFormatString "-CFileCB::WriteL() r %d" */
-        ECFileCBWriteLRet,
-
-		/** @SYMTraceFormatString "+CFileCB::SetSizeL() this %x aSize %ld" */
-		ECFileCBSetSizeL,
-        /** @SYMTraceFormatString "-CFileCB::SetSizeL() r %d" */
-        ECFileCBSetSizeLRet,
-
-		/** @SYMTraceFormatString "+CFileCB::SetEntryL() this %x aTime %lx aSetAttMask %x aClearAttMask %x" */
-		ECFileCBSetEntryL,
-        /** @SYMTraceFormatString "-CFileCB::SetEntryL() r %d" */
-        ECFileCBSetEntryLRet,
-
-		/** @SYMTraceFormatString "+CFileCB::FlushDataL() this %x" */
-		ECFileCBFlushDataL,
-        /** @SYMTraceFormatString "-CFileCB::FlushDataL() r %d" */
-        ECFileCBFlushDataLRet,
-
-		/** @SYMTraceFormatString "+CFileCB::GetInterface() aInterfaceId %d aInput %x" */
-		ECFileCBGetInterface,
-        /** @SYMTraceFormatString "-CFileCB::GetInterface() r %d aInterface %x" */
-        ECFileCBGetInterfaceRet,
-
-
-		/** @SYMTraceFormatString "+CDirCB::ReadL() this %x" */
-		ECDirCBReadL,
-        /** @SYMTraceFormatString "-CDirCB::ReadL() r %d att %x modified %lx size %d" */
-        ECDirCBReadLRet,
-
-		/** @SYMTraceFormatString "+CDirCB::StoreLongEntryNameL() this %x" */
-		ECDirCBStoreLongEntryNameL,
-        /** @SYMTraceFormatString "-CDirCB::StoreLongEntryNameL() r %d" */
-        ECDirCBStoreLongEntryNameLRet,
-
-
-		/** @SYMTraceFormatString "+CFormatCB::DoFormatStepL() this %x" */
-		ECFormatCBDoFormatStepL,
-        /** @SYMTraceFormatString "-CFormatCB::DoFormatStepL() r %d  iCurrentStep %d" */
-        ECFormatCBDoFormatStepLRet,
-
-
-
-
-
-        /**
-        Provided to allow the following compile time assert.
-        */
-        EFormatIdHighWaterMark,
-        };
-    __ASSERT_COMPILE(EFormatIdHighWaterMark <= (UTF::KMaxFormatId + 1));
-	}
-
-namespace UTraceModuleProxyDrive
-    {
-	/** 
-	@SYMTraceFormatCategory EF32TraceUidProxyDrive 
-    @SYMTraceFormatId
-    */
-    enum TFormatId
-        {
-		EReserved = UTF::KInitialClientFormat-1,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::New() aMount %x drive %d" */
-		ECLocalProxyDriveNew,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::New() proxyDrive %x" */
-        ECLocalProxyDriveNewRet,
-
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::Initialise() this %x" */
-		ECBaseExtProxyDriveInitialise,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::Initialise() r %d" */
-        ECBaseExtProxyDriveInitialiseRet,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::Initialise() this %x" */
-		ECLocalProxyDriveInitialise,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::Initialise() r %d" */
-        ECLocalProxyDriveInitialiseRet,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::ControlIO() this %x" */
-		ECBaseExtProxyDriveControlIO,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::ControlIO() r %d" */
-        ECBaseExtProxyDriveControlIORet,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::ControlIO() this %x" */
-		ECLocalProxyDriveControlIO,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::ControlIO() r %d" */
-        ECLocalProxyDriveControlIORet,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::Read1() this %x aPos %ld aLength %d aTrg %x threadId %x aOffset %x aFlags %x" */
-		ECBaseExtProxyDriveRead1,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::Read1() r %d" */
-        ECBaseExtProxyDriveRead1Ret,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::Read1() this %x aPos %ld aLength %d aTrg %x threadId %x aOffset %x aFlags %x" */
-		ECLocalProxyDriveRead1,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::Read1() r %d" */
-        ECLocalProxyDriveRead1Ret,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::Read2() this %x aPos %ld aLength %d aTrg %x threadId %x aOffset %x" */
-		ECBaseExtProxyDriveRead2,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::Read2() r %d" */
-        ECBaseExtProxyDriveRead2Ret,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::Read2() this %x aPos %ld aLength %d aTrg %x threadId %x aOffset %x" */
-		ECLocalProxyDriveRead2,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::Read2() r %d" */
-        ECLocalProxyDriveRead2Ret,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::Read3() this %x aPos %ld aLength %d aTrg %x" */
-		ECBaseExtProxyDriveRead3,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::Read3() r %d" */
-        ECBaseExtProxyDriveRead3Ret,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::Read3() this %x aPos %ld aLength %d aTrg %x" */
-		ECLocalProxyDriveRead3,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::Read3() r %d" */
-        ECLocalProxyDriveRead3Ret,
-
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::Write1() this %x aPos %ld aLength %d aSrc %x threadId %x aOffset %x aFlags %x" */
-		ECBaseExtProxyDriveWrite1,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::Write1() r %d" */
-        ECBaseExtProxyDriveWrite1Ret,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::Write1() this %x aPos %ld aLength %d aSrc %x threadId %x aOffset %x aFlags %x" */
-		ECLocalProxyDriveWrite1,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::Write1() r %d" */
-        ECLocalProxyDriveWrite1Ret,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::Write2() this %x aPos %ld aLength %d aSrc %x threadId %x aOffset %x" */
-		ECBaseExtProxyDriveWrite2,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::Write2() r %d" */
-        ECBaseExtProxyDriveWrite2Ret,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::Write2() this %x aPos %ld aLength %d aSrc %x threadId %x aOffset %x" */
-		ECLocalProxyDriveWrite2,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::Write2() r %d" */
-        ECLocalProxyDriveWrite2Ret,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::Write3() this %x aPos %ld aLength %d aSrc %x" */
-		ECBaseExtProxyDriveWrite3,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::Write3() r %d" */
-        ECBaseExtProxyDriveWrite3Ret,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::Write3() this %x aPos %ld aLength %d aSrc %x" */
-		ECLocalProxyDriveWrite3,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::Write3() r %d" */
-        ECLocalProxyDriveWrite3Ret,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::Dismounted() this %x" */
-		ECBaseExtProxyDriveDismounted,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::Dismounted() r %d" */
-        ECBaseExtProxyDriveDismountedRet,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::Dismounted() this %x" */
-		ECLocalProxyDriveDismounted,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::Dismounted() r %d" */
-        ECLocalProxyDriveDismountedRet,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::Enlarge() this %x aLength %d" */
-		ECBaseExtProxyDriveEnlarge,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::Enlarge() r %d" */
-        ECBaseExtProxyDriveEnlargeRet,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::Enlarge() this %x aLength %d" */
-		ECLocalProxyDriveEnlarge,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::Enlarge() r %d" */
-        ECLocalProxyDriveEnlargeRet,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::ReduceSize() this %x aPos %d aLength %d" */
-		ECBaseExtProxyDriveReduceSize,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::ReduceSize() r %d" */
-        ECBaseExtProxyDriveReduceSizeRet,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::ReduceSize() this %x aPos %d aLength %d" */
-		ECLocalProxyDriveReduceSize,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::ReduceSize() r %d" */
-        ECLocalProxyDriveReduceSizeRet,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::Caps() this %x" */
-		ECBaseExtProxyDriveCaps,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::Caps() r %d" */
-        ECBaseExtProxyDriveCapsRet,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::Caps() this %x" */
-		ECLocalProxyDriveCaps,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::Caps() r %d" */
-        ECLocalProxyDriveCapsRet,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::Format1() this %x" */
-		ECBaseExtProxyDriveFormat1,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::Format1() r %d iFormatIsCurrent %d i512ByteSectorsFormatted %d iMaxBytesPerFormat %d" */
-        ECBaseExtProxyDriveFormat1Ret,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::Format1() this %x" */
-		ECLocalProxyDriveFormat1,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::Format1() r %d iFormatIsCurrent %d i512ByteSectorsFormatted %d iMaxBytesPerFormat %d" */
-        ECLocalProxyDriveFormat1Ret,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::Format2() this %x aPos %ld aLength %d" */
-		ECBaseExtProxyDriveFormat2,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::Format2() r %d" */
-        ECBaseExtProxyDriveFormat2Ret,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::Format2() this %x aPos %ld aLength %d" */
-		ECLocalProxyDriveFormat2,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::Format2() r %d" */
-        ECLocalProxyDriveFormat2Ret,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::SetMountInfo() this %x" */
-		ECBaseExtProxyDriveSetMountInfo,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::SetMountInfo() r %d" */
-        ECBaseExtProxyDriveSetMountInfoRet,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::SetMountInfo() this %x" */
-		ECLocalProxyDriveSetMountInfo,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::SetMountInfo() r %d" */
-        ECLocalProxyDriveSetMountInfoRet,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::ForceRemount() this %x" */
-		ECBaseExtProxyDriveForceRemount,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::ForceRemount() r %d" */
-        ECBaseExtProxyDriveForceRemountRet,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::ForceRemount() this %x" */
-		ECLocalProxyDriveForceRemount,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::ForceRemount() r %d" */
-        ECLocalProxyDriveForceRemountRet,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::Unlock() this %x aPassword %d" */
-		ECBaseExtProxyDriveUnlock,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::Unlock() r %d" */
-        ECBaseExtProxyDriveUnlockRet,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::Unlock() this %x aPassword %d" */
-		ECLocalProxyDriveUnlock,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::Unlock() r %d" */
-        ECLocalProxyDriveUnlockRet,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::Lock() this %x aPassword %d" */
-		ECBaseExtProxyDriveLock,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::Lock() r %d" */
-        ECBaseExtProxyDriveLockRet,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::Lock() this %x aPassword %d" */
-		ECLocalProxyDriveLock,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::Lock() r %d" */
-        ECLocalProxyDriveLockRet,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::Clear() this %x" */
-		ECBaseExtProxyDriveClear,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::Clear() r %d" */
-        ECBaseExtProxyDriveClearRet,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::Clear() this %x" */
-		ECLocalProxyDriveClear,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::Clear() r %d" */
-        ECLocalProxyDriveClearRet,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::ErasePassword() this %x" */
-		ECBaseExtProxyDriveErasePassword,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::ErasePassword() r %d" */
-        ECBaseExtProxyDriveErasePasswordRet,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::ErasePassword() this %x" */
-		ECLocalProxyDriveErasePassword,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::ErasePassword() r %d" */
-        ECLocalProxyDriveErasePasswordRet,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::DeleteNotify() this %x aPos %ld aLength %d" */
-		ECBaseExtProxyDriveDeleteNotify,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::DeleteNotify() r %d" */
-        ECBaseExtProxyDriveDeleteNotifyRet,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::DeleteNotify() this %x aPos %ld aLength %d" */
-		ECLocalProxyDriveDeleteNotify,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::DeleteNotify() r %d" */
-        ECLocalProxyDriveDeleteNotifyRet,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::GetLastErrorInfo() this %x" */
-		ECBaseExtProxyDriveGetLastErrorInfo,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::GetLastErrorInfo() r %d" */
-        ECBaseExtProxyDriveGetLastErrorInfoRet,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::GetLastErrorInfo() this %x" */
-		ECLocalProxyDriveGetLastErrorInfo,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::GetLastErrorInfo() r %d" */
-        ECLocalProxyDriveGetLastErrorInfoRet,
-
-		/** @SYMTraceFormatString "+CBaseExtProxyDrive::GetInterface() this %x aInterfaceId %d aInput %x" */
-		ECBaseExtProxyDriveGetInterface,
-        /** @SYMTraceFormatString "-CBaseExtProxyDrive::GetInterface() r %d aInterface %x" */
-        ECBaseExtProxyDriveGetInterfaceRet,
-
-		/** @SYMTraceFormatString "+CLocalProxyDrive::GetInterface() this %x aInterfaceId %d aInput %x" */
-		ECLocalProxyDriveGetInterface,
-        /** @SYMTraceFormatString "-CLocalProxyDrive::GetInterface() r %d aInterface %x" */
-        ECLocalProxyDriveGetInterfaceRet,
-
-
-
-
-        /**
-        Provided to allow the following compile time assert.
-        */
-        EFormatIdHighWaterMark,
-        };
-    __ASSERT_COMPILE(EFormatIdHighWaterMark <= (UTF::KMaxFormatId + 1));
-
-
-
-    } // end of namespace UTraceModuleFileSys
-
-	
-#endif // UTRACEEFILE_H
--- a/userlibandfileserver/fileserver/inc/utraceefsrv.h	Wed Jul 21 14:46:58 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,995 +0,0 @@
-
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// File Server client-side tracing
-// 
-//
-
-/**
- @file
- @publishedPartner
- @prototype
-*/
-
-#ifndef UTRACEEFSRV_H
-#define UTRACEEFSRV_H
-
-
-#include <f32tracedef.h>
-
-#define MODULEUID EF32TraceUidEfsrv
-
-
-/**
-This defines trace attributes to be used by trace points within the efsrv.dll executable.
-*/
-namespace UTraceModuleEfsrv
-    {
-
-	/** 
-	@SYMTraceFormatCategory EF32TraceUidEfsrv 
-	*/
-
-
-
-    /**
-    @SYMTraceFormatId
-    */
-    enum TFormatId
-        {
-		EReserved = UTF::KInitialClientFormat-1,
-
-        /** @SYMTraceFormatString "+RFile::Replace() sess %x mode %x FileName %*S" */
-		EFileReplace,
-        /** @SYMTraceFormatString "-RFile::Replace() r %d subs %x" */
-        EFileReplaceReturn,
-
-        /** @SYMTraceFormatString "+RFile::Create() sess %x mode %x FileName %*S" */
-		EFileCreate,
-        /** @SYMTraceFormatString "-RFile::Create() r %d subs %x" */
-        EFileCreateReturn,
-
-        /** @SYMTraceFormatString "+RFile::Open() sess %x mode %x FileName %*S" */
-		EFileOpen,
-        /** @SYMTraceFormatString "-RFile::Open() r %d subs %x" */
-        EFileOpenReturn,
-
-        /** @SYMTraceFormatString "+RFile::Adopt() sess %x subs %x" */
-        EFileAdopt,
-        /** @SYMTraceFormatString "-RFile::Adopt() r %d sess %x subs %x" */
-        EFileAdoptReturn,
-
-        /** @SYMTraceFormatString "+RFile::AdoptFromServer() sess %x subs %x" */
-        EFileAdoptFromServer,
-        /** @SYMTraceFormatString "-RFile::AdoptFromServer() r %d sess %x subs %x" */
-        EFileAdoptFromServerReturn,
-
-        /** @SYMTraceFormatString "+RFile::AdoptFromClient() sess %x subs %x aFsHandleIndex %d aFileHandleIndex %d " */
-        EFileAdoptFromClient,
-        /** @SYMTraceFormatString "-RFile::AdoptFromClient() r %d sess %x subs %x" */
-        EFileAdoptFromClientReturn,
-
-        /** @SYMTraceFormatString "+RFile::AdoptFromCreator() subs %x aFsHandleIndex %d aFileHandleIndex %d" */
-        EFileAdoptFromCreator,
-        /** @SYMTraceFormatString "-RFile::AdoptFromCreator() r %d sess %x subs %x" */
-        EFileAdoptFromCreatorReturn,
-
-        /** @SYMTraceFormatString "+RFile::Duplicate() sess %x subs %x aType %d" */
-        EFileDuplicate,
-        /** @SYMTraceFormatString "-RFile::Duplicate() r %d sess %x subs %x" */
-        EFileDuplicateReturn,
-
-        
-        /** @SYMTraceFormatString "+RFile::TransferToServer() sess %x subs %x aFsHandleIndex %d aFileHandleIndex %d" */
-        EFileTransferToServer,
-        /** @SYMTraceFormatString "-RFile::TransferToServer() r %d" */
-        EFileTransferToServerReturn,
-
-        /** @SYMTraceFormatString "+RFile::TransferToClient() sess %x subs %x aFileHandleIndex %d" */
-        EFileTransferToClient,
-        /** @SYMTraceFormatString "-RFile::TransferToClient() r %d" */
-        EFileTransferToClientReturn,
-
-        /** @SYMTraceFormatString "+RFile::TransferToProcess() sess %x subs %x aFsHandleIndex %d aFileHandleIndex %d" */
-        EFileTransferToProcess,
-        /** @SYMTraceFormatString "-RFile::TransferToProcess() r %d" */
-        EFileTransferToProcessReturn,
-
-		
-		/** @SYMTraceFormatString "+RFile::Name() sess %x subs %x" */
-        EFileName,
-		/** @SYMTraceFormatString "-RFile::Name() r %d aName %*S" */
-        EFileNameReturn,
-
-		/** @SYMTraceFormatString "+RFile::FullName() sess %x subs %x" */
-        EFileFullName,
-		/** @SYMTraceFormatString "-RFile::FullName() r %d aName %*S" */
-        EFileFullNameReturn,
-
-		
-		
-		/** @SYMTraceFormatString "+RFile::Temp() sess %x aPath %*S aMode %x" */
-        EFileTemp,
-        /** @SYMTraceFormatString "-RFile::Temp() r %d subs %x aName %*S" */
-        EFileTempReturn,
-
-
-        /** @SYMTraceFormatString "+RFile::Write1() sess %x subs %x len %d" */
-        EFileWrite1,
-		/** @SYMTraceFormatString "-RFile::Write1() r %d" */
-        EFileWrite1Return,
-		
-        /** @SYMTraceFormatString "+RFile::Write2() sess %x subs %x len %d status %x" */
-        EFileWrite2,
-		/** @SYMTraceFormatString "-RFile::Write2()" */
-        EFileWrite2Return,
-		
-        /** @SYMTraceFormatString "+RFile::Write3() sess %x subs %x pos %ld len %d" */
-        EFileWrite3,
-		/** @SYMTraceFormatString "-RFile::Write3() r %d" */
-        EFileWrite3Return,
-		
-        /** @SYMTraceFormatString "+RFile::Write4() sess %x subs %x pos %ld len %d status %x" */
-        EFileWrite4,
-		/** @SYMTraceFormatString "-RFile::Write4()" */
-        EFileWrite4Return,
-		
-
-
-
-        /** @SYMTraceFormatString "+RFile::Read1() sess %x subs %x maxlen %d" */
-        EFileRead1,
-		/** @SYMTraceFormatString "-RFile::Read1() r %d len %d" */
-        EFileRead1Return,
-
-        /** @SYMTraceFormatString "+RFile::Read2() sess %x subs %x maxlen %d status %x" */
-        EFileRead2,
-		/** @SYMTraceFormatString "-RFile::Read2()" */
-        EFileRead2Return,
-
-        /** @SYMTraceFormatString "+RFile::Read3() sess %x subs %x aPos %ld maxlen %d" */
-        EFileRead3,
-		/** @SYMTraceFormatString "-RFile::Read3() r %d len %d" */
-        EFileRead3Return,
-
-        /** @SYMTraceFormatString "+RFile::Read4() sess %x subs %x aPos %ld maxlen %d status %x" */
-        EFileRead4,
-		/** @SYMTraceFormatString "-RFile::Read4()" */
-        EFileRead4Return,
-
-
-
-
-
-		/** @SYMTraceFormatString "+RFile::Lock() sess %x subs %x aPos %ld aLength %d" */
-        EFileLock,
-        /** @SYMTraceFormatString "-RFile::Lock() r %d" */
-        EFileLockReturn,
-
-		/** @SYMTraceFormatString "+RFile::UnLock() sess %x subs %x aPos %ld aLength %d" */
-        EFileUnLock,
-        /** @SYMTraceFormatString "-RFile::UnLock() r %d" */
-        EFileUnLockReturn,
-
-		/** @SYMTraceFormatString "+RFile::Seek() sess %x subs %x aMode %x aPos %ld" */
-        EFileSeek,
-        /** @SYMTraceFormatString "-RFile::Seek() r %d" */
-        EFileSeekReturn,
-
-		/** @SYMTraceFormatString "+RFile::Flush() sess %x subs %x status %x" */
-        EFileFlush,
-        /** @SYMTraceFormatString "-RFile::Flush() r %d" */
-        EFileFlushReturn,
-
-		/** @SYMTraceFormatString "+RFile::Size1() sess %x subs %x" */
-        EFileSize,
-        /** @SYMTraceFormatString "-RFile::Size1() r %d aSize %d" */
-        EFileSizeReturn,
-
-		/** @SYMTraceFormatString "+RFile::Size2() sess %x subs %x" */
-        EFileSize2,
-        /** @SYMTraceFormatString "-RFile::Size2() r %d aSize %ld" */
-        EFileSize2Return,
-
-		/** @SYMTraceFormatString "+RFile::SetSize() sess %x subs %x aSize %ld" */
-        EFileSetSize,
-        /** @SYMTraceFormatString "-RFile::SetSize() r %d" */
-        EFileSetSizeReturn,
-
-		/** @SYMTraceFormatString "+RFile::Att() sess %x subs %x" */
-        EFileAtt,
-        /** @SYMTraceFormatString "-RFile::Att() r %d aVal %x" */
-        EFileAttReturn,
-
-		/** @SYMTraceFormatString "+RFile::SetAtt() sess %x subs %x aSetAttMask %x aClearAttMask %x" */
-        EFileSetAtt,
-        /** @SYMTraceFormatString "-RFile::SetAtt() r %d" */
-        EFileSetAttReturn,
-
-		/** @SYMTraceFormatString "+RFile::Modified() sess %x subs %x" */
-        EFileModified,
-        /** @SYMTraceFormatString "-RFile::Modified() r %d aTime %lx" */
-        EFileModifiedReturn,
-
-		/** @SYMTraceFormatString "+RFile::SetModified() sess %x subs %x aTime %lx" */
-        EFileSetModified,
-        /** @SYMTraceFormatString "-RFile::SetModified() r %d" */
-        EFileSetModifiedReturn,
-
-		/** @SYMTraceFormatString "+RFile::Set() sess %x subs %x aTime %lx aSetAttMask %x aClearAttMask %x" */
-        EFileSet,
-        /** @SYMTraceFormatString "-RFile::Set() r %d" */
-        EFileSetReturn,
-
-		/** @SYMTraceFormatString "+RFile::ChangeMode() sess %x subs %x aNewMode %x" */
-        EFileChangeMode,
-        /** @SYMTraceFormatString "-RFile::ChangeMode() r %d" */
-        EFileChangeModeReturn,
-
-		/** @SYMTraceFormatString "+RFile::Rename() sess %x subs %x aNewName %*S" */
-        EFileRename,
-        /** @SYMTraceFormatString "-RFile::Rename() r %d" */
-        EFileRenameReturn,
-
-		/** @SYMTraceFormatString "+RFile::Drive() sess %x subs %x" */
-        EFileDrive,
-        /** @SYMTraceFormatString "-RFile::Drive() r %d driveAtt %x mediaAtt %x type %x" */
-        EFileDriveReturn,
-
-		/** @SYMTraceFormatString "+RFile::Clamp() sess %x subs %x" */
-        EFileClamp,
-        /** @SYMTraceFormatString "-RFile::Clamp() r %d" */
-        EFileClampReturn,
-
-		/** @SYMTraceFormatString "+RFile::BlockMap() sess %x subs %x aStartPos %ld aEndPos %ld aBlockMapusage %d" */
-        EFileBlockMap,
-        /** @SYMTraceFormatString "-RFile::BlockMap() r %d" */
-        EFileBlockMapReturn,
-
-		/** @SYMTraceFormatString "+RFile::Close() sess %x subs %x" */
-        EFileClose,
-        /** @SYMTraceFormatString "-RFile::Close()" */
-        EFileCloseReturn,
-
-
-
-		/** @SYMTraceFormatString "+RFS::DriveToChar() aDrive %d" */
-		EFsDriveToChar,
-		/** @SYMTraceFormatString "-RFs::DriveToChar() r %d aChar %c" */
-		EFsDriveToCharReturn,
-		/** @SYMTraceFormatString "+RFs::IsRomAddress() aPtr %x" */
-		EFsIsRomAddress,
-		/** @SYMTraceFormatString "-RFS::IsRomAddress() r %d" */
-		EFsIsRomAddressReturn,
-		/** @SYMTraceFormatString "+RFs::GetSystemDrive()" */
-		EFsGetSystemDrive,
-		/** @SYMTraceFormatString "-RFs::GetSystemDrive() r %d" */
-		EFsGetSystemDriveReturn,
-		/** @SYMTraceFormatString "+RFs::GetSystemDriveChar()" */
-		EFsGetSystemDriveChar,
-		/** @SYMTraceFormatString "-RFs::GetSystemDriveChar() r %c" */
-		EFsGetSystemDriveCharReturn,
-		/** @SYMTraceFormatString "+RFs::SetSystemDrive() sess %x" */
-		EFsSetSystemDrive,
-		/** @SYMTraceFormatString "-RFs::SetSystemDrive() r %d" */
-		EFsSetSystemDriveReturn,
-		/** @SYMTraceFormatString "+RFs::Connect()" */
-		EFsConnect,
-		/** @SYMTraceFormatString "-RFs::Connect() r %d sess %x" */
-		EFsConnectReturn,
-		/** @SYMTraceFormatString "+RFs::SetSessionToPrivate() sess %x" */
-		EFsSetSessionToPrivate,
-		/** @SYMTraceFormatString "-RFs::SetSessionToPrivate() r %d" */
-		EFsSetSessionToPrivateReturn,
-		/** @SYMTraceFormatString "+RFs::PrivatePath() sess %x" */
-		EFsPrivatePath,
-		/** @SYMTraceFormatString "-RFs::PrivatePath() r %d aPath %*S" */
-		EFsPrivatePathReturn,
-		/** @SYMTraceFormatString "+RFs::CreatePrivatePath() sess %x aDrive %d" */
-		EFsCreatePrivatePath,
-		/** @SYMTraceFormatString "-RFs::CreatePrivatePath() r %d" */
-		EFsCreatePrivatePathReturn,
-		/** @SYMTraceFormatString "+RFs::Version() sess %x" */
-		EFsVersion,
-		/** @SYMTraceFormatString "-RFs::Version() iMajor %d iMinor %d iBuild %d" */
-		EFsVersionReturn,
-		/** @SYMTraceFormatString "+RFs::AddFileSystem() sess %x aFileName %*S" */
-		EFsAddFileSystem,
-		/** @SYMTraceFormatString "-RFs::AddFileSystem() r %d" */
-		EFsAddFileSystemReturn,
-		/** @SYMTraceFormatString "+RFs::RemoveFileSystem() sess %x aFileName %*S" */
-		EFsRemoveFileSystem,
-		/** @SYMTraceFormatString "-RFs::RemoveFileSystem() r %d" */
-		EFsRemoveFileSystemReturn,
-		/** @SYMTraceFormatString "+RFs::MountFileSystem1() sess %x aFileSystemName %*S aDrive %d" */
-		EFsMountFileSystem1,
-		/** @SYMTraceFormatString "-RFs::MountFileSystem1() r %d" */
-		EFsMountFileSystem1Return,
-		/** @SYMTraceFormatString "+RFs::MountFileSystem2() sess %x aFileSystemName %*S aDrive %d aIsSync %d" */
-		EFsMountFileSystem2,
-		/** @SYMTraceFormatString "-RFs::MountFileSystem2() r %d" */
-		EFsMountFileSystem2Return,
-		/** @SYMTraceFormatString "+RFs::MountFileSystem3() sess %x aFileSystemName %*S aExtensionName %*S aDrive %d" */
-		EFsMountFileSystem3,
-		/** @SYMTraceFormatString "-RFs::MountFileSystem3() r %d" */
-		EFsMountFileSystem3Return,
-		/** @SYMTraceFormatString "+RFs::MountFileSystem4() sess %x aFileSystemName %*S aExtensionName %*S aDrive %d aIsSync %d" */
-		EFsMountFileSystem4,
-		/** @SYMTraceFormatString "-RFs::MountFileSystem4() r %d" */
-		EFsMountFileSystem4Return,
-		/** @SYMTraceFormatString "+RFs::MountFileSystemAndScan1() sess %x aFileSystemName %*S aDrive %d" */
-		EFsMountFileSystemAndScan1,
-		/** @SYMTraceFormatString "-RFs::MountFileSystemAndScan1() r %d" */
-		EFsMountFileSystemAndScan1Return,
-		/** @SYMTraceFormatString "+RFs::MountFileSystemAndScan2() sess %x aFileSystemName %*S aExtensionName %*S aDrive %d " */
-		EFsMountFileSystemAndScan2,
-		/** @SYMTraceFormatString "-RFs::MountFileSystemAndScan2() r %d aIsMountSuccess %d" */
-		EFsMountFileSystemAndScan2Return,
-		/** @SYMTraceFormatString "+RFs::DismountFileSystem() sess %x aFileSystemName %*S aDrive %d" */
-		EFsDismountFileSystem,
-		/** @SYMTraceFormatString "-RFs::DismountFileSystem() r %d" */
-		EFsDismountFileSystemReturn,
-		/** @SYMTraceFormatString "+RFs::FileSystemName() sess %x aDrive %d" */
-		EFsFileSystemName,
-		/** @SYMTraceFormatString "-RFs::FileSystemName() r %d aName %*S" */
-		EFsFileSystemNameReturn,
-		/** @SYMTraceFormatString "+RFs::AddExtension() sess %x aFileName %*S" */
-		EFsAddExtension,
-		/** @SYMTraceFormatString "-RFs::AddExtension() r %d" */
-		EFsAddExtensionReturn,
-		/** @SYMTraceFormatString "+RFs::MountExtension() sess %x aExtensionName %*S aDrive %d" */
-		EFsMountExtension,
-		/** @SYMTraceFormatString "-RFs::MountExtension() r %d" */
-		EFsMountExtensionReturn,
-		/** @SYMTraceFormatString "+RFs::DismountExtension() sess %x aExtensionName %*S aDrive %d" */
-		EFsDismountExtension,
-		/** @SYMTraceFormatString "-RFs::DismountExtension() r %d" */
-		EFsDismountExtensionReturn,
-		/** @SYMTraceFormatString "+RFs::RemoveExtension() sess %x aExtensionName %*S" */
-		EFsRemoveExtension,
-		/** @SYMTraceFormatString "-RFs::RemoveExtension() r %d" */
-		EFsRemoveExtensionReturn,
-		/** @SYMTraceFormatString "+RFs::ExtensionName() sess %x aExtensionName %*S aDrive %d aPos %d" */
-		EFsExtensionName,
-		/** @SYMTraceFormatString "-RFs::ExtensionName() r %d" */
-		EFsExtensionNameReturn,
-		/** @SYMTraceFormatString "+RFs::RemountDrive() sess %x aDrive %d aMountInfo %x aFlags %x" */
-		EFsRemountDrive,
-		/** @SYMTraceFormatString "-RFs::RemountDrive() r %d" */
-		EFsRemountDriveReturn,
-		/** @SYMTraceFormatString "+RFs::NotifyChange1() sess %x aType %x status %x" */
-		EFsNotifyChange1,
-		/** @SYMTraceFormatString "-RFs::NotifyChange1() r %d" */
-		EFsNotifyChange1Return,
-		/** @SYMTraceFormatString "+RFs::NotifyChange2() sess %x aType %x status %x aPathName %*S" */
-		EFsNotifyChange2,
-		/** @SYMTraceFormatString "-RFs::NotifyChange2() r %d" */
-		EFsNotifyChange2Return,
-		/** @SYMTraceFormatString "+RFs::NotifyChangeCancel1() sess %x" */
-		EFsNotifyChangeCancel1,
-		/** @SYMTraceFormatString "-RFs::NotifyChangeCancel1() r %d" */
-		EFsNotifyChangeCancel1Return,
-		/** @SYMTraceFormatString "+RFs::NotifyChangeCancel2() sess %x status %x" */
-		EFsNotifyChangeCancel2,
-		/** @SYMTraceFormatString "-RFs::NotifyChangeCancel2() r %d" */
-		EFsNotifyChangeCancel2Return,
-		/** @SYMTraceFormatString "+RFs::NotifyDiskSpace() sess %x aThreshold %ld aDrive %d status %x" */
-		EFsNotifyDiskSpace,
-		/** @SYMTraceFormatString "-RFs::NotifyDiskSpace() r %d" */
-		EFsNotifyDiskSpaceReturn,
-		/** @SYMTraceFormatString "+RFs::NotifyDiskSpaceCancel1() sess %x status %x" */
-		EFsNotifyDiskSpaceCancel1,
-		/** @SYMTraceFormatString "-RFs::NotifyDiskSpaceCancel1() r %d" */
-		EFsNotifyDiskSpaceCancel1Return,
-		/** @SYMTraceFormatString "+RFs::NotifyDiskSpaceCancel2() sess %x" */
-		EFsNotifyDiskSpaceCancel2,
-		/** @SYMTraceFormatString "-RFs::NotifyDiskSpaceCancel2() r %d" */
-		EFsNotifyDiskSpaceCancel2Return,
-		/** @SYMTraceFormatString "+RFs::DriveList1() sess %x" */
-		EFsDriveList1,
-		/** @SYMTraceFormatString "-RFs::DriveList1() r %d" */
-		EFsDriveList1Return,
-		/** @SYMTraceFormatString "+RFs::DriveList2() sess %x aFlags %x" */
-		EFsDriveList2,
-		/** @SYMTraceFormatString "-RFs::DriveList2() r %d" */
-		EFsDriveList2Return,
-		/** @SYMTraceFormatString "+RFs::Drive() sess %x aDrive %d" */
-		EFsDrive,
-		/** @SYMTraceFormatString "-RFs::Drive() r %d driveAtt %x mediaAtt %x type %x" */
-		EFsDriveReturn,
-		/** @SYMTraceFormatString "+RFs::Volume1() sess %x aDrive %d" */
-		EFsVolume1,
-		/** @SYMTraceFormatString "-RFs::Volume1() r %d iUniqueID %x iSize %ld iFree %ld iFileCacheFlags %x" */
-		EFsVolume1Return,
-		/** @SYMTraceFormatString "+RFs::Volume2() sess %x aDrive %d status %x" */
-		EFsVolume2,
-		/** @SYMTraceFormatString "-RFs::Volume2() r %d" */
-		EFsVolume2Return,
-		/** @SYMTraceFormatString "+RFs::SetVolumeLabel() sess %x aName %*S aDrive %d" */
-		EFsSetVolumeLabel,
-		/** @SYMTraceFormatString "-RFs::SetVolumeLabel() r %d" */
-		EFsSetVolumeLabelReturn,
-		/** @SYMTraceFormatString "+RFs::Subst() sess %x aPath %*S aDrive %d" */
-		EFsSubst,
-		/** @SYMTraceFormatString "-RFs::Subst() r %d" */
-		EFsSubstReturn,
-		/** @SYMTraceFormatString "+RFs::SetSubst() sess %x aPath %%S aDrive %d" */
-		EFsSetSubst,
-		/** @SYMTraceFormatString "-RFs::SetSubst() r %d" */
-		EFsSetSubstReturn,
-		/** @SYMTraceFormatString "+RFs::RealName() sess %x aName %*S" */
-		EFsRealName,
-		/** @SYMTraceFormatString "-RFs::RealName() r %d aResult %*S" */
-		EFsRealNameReturn,
-		/** @SYMTraceFormatString "+RFs::GetMediaSerialNumber() sess %x aDrive %d" */
-		EFsGetMediaSerialNumber,
-		/** @SYMTraceFormatString "-RFs::GetMediaSerialNumber() r %d aSerialNum %*x" */
-		EFsGetMediaSerialNumberReturn,
-		/** @SYMTraceFormatString "+RFs::SessionPath() sess %x" */
-		EFsSessionPath,
-		/** @SYMTraceFormatString "-RFs::SessionPath() r %d aPath %*S" */
-		EFsSessionPathReturn,
-		/** @SYMTraceFormatString "+RFs::SetSessionPath() sess %x aPath %*S" */
-		EFsSetSessionPath,
-		/** @SYMTraceFormatString "-RFs::SetSessionPath() r %d" */
-		EFsSetSessionPathReturn,
-		/** @SYMTraceFormatString "+RFs::MkDir() sess %x aPath %*S" */
-		EFsMkDir,
-		/** @SYMTraceFormatString "-RFs::MkDir() r %d" */
-		EFsMkDirReturn,
-		/** @SYMTraceFormatString "+RFs::MkDirAll() sess %x aPath %*S" */
-		EFsMkDirAll,
-		/** @SYMTraceFormatString "-RFs::MkDirAll() r %d" */
-		EFsMkDirAllReturn,
-		/** @SYMTraceFormatString "+RFs::RmDir() sess %x aPath %*S" */
-		EFsRmDir,
-		/** @SYMTraceFormatString "-RFs::RmDir() r %d" */
-		EFsRmDirReturn,
-		/** @SYMTraceFormatString "+RFs::GetDir1() sess %x aName %*S aUidType0 %x aUidType1 %x aUidType2 %x aKey %x" */
-		EFsGetDir1,
-		/** @SYMTraceFormatString "-RFs::GetDir1() r %d" */
-		EFsGetDir1Return,
-		/** @SYMTraceFormatString "+RFs::GetDir2() sess %x aName %*S anAttMask %x aKey %x" */
-		EFsGetDir2,
-		/** @SYMTraceFormatString "-RFs::GetDir2() r %d" */
-		EFsGetDir2Return,
-		/** @SYMTraceFormatString "+RFs::GetDir3() sess %x aName %*S anAttMask %x aKey %x" */
-		EFsGetDir3,
-		/** @SYMTraceFormatString "-RFs::GetDir3() r %d" */
-		EFsGetDir3Return,
-		/** @SYMTraceFormatString "+RFs::Parse1() sess %x aName %*S" */
-		EFsParse1,
-		/** @SYMTraceFormatString "-RFs::Parse1() r %d" */
-		EFsParse1Return,
-		/** @SYMTraceFormatString "+RFs::Parse2() sess %x aName %*S aRelated %*S" */
-		EFsParse2,
-		/** @SYMTraceFormatString "-RFs::Parse2() r %d" */
-		EFsParse2Return,
-		/** @SYMTraceFormatString "+RFs::Delete() sess %x aName %*S" */
-		EFsDelete,
-		/** @SYMTraceFormatString "-RFs::Delete() r %d" */
-		EFsDeleteReturn,
-		/** @SYMTraceFormatString "+RFs::Rename() sess %x anOldName %*S aNewName %*S" */
-		EFsRename,
-		/** @SYMTraceFormatString "-RFs::Rename() r %d" */
-		EFsRenameReturn,
-		/** @SYMTraceFormatString "+RFs::Replace() sess %x anOldName %*S aNewName %*S" */
-		EFsReplace,
-		/** @SYMTraceFormatString "-RFs::Replace() r %d" */
-		EFsReplaceReturn,
-		/** @SYMTraceFormatString "+RFs::Att() sess %x aName %*S" */
-		EFsAtt,
-		/** @SYMTraceFormatString "-RFs::Att() r %d aVal %x" */
-		EFsAttReturn,
-		/** @SYMTraceFormatString "+RFs::SetAtt() sess %x aName %*S aSetAttMask %x aClearAttMask %x" */
-		EFsSetAtt,
-		/** @SYMTraceFormatString "-RFs::SetAtt() r %d" */
-		EFsSetAttReturn,
-		/** @SYMTraceFormatString "+RFs::Modified() sess %x aName %*S" */
-		EFsModified,
-		/** @SYMTraceFormatString "-RFs::Modified() r %d aTime %lx" */
-		EFsModifiedReturn,
-		/** @SYMTraceFormatString "+RFs::SetModified() sess %x aName %*S aTime %lx" */
-		EFsSetModified,
-		/** @SYMTraceFormatString "-RFs::SetModified() r %d" */
-		EFsSetModifiedReturn,
-		/** @SYMTraceFormatString "+RFs::Entry() sess %x aName %*S" */
-		EFsEntry,
-		/** @SYMTraceFormatString "-RFs::Entry() r %d att %x modified %lx size %d" */
-		EFsEntryReturn,
-		/** @SYMTraceFormatString "+RFs::SetEntry() sess %x aName %*S aTime %lx aSetAttMask %x aClearAttMask %x" */
-		EFsSetEntry,
-		/** @SYMTraceFormatString "-RFs::SetEntry() r %d" */
-		EFsSetEntryReturn,
-		/** @SYMTraceFormatString "+RFs::ReadFileSection() sess %x aName %*S aPos %ld aLength %d" */
-		EFsReadFileSection,
-		/** @SYMTraceFormatString "-RFs::ReadFileSection() r %d" */
-		EFsReadFileSectionReturn,
-		/** @SYMTraceFormatString "+RFs::ResourceCountMarkStart() sess %x" */
-		EFsResourceCountMarkStart,
-		/** @SYMTraceFormatString "-RFs::ResourceCountMarkStart() r %d" */
-		EFsResourceCountMarkStartReturn,
-		/** @SYMTraceFormatString "+RFs::ResourceCountMarkEnd() sess %x" */
-		EFsResourceCountMarkEnd,
-		/** @SYMTraceFormatString "-RFs::ResourceCountMarkEnd() r %d" */
-		EFsResourceCountMarkEndReturn,
-		/** @SYMTraceFormatString "+RFs::ResourceCount() sess %x" */
-		EFsResourceCount,
-		/** @SYMTraceFormatString "-RFs::ResourceCount() r %d" */
-		EFsResourceCountReturn,
-		/** @SYMTraceFormatString "+RFs::CheckDisk() sess %x aDrive %*S" */
-		EFsCheckDisk,
-		/** @SYMTraceFormatString "-RFs::CheckDisk() r %d" */
-		EFsCheckDiskReturn,
-		/** @SYMTraceFormatString "+RFs::ScanDrive() sess %x aDrive %*S" */
-		EFsScanDrive,
-		/** @SYMTraceFormatString "-RFs::ScanDrive() r %d" */
-		EFsScanDriveReturn,
-		/** @SYMTraceFormatString "+RFs::GetShortName() sess %x aLongName %*S" */
-		EFsGetShortName,
-		/** @SYMTraceFormatString "-RFs::GetShortName() r %d aShortName %*S" */
-		EFsGetShortNameReturn,
-		/** @SYMTraceFormatString "+RFs::GetLongName() sess %x aShortName %*S" */
-		EFsGetLongName,
-		/** @SYMTraceFormatString "-RFs::GetLongName() r %d aLongName %*S" */
-		EFsGetLongNameReturn,
-		/** @SYMTraceFormatString "+RFs::IsFileOpen() sess %x aFileName %*S" */
-		EFsIsFileOpen,
-		/** @SYMTraceFormatString "-RFs::IsFileOpen() r %d anAnswer %d" */
-		EFsIsFileOpenReturn,
-		/** @SYMTraceFormatString "+RFs::GetNotifyUser() sess %x" */
-		EFsGetNotifyUser,
-		/** @SYMTraceFormatString "-RFs::GetNotifyUser() r %d" */
-		EFsGetNotifyUserReturn,
-		/** @SYMTraceFormatString "+RFs::SetNotifyUser() sess %x aValue %d" */
-		EFsSetNotifyUser,
-		/** @SYMTraceFormatString "-RFs::SetNotifyUser() r %d" */
-		EFsSetNotifyUserReturn,
-		/** @SYMTraceFormatString "+RFs::IsFileInRom() sess %x aFileName %*S" */
-		EFsIsFileInRom,
-		/** @SYMTraceFormatString "-RFs::IsFileInRom() r %d" */
-		EFsIsFileInRomReturn,
-		/** @SYMTraceFormatString "+RFs::IsValidName1() sess %x aFileName %*S" */
-		EFsIsValidName1,
-		/** @SYMTraceFormatString "-RFs::IsValidName1() r %d" */
-		EFsIsValidName1Return,
-		/** @SYMTraceFormatString "+RFs::IsValidName2() sess %x aFileName %*S" */
-		EFsIsValidName2,
-		/** @SYMTraceFormatString "-RFs::IsValidName2() r %d aBadChar %c" */
-		EFsIsValidName2Return,
-		/** @SYMTraceFormatString "+RFs::IsValidName3() sess %x aFileName %*S" */
-		EFsIsValidName3,
-		/** @SYMTraceFormatString "-RFs::IsValidName3() r %d err %d" */
-		EFsIsValidName3Return,
-		/** @SYMTraceFormatString "+RFs::GetDriveName() sess %x aDrive %d" */
-		EFsGetDriveName,
-		/** @SYMTraceFormatString "-RFs::GetDriveName() r %d aDriveName %*S" */
-		EFsGetDriveNameReturn,
-		/** @SYMTraceFormatString "+RFs::SetDriveName() sess %x aDrive %d aDriveName %*S" */
-		EFsSetDriveName,
-		/** @SYMTraceFormatString "-RFs::SetDriveName() r %d" */
-		EFsSetDriveNameReturn,
-		/** @SYMTraceFormatString "+RFs::LockDrive() sess %x aDrv %d aStore %d" */
-		EFsLockDrive,
-		/** @SYMTraceFormatString "-RFs::LockDrive() r %d" */
-		EFsLockDriveReturn,
-		/** @SYMTraceFormatString "+RFs::UnlockDrive() sess %x aDrv %d aStore %d" */
-		EFsUnlockDrive,
-		/** @SYMTraceFormatString "-RFs::UnlockDrive() r %d" */
-		EFsUnlockDriveReturn,
-		/** @SYMTraceFormatString "+RFs::ClearPassword() sess %x aDrv %d" */
-		EFsClearPassword,
-		/** @SYMTraceFormatString "-RFs::ClearPassword() r %d" */
-		EFsClearPasswordReturn,
-		/** @SYMTraceFormatString "+RFs::ErasePassword() sess %x aDrv %d" */
-		EFsErasePassword,
-		/** @SYMTraceFormatString "-RFs::ErasePassword() r %d" */
-		EFsErasePasswordReturn,
-		/** @SYMTraceFormatString "+RFs::StartupInitComplete() sess %x status %x" */
-		EFsStartupInitComplete,
-		/** @SYMTraceFormatString "-RFs::StartupInitComplete() r %d" */
-		EFsStartupInitCompleteReturn,
-		/** @SYMTraceFormatString "+RFs::SetLocalDriveMapping() sess %x aMapping %*x" */
-		EFsSetLocalDriveMapping,
-		/** @SYMTraceFormatString "-RFs::SetLocalDriveMapping() r %d" */
-		EFsSetLocalDriveMappingReturn,
-		/** @SYMTraceFormatString "+RFs::FinaliseDrive() sess %x aDriveNo %d aMode %d" */
-		EFsFinaliseDrive,
-		/** @SYMTraceFormatString "-RFs::FinaliseDrive() r %d" */
-		EFsFinaliseDriveReturn,
-		/** @SYMTraceFormatString "+RFs::FinaliseDrives() sess %x" */
-		EFsFinaliseDrives,
-		/** @SYMTraceFormatString "-RFs::FinaliseDrives() r %d" */
-		EFsFinaliseDrivesReturn,
-		/** @SYMTraceFormatString "+RFs::SwapFileSystem() sess %x aOldFileSystemName %*S aNewFileSystemName %*S aDrive %d" */
-		EFsSwapFileSystem,
-		/** @SYMTraceFormatString "-RFs::SwapFileSystem() r %d" */
-		EFsSwapFileSystemReturn,
-		/** @SYMTraceFormatString "+RFs::AddCompositeMount() sess %x aFileSystemName %*S aLocalDriveToMount %d aCompositeDrive %d aSync %d" */
-		EFsAddCompositeMount,
-		/** @SYMTraceFormatString "-RFs::AddCompositeMount() r %d" */
-		EFsAddCompositeMountReturn,
-		/** @SYMTraceFormatString "+RFs::ReserveDriveSpace() sess %x aDriveNo %d aSpace %d" */
-		EFsReserveDriveSpace,
-		/** @SYMTraceFormatString "-RFs::ReserveDriveSpace() r %d" */
-		EFsReserveDriveSpaceReturn,
-		/** @SYMTraceFormatString "+RFs::GetReserveAccess() sess %x aDriveNo %d" */
-		EFsGetReserveAccess,
-		/** @SYMTraceFormatString "-RFs::GetReserveAccess() r %d" */
-		EFsGetReserveAccessReturn,
-		/** @SYMTraceFormatString "+RFs::ReleaseReserveAccess() sess %x aDriveNo %d" */
-		EFsReleaseReserveAccess,
-		/** @SYMTraceFormatString "-RFs::ReleaseReserveAccess() r %d" */
-		EFsReleaseReserveAccessReturn,
-		/** @SYMTraceFormatString "+RFs::NotifyDismount() sess %x aDrive %d stauts %x aMode %d" */
-		EFsNotifyDismount,
-		/** @SYMTraceFormatString "-RFs::NotifyDismount() r %d" */
-		EFsNotifyDismountReturn,
-		/** @SYMTraceFormatString "+RFs::NotifyDismountCancel1() sess %x status %x" */
-		EFsNotifyDismountCancel1,
-		/** @SYMTraceFormatString "-RFs::NotifyDismountCancel1() r %d" */
-		EFsNotifyDismountCancel1Return,
-		/** @SYMTraceFormatString "+RFs::NotifyDismountCancel2() sess %x" */
-		EFsNotifyDismountCancel2,
-		/** @SYMTraceFormatString "-RFs::NotifyDismountCancel2() r %d" */
-		EFsNotifyDismountCancel2Return,
-		/** @SYMTraceFormatString "+RFs::AllowDismount() sess %x aDrive %d" */
-		EFsAllowDismount,
-		/** @SYMTraceFormatString "-RFs::AllowDismount() r %d" */
-		EFsAllowDismountReturn,
-		/** @SYMTraceFormatString "+RFs::SetStartupConfiguration() sess %x aCommand %d aParam1 %x aParam2 %x" */
-		EFsSetStartupConfiguration,
-		/** @SYMTraceFormatString "-RFs::SetStartupConfiguration() r %d" */
-		EFsSetStartupConfigurationReturn,
-		/** @SYMTraceFormatString "+RFs::SetNotifyChange() sess %x aNotifyChange %d" */
-		EFsSetNotifyChange,
-		/** @SYMTraceFormatString "-RFs::SetNotifyChange() r %d" */
-		EFsSetNotifyChangeReturn,
-		/** @SYMTraceFormatString "+RFs::InitialisePropertiesFile() sess %x filePtr %x fileLen %d" */
-		EFsInitialisePropertiesFile,
-		/** @SYMTraceFormatString "-RFs::InitialisePropertiesFile() r %d" */
-		EFsInitialisePropertiesFileReturn,
-		/** @SYMTraceFormatString "+RFs::QueryVolumeInfoExt() sess %x aDrive %d aCommand %d" */
-		EFsQueryVolumeInfoExt,
-		/** @SYMTraceFormatString "-RFs::QueryVolumeInfoExt() r %d" */
-		EFsQueryVolumeInfoExtReturn,
-		/** @SYMTraceFormatString "+RFs::VolumeIOParam() sess %x aDrive %d" */
-		EFsVolumeIOParam,
-		/** @SYMTraceFormatString "-RFs::VolumeIOParam() r %d iBlockSize %d iClusterSize %d iRecReadBufSize %d iRecWriteBufSize %d" */
-		EFsVolumeIOParamReturn,
-		/** @SYMTraceFormatString "+RFs::FileSystemSubType() sess %x aDrive %d aName %*S" */
-		EFsFileSystemSubType,
-		/** @SYMTraceFormatString "-RFs::FileSystemSubType() r %d" */
-		EFsFileSystemSubTypeReturn,
-
-		/** @SYMTraceFormatString "+RFs::AddPlugin() sess %x aFileName %*S" */
-        EFsAddPlugin,
-        /** @SYMTraceFormatString "-RFs::AddPlugin() r %d" */
-        EFsAddPluginReturn,
-
-		/** @SYMTraceFormatString "+RFs::RemovePlugin() sess %x aPluginName %*S" */
-        EFsRemovePlugin,
-        /** @SYMTraceFormatString "-RFs::RemovePlugin() r %d" */
-        EFsRemovePluginReturn,
-
-		/** @SYMTraceFormatString "+RFs::MountPlugin1() sess %x aPluginName %*S" */
-        EFsMountPlugin1,
-        /** @SYMTraceFormatString "-RFs::MountPlugin1() r %d" */
-        EFsMountPlugin1Return,
-
-		/** @SYMTraceFormatString "+RFs::MountPlugin2() sess %x aPluginName %*S aDrive %d" */
-        EFsMountPlugin2,
-        /** @SYMTraceFormatString "-RFs::MountPlugin2() r %d" */
-        EFsMountPlugin2Return,
-
-		/** @SYMTraceFormatString "+RFs::MountPlugin3() sess %x aPluginName %*S aDrive %d aPos %d" */
-        EFsMountPlugin3,
-        /** @SYMTraceFormatString "-RFs::MountPlugin3() r %d" */
-        EFsMountPlugin3Return,
-
-		/** @SYMTraceFormatString "+RFs::DismountPlugin() sess %x aPluginName %*S" */
-        EFsDismountPlugin1,
-        /** @SYMTraceFormatString "-RFs::DismountPlugin() r %d" */
-        EFsDismountPlugin1Return,
-
-		/** @SYMTraceFormatString "+RFs::DismountPlugin2() sess %x aPluginName %*S aDrive %d" */
-        EFsDismountPlugin2,
-        /** @SYMTraceFormatString "-RFs::DismountPlugin2() r %d" */
-        EFsDismountPlugin2Return,
-
-		/** @SYMTraceFormatString "+RFs::DismountPlugin3() sess %x aPluginName %*S aDrive %d aPos %d" */
-        EFsDismountPlugin3,
-        /** @SYMTraceFormatString "-RFs::DismountPlugin3() r %d" */
-        EFsDismountPlugin3Return,
-
-		/** @SYMTraceFormatString "+RFs::PluginName() sess %x aDrive %d aPos %d" */
-        EFsPluginName,
-        /** @SYMTraceFormatString "-RFs::PluginName() r %d aName %*S" */
-        EFsPluginNameReturn,
-
-		/** @SYMTraceFormatString "+RFs::Close() sess %x" */
-		EFsClose,
-		/** @SYMTraceFormatString "-RFs::Close() r %d" */
-		EFsCloseReturn,
-
-
-		/** @SYMTraceFormatString "+RDir::Open1() sess %x aName %*S aUidType0 %x aUidType1 %x aUidType2 %x" */
-        EDirOpen1,
-        /** @SYMTraceFormatString "-RDir::Open1() r %d subs %x" */
-        EDirOpen1Return,
-
-		/** @SYMTraceFormatString "+RDir::Open2() sess %x aName %*S anAttMask %x" */
-        EDirOpen2,
-        /** @SYMTraceFormatString "-RDir::Open2() r %d subs %x" */
-        EDirOpen2Return,
-
-		/** @SYMTraceFormatString "+RDir::Close() sess %x subs %x" */
-        EDirClose,
-        /** @SYMTraceFormatString "-RDir::Close()" */
-        EDirCloseReturn,
-
-		/** @SYMTraceFormatString "+RDir::Read1() sess %x subs %x" */
-        EDirRead1,
-        /** @SYMTraceFormatString "-RDir::Read1() r %d count %d" */
-        EDirRead1Return,
-
-		/** @SYMTraceFormatString "+RDir::Read2() sess %x subs %x status %x" */
-        EDirRead2,
-        /** @SYMTraceFormatString "-RDir::Read2()" */
-        EDirRead2Return,
-
-		/** @SYMTraceFormatString "+RDir::Read3() sess %x subs %x" */
-        EDirRead3,
-        /** @SYMTraceFormatString "-RDir::Read3() r %d" */
-        EDirRead3Return,
-
-		/** @SYMTraceFormatString "+RDir::Read4() sess %x subs %x status %x" */
-        EDirRead4,
-        /** @SYMTraceFormatString "-RDir::Read4()" */
-        EDirRead4Return,
-
-
-		/** @SYMTraceFormatString "+RFormat::Open1() sess %x aName %*S aFormatMode %x" */
-        EFormat1Open,
-        /** @SYMTraceFormatString "-RFormat::Open1() r %d subs %x aCount %d" */
-        EFormatOpen1Return,
-
-		/** @SYMTraceFormatString "+RFormat::Open2() sess %x aName %*S aFormatMode %x aInfo %x" */
-        EFormat2Open,
-        /** @SYMTraceFormatString "-RFormat::Open2() r %d subs %x aCount %d" */
-        EFormatOpen2Return,
-
-		/** @SYMTraceFormatString "+RFormat::Close() sess %x subs %x" */
-        EFormatClose,
-        /** @SYMTraceFormatString "-RFormat::Close()" */
-        EFormatCloseReturn,
-
-		/** @SYMTraceFormatString "+RFormat::Next1() sess %x subs %x" */
-        EFormatNext1,
-        /** @SYMTraceFormatString "-RFormat::Next1() r %d aStep %d" */
-        EFormatNext1Return,
-
-		/** @SYMTraceFormatString "+RFormat::Next2() sess %x subs %x status %x" */
-        EFormatNext2,
-        /** @SYMTraceFormatString "-RFormat::Next2()" */
-        EFormatNext2Return,
-
-
-
-		/** @SYMTraceFormatString "+RPlugin::Open() aPos %d" */
-        EPluginOpen,
-        /** @SYMTraceFormatString "-RPlugin::Open() r %d subs %x" */
-        EPluginOpenReturn,
-
-		/** @SYMTraceFormatString "+RPlugin::Close() sess %x subs %x" */
-        EPluginClose,
-        /** @SYMTraceFormatString "-RPlugin::Close() r %d" */
-        EPluginCloseReturn,
-
-		/** @SYMTraceFormatString "+RPlugin::DoRequest1() sess %x subs %x aReqNo %d status %x" */
-        EPluginDoRequest1,
-        /** @SYMTraceFormatString "-RPlugin::DoRequest1()" */
-        EPluginDoRequest1Return,
-
-		/** @SYMTraceFormatString "+RPlugin::DoRequest2() sess %x subs %x aReqNo %d status %x a1 %x" */
-        EPluginDoRequest2,
-        /** @SYMTraceFormatString "-RPlugin::DoRequest2()" */
-        EPluginDoRequest2Return,
-
-		/** @SYMTraceFormatString "+RPlugin::DoRequest3() sess %x subs %x aReqNo %d status %x a1 %x a2 %x" */
-        EPluginDoRequest3,
-        /** @SYMTraceFormatString "-RPlugin::DoRequest3()" */
-        EPluginDoRequest3Return,
-
-		/** @SYMTraceFormatString "+RPlugin::DoControl() sess %x subs %x aFunction %d" */
-        EPluginDoControl1,
-        /** @SYMTraceFormatString "-RPlugin::DoControl() r %d" */
-        EPluginDoControl1Return,
-
-		/** @SYMTraceFormatString "+RPlugin::DoControl2() sess %x subs %x aFunction %d a1 %x" */
-        EPluginDoControl2,
-        /** @SYMTraceFormatString "-RPlugin::DoControl2() r %d" */
-        EPluginDoControl2Return,
-
-		/** @SYMTraceFormatString "+RPlugin::DoControl3() sess %x subs %x aFunction %d a1 %x a2 %x" */
-        EPluginDoControl3,
-        /** @SYMTraceFormatString "-RPlugin::DoControl3() r %d" */
-        EPluginDoControl3Return,
-
-		/** @SYMTraceFormatString "+RPlugin::DoCancel() sess %x subs %x aReqMask %x" */
-        EPluginDoCancel,
-        /** @SYMTraceFormatString "-RPlugin::DoCancel()" */
-        EPluginDoCancelReturn,
-
-
-		/** @SYMTraceFormatString "+CFileMan::NewL1() sess %x" */
-        ECFileManNewL1,
-        /** @SYMTraceFormatString "-CFileMan::NewL1() CFileMan* %x" */
-        ECFileManNewL1Return,
-
-		/** @SYMTraceFormatString "+CFileMan::NewL2() sess %x anObserver %x" */
-        ECFileManNewL2,
-        /** @SYMTraceFormatString "-CFileMan::NewL2() CFileMan* %x" */
-        ECFileManNewL2Return,
-
-		/** @SYMTraceFormatString "+CFileMan::~CFileMan() this %x" */
-        ECFileManDestructor,
-        /** @SYMTraceFormatString "-CFileMan::~CFileMan()" */
-        ECFileManDestructorReturn,
-
-		/** @SYMTraceFormatString "+CFileMan::CurrentAction() this %x" */
-        ECFileManCurrentAction,
-        /** @SYMTraceFormatString "-CFileMan::CurrentAction() action %d" */
-        ECFileManCurrentActionReturn,
-
-		/** @SYMTraceFormatString "+CFileMan::GetCurrentTarget() this %x" */
-        ECFileManGetCurrentTarget,
-        /** @SYMTraceFormatString "-CFileMan::GetCurrentTarget() aTrgName %*S" */
-        ECFileManGetCurrentTargetReturn,
-
-		/** @SYMTraceFormatString "+CFileMan::GetCurrentSource() this %x" */
-        ECFileManGetCurrentSource,
-        /** @SYMTraceFormatString "-CFileMan::GetCurrentSource() aSrcName %*S" */
-        ECFileManGetCurrentSourceReturn,
-
-		/** @SYMTraceFormatString ".CFileMan::BytesTransferredByCopyStep() this %x BytesTransferred %d" */
-        ECFileManBytesTransferredByCopyStep,
-
-		/** @SYMTraceFormatString "+CFileMan::Attribs1() this %x aName %*S aSetMask %x aClearMask %x aTime %lx aSwitches %d, status %x" */
-        ECFileManAttribs1,
-        /** @SYMTraceFormatString "-CFileMan::Attribs1() r %d" */
-        ECFileManAttribs1Return,
-
-		/** @SYMTraceFormatString "+CFileMan::Attribs2() this %x aName %*S aSetMask %x aClearMask %x aTime %lx aSwitches %d" */
-        ECFileManAttribs2,
-        /** @SYMTraceFormatString "-CFileMan::Attribs2() r %d" */
-        ECFileManAttribs2Return,
-
-		/** @SYMTraceFormatString "+CFileMan::Copy1() this %x anOld %*S aNew %*S aSwitches %d status %x" */
-        ECFileManCopy1,
-        /** @SYMTraceFormatString "-CFileMan::Copy1() r %d" */
-        ECFileManCopy1Return,
-
-		/** @SYMTraceFormatString "+CFileMan::Copy2() this %x anOld %*S aNew %*S aSwitches %d" */
-        ECFileManCopy2,
-        /** @SYMTraceFormatString "-CFileMan::Copy2() r %d" */
-        ECFileManCopy2Return,
-
-		/** @SYMTraceFormatString "+CFileMan::Copy3() this %x anOldSubs %x aNew %*S aSwitches %d" */
-        ECFileManCopy3,
-        /** @SYMTraceFormatString "-CFileMan::Copy3() r %d" */
-        ECFileManCopy3Return,
-
-		/** @SYMTraceFormatString "+CFileMan::Copy4() this %x anOldSubs %x aNew %*S aSwitches %dstatus %x" */
-        ECFileManCopy4,
-        /** @SYMTraceFormatString "-CFileMan::Copy4() r %d" */
-        ECFileManCopy4Return,
-		
-		/** @SYMTraceFormatString "+CFileMan::Delete1() this %x aName %*S aSwitches %d status %x" */
-        ECFileManDelete1,
-        /** @SYMTraceFormatString "-CFileMan::Delete1() r %d" */
-        ECFileManDelete1Return,
-
-		/** @SYMTraceFormatString "+CFileMan::Delete2() this %x aName %*S aSwitches %d" */
-        ECFileManDelete2,
-        /** @SYMTraceFormatString "-CFileMan::Delete2() r %d" */
-        ECFileManDelete2Return,
-
-		/** @SYMTraceFormatString "+CFileMan::Move1() this %x anOld %*S aNew %*S aSwitches %d status %x" */
-        ECFileManMove1,
-        /** @SYMTraceFormatString "-CFileMan::Move1() r %d" */
-        ECFileManMove1Return,
-
-		/** @SYMTraceFormatString "+CFileMan::Move2() this %x anOld %*S aNew %*S aSwitches %d" */
-        ECFileManMove2,
-        /** @SYMTraceFormatString "-CFileMan::Move2() r %d" */
-        ECFileManMove2Return,
-
-		/** @SYMTraceFormatString "+CFileMan::Rename1() this %x anOld %*S aNew %*S aSwitches %d status %x" */
-        ECFileManRename1,
-        /** @SYMTraceFormatString "-CFileMan::Rename1() r %d" */
-        ECFileManRename1Return,
-
-		/** @SYMTraceFormatString "+CFileMan::Rename2() this %x anOld %*S aNew %*S aSwitches %d" */
-        ECFileManRename2,
-        /** @SYMTraceFormatString "-CFileMan::Rename2() r %d" */
-        ECFileManRename2Return,
-
-		/** @SYMTraceFormatString "+CFileMan::RmDir1() this %x aDirName %*S status %x" */
-        ECFileManRmDir1,
-        /** @SYMTraceFormatString "-CFileMan::RmDir1() r %d" */
-        ECFileManRmDir1Return,
-
-		/** @SYMTraceFormatString "+CFileMan::RmDir2() this %x aDirName %*S" */
-        ECFileManRmDir2,
-        /** @SYMTraceFormatString "-CFileMan::RmDir2() r %d" */
-        ECFileManRmDir2Return,
-
-
-
-
-
-		/** @SYMTraceFormatString "+CDirScan::NewL() sess %x" */
-        ECDirScanNewL,
-        /** @SYMTraceFormatString "-CDirScan::NewL() CDirScan* %x" */
-        ECDirScanNewLReturn,
-
-		/** @SYMTraceFormatString "+CDirScan::NewLC() sess %x" */
-        ECDirScanNewLC,
-        /** @SYMTraceFormatString "-CDirScan::NewLC() CDirScan* %x" */
-        ECDirScanNewLCReturn,
-
-		/** @SYMTraceFormatString "+CDirScan::~CDirScan() this %x" */
-        ECDirScanDestructor,
-        /** @SYMTraceFormatString "-CDirScan::~CDirScan()" */
-        ECDirScanDestructorReturn,
-
-		/** @SYMTraceFormatString "+CDirScan::SetScanDataL() this %x aMatchName %*S anEntryAttMask %x anEntrySortKey %d aScanDir %d" */
-        ECDirScanSetScanDataL,
-        /** @SYMTraceFormatString "-CDirScan::SetScanDataL() r %d" */
-        ECDirScanSetScanDataLReturn,
-
-		/** @SYMTraceFormatString "+CDirScan::NextL() this %x" */
-        ECDirScanNextL,
-        /** @SYMTraceFormatString "-CDirScan::NextL() r %d DirEntries %d" */
-        ECDirScanNextLReturn,
-
-        /** @SYMTraceFormatString "-CDirScan Leave r %d" */
-        ECDirScanLeave,
-
-
-
-
-
-
-        /** @SYMTraceFormatString "Efsrv.dll Panic r %d" */
-        EPanic,
-
-        
-		/** @SYMTraceFormatString "TimeStamp" */
-        ETimeStamp,
-
-        /**
-        Provided to allow the following compile time assert.
-        */
-        EFormatIdHighWaterMark,
-        };
-    __ASSERT_COMPILE(EFormatIdHighWaterMark <= (UTF::KMaxFormatId + 1));
-
-
-
-    } // end of namespace UTraceModuleEfsrv
-
-	
-#endif // UTRACEEFSRV_H
--- a/userlibandfileserver/fileserver/rom/f32.iby	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/rom/f32.iby	Thu Jul 22 16:46:39 2010 +0100
@@ -17,8 +17,6 @@
 secondary=\Epoc32\Release\##MAIN##\##BUILD##\efile.exe  sys\bin\efile.exe  FIXED HEAPMAX(0x80000)
 file=\Epoc32\Release\##MAIN##\##BUILD##\efsrv.dll       sys\bin\efsrv.dll
 
-device[VARID]=\Epoc32\Release\##KMAIN##\##BUILD##\d_ftrace.ldd          sys\bin\d_ftrace.ldd
-
 #ifdef WITH_EXFAT
 file=\Epoc32\Release\##MAIN##\##BUILD##\exfat.fsy       sys\bin\exfat.fsy
 #endif
--- a/userlibandfileserver/fileserver/scomp/base_f32_scomp.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/scomp/base_f32_scomp.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "Composite File System"
 
 component	base_f32_scomp
--- a/userlibandfileserver/fileserver/sfat/base_f32_sfat.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat/base_f32_sfat.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "FAT File System"
 
 component	base_f32_sfat
--- a/userlibandfileserver/fileserver/sfat32/base_f32_sfat32.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/base_f32_sfat32.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "FAT32 File System"
 
 component	base_f32_sfat32
--- a/userlibandfileserver/fileserver/sfat32/inc/sl_std.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/inc/sl_std.h	Thu Jul 22 16:46:39 2010 +0100
@@ -92,12 +92,12 @@
 
     //-- public interface to the local drive. Provides media driver's error handling (critical and non-critical user notifiers)
     //-- and thread-safety if required.
-	TInt ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const;
+	TInt ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const;
 	TInt ReadNonCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const;
 	TInt ReadCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const;
 	
     TInt WriteCritical(TInt64 aPos,const TDesC8& aSrc);
-    TInt WriteNonCritical(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset);
+    TInt WriteNonCritical(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag);
 	
     TInt GetLastErrorInfo(TDes8& aErrorInfo) const;
 
@@ -148,9 +148,9 @@
         inline void LeaveCriticalSection() const {iLock.Signal();}
 
         //-- methods' wrappers that are used by TDriveInterface
-        TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const;
+        TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const;
         TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg) const;
-        TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset);
+        TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag);
         TInt Write(TInt64 aPos, const TDesC8& aSrc);
         TInt GetLastErrorInfo(TDes8& aErrorInfo) const;
         TInt Caps(TDes8& anInfo) const;
@@ -336,7 +336,7 @@
 	@param aMessage	Refrence to server message from request
 	@param anOffset	Offset into read data to write
 	*/
-	virtual void ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const = 0;
+	virtual void ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const = 0;
 
 	/**
 	Disk write function
@@ -347,7 +347,7 @@
 	@param aMessage	Refrence to server message from request, contains data
 	@param anOffset	Offset into write data to use in write
 	*/
-	virtual void WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset) = 0;
+	virtual void WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) = 0;
 
     
     virtual inline MWTCacheInterface* DirCacheInterface();
@@ -570,8 +570,8 @@
     void DirReadL(const TEntryPos& aPos,TInt aLength,TDes8& aDes) const;
     void DirWriteL(const TEntryPos& aPos,const TDesC8& aDes);
 
-	void ReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset) const;
-    void WriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint& aBadcluster, TUint& aGoodcluster);
+	void ReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset, TUint aFlag) const;
+    void WriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint& aBadcluster, TUint& aGoodcluster, TUint aFlag);
 	
 	void MoveToNextEntryL(TEntryPos& aPos) const;
 	void MoveToDosEntryL(TEntryPos& aPos,TFatDirEntry& anEntry) const;
@@ -703,8 +703,8 @@
 	void DoCheckFatForLoopsL(TUint32 aCluster, TUint32& aPreviousCluster, TUint32& aChangePreviousCluster, TUint32& aCount) const;
     void InitializeL(const TLocalDriveCaps& aLocDrvCaps, TBool aIgnoreFSInfo=EFalse);
 
-	void DoReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset) const;
-    void DoWriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint aLastcluster, TUint& aBadcluster, TUint& aGoodcluster);
+	void DoReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset, TUint aFlag) const;
+    void DoWriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint aLastcluster, TUint& aBadcluster, TUint& aGoodcluster, TUint aFlag);
 
 	TBool IsUniqueNameL(const TShortName& aName, TUint32 aDirCluster);
 	TBool FindShortNameL(const TShortName& aName,TEntryPos& anEntryPos);
--- a/userlibandfileserver/fileserver/sfat32/inc/sl_std.inl	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/inc/sl_std.inl	Thu Jul 22 16:46:39 2010 +0100
@@ -523,9 +523,9 @@
     }  
 
 void CFatFileCB::IndicateFileSizeModified(TBool aModified) 
-    {
-    iFileSizeModified = aModified;
-    }
+	{
+	iFileSizeModified = aModified;
+	}
 
 //-----------------------------------------------------------------------------
 /** @return ETrue if file attributes' 'Modified' flag is set*/
--- a/userlibandfileserver/fileserver/sfat32/sl_dir_cache.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/sl_dir_cache.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -113,6 +113,7 @@
                   iMinSizeInPages(aMinPageNum),
                   iMaxSizeInPages(aMaxPageNum),
                   iDrive(aDrive),
+				  iLastVisitedPage(NULL),
                   iLockedQ(_FOFF(TDynamicDirCachePage, iLink)),
                   iUnlockedQ(_FOFF(TDynamicDirCachePage, iLink)),
                   iLockedQCount(0),
@@ -158,19 +159,19 @@
 
 	// allocate as many permanently locked pages as there are threads - plus one
 	// otherwise DoMakePageMRU() won't work properly with only one thread
-	//-- At present moment the size of TDrive thread pool is 1 (1 drive thread in a pool)
-	const TUint KThreadCount = 1;
-	iPermanentlyAllocatedPageCount = KThreadCount + 1; 
+    //-- At present moment the size of TDrive thread pool is 1 (1 drive thread in a pool)
+    const TUint KThreadCount = 1;
+    iPermanentlyAllocatedPageCount = KThreadCount; 
 
 	if (iPermanentlyAllocatedPageCount > iMinSizeInPages)
 		iMinSizeInPages = iPermanentlyAllocatedPageCount;
 
 	for (TUint n=0; n<iPermanentlyAllocatedPageCount; n++)
 		{
-		TDynamicDirCachePage* pPage = AllocateAndLockNewPage(0);
-		ASSERT(pPage);
-		if (!pPage)
-			User::Leave(KErrNoMemory);
+        TDynamicDirCachePage* pPage = AllocateAndLockNewPage();
+        ASSERT(pPage);
+        if (!pPage)
+            User::Leave(KErrNoMemory);
 		AddFirstOntoQueue(pPage, TDynamicDirCachePage::ELocked);
 		LookupTblAdd(pPage);
 		}
@@ -191,42 +192,6 @@
     }
 
 /**
-Insert an unlocked page into the last position of the locked queue, may squeeze the original last page into
-the unlocked queue.
-This function is used on last visited but 'unlocked' pages to avoid excessive lock/unlock calls to cache memory
-manager as contiguous entry reading/writing often happens on the same page.
-@param	aPage	the page to be inserted.
-@pre	the page type of aPage should only be TDynamicDirCachePage::EUnknown
-*/
-void CDynamicDirCache::MakePageLastLocked(TDynamicDirCachePage* aPage)
-	{
-	// this function should not be called on active pages
-	ASSERT(aPage->iType == TDynamicDirCachePage::EUnknown);
-
-	if (iLockedQ.IsEmpty())
-		{
-		// if locked queue is empty, add it onto the locked queue directly
-		AddFirstOntoQueue(aPage, TDynamicDirCachePage::ELocked);
-		}
-	else
-		{
-		// otherwise, we squeeze for the last position on locked queue
-		while (iLockedQCount + 1 >= iMinSizeInPages)
-			{
-			TDynamicDirCachePage* last = iLockedQ.Last();
-			DeQueue(last);
-			UnlockPage(last);
-			AddFirstOntoQueue(last, TDynamicDirCachePage::EUnlocked);
-			}
-
-		// iLockedQCount + 1 < iMinSizeInPages
-		iLockedQ.AddLast(*aPage);
-		aPage->SetPageType(TDynamicDirCachePage::ELocked);
-		iLockedQCount++;
-		}
-	}
-
-/**
     Read data from a single page. If the page is not found or not valid anymore, read media onto iActive page first.
     The data will be _Appended_ the the descriptor aDes. The caller is responsible for maintaining this descriptor.
 
@@ -248,13 +213,19 @@
             aDes.Append(pPage->PtrInPage(aPos), aLength);
 
 
-            // if page is from unlocked queue, insert it onto the last page of the locked
-            //  queue. this is to avoid excessive locking and unlocking operations that is
-            //  highly likely to happen for following reads.
-            if (pPage->PageType() == TDynamicDirCachePage::EUnlocked)
-            	{
-            	DeQueue(pPage);
-            	MakePageLastLocked(pPage);
+            // if page is from unlocked queue, try to keep it locked until we move to a 
+            //  different page from the unlocked queue 
+            // this is to avoid excessive locking and unlocking operations that is
+            //  highly likely to happen when DoFindL() linearly scan through the directory
+            if (pPage->PageType() == TDynamicDirCachePage::EUnlocked
+                && iLastVisitedPage != pPage)
+                {
+                // Note: iLastVisitedPage may have been moved from unlocked queue to locked queue
+                if(iLastVisitedPage && iLastVisitedPage->PageType() == TDynamicDirCachePage::EUnlocked)
+                    {
+                    User::LeaveIfError(UnlockPage(iLastVisitedPage));
+                    }
+                iLastVisitedPage = pPage;
             	}
     		}
     	else	// page locking failed
@@ -624,23 +595,32 @@
         case EDumpCache:
         	{
         	RFs fs;
-        	fs.Connect();
+        	r = fs.Connect();
+            if(r != KErrNone)
+                break;
+
         	const TUint32 debugRegister = DebugRegister();
         	fs.SetDebugRegister(debugRegister|KFSYS);
         	Dump();
         	fs.SetDebugRegister(debugRegister);
         	fs.Close();
+        	r = KErrNone;
         	break;
         	}
         case ECacheInfo:
         	{
         	RFs fs;
-        	fs.Connect();
+        	r = fs.Connect();
+            if(r != KErrNone)
+                break;
+        	
         	const TUint32 debugRegister = DebugRegister();
         	fs.SetDebugRegister(debugRegister|KFSYS);
-        	Info();
+            TDirCacheInfo* aInfo = static_cast<TDirCacheInfo*>(aParam2);
+            Info(aInfo);
         	fs.SetDebugRegister(debugRegister);
         	fs.Close();
+        	r = KErrNone;
         	break;
         	}
 
@@ -683,14 +663,14 @@
 	{
 //	__PRINT1(_L("MakePageMRU (%lx)"), aPos);
 //	__PRINT4(_L("Current Cache State: iLockedQCount=%d, iUnlockedQCount=%d, iLookupTbl=%d, iMaxSizeInPages=%d"), iLockedQCount, iUnlockedQCount, iLookupTable.Count(), iMaxSizeInPages);
-	// check there are at least two locked pages
-	ASSERT(iLockedQCount > 1);
+	// check there are at least one locked pages
+	ASSERT(iLockedQCount > 0);
 	
 	// check the MRU page first, if it is already the MRU page, we can return immediately
 	TInt64 pageStartMedPos = CalcPageStartPos(aPos);
 	if (!iLockedQ.IsEmpty())
 		{
-		if (iLockedQ.First()->StartPos() == pageStartMedPos)
+        if (iLockedQCount > 1 && iLockedQ.First()->StartPos() == pageStartMedPos)
 			{
 			return;
 			}
@@ -703,7 +683,7 @@
 		// lock page before make it MRU
 		if (pPage->PageType() == TDynamicDirCachePage::EUnlocked)
 			{
-			ASSERT(!pPage->IsLocked());
+            ASSERT(!pPage->IsLocked() || (pPage->IsLocked() && pPage == iLastVisitedPage));
 			if (LockPage(pPage) == NULL)
 				{
 				DeQueue(pPage);
@@ -735,8 +715,9 @@
 	ASSERT(pPage && pPage->IsValid() && pPage->IsLocked());
 
 
-	// if we used the active page (last on the queue), try to grow the cache.
-	TBool growCache = pPage == iLockedQ.Last();
+
+    TBool makeNewPageMRU = pPage == iLockedQ.Last();
+
 
 	switch (pPage->PageType())
 		{
@@ -764,16 +745,27 @@
 			ASSERT(0);
 		}
 
-	if (CacheIsFull() || !growCache)
-		return;
+    if (!makeNewPageMRU)
+        return;
+    
+    // when cache is full and a new MRU page is about to be added, we will need to evict the LRU page
+    //  accordingly
+    if (CacheIsFull())
+        {
+        TUint32& queueCnt = iMaxSizeInPages - iMinSizeInPages > 0 ? iUnlockedQCount : iLockedQCount;
+        queueCnt++;
+        CheckThresholds();
+        queueCnt--;
+        }
 
-	// attempt to grow the cache by appending a clean, new page at the end of the LRU list.
-	// This can fail when out of memory; the LRU mechanism then makes sure the oldest page will be re-used.
-	TDynamicDirCachePage* nPage = AllocateAndLockNewPage(0);
-	if (!nPage)
-		return;
+    // attempt to grow the cache by appending a clean, new page at the end of the locked page queue.
+    // This can fail when out of memory; the LRU mechanism then makes sure the oldest page will be re-used.
+    TDynamicDirCachePage* nPage = AllocateAndLockNewPage();
+    if (!nPage)
+        return;
 
-	// about to add a page to end of locked queue, so lie about iLockedQCount
+    // about to add the new active page, force the locked queue to evict the existing last page to make room 
+    //  for the new active page 
 	iLockedQCount++;
 	CheckThresholds();
 	iLockedQCount--;
@@ -781,7 +773,6 @@
 	iLockedQ.AddLast(*nPage);
 	nPage->SetPageType(TDynamicDirCachePage::ELocked);
 	++iLockedQCount;
-	LookupTblAdd(nPage);
 	}
 
 /**
@@ -857,7 +848,7 @@
 */
 void CDynamicDirCache::CheckThresholds()
 	{
-	while (iLockedQCount + 1 > iMinSizeInPages)
+    while (iLockedQCount > iMinSizeInPages)
 		{
 		TDynamicDirCachePage* movePage = iLockedQ.Last();
 		UnlockPage(movePage);
@@ -897,65 +888,67 @@
 Try to create a new page and lock the page content when it is created. This function should only be called
 when creating iActive page or making a page MRU (which might result in page evictions).
 @return	the pointer of the newly created page, or NULL if allocation failed.
-@param	aStartMedPos	the starting media address of the page to be created.
-@pre	aStartMedPos should not already be existing in the cache.
 */
-TDynamicDirCachePage* CDynamicDirCache::AllocateAndLockNewPage(TInt64 aStartMedPos)
-	{
-	__PRINT1(_L("CDynamicDirCache::AllocateAndLockNewPage(aStartMedPos=%lx)"), aStartMedPos);
+TDynamicDirCachePage* CDynamicDirCache::AllocateAndLockNewPage(/*TInt64 aStartMedPos*/)
+    {
+    __PRINT(_L("CDynamicDirCache::AllocateAndLockNewPage()"));
 
-	TUint8* startRamAddr = iCacheMemoryClient->AllocateAndLockSegments(PageSizeInSegs());
+    TUint8* startRamAddr = iCacheMemoryClient->AllocateAndLockSegments(PageSizeInSegs());
+
+    if (!startRamAddr)
+        return NULL;
 
-	if (!startRamAddr)
-		return NULL;
-
-	TDynamicDirCachePage* pPage = TDynamicDirCachePage::CreateCachePage(this, aStartMedPos, startRamAddr);
+    TDynamicDirCachePage* pPage = TDynamicDirCachePage::CreateCachePage(this, 0, startRamAddr);
 
-	// Failure would mean the cache chunk was able to grow but we've run out of heap.
-	// This seems extremely unlikely, but decommit the now-unmanageable cache segment just in case.
-	if (!pPage)
-		{
-		iCacheMemoryClient->DecommitSegments(startRamAddr, PageSizeInSegs());
-		return NULL;
-		}
+    // Failure would mean the cache chunk was able to grow but we've run out of heap.
+    // This seems extremely unlikely, but decommit the now-unmanageable cache segment just in case.
+    if (!pPage)
+        {
+        iCacheMemoryClient->DecommitSegments(startRamAddr, PageSizeInSegs());
+        return NULL;
+        }
 
 	pPage->SetLocked(ETrue);
 	pPage->SetValid(EFalse);
 	return pPage;
 	}
 
-#ifdef _DEBUG
+#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
 /**
 Dump cache information, only enabled in debug mode.
 @see CDynamicDirCache::Control()
 */
-void CDynamicDirCache::Info() const
-	{
-	__PRINT(_L("======== CDynamicDirCache::Info ========="));
-	const TUint32 SegmentSizeInBytesLog2 = CCacheMemoryManagerFactory::CacheMemoryManager()->SegmentSizeInBytesLog2();
-	// page size
-	__PRINT1(_L("=== Pages size:               [%d Bytes]"), iPageSizeInBytes);
-	__PRINT1(_L("=== Segment size:             [%d Bytes]"), 1 << SegmentSizeInBytesLog2);
+void CDynamicDirCache::Info(TDirCacheInfo* aInfo) const
+    {
+    __PRINT(_L("======== CDynamicDirCache::Info ========="));
+    const TUint32 SegmentSizeInBytesLog2 = CCacheMemoryManagerFactory::CacheMemoryManager()->SegmentSizeInBytesLog2();
+    const TUint32 pageMemSizeLog2 = iPageSizeLog2 > SegmentSizeInBytesLog2 ? iPageSizeLog2 : SegmentSizeInBytesLog2;
+    // page size
+    __PRINT1(_L("=== Segment size:             [%d Bytes]"), 1 << SegmentSizeInBytesLog2);
+    __PRINT1(_L("=== Page data size:           [%d Bytes]"), iPageSizeInBytes);
+    __PRINT1(_L("=== Page mem size:            [%d Bytes]"), 1 << pageMemSizeLog2);
 
-	// data size:
-	__PRINT1(_L("=== Min data size:            [%d Bytes]"), iMinSizeInPages << iPageSizeLog2);
-	__PRINT1(_L("=== Max data size:            [%d Bytes]"), iMaxSizeInPages << iPageSizeLog2);
+    // cache size in pages
+    __PRINT1(_L("=== Min cache size in pages:  [%d]"), iMinSizeInPages);
+    __PRINT1(_L("=== Max cache size in pages:  [%d]"), iMaxSizeInPages);
 
-	// memory size:
-	const TUint32 pageMemSizeLog2 = iPageSizeLog2 > SegmentSizeInBytesLog2 ? iPageSizeLog2 : SegmentSizeInBytesLog2;
-	__PRINT1(_L("=== Min memory size:          [%d Bytes]"), iMinSizeInPages << pageMemSizeLog2);
-	__PRINT1(_L("=== Max memory size:          [%d Bytes]"), iMaxSizeInPages << pageMemSizeLog2);
-
-	// reserved pages
-	__PRINT1(_L("=== Number of pages reserved: [%d]"), iMinSizeInPages);
-	__PRINT1(_L("=== Reserved memory:          [%d Bytes]"), (iMinSizeInPages * PageSizeInSegs()) << SegmentSizeInBytesLog2);
-	// locked page num
-	__PRINT1(_L("=== Number of pages locked:   [%d]"), iLockedQCount);
-	__PRINT1(_L("=== Locked memory:            [%d Bytes]"), (iLockedQCount * PageSizeInSegs()) << SegmentSizeInBytesLog2);
-	// unlocked page num
-	__PRINT1(_L("=== Number of pages unlocked: [%d]"), iUnlockedQCount);
-	__PRINT1(_L("=== Unlocked memory:          [%d Bytes]"), (iUnlockedQCount * PageSizeInSegs()) << SegmentSizeInBytesLog2);
-	}
+    // locked page num
+    __PRINT1(_L("=== Number of pages locked:   [%d]"), iLockedQCount);
+    // unlocked page num
+    __PRINT1(_L("=== Number of pages unlocked: [%d]"), iUnlockedQCount);
+    __PRINT(_L("=========================================\n"));
+    
+    ASSERT(aInfo);
+    aInfo->iMemorySegmentSize       = 1 << SegmentSizeInBytesLog2;
+    aInfo->iPageSizeInMemory        = PageSizeInSegs() << SegmentSizeInBytesLog2;
+    aInfo->iPageSizeInData          = iPageSizeInBytes;
+    aInfo->iMinCacheSizeInPages     = iMinSizeInPages;
+    aInfo->iMaxCacheSizeInPages     = iMaxSizeInPages;
+    aInfo->iMinCacheSizeInMemory    = iMinSizeInPages * aInfo->iPageSizeInMemory;
+    aInfo->iMaxCacheSizeInMemory    = iMaxSizeInPages * aInfo->iPageSizeInMemory;
+    aInfo->iLockedPageNumber        = iLockedQCount;
+    aInfo->iUnlockedPageNumber      = iUnlockedQCount;
+    }
 
 /**
 Dump cache content, only enabled in debug mode.
@@ -1005,7 +998,7 @@
         }
     __PRINT(_L("===========================================\n"));
     }
-#endif //_DEBUG
+#endif //#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
 
 /**
 Lock an unlocked page, or do nothing if the page is already locked.
@@ -1037,14 +1030,17 @@
 	{
 	ASSERT(aPage != NULL);
 	__PRINT1(_L("CDynamicDirCache::UnlockPage(%lx)"), aPage->StartPos());
-	TInt r = iCacheMemoryClient->UnlockSegments(aPage->StartPtr(), PageSizeInSegs());
-	if (r == KErrNone)
-		{
-		aPage->SetLocked(EFalse);
+    if (aPage)
+        {
+		TInt r = iCacheMemoryClient->UnlockSegments(aPage->StartPtr(), PageSizeInSegs());
+		if (r == KErrNone)
+			{
+			aPage->SetLocked(EFalse);
+			}
+		return r;
 		}
-	return r;
-	}
-
+    return KErrArgument;
+    }
 /**
 Decommit a locked or unlocked page.
 @return	TInt	KErrNone if decommition was successful, otherwise system-wide error code.
--- a/userlibandfileserver/fileserver/sfat32/sl_dir_cache.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/sl_dir_cache.h	Thu Jul 22 16:46:39 2010 +0100
@@ -27,6 +27,7 @@
 #include "sf_memory_client.h"
 #include "sl_cache.h"
 #include <e32hashtab.h>
+#include <f32dbg.h>
 
 //---------------------------------------------------------------------------------------------------------------------------------
 class 	CDynamicDirCache;
@@ -132,9 +133,11 @@
 	
 	TUint32 PageSizeInSegs() const;
 
+#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
     // Debugging functions
 	void Dump();
-	void Info() const;
+	void Info(TDirCacheInfo* aInfo) const;
+#endif //#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
 
 protected:
 	CDynamicDirCache(TDriveInterface& aDrive, TUint32 aMinSizeInBytes, TUint32 aMaxSizeInBytes, TUint32 aPageSizeInBytesLog2, TUint32 aWrGranularityLog2);
@@ -145,7 +148,7 @@
 
 	TDynamicDirCachePage* FindPageByPos(TInt64 aPos);
 	TDynamicDirCachePage* UpdateActivePageL(TInt64 aPos);
-	TDynamicDirCachePage* AllocateAndLockNewPage(TInt64 aStartMedPos);
+	TDynamicDirCachePage* AllocateAndLockNewPage(/*TInt64 aStartMedPos*/);
 	TUint8* LockPage(TDynamicDirCachePage* aPage);
 	TInt 	UnlockPage(TDynamicDirCachePage* aPage);
 	TInt 	DecommitPage(TDynamicDirCachePage* aPage);
@@ -159,7 +162,6 @@
 	TInt LookupTblAdd(TDynamicDirCachePage* aPage);
 	TDynamicDirCachePage* LookupTblFind(TInt64 aPos);
 	TInt ResetPagePos(TDynamicDirCachePage* aPage);
-	void MakePageLastLocked(TDynamicDirCachePage* aPage);
 	void DoMakePageMRU(TInt64 aPos);
 	void DoInvalidateCache(void);
 	
@@ -177,6 +179,9 @@
 	TDriveInterface&    iDrive;        		///< reference to the driver for media access
 	TUint32             iCacheDisabled : 1; ///< if not 0 the cache is disabled totally and all reads and writes go via TDriveInterface directly
 
+	TDynamicDirCachePage* iLastVisitedPage; ///< a pointer to the last visited page, we always keep it locked
+                                            ///<  to avoid excessive lock/unlock activities when we are scanning
+                                            ///<  a page on the UnlockedQueue
 	
 	// data structures for LRU page list	
 	TCachePageList 	iLockedQ;				///< the locked queue that manages all locked pages, limited by minimum page number
--- a/userlibandfileserver/fileserver/sfat32/sl_dir_cache.inl	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/sl_dir_cache.inl	Thu Jul 22 16:46:39 2010 +0100
@@ -194,7 +194,7 @@
 TBool CDynamicDirCache::CacheIsFull() const
 	{
 	// active page, locked page and unlocked page
-	return (iLockedQCount + iUnlockedQCount + 1 >= iMaxSizeInPages);
+	return (iLockedQCount + iUnlockedQCount >= iMaxSizeInPages);
 	}
 
 /**
--- a/userlibandfileserver/fileserver/sfat32/sl_disk.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/sl_disk.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -286,11 +286,11 @@
 
     @leave on error
 */
-void CAtaDisk::ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const
+void CAtaDisk::ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const
 	{
 
 	__PRINT4(_L("CAtaDisk::ReadL() pos:%u:%u, len:%u, offset:%u"), I64HIGH(aPos), I64LOW(aPos), aLength, anOffset);
-	User::LeaveIfError(iDrive.ReadNonCritical(aPos,aLength,aTrg,aMessage,anOffset));
+	User::LeaveIfError(iDrive.ReadNonCritical(aPos,aLength,aTrg,aMessage,anOffset, aFlag));
 	}
 
 //-------------------------------------------------------------------------------------
@@ -309,12 +309,12 @@
 
     @leave on error
 */
-void CAtaDisk::WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset)
+void CAtaDisk::WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag)
 	{
     __PRINT4(_L("CAtaDisk::WriteL() pos:%u:%u, len:%u, offset:%u"), I64HIGH(aPos), I64LOW(aPos), aLength, anOffset);
 
 	//-- write data to the media directly
-    User::LeaveIfError(iDrive.WriteNonCritical(aPos,aLength,aSrc,aMessage,anOffset));
+    User::LeaveIfError(iDrive.WriteNonCritical(aPos,aLength,aSrc,aMessage,anOffset, aFlag));
 
     //-- we need to invalidate UID cache page that corresponds to aPos (if any). This is UID caching specific. UID is stored in the first few bytes of 
     //-- the executable module and therefore belongs to one cache page only.
@@ -444,7 +444,7 @@
 //
 // Read from ramDrive into thread relative descriptor
 //
-void CRamDisk::ReadL(TInt64 aPos,TInt aLength,const TAny* /*aTrg*/,const RMessagePtr2 &aMessage,TInt anOffset) const
+void CRamDisk::ReadL(TInt64 aPos,TInt aLength,const TAny* /*aTrg*/,const RMessagePtr2 &aMessage,TInt anOffset, TUint /*aFlag*/) const
 	{
 	__PRINT2(_L("CRamDisk::ReadL TAny* Pos 0x%x, Len %d"),aPos,aLength);
 	__ASSERT_ALWAYS((aPos+aLength<=I64INT(iFatMount->Size())) && (aLength>=0),User::Leave(KErrCorrupt));
@@ -457,7 +457,7 @@
 //
 // Write from thread relative descriptor into ramDrive
 //
-void CRamDisk::WriteL(TInt64 aPos,TInt aLength,const TAny* /*aSrc*/,const RMessagePtr2 &aMessage,TInt anOffset)
+void CRamDisk::WriteL(TInt64 aPos,TInt aLength,const TAny* /*aSrc*/,const RMessagePtr2 &aMessage,TInt anOffset, TUint /*aFlag*/)
 	{
 	__PRINT2(_L("CRamDisk::WriteL TAny* Pos 0x%x, Len %d"),aPos,aLength);
 	__ASSERT_ALWAYS(aPos+aLength<=I64INT(iFatMount->Size()),User::Leave(KErrCorrupt));
--- a/userlibandfileserver/fileserver/sfat32/sl_disk.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/sl_disk.h	Thu Jul 22 16:46:39 2010 +0100
@@ -49,8 +49,8 @@
     virtual void InvalidateUidCachePage(TUint64 aPos);
 
 	
-    void ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const;
-	void WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset);
+    void ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const;
+	void WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag);
 	virtual TInt GetLastErrorInfo(TDes8& aErrorInfo) const;
 
     MWTCacheInterface* DirCacheInterface();
@@ -80,11 +80,9 @@
 public:
 	void ReadCachedL(TInt64 aPos,TInt aLength,TDes8& aDes) const;
 	void WriteCachedL(TInt64 aPos,const TDesC8& aDes);
-	void ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const;
-	void WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset);
-
-    
-
+	void ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const;
+	void WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag);
+	
 private:
 	inline TUint8 *RamDiskBase() const;
 
--- a/userlibandfileserver/fileserver/sfat32/sl_drv.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/sl_drv.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -49,6 +49,7 @@
 {	 
 	 if((iMount != NULL) && (iMount->LocalDrive() != NULL))
 		{
+		ASSERT(iMount->LocalDrive()->Mount() == NULL || iMount->LocalDrive()->Mount() == iMount);
 		iMount->LocalDrive()->SetMount(NULL);
 		}
      iMount = NULL;
@@ -117,7 +118,7 @@
     @return KErrBadPower - failure due to low power
 
 */
-TInt TDriveInterface::ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const
+TInt TDriveInterface::ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const
 {
     //__PRINT2(_L("#=+++ Read_nc2: pos:%LU, len:%u"), aPos, aLength);
 
@@ -126,7 +127,7 @@
 
     for(;;)
     {
-        nRes = iProxyDrive.Read(aPos, aLength, aTrg, aMessage, anOffset);
+        nRes = iProxyDrive.Read(aPos, aLength, aTrg, aMessage, anOffset, aFlag);
         if (nRes==KErrNone)
             break;
 
@@ -200,7 +201,7 @@
     @return KErrCorrupt - an illegal write is detected
     @return KErrAccessDenied - write to protected media
 */
-TInt TDriveInterface::WriteNonCritical(TInt64 aPos, TInt aLength, const TAny* aSrc, const RMessagePtr2 &aMessage, TInt anOffset)
+TInt TDriveInterface::WriteNonCritical(TInt64 aPos, TInt aLength, const TAny* aSrc, const RMessagePtr2 &aMessage, TInt anOffset, TUint aFlag)
 {
     //__PRINT2(_L("#=+++ Write_NC: pos:%LU, len:%u"), aPos, aLength);
 
@@ -211,7 +212,7 @@
     for(;;)
     {
         iMount->OpenMountForWrite(); //-- make a callback to CFatMountCB to perform some actions on 1st write.
-        nRes = iProxyDrive.Write(aPos, aLength, aSrc, aMessage, anOffset);
+        nRes = iProxyDrive.Write(aPos, aLength, aSrc, aMessage, anOffset, aFlag);
         if (nRes==KErrNone)
             break;
 
@@ -542,10 +543,10 @@
 
 //-- see original TDriveInterface methods
 
-TInt TDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const
+TInt TDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const
 {
     EnterCriticalSection();
-    TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg, aMessage.Handle(), anOffset);
+    TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg, aMessage.Handle(), anOffset, aFlag);
     LeaveCriticalSection();
     return nRes;
 }
@@ -558,10 +559,10 @@
     return nRes;
 }
 
-TInt TDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset)
+TInt TDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag)
 {
     EnterCriticalSection();
-    TInt nRes = iLocalDrive->Write(aPos, aLength, aSrc, aMessage.Handle(), anOffset);
+    TInt nRes = iLocalDrive->Write(aPos, aLength, aSrc, aMessage.Handle(), anOffset, aFlag);
     LeaveCriticalSection();
     return nRes;
 }
--- a/userlibandfileserver/fileserver/sfat32/sl_file.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/sl_file.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -24,13 +24,13 @@
 const TInt KFirstClusterNum=2;
 
 CFatFileCB::CFatFileCB()
-	{
-	__PRINT1(_L("CFatFileCB created 0x%x"),this);
-	}
+    {
+    __PRINT1(_L("CFatFileCB created 0x%x"),this);
+    }
 
 CFatFileCB::~CFatFileCB()
-	{
-	__PRINT1(_L("~CFatFileCB deleted 0x%x"),this);
+    {
+    __PRINT1(_L("~CFatFileCB deleted 0x%x"),this);
 
     //-- a nasty trick to find out if the CFatFileCB is in consistent state on the moment of destruction.
     //-- Because of OOM conditions CFatFileCB might not be fully constructed and to be deleted, while FlushAll()
@@ -42,140 +42,140 @@
             {
             IndicateFileTimeModified(ETrue); //-- this will force writing file modification time to the media on Flush
             TRAP_IGNORE(FlushAllL());
-        }
+            }
         }
 
     delete[] iSeekIndex;
-	}
+    }
 
 
 void CFatFileCB::CreateSeekIndex()
 //
 // Create a seek index
 //
-	{
+    {
 
-	iSeekIndex = new TUint32[KSeekIndexSize];
-	if (iSeekIndex == NULL)
-		return;
+    iSeekIndex = new TUint32[KSeekIndexSize];
+    if (iSeekIndex == NULL)
+        return;
 
-	Mem::FillZ(iSeekIndex, sizeof(TUint32) * KSeekIndexSize);
+    Mem::FillZ(iSeekIndex, sizeof(TUint32) * KSeekIndexSize);
 
-	iSeekIndexSize=CalcSeekIndexSize(FCB_FileSize());
-	}
+    iSeekIndexSize=CalcSeekIndexSize(FCB_FileSize());
+    }
 
 TInt CFatFileCB::SeekToPosition(TUint aNewRelCluster, TUint aClusterOffset)
 //
 // Use the seek index to set iCurrentPos.iCluster as close as possible to aNewRelCluster
 // Return aNewRelCluster-aCurrentPos.iCluster
 //
-	{
-	TInt clusterOffset=aClusterOffset;
-	TInt seekPos=(aNewRelCluster>>iSeekIndexSize)-1;
-	__ASSERT_DEBUG(seekPos<KSeekIndexSize,Fault(EFatFileSeekIndexTooSmall));
+    {
+    TInt clusterOffset=aClusterOffset;
+    TInt seekPos=(aNewRelCluster>>iSeekIndexSize)-1;
+    __ASSERT_DEBUG(seekPos<KSeekIndexSize,Fault(EFatFileSeekIndexTooSmall));
 
-	while(seekPos>=0 && iSeekIndex[seekPos]==0 && clusterOffset!=0)
-		{
-		seekPos--;
-		clusterOffset--;
-		}
-	if (clusterOffset==0) // Counted back to the current cluster
-		return(aClusterOffset);
-	if (seekPos<0)
-		{
-		iCurrentPos.iCluster=FCB_StartCluster();
-		return(aNewRelCluster);
-		}
+    while(seekPos>=0 && iSeekIndex[seekPos]==0 && clusterOffset!=0)
+        {
+        seekPos--;
+        clusterOffset--;
+        }
+    if (clusterOffset==0) // Counted back to the current cluster
+        return(aClusterOffset);
+    if (seekPos<0)
+        {
+        iCurrentPos.iCluster=FCB_StartCluster();
+        return(aNewRelCluster);
+        }
 
-	iCurrentPos.iCluster=iSeekIndex[seekPos];
-	return(aNewRelCluster-((seekPos+1)<<iSeekIndexSize));
-	}
+    iCurrentPos.iCluster=iSeekIndex[seekPos];
+    return(aNewRelCluster-((seekPos+1)<<iSeekIndexSize));
+    }
 
 void CFatFileCB::SetSeekIndexValueL(TUint aRelCluster, TUint aStoredCluster)
 //
 // Sets a value in the seekindex
 //
-	{
+    {
 
-	TInt seekPos=(aRelCluster>>iSeekIndexSize)-1;
-	__ASSERT_DEBUG(seekPos<KSeekIndexSize,Fault(EFatFileSeekIndexTooSmall));
-	__ASSERT_DEBUG(seekPos>=0,Fault(EFatFileSeekIndexTooSmall2));
-	iSeekIndex[seekPos] = aStoredCluster;
-	}
+    TInt seekPos=(aRelCluster>>iSeekIndexSize)-1;
+    __ASSERT_DEBUG(seekPos<KSeekIndexSize,Fault(EFatFileSeekIndexTooSmall));
+    __ASSERT_DEBUG(seekPos>=0,Fault(EFatFileSeekIndexTooSmall2));
+    iSeekIndex[seekPos] = aStoredCluster;
+    }
 
 TBool CFatFileCB::IsSeekBackwards(TUint aPos)
 //
 // Return true if aPos<currentPos
 //
-	{
-	
-	TUint cluster=iCurrentPos.iCluster<<ClusterSizeLog2();
-	TInt offset=ClusterRelativePos(iCurrentPos.iPos);
-	TUint currentPos=cluster+offset;
-	return(aPos<currentPos);
-	}
+    {
+    
+    TUint cluster=iCurrentPos.iCluster<<ClusterSizeLog2();
+    TInt offset=ClusterRelativePos(iCurrentPos.iPos);
+    TUint currentPos=cluster+offset;
+    return(aPos<currentPos);
+    }
 
 void CFatFileCB::CheckPosL(TUint aPos)
 //
 // Check that the file is positioned correctly.
 // If aPos<currentPos attempt to guess the new position.
 //
-	{
-	__PRINT1(_L("CFatFileCB::CheckPosL(%d)"), aPos);
-	if (aPos==iCurrentPos.iPos)
-		return;
+    {
+    __PRINT1(_L("CFatFileCB::CheckPosL(%d)"), aPos);
+    if (aPos==iCurrentPos.iPos)
+        return;
     __ASSERT_DEBUG(aPos <= FCB_FileSize(), Fault(EFatFilePosBeyondEnd));
 
-	if (FileSizeModified() && IsSeekBackwards(aPos))
-		FlushDataL(); 
-	
-	TUint newRelCluster=aPos>>ClusterSizeLog2();
-	if ( aPos && (aPos==(newRelCluster<<ClusterSizeLog2())) )
-		newRelCluster--;
-	TUint oldRelCluster=iCurrentPos.iPos>>ClusterSizeLog2();
-	
-	if ( iCurrentPos.iPos && (iCurrentPos.iPos==(oldRelCluster<<ClusterSizeLog2())) )
-		oldRelCluster--;	
-	
-	TInt clusterOffset=newRelCluster-oldRelCluster;
-	TUint32 oldCluster=iCurrentPos.iCluster;
+    if (FileSizeModified() && IsSeekBackwards(aPos))
+        FlushDataL(); 
+    
+    TUint newRelCluster=aPos>>ClusterSizeLog2();
+    if ( aPos && (aPos==(newRelCluster<<ClusterSizeLog2())) )
+        newRelCluster--;
+    TUint oldRelCluster=iCurrentPos.iPos>>ClusterSizeLog2();
+    
+    if ( iCurrentPos.iPos && (iCurrentPos.iPos==(oldRelCluster<<ClusterSizeLog2())) )
+        oldRelCluster--;    
+    
+    TInt clusterOffset=newRelCluster-oldRelCluster;
+    TUint32 oldCluster=iCurrentPos.iCluster;
 
-	iCurrentPos.iPos=aPos;
-	if (clusterOffset==0)
-		return;
-	TInt seekOffset=clusterOffset;
-	if (iSeekIndex!=NULL)
-		{ // Can alter iCurrentPos.iCluster
-		seekOffset=SeekToPosition(newRelCluster,seekOffset);
-		if (seekOffset==0)
-			return;
-		}
-	if (clusterOffset==-1 && seekOffset!=1)
-		{ // Check previous cluster
-		TUint32 cluster=oldCluster-1;
-		if (FAT().GetNextClusterL(cluster) && cluster==oldCluster)
-			{
+    iCurrentPos.iPos=aPos;
+    if (clusterOffset==0)
+        return;
+    TInt seekOffset=clusterOffset;
+    if (iSeekIndex!=NULL)
+        { // Can alter iCurrentPos.iCluster
+        seekOffset=SeekToPosition(newRelCluster,seekOffset);
+        if (seekOffset==0)
+            return;
+        }
+    if (clusterOffset==-1 && seekOffset!=1)
+        { // Check previous cluster
+        TUint32 cluster=oldCluster-1;
+        if (FAT().GetNextClusterL(cluster) && cluster==oldCluster)
+            {
             iCurrentPos.iCluster=oldCluster-1;
-			return;
-			}
-		}
-	if (seekOffset<0)
-		{
-		seekOffset=newRelCluster;
-		iCurrentPos.iCluster=FCB_StartCluster();
-		}
-	while (seekOffset--)
-		{
+            return;
+            }
+        }
+    if (seekOffset<0)
+        {
+        seekOffset=newRelCluster;
+        iCurrentPos.iCluster=FCB_StartCluster();
+        }
+    while (seekOffset--)
+        {
         if (!FAT().GetNextClusterL(iCurrentPos.iCluster))
             {
             __PRINT(_L("CFatFileCB::CheckPosL() corrupt#1"));
             User::Leave(KErrCorrupt);
             }
         TInt cluster=newRelCluster-seekOffset;
-		if (iSeekIndex!=NULL && cluster && (cluster>>iSeekIndexSize)<<iSeekIndexSize==cluster)
-			SetSeekIndexValueL(cluster,iCurrentPos.iCluster);
-		}
-	}
+        if (iSeekIndex!=NULL && cluster && (cluster>>iSeekIndexSize)<<iSeekIndexSize==cluster)
+            SetSeekIndexValueL(cluster,iCurrentPos.iCluster);
+        }
+    }
 
 //-----------------------------------------------------------------------------
 /** 
@@ -185,21 +185,21 @@
     @param  aFileDosEntryPos    this file DOS entry dir. iterator in the parent directory.
 */
 void CFatFileCB::SetupL(const TFatDirEntry& aFatDirEntry, const TEntryPos& aFileDosEntryPos)
-	{
-	__PRINT1(_L("CFatFileCB::SetupL[0x%x]"), this);
-	
+    {
+    __PRINT1(_L("CFatFileCB::SetupL[0x%x]"), this);
+    
 
     //-- set up a file control block
-	iCurrentPos.iCluster= FatMount().StartCluster(aFatDirEntry);
-	iCurrentPos.iPos=0;
-	
+    iCurrentPos.iCluster= FatMount().StartCluster(aFatDirEntry);
+    iCurrentPos.iPos=0;
+    
     SetAtt(aFatDirEntry.Attributes());
-	SetModified(aFatDirEntry.Time(FatMount().TimeOffset()));
+    SetModified(aFatDirEntry.Time(FatMount().TimeOffset()));
     
     FCB_SetStartCluster(iCurrentPos.iCluster);
     FCB_SetFileSize(aFatDirEntry.Size()); 
 
-	iFileDosEntryPos = aFileDosEntryPos;
+    iFileDosEntryPos = aFileDosEntryPos;
 
     SetMaxSupportedSize(KMaxSupportedFatFileSize);
 
@@ -213,7 +213,7 @@
     IndicateFileAttModified(EFalse);
     IndicateFileSizeModified(EFalse);
     IndicateFileTimeModified(EFalse);
-	}
+    }
 
 //-----------------------------------------------------------------------------
 /**
@@ -229,32 +229,34 @@
 
 */
 void CFatFileCB::ReadL(TInt64 aPos,TInt& aLength, TDes8* aDes, const RMessagePtr2& aMessage, TInt aOffset)
-	{
-	__PRINT3(_L("CFatFileCB::ReadL[0x%x] pos=%LU len=%d"), this, aPos, aLength);
-	
+    {
+    __PRINT3(_L("CFatFileCB::ReadL[0x%x] pos=%LU len=%d"), this, aPos, aLength);
+    
     if((TUint64)aPos > KMaxSupportedFatFileSize-1)
         User::Leave(KErrNotSupported);  //-- max. position in the file is 0xFFFFFFFE
 
     FatMount().CheckStateConsistentL();
     
-	CheckPosL(I64LOW(aPos));
+    CheckPosL(I64LOW(aPos));
+    
+    const TUint startPos = iCurrentPos.iPos;
+    const TUint curSize  = FCB_FileSize();
+    const TUint length   = (TUint)aLength;
+    
+    if((startPos + length > curSize) || (startPos > startPos + length) )
+        aLength=curSize-startPos;
+		
+	TUint flag = DirectIOMode(aMessage) ? RLocalDrive::ELocDrvDirectIO : 0;
 	
-	const TUint startPos = iCurrentPos.iPos;
-	const TUint curSize  = FCB_FileSize();
-	const TUint length   = (TUint)aLength;
-	
-	if((startPos + length > curSize) || (startPos > startPos + length) )
-		aLength=curSize-startPos;
-	
-    FatMount().ReadFromClusterListL(iCurrentPos,aLength,aDes,aMessage,aOffset);
+    FatMount().ReadFromClusterListL(iCurrentPos,aLength,aDes,aMessage,aOffset, flag);
 	aLength=iCurrentPos.iPos-startPos;
 	}
 
 
 void CFatFileCB::ReadL(TInt aFilePos,TInt& aLength,const TAny* aTrg,const RMessagePtr2& aMessage)
-	{
-	ReadL(TInt64(aFilePos),aLength,(TDes8*) aTrg,aMessage, 0);
-	}
+    {
+    ReadL(TInt64(aFilePos),aLength,(TDes8*) aTrg,aMessage, 0);
+    }
 
 //-----------------------------------------------------------------------------
 /**
@@ -270,115 +272,117 @@
 
 */
 void CFatFileCB::WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aSrc,const RMessagePtr2& aMessage, TInt aOffset)
-	{
-	__PRINT3(_L("CFatFileCB::WriteL[0x%x] pos=%LU len=%d"), this, aPos, aLength);
+    {
+    __PRINT3(_L("CFatFileCB::WriteL[0x%x] pos=%LU len=%d"), this, aPos, aLength);
 
-	// FAT supports 32 bits only for file size
-   	TUint64 endPos = aPos + aLength;
-   	if(endPos > KMaxSupportedFatFileSize)
-   		User::Leave(KErrNotSupported);
-   	
+    // FAT supports 32 bits only for file size
+    TUint64 endPos = aPos + aLength;
+    if(endPos > KMaxSupportedFatFileSize)
+        User::Leave(KErrNotSupported);
+    
     FatMount().CheckStateConsistentL();
     FatMount().CheckWritableL();
     const TUint pos = I64LOW(aPos);
-  	CheckPosL(pos);
-  	
-	const TUint startCluster = FCB_StartCluster();
-	const TUint length       = (TUint)aLength;
+    CheckPosL(pos);
+    
+    const TUint startCluster = FCB_StartCluster();
+    const TUint length       = (TUint)aLength;
+    
+    endPos = iCurrentPos.iPos + length; 
+    if ((endPos           > FCB_FileSize()) ||
+        (iCurrentPos.iPos > endPos)         ) // Overflow condition 
+        DoSetSizeL(iCurrentPos.iPos+length,EFalse);
+    
+    TUint startPos=iCurrentPos.iPos;
+    TUint badcluster=0;
+    TUint goodcluster=0;
+   	
+	TUint flag = DirectIOMode(aMessage) ? RLocalDrive::ELocDrvDirectIO : 0;
 	
-	endPos = iCurrentPos.iPos + length; 
-	if ((endPos           > FCB_FileSize()) ||
-	    (iCurrentPos.iPos > endPos)         ) // Overflow condition 
-		DoSetSizeL(iCurrentPos.iPos+length,EFalse);
+	TRAPD(ret, FatMount().WriteToClusterListL(iCurrentPos,aLength,aSrc,aMessage,aOffset,badcluster, goodcluster, flag));
    	
-	TUint startPos=iCurrentPos.iPos;
-	TUint badcluster=0;
-	TUint goodcluster=0;
-   	
-	TRAPD(ret, FatMount().WriteToClusterListL(iCurrentPos,aLength,aSrc,aMessage,aOffset,badcluster, goodcluster));
-   	
-	if (ret == KErrCorrupt || ret == KErrDied)
-		{
+    if (ret == KErrCorrupt || ret == KErrDied)
+        {
         if(startCluster == 0)
-			{ //Empty File, revert all the clusters allocated.
-			const TUint32 cluster = FCB_StartCluster();
-			FCB_SetStartCluster(0);
-			FCB_SetFileSize(0);
-			IndicateFileSizeModified(ETrue);
+            { //Empty File, revert all the clusters allocated.
+            const TUint32 cluster = FCB_StartCluster();
+            FCB_SetStartCluster(0);
+            FCB_SetFileSize(0);
+            IndicateFileSizeModified(ETrue);
             
-			FlushAllL();
+            FlushAllL();
 
-			iCurrentPos.iCluster = 0;
-			iCurrentPos.iPos = 0;
+            iCurrentPos.iCluster = 0;
+            iCurrentPos.iPos = 0;
 
-			FAT().FreeClusterListL(cluster);
-			FAT().FlushL();
-			}
-		else
-			{ //Calculate the clusters required based on file size, revert extra clusters if allocated.
-			const TUint curSize = FCB_FileSize();
-			TUint ClustersNeeded = curSize >> ClusterSizeLog2();
-			if(curSize > (ClustersNeeded << ClusterSizeLog2()))
-				{
-				ClustersNeeded++;
-				}
+            FAT().FreeClusterListL(cluster);
+            FAT().FlushL();
+            }
+        else
+            { //Calculate the clusters required based on file size, revert extra clusters if allocated.
+            const TUint curSize = FCB_FileSize();
+            TUint ClustersNeeded = curSize >> ClusterSizeLog2();
+            if(curSize > (ClustersNeeded << ClusterSizeLog2()))
+                {
+                ClustersNeeded++;
+                }
 
-			TUint32 cluster = FCB_StartCluster();
-			while(--ClustersNeeded)
-				{
-				FAT().GetNextClusterL(cluster);
-				}
+            TUint32 cluster = FCB_StartCluster();
+            while(--ClustersNeeded)
+                {
+                FAT().GetNextClusterL(cluster);
+                }
                 
-			iCurrentPos.iCluster = cluster;
+            iCurrentPos.iCluster = cluster;
 
-			if (FAT().GetNextClusterL(cluster))
-				{
-				FAT().FreeClusterListL(cluster);
-				}
+            if (FAT().GetNextClusterL(cluster))
+                {
+                FAT().FreeClusterListL(cluster);
+                }
 
-			FAT().WriteFatEntryEofL(iCurrentPos.iCluster);
-			FAT().FlushL();
-			}
-		}
+            FAT().WriteFatEntryEofL(iCurrentPos.iCluster);
+            FAT().FlushL();
+            }
+        }
 
-	User::LeaveIfError(ret);
+    User::LeaveIfError(ret);
 
-	if(badcluster != 0)
-		{
-		if(FCB_StartCluster() == badcluster)
-			{
+    if(badcluster != 0)
+        {
+        if(FCB_StartCluster() == badcluster)
+            {
             FCB_SetStartCluster(goodcluster);
-			FlushStartClusterL();
-			}
-		else
-			{
-			TUint32 aCluster = FCB_StartCluster();
-			do
-				{
+            FlushStartClusterL();
+            }
+        else
+            {
+            TUint32 aCluster = FCB_StartCluster();
+            do
+                {
                 if((TUint)badcluster == FAT().ReadL(aCluster))
-					{
-					FAT().WriteL(aCluster, goodcluster);
-					FAT().FlushL();
-					break;
-					}
-				}
-			while(FAT().GetNextClusterL(aCluster));
-			}
-		}
-	aLength=iCurrentPos.iPos-startPos;
+                    {
+                    FAT().WriteL(aCluster, goodcluster);
+                    FAT().FlushL();
+                    break;
+                    }
+                }
+            while(FAT().GetNextClusterL(aCluster));
+            }
+        }
+    aLength=iCurrentPos.iPos-startPos;
 
-	if(!IsSequentialMode() && FatMount().IsRuggedFSys() && pos+(TUint)aLength > FCB_FileSize())
-		{
-		WriteFileSizeL(pos+aLength);
-		}
+    if(!IsSequentialMode() && FatMount().IsRuggedFSys() && pos+(TUint)aLength > FCB_FileSize())
+        {
+        WriteFileSizeL(pos+aLength);
+        }
 
-	}
+    }
 
 
 void CFatFileCB::WriteL(TInt aFilePos,TInt& aLength,const TAny* aSrc,const RMessagePtr2& aMessage)
-	{
-	WriteL(TInt64(aFilePos),aLength,(TDesC8*) aSrc,aMessage, 0);
-	}
+    {
+    WriteL(TInt64(aFilePos),aLength,(TDesC8*) aSrc,aMessage, 0);
+    }
 
 
 //-----------------------------------------------------------------------------
@@ -388,58 +392,58 @@
 // Resize the seek index to accomodate a larger or smaller filesize
 // Assumes KSeekIndexSize is a power of 2.
 //
-	{
+    {
 
-	TInt maxNewIndex=aNewSize>>(ClusterSizeLog2()+aNewMult);
+    TInt maxNewIndex=aNewSize>>(ClusterSizeLog2()+aNewMult);
 
 
-	TInt    index=0;
-	TInt	indexEnd=KSeekIndexSize;
-	TInt	newValEnd=maxNewIndex;
+    TInt    index=0;
+    TInt    indexEnd=KSeekIndexSize;
+    TInt    newValEnd=maxNewIndex;
 
-	if (iSeekIndexSize<aNewMult)
-		{
-		TInt newVal=index;
-		TInt step=1<<(aNewMult-iSeekIndexSize);
-		index+=step-1;
-		while(index<indexEnd && newVal<newValEnd)
-			{
-			iSeekIndex[newVal] =  iSeekIndex[index];
-			newVal++;
-			index+=step;
-			}
-		while(newVal<indexEnd)
-			iSeekIndex[newVal++] =  0;
-		}
-	else
-		{
-		TInt diffSize = iSeekIndexSize-aNewMult;
-		TInt oldVal=(KSeekIndexSize>>diffSize) - 1;
-		TInt newVal=indexEnd-1;
-		TInt skip=(1<<diffSize)-1;
+    if (iSeekIndexSize<aNewMult)
+        {
+        TInt newVal=index;
+        TInt step=1<<(aNewMult-iSeekIndexSize);
+        index+=step-1;
+        while(index<indexEnd && newVal<newValEnd)
+            {
+            iSeekIndex[newVal] =  iSeekIndex[index];
+            newVal++;
+            index+=step;
+            }
+        while(newVal<indexEnd)
+            iSeekIndex[newVal++] =  0;
+        }
+    else
+        {
+        TInt diffSize = iSeekIndexSize-aNewMult;
+        TInt oldVal=(KSeekIndexSize>>diffSize) - 1;
+        TInt newVal=indexEnd-1;
+        TInt skip=(1<<diffSize)-1;
 
-		if ((iSeekIndexSize - aNewMult) > KSeekIndexSizeLog2)
-			{
+        if ((iSeekIndexSize - aNewMult) > KSeekIndexSizeLog2)
+            {
             ClearIndex(0); //-- Invalidate every entry.
-			}
-		else
-			{
-			while(newVal>=index)
-				{
+            }
+        else
+            {
+            while(newVal>=index)
+                {
 
-				iSeekIndex[newVal--] =  iSeekIndex[oldVal--];
+                iSeekIndex[newVal--] =  iSeekIndex[oldVal--];
 
 
-				for(TInt i=skip;i>0;i--)
-					{	
-					iSeekIndex[newVal--] = 0;
+                for(TInt i=skip;i>0;i--)
+                    {   
+                    iSeekIndex[newVal--] = 0;
 
-					}
-				}
-			}
-		}
-	iSeekIndexSize=aNewMult;
-	}
+                    }
+                }
+            }
+        }
+    iSeekIndexSize=aNewMult;
+    }
 
 
 /**
@@ -449,44 +453,44 @@
             if = 0  all existing index will be zero filled
 */ 
 void CFatFileCB::ClearIndex(TUint aNewSize)
-	{
+    {
 
-	if (!iSeekIndex)
-	    return;
+    if (!iSeekIndex)
+        return;
 
     if(aNewSize==0)
-    	{
-    	//-- zero fill all the array
+        {
+        //-- zero fill all the array
         Mem::FillZ(iSeekIndex, KSeekIndexSize*sizeof(TUint32));
-		return;
-    	}
+        return;
+        }
 
-	// Files that fill up a cluster exactly do not have a trailing empty
-	// cluster. So the entry for that position must also be invalidated
-	aNewSize--;
-	TInt firstInvalidIndex=aNewSize>>(iSeekIndexSize+ClusterSizeLog2());
-		
-	TInt indexLen=KSeekIndexSize-firstInvalidIndex;
+    // Files that fill up a cluster exactly do not have a trailing empty
+    // cluster. So the entry for that position must also be invalidated
+    aNewSize--;
+    TInt firstInvalidIndex=aNewSize>>(iSeekIndexSize+ClusterSizeLog2());
+        
+    TInt indexLen=KSeekIndexSize-firstInvalidIndex;
 
-	Mem::FillZ(iSeekIndex+firstInvalidIndex, indexLen * sizeof(TUint32));
-	}
+    Mem::FillZ(iSeekIndex+firstInvalidIndex, indexLen * sizeof(TUint32));
+    }
 
 TInt CFatFileCB::CalcSeekIndexSize(TUint aSize)
 //
 // Find the nearest power of 2 > aSize
 //
-	{
-	TInt count = 0;
-	const TUint indexSize=KSeekIndexSize<<ClusterSizeLog2();//KSeekIndexSize=128
-	if (aSize<=indexSize)
-	  return(count);
-	
-	while((aSize>>=1)>0)
-		{
-		count++;
-		}
-	return (count - (KSeekIndexSizeLog2 + ClusterSizeLog2()) + 1);
-	}
+    {
+    TInt count = 0;
+    const TUint indexSize=KSeekIndexSize<<ClusterSizeLog2();//KSeekIndexSize=128
+    if (aSize<=indexSize)
+      return(count);
+    
+    while((aSize>>=1)>0)
+        {
+        count++;
+        }
+    return (count - (KSeekIndexSizeLog2 + ClusterSizeLog2()) + 1);
+    }
 
 //-----------------------------------------------------------------------------
 /**
@@ -494,21 +498,21 @@
     @param aSize new file size.
 */
 void CFatFileCB::SetSizeL(TInt64 aSize)
-	{
-	__PRINT2(_L("CFatFileCB::SetSizeL[0x%x] sz=%LU"), this, aSize);
-	
-	//-- max. file size for FAT is 4GB-1
-	if (I64HIGH(aSize))
-		User::Leave(KErrNotSupported);
+    {
+    __PRINT2(_L("CFatFileCB::SetSizeL[0x%x] sz=%LU"), this, aSize);
+    
+    //-- max. file size for FAT is 4GB-1
+    if (I64HIGH(aSize))
+        User::Leave(KErrNotSupported);
 
-	DoSetSizeL(I64LOW(aSize), FatMount().IsRuggedFSys());
-	}
+    DoSetSizeL(I64LOW(aSize), FatMount().IsRuggedFSys());
+    }
 
 
 void CFatFileCB::SetSizeL(TInt aSize)
-	{
-	SetSizeL(TInt64(aSize));
-	}
+    {
+    SetSizeL(TInt64(aSize));
+    }
 
 //-----------------------------------------------------------------------------
 /**
@@ -516,22 +520,22 @@
 */
 void CFatFileCB::DoShrinkFileToZeroSizeL()
     {
-	    ASSERT(FCB_FileSize());
+        ASSERT(FCB_FileSize());
         ASSERT(FileSizeModified());
         
         ClearIndex(0); // Clear seek index array
-		
+        
         //-- update file dir. entry
         const TUint32 cluster = FCB_StartCluster();
-		FCB_SetStartCluster(0);
-		FCB_SetFileSize(0);
-			FlushAllL();
-		
+        FCB_SetStartCluster(0);
+        FCB_SetFileSize(0);
+            FlushAllL();
+        
         //-- free cluster list. 
-			CheckPosL(0);
-			FAT().FreeClusterListL(cluster);
-			FAT().FlushL();
-			}
+            CheckPosL(0);
+            FAT().FreeClusterListL(cluster);
+            FAT().FlushL();
+            }
 
 //-----------------------------------------------------------------------------
 /*
@@ -541,35 +545,36 @@
     @param aForceCachesFlush if ETrue, all file/FAT caches will be flushed 
 */
 void CFatFileCB::DoShrinkFileL(TUint32 aNewSize, TBool aForceCachesFlush)
-		{
+    {
     ASSERT(FileSizeModified());
     ASSERT(FCB_FileSize() > aNewSize && aNewSize);
-	
-    if(aForceCachesFlush)		
+    
+    if(aForceCachesFlush)       
         WriteFileSizeL(aNewSize); //-- write file size directly to its dir. entry
 
-	CheckPosL(aNewSize);
-	
+    CheckPosL(aNewSize);
+
     TUint32 cluster=iCurrentPos.iCluster;
-		if (FAT().GetNextClusterL(cluster))
-	    {//-- truncate the cluster chain
-			FAT().WriteFatEntryEofL(iCurrentPos.iCluster);
-			FAT().FreeClusterListL(cluster);
-			}
-		
+    
+    if (FAT().GetNextClusterL(cluster))
+        {//-- truncate the cluster chain
+        FAT().WriteFatEntryEofL(iCurrentPos.iCluster);
+        FAT().FreeClusterListL(cluster);
+        }
+        
     ClearIndex(aNewSize);
-		FAT().FlushL();
-		}
-	
+    FAT().FlushL();
+    }
+    
 //-----------------------------------------------------------------------------
 /**
     Expand a file.
-	
+    
     @param aNewSize new file size.
     @param aForceCachesFlush if ETrue, all file/FAT caches will be flushed
 */
 void CFatFileCB::DoExpandFileL(TUint32 aNewSize, TBool aForceCachesFlush)
-		{
+    {
     ASSERT(FCB_FileSize() < aNewSize);
     ASSERT(FileSizeModified());
 
@@ -577,41 +582,41 @@
     const TUint32 newSizeClusters = (TUint32)(((TUint64)aNewSize + Pow2(KClusterSzLog2) - 1) >> KClusterSzLog2);
 
 
-	//-- expanding a file
-	if (FCB_StartCluster() == 0)
-		{//-- the initial file size is 0 (no cluster chain)
+    //-- expanding a file
+    if (FCB_StartCluster() == 0)
+        {//-- the initial file size is 0 (no cluster chain)
          
         ClearIndex(0); //-- clear seek index array
         //-- FAT().FreeClusterHint() will give us a hint of the last free cluster
         const TUint32 tempStartCluster=FAT().AllocateClusterListL(newSizeClusters, FAT().FreeClusterHint()); 
-		FAT().FlushL();
+        FAT().FlushL();
 
-		iCurrentPos.iCluster=tempStartCluster;
-		FCB_SetStartCluster(tempStartCluster);
-		FCB_SetFileSize(aNewSize);
-		FlushAllL();
-		}
-	else
-		{
-		const TUint curSize = FCB_FileSize(); 
-	    const TUint32 oldSizeClusters = ((curSize + Pow2(KClusterSzLog2) - 1) >> KClusterSzLog2);
+        iCurrentPos.iCluster=tempStartCluster;
+        FCB_SetStartCluster(tempStartCluster);
+        FCB_SetFileSize(aNewSize);
+        FlushAllL();
+        }
+    else
+        {
+        const TUint curSize = FCB_FileSize(); 
+        const TUint32 oldSizeClusters = ((curSize + Pow2(KClusterSzLog2) - 1) >> KClusterSzLog2);
         ASSERT(newSizeClusters >= oldSizeClusters);
-		const TUint newClusters = newSizeClusters-oldSizeClusters;	//-- Number of clusters we need to append to the existing cluster chain
-		if (newClusters)
-			{
-			TEntryPos currentPos=iCurrentPos;
-			CheckPosL(FCB_FileSize());
-			FAT().ExtendClusterListL(newClusters,iCurrentPos.iCluster);
-			iCurrentPos=currentPos;
-			}
-	
-		FAT().FlushL();
-		
-        if(!IsSequentialMode() && aForceCachesFlush)	// Write file size directly to its dir. entry if a cache flush
-			WriteFileSizeL(aNewSize);				// is needed and rugged FAT is not ignored by client
-		}
+        const TUint newClusters = newSizeClusters-oldSizeClusters;  //-- Number of clusters we need to append to the existing cluster chain
+        if (newClusters)
+            {
+            TEntryPos currentPos=iCurrentPos;
+            CheckPosL(FCB_FileSize());
+            FAT().ExtendClusterListL(newClusters,iCurrentPos.iCluster);
+            iCurrentPos=currentPos;
+            }
+    
+        FAT().FlushL();
+        
+        if(!IsSequentialMode() && aForceCachesFlush)    // Write file size directly to its dir. entry if a cache flush
+            WriteFileSizeL(aNewSize);               // is needed and rugged FAT is not ignored by client
+        }
 
-	}
+    }
 
 //-----------------------------------------------------------------------------
 /**
@@ -621,21 +626,22 @@
                                 it is used in Rugged FAT mode.
 */
 void CFatFileCB::DoSetSizeL(TUint aSize, TBool aForceCachesFlush)
-	{
-	__PRINT4(_L("CFatFileCB::DoSetSizeL[0x%x] sz:%d, oldSz:%d, flush:%d"), this, aSize, FCB_FileSize(), aForceCachesFlush);
+    {
+    __PRINT4(_L("CFatFileCB::DoSetSizeL[0x%x] sz:%d, oldSz:%d, flush:%d"), this, aSize, FCB_FileSize(), aForceCachesFlush);
 
     FatMount().CheckStateConsistentL();
     FatMount().CheckWritableL();
 
-	
-	// Can not change the file size if it is clamped
-	if(Mount().IsFileClamped(MAKE_TINT64(0,FCB_StartCluster())) > 0)
-		User::Leave(KErrInUse);
-	
-	if(aSize == FCB_FileSize())
+    
+    // Can not change the file size if it is clamped
+    if(Mount().IsFileClamped(MAKE_TINT64(0,FCB_StartCluster())) > 0)
+        User::Leave(KErrInUse);
+    
+    if(aSize == FCB_FileSize())
         return;
 
     IndicateFileSizeModified(ETrue);
+	IndicateFileAttModified(ETrue);		// ensure file size is flushed
 
 	TInt newIndexMult=CalcSeekIndexSize(aSize);
 	if (iSeekIndex!=NULL && newIndexMult!=iSeekIndexSize)
@@ -650,18 +656,18 @@
         }
 
     //-------------------------------------------
-	//-- shrinking file to non-zero size
+    //-- shrinking file to non-zero size
     if (aSize < FCB_FileSize())
-		{
+        {
         DoShrinkFileL(aSize, aForceCachesFlush);
         return;
         }
     
     //-------------------------------------------
-	//-- expanding a file
+    //-- expanding a file
     DoExpandFileL(aSize, aForceCachesFlush);
 
-	}
+    }
 
 //-----------------------------------------------------------------------------
 /**
@@ -675,33 +681,37 @@
 
 */
 void CFatFileCB::SetEntryL(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask)
-	{
-	__PRINT1(_L("CFatFileCB::SetEntryL[0x%x]"), this);
+    {
+    __PRINT1(_L("CFatFileCB::SetEntryL[0x%x]"), this);
     
     FatMount().CheckStateConsistentL();
     FatMount().CheckWritableL();
 
     //-- change file attributes
     const TUint setAttMask = (aSetAttMask & KEntryAttMaskSupported); //-- supported attributes to set
-    TUint newAtt = Att();
+	TUint oldAtt = Att();
+	TUint newAtt = oldAtt;
 
 	if (setAttMask|aClearAttMask)
 		{
         newAtt |= setAttMask;
         newAtt &= ~aClearAttMask;
-        SetAtt(newAtt);
-        IndicateFileAttModified(ETrue); //-- indicate that file attributes have changed
+		if (newAtt != oldAtt)
+			{
+	        SetAtt(newAtt);
+		    IndicateFileAttModified(ETrue); //-- indicate that file attributes have changed
+			}
 		}
     
     //-- set file entry modification time if required
 	if (aSetAttMask&KEntryAttModified)
-	{
+		{
         SetModified(aTime);        //-- set file modified time
         IndicateFileAttModified(ETrue); //-- indicate that file attributes have changed
         IndicateFileTimeModified(ETrue); //-- this will force writing file mod. time to the media on Flush
         }
 
-	}
+    }
 
 
 //-----------------------------------------------------------------------------
@@ -709,39 +719,39 @@
     The same as FlushAllL(). This method is called from RFile::Flush()
 */
 void CFatFileCB::FlushDataL()
-	{
-	__PRINT1(_L("CFatFileCB::FlushDataL[0x%x]"), this);
+    {
+    __PRINT1(_L("CFatFileCB::FlushDataL[0x%x]"), this);
     FlushAllL();
-	}
+    }
 
 //-----------------------------------------------------------------------------
 /** 
     Flush the fide directory entry data: files size, attributes, time etc. 
 */
 void CFatFileCB::FlushAllL()
-	{
+    {
 
     //-- define this symbol in order to enable legacy behaviour, i.e. compulsory updating file dir. entry on flush.
     //-- otherwise the FlushAllL() will update the file dir. entry only if it differs from what is on the media, i.e.
     //-- file size, start cluster, attributes and modification timestamp
     #define ALWAYS_UPDATE_ENTRY_ON_FLUSH
 
-	__PRINT1(_L("CFatFileCB::FlushAllL[0x%x]"), this);
+    __PRINT1(_L("CFatFileCB::FlushAllL[0x%x]"), this);
 
     if (Mount().IsCurrentMount()==EFalse)
-		User::Leave(KErrDisMounted);
+        User::Leave(KErrDisMounted);
 
     FatMount().CheckStateConsistentL();
     FatMount().CheckWritableL();
 
-	if(!FileSizeModified() && !FileAttModified() && !FileTimeModified())
+    if(!FileSizeModified() && !FileAttModified() && !FileTimeModified())
         return; //-- nothing has changed in the file entry at all
 
 
     //-- read file dir. entry
-	TFatDirEntry entry;
-	FatMount().ReadDirEntryL(iFileDosEntryPos,entry);
-	__ASSERT_ALWAYS(entry.IsEndOfDirectory()==EFalse,User::Leave(KErrCorrupt));
+    TFatDirEntry entry;
+    FatMount().ReadDirEntryL(iFileDosEntryPos,entry);
+    __ASSERT_ALWAYS(entry.IsEndOfDirectory()==EFalse,User::Leave(KErrCorrupt));
 
     //-- the problem with KEntryAttModified here is that the file server uses this flag to 
     //-- deal with dirty file data. This means that this flag can be set even if there were no changes
@@ -772,35 +782,35 @@
 
     if(bUpdateDirEntry)
         {//-- write entry to the media
-	    __PRINT(_L("  CFatFileCB::FlushAllL #1"));
+        __PRINT(_L("  CFatFileCB::FlushAllL #1"));
         entry.SetAttributes(Att() & KEntryAttMaskSupported);
-	    entry.SetSize(FCB_FileSize());
-	    entry.SetTime(iModified, timeOffset);
-	    
+        entry.SetSize(FCB_FileSize());
+        entry.SetTime(iModified, timeOffset);
+        
         entry.SetStartCluster(FCB_StartCluster());
 
 	    const TBool setNotify = FatMount().GetNotifyUser();
-	if(setNotify)
-		{
-		FatMount().SetNotifyOff();	// do not launch a notifier
-		}
+		if(setNotify)
+			{
+			FatMount().SetNotifyOff();	// do not launch a notifier
+			}
 
-	    TRAPD(ret, FatMount().WriteDirEntryL(iFileDosEntryPos,entry));
-	
-	if(setNotify)
-		{
-		FatMount().SetNotifyOn();
-		}
+			TRAPD(ret, FatMount().WriteDirEntryL(iFileDosEntryPos,entry));
+		
+		if(setNotify)
+			{
+			FatMount().SetNotifyOn();
+			}
 
-	User::LeaveIfError(ret);
+		User::LeaveIfError(ret);
 
-        IndicateFileSizeModified(EFalse);
-        IndicateFileTimeModified(EFalse);
+		IndicateFileSizeModified(EFalse);
+		IndicateFileTimeModified(EFalse);
 	    }
 
 
-        //-- KEntryAttModified must be reset anyway
-        IndicateFileAttModified(EFalse); 
+    //-- KEntryAttModified must be reset anyway
+    IndicateFileAttModified(EFalse); 
 	}
 
 //-----------------------------------------------------------------------------
@@ -810,7 +820,7 @@
     @param  aNewName new file name; all trailing dots from the name will be removed
 */
 void CFatFileCB::RenameL(const TDesC& aNewName)
-	{
+    {
     __PRINT2(_L("CFatFileCB::RenameL[0x%x], name:%S"),this, &aNewName);
 
     FatMount().CheckStateConsistentL();
@@ -819,97 +829,97 @@
     const TPtrC fileName = RemoveTrailingDots(aNewName); //-- remove trailing dots from the name
 
 
-	FatMount().DoRenameOrReplaceL(*iFileName, fileName, CFatMountCB::EModeRename, iFileDosEntryPos);
-	
+    FatMount().DoRenameOrReplaceL(*iFileName, fileName, CFatMountCB::EModeRename, iFileDosEntryPos);
+    
     AllocBufferL(iFileName, fileName);
-	
-	if(!FatMount().IsRuggedFSys())
-		FAT().FlushL();
-	}
+    
+    if(!FatMount().IsRuggedFSys())
+        FAT().FlushL();
+    }
 
 
 //***********************************************************
 //* BlockMap interface
 //***********************************************************
-	
+    
 TInt CFatFileCB::BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos)
 //
 // Retrieves the block map of a given section of the file, in the FAT file system.
-//	
-	{
-	__PRINT2(_L("CFatFileCB::BlockMap aStartPos=%ld aEndPos=%ld"), aStartPos, aEndPos);
-	
-	if ( I64HIGH(aStartPos) || I64HIGH(aEndPos) )
-		return KErrNotSupported;
+//  
+    {
+    __PRINT2(_L("CFatFileCB::BlockMap aStartPos=%ld aEndPos=%ld"), aStartPos, aEndPos);
+    
+    if ( I64HIGH(aStartPos) || I64HIGH(aEndPos) )
+        return KErrNotSupported;
 
     TUint startPos = I64LOW(aStartPos);
-	TUint endPos = I64LOW(aEndPos);
+    TUint endPos = I64LOW(aEndPos);
 
-	// aEndPos will always be >=0 at this point
-	const TUint length = endPos - startPos;
-	
-	// Store the position of cluster zero in aInfo
-	CFatMountCB& fatMount = FatMount();
+    // aEndPos will always be >=0 at this point
+    const TUint length = endPos - startPos;
+    
+    // Store the position of cluster zero in aInfo
+    CFatMountCB& fatMount = FatMount();
 
-	TInt drvNo=-1;
-	TBusLocalDrive* locDrv;
-	if((fatMount.LocalDrive()->GetLocalDrive(locDrv)==KErrNone) && ((drvNo=GetLocalDriveNumber(locDrv))>=0) && (drvNo<KMaxLocalDrives))
-		aInfo.iLocalDriveNumber=drvNo;
-	else
-		return KErrNotSupported;
+    TInt drvNo=-1;
+    TBusLocalDrive* locDrv;
+    if((fatMount.LocalDrive()->GetLocalDrive(locDrv)==KErrNone) && ((drvNo=GetLocalDriveNumber(locDrv))>=0) && (drvNo<KMaxLocalDrives))
+        aInfo.iLocalDriveNumber=drvNo;
+    else
+        return KErrNotSupported;
 
-	// Fetch the address of cluster 0
-	aInfo.iStartBlockAddress = fatMount.FAT().DataPositionInBytes(KFirstClusterNum);
+    // Fetch the address of cluster 0
+    aInfo.iStartBlockAddress = fatMount.FAT().DataPositionInBytes(KFirstClusterNum);
 
-	TRAPD(r, CheckPosL(startPos));
-	if (r != KErrNone)
-		return r;
+    TRAPD(r, CheckPosL(startPos));
+    if (r != KErrNone)
+        return r;
 
-	aInfo.iBlockStartOffset = fatMount.ClusterRelativePos(iCurrentPos.iPos);
-	aInfo.iBlockGranularity = 1 << FatMount().ClusterSizeLog2();
-	const TUint myStartPos = iCurrentPos.iPos;
-	if ( myStartPos + length > FCB_FileSize())
-		return KErrArgument;
+    aInfo.iBlockStartOffset = fatMount.ClusterRelativePos(iCurrentPos.iPos);
+    aInfo.iBlockGranularity = 1 << FatMount().ClusterSizeLog2();
+    const TUint myStartPos = iCurrentPos.iPos;
+    if ( myStartPos + length > FCB_FileSize())
+        return KErrArgument;
 
-	TRAP(r, FatMount().BlockMapReadFromClusterListL(iCurrentPos, length, aInfo));
-	if (r != KErrNone)
-		return r;
+    TRAP(r, FatMount().BlockMapReadFromClusterListL(iCurrentPos, length, aInfo));
+    if (r != KErrNone)
+        return r;
 
-	aStartPos = iCurrentPos.iPos;
-	if ((I64LOW(aStartPos) == FCB_FileSize()) || ( I64LOW(aStartPos) == (myStartPos + length)))
-		return KErrCompletion;
-	else
-		return KErrNone;
-	}
+    aStartPos = iCurrentPos.iPos;
+    if ((I64LOW(aStartPos) == FCB_FileSize()) || ( I64LOW(aStartPos) == (myStartPos + length)))
+        return KErrCompletion;
+    else
+        return KErrNone;
+    }
 
 
 TInt CFatFileCB::GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput)
-	{
-	switch(aInterfaceId)
-		{
-		case EExtendedFileInterface:
-			((CFileCB::MExtendedFileInterface*&) aInterface) = this;
-			return KErrNone;
+    {
+    switch(aInterfaceId)
+        {
+        case EExtendedFileInterface:
+            ((CFileCB::MExtendedFileInterface*&) aInterface) = this;
+            return KErrNone;
 
-		case EBlockMapInterface:
-			aInterface = (CFileCB::MBlockMapInterface*) this;
-			return KErrNone;
+        case EBlockMapInterface:
+            aInterface = (CFileCB::MBlockMapInterface*) this;
+            return KErrNone;
 
-		case EGetLocalDrive:
-			return FatMount().LocalDrive()->GetLocalDrive((TBusLocalDrive*&) aInterface);
+        case EGetLocalDrive:
+            return FatMount().LocalDrive()->GetLocalDrive((TBusLocalDrive*&) aInterface);
 
-		default:
-			return CFileCB::GetInterface(aInterfaceId,aInterface,aInput);
-		}
-	}
+        default:
+            return CFileCB::GetInterface(aInterfaceId,aInterface,aInput);
+        }
+    }
 
 
 /**
     Overwrites file's start cluster (iStartCluster) in its directory entry.
 */
 void CFatFileCB::FlushStartClusterL()
-	{
-	__PRINT1(_L("CFatFileCB::FlushStartClusterL[0x%x]"), this);
+    {
+    __PRINT1(_L("CFatFileCB::FlushStartClusterL[0x%x]"), this);
 
     CFatMountCB& mount = FatMount();
     TFatDirEntry dirEntry;
@@ -917,21 +927,36 @@
     mount.ReadDirEntryL(iFileDosEntryPos, dirEntry); //-- read this file's dir. entry
     dirEntry.SetStartCluster(FCB_StartCluster());    //-- set new start cluster
     mount.WriteDirEntryL(iFileDosEntryPos, dirEntry);//-- write the entry back
-	}
+    }
 
 
 /**
     This is a RuggedFAT - specific method. Writes file size to the corresponding field of its file directory entry.
 */
 void CFatFileCB::WriteFileSizeL(TUint aSize)
-	{
-	__PRINT2(_L("CFatFileCB::WriteFileSizeL[0x%x], sz:%d"), this, aSize);
+    {
+    __PRINT2(_L("CFatFileCB::WriteFileSizeL[0x%x], sz:%d"), this, aSize);
 
     CFatMountCB& mount = FatMount();
     TFatDirEntry dirEntry;
 
     mount.ReadDirEntryL(iFileDosEntryPos, dirEntry); //-- read this file's dir. entry
     dirEntry.SetSize(aSize);                         //-- set new size
+
+	// As we're updating the directory entry anyway, we might as well update the attributes & time 
+	// if these have been modified to save having to update them later...
+	if (FileAttModified())
+		{
+		dirEntry.SetAttributes(Att() & KEntryAttMaskSupported);
+        IndicateFileAttModified(EFalse); 
+		IndicateFileTimeModified(ETrue);	//-- this mirrors the behaviour of CFatFileCB::~CFatFileCB()
+		}
+	if (FileTimeModified())
+		{
+		dirEntry.SetTime(iModified, FatMount().TimeOffset());
+        IndicateFileTimeModified(EFalse);
+		}
+
     mount.WriteDirEntryL(iFileDosEntryPos, dirEntry);//-- write the entry back
 
     IndicateFileSizeModified(EFalse);
--- a/userlibandfileserver/fileserver/sfat32/sl_leafdir_cache.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/sl_leafdir_cache.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -974,7 +974,10 @@
 	{
 	RPointerArray<CLeafDirTreeNode>* nodeStack = new(ELeave) RPointerArray<CLeafDirTreeNode>(4);
 	RFs fs;
-	fs.Connect();
+	
+    TInt nRes = fs.Connect();
+    User::LeaveIfError(nRes);
+
 	const TUint32 debugRegister = DebugRegister();
 	fs.SetDebugRegister(debugRegister|KFSYS);
 	if (iRoot != NULL)
--- a/userlibandfileserver/fileserver/sfat32/sl_mnt.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/sl_mnt.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -26,6 +26,7 @@
 #include "sl_dir_cache.h"
 #include "sl_scandrv.h"
 #include <hal.h>
+#include <f32dbg.h>
 
 TShortName DoGenerateShortNameL(const TDesC& aLongName,TInt& aNum,TBool aUseTildeSelectively);
 
@@ -1341,9 +1342,10 @@
     FindEntryStartL(RemoveTrailingDots(aName),KEntryAttMaskSupported,firstEntry,firstEntryPos);
     MoveToDosEntryL(firstEntryPos,firstEntry);
     TUint setAttMask=aSetAttMask&KEntryAttMaskSupported;
+	TInt oldAtt = firstEntry.Attributes();
+	TInt att = oldAtt;
     if (setAttMask|aClearAttMask)
         {
-        TInt att=firstEntry.Attributes();
         att|=setAttMask;
         att&=(~aClearAttMask);
         firstEntry.SetAttributes(att);
@@ -1352,6 +1354,8 @@
 		{
 		firstEntry.SetTime(aTime,TimeOffset());
 		}
+	else if (att == oldAtt)
+		return;					// no change - don't bother writing entry
     WriteDirEntryL(firstEntryPos,firstEntry);
     }
 
@@ -1607,7 +1611,7 @@
 /**
     Overwrite as many contiguous file clusters as possible.
 */
-void CFatMountCB::DoWriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint aLastcluster, TUint& aBadcluster, TUint& aGoodcluster)
+void CFatMountCB::DoWriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint aLastcluster, TUint& aBadcluster, TUint& aGoodcluster, TUint aFlag)
     {
 
     __PRINT(_L("CFatMountCB::DoWriteToClusterListL"));
@@ -1621,7 +1625,7 @@
     const TInt writeLength=Min(aLength,(clusterListLen<<ClusterSizeLog2())-clusterRelativePos);
     TInt64 dataStart=FAT().DataPositionInBytes(aPos.iCluster)+clusterRelativePos;
 
-    TRAPD(r, iRawDisk->WriteL(dataStart,writeLength,aSrc,aMessage,anOffset));
+    TRAPD(r, iRawDisk->WriteL(dataStart,writeLength,aSrc,aMessage,anOffset, aFlag));
 
     if(r == KErrNone) // Write succeded
         {
@@ -1736,7 +1740,7 @@
 
 //-----------------------------------------------------------------------------------------
 
-void CFatMountCB::WriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint& aBadcluster, TUint& aGoodcluster)
+void CFatMountCB::WriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint& aBadcluster, TUint& aGoodcluster, TUint aFlag)
 //
 // Overwrite cluster list.
 //
@@ -1758,7 +1762,7 @@
     TInt previouscluster=0;
     FOREVER
         {
-        DoWriteToClusterListL(aPos,length-offset,aSrc,aMessage,anOffset+offset, previouscluster, aBadcluster, aGoodcluster);
+        DoWriteToClusterListL(aPos,length-offset,aSrc,aMessage,anOffset+offset, previouscluster, aBadcluster, aGoodcluster, aFlag);
         if (offset == (aPos.iPos-startPos))
             continue;
         offset=aPos.iPos-startPos;
@@ -1773,7 +1777,7 @@
 
 //-----------------------------------------------------------------------------------------
 
-void CFatMountCB::DoReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset) const
+void CFatMountCB::DoReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset, TUint aFlag) const
 //
 // Read from as many contiguous file clusters as possible
 //
@@ -1789,7 +1793,7 @@
     const TInt readLength=Min(aLength,(clusterListLen<<ClusterSizeLog2())-clusterRelativePos);
     const TInt64 dataStart=FAT().DataPositionInBytes(aPos.iCluster)+clusterRelativePos;
 
-    TRAPD(r, iRawDisk->ReadL(dataStart,readLength,aTrg,aMessage,anOffset));
+    TRAPD(r, iRawDisk->ReadL(dataStart,readLength,aTrg,aMessage,anOffset, aFlag));
 
     if(r == KErrNone) // Read succeded
         {
@@ -1814,7 +1818,7 @@
 
 //-----------------------------------------------------------------------------------------
 
-void CFatMountCB::ReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset) const
+void CFatMountCB::ReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset, TUint aFlag) const
 //
 // Read from cluster list
 //
@@ -1834,7 +1838,7 @@
     TInt offset=0;
     FOREVER
         {
-        DoReadFromClusterListL(aPos,aLength-offset,aTrg,aMessage,anOffset+offset);
+        DoReadFromClusterListL(aPos,aLength-offset,aTrg,aMessage,anOffset+offset, aFlag);
         offset=aPos.iPos-startPos;
         if ((offset<aLength))
             {
@@ -3228,7 +3232,7 @@
 			TInt readLength = Min(aLength-readTotal,(clusterListLen<<ClusterSizeLog2())-pos);
 			__ASSERT_DEBUG(readLength>0,Fault(EReadFileSectionFailed));
 			TInt64 dataAddress=(FAT().DataPositionInBytes(cluster))+pos;
-			iRawDisk->ReadL(dataAddress,readLength,aTrg,aMessage,readTotal);
+			iRawDisk->ReadL(dataAddress,readLength,aTrg,aMessage,readTotal, 0);
 			readTotal += readLength;
 
 			if (readTotal == aLength)
@@ -3256,7 +3260,7 @@
 // Read aLength of data from disk directly to thread relative descriptor
 //
     {
-    iRawDisk->ReadL(aPos,aLength,aTrg,aMessage,anOffset);
+    iRawDisk->ReadL(aPos,aLength,aTrg,aMessage,anOffset, 0);
     }
 
 //-----------------------------------------------------------------------------------------
@@ -3271,7 +3275,7 @@
 	//-- check if we are trying to write to the FAT directly and wait until FAT scan thread finishes in this case.
     FAT().RequestRawWriteAccess(aPos, aLength);
 
-    iRawDisk->WriteL(aPos,aLength,aSrc,aMessage,anOffset);
+    iRawDisk->WriteL(aPos,aLength,aSrc,aMessage,anOffset, 0);
     //-- Note: FAT directory cache will be invalidated in MountL()
     }
 
@@ -3623,23 +3627,36 @@
 		case EDisableFATDirCache:
 			{
 		    MWTCacheInterface* pDirCache = iRawDisk->DirCacheInterface();
-		    TUint32 KEDisableFATDirCache = CDynamicDirCache::EDisableCache;
+		    TUint32 KEDisableFATDirCache = MWTCacheInterface::EDisableCache;
 		    pDirCache->Control(KEDisableFATDirCache, (TUint32) aParam1, NULL);
 			break;
 			}
 		case EDumpFATDirCache:
 			{
 		    MWTCacheInterface* pDirCache = iRawDisk->DirCacheInterface();
-		    TUint32 KEDumpFATDirCache = CDynamicDirCache::EDumpCache;
-		    pDirCache->Control(KEDumpFATDirCache, 0, NULL);
+		    if (pDirCache)
+		        {
+	            TUint32 KEDumpFATDirCache = MWTCacheInterface::EDumpCache;
+	            pDirCache->Control(KEDumpFATDirCache, 0, NULL);
+		        }
 			break;
 			}
 		case EFATDirCacheInfo:
 			{
-		    MWTCacheInterface* pDirCache = iRawDisk->DirCacheInterface();
-		    TUint32 KEFATDirCacheInfo = CDynamicDirCache::ECacheInfo;
-		    pDirCache->Control(KEFATDirCacheInfo, 0, NULL);
-			break;
+			MWTCacheInterface* pDCache = iRawDisk->DirCacheInterface();
+		    if (pDCache)
+		        {
+	            TUint32 KEFATDirCacheInfo = MWTCacheInterface::ECacheInfo;
+	            TDirCacheInfo aInfo;
+	            TInt r = pDCache->Control(KEFATDirCacheInfo, 0, static_cast<TAny*>(&aInfo));
+	            if (r == KErrNone)
+	                {
+	                TPckgBuf<TDirCacheInfo> pkgBuf(aInfo);
+	                r = aMessage.Write(2,pkgBuf);
+	                }
+                return r;
+		        }
+		    return KErrNotSupported;
 			}
 
 
--- a/userlibandfileserver/fileserver/sfat32/sl_mnt32.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/sl_mnt32.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -892,6 +892,13 @@
     if(aLevel == EMountVolParamQuery)
         {
         ASSERT(ConsistentState()); //-- volume state shall be consistent, otherwise its parameters do not make sense
+
+		// Ram Drives calculate their total / free space based on querying HAL parameters
+		// in ::VolumeL(). To make all interfaces return consistent results, we need to force
+		// a fallback to that for RAM drives.
+		if (iRamDrive)
+			return (KErrNotSupported);
+
         switch(aOption)
             {
             //-- Request a certain amount of free space on the volume.
@@ -927,11 +934,8 @@
             //-- A request to obtain size of the mounted volume without blocking (CMountCB::VolumeL() can block).
             case ESQ_MountedVolumeSize:
                 {
-                if(iRamDrive)
-                    return KErrNotSupported; //-- it requires knowledge of free space on the volume
-    
                 TUint64* pVal = (TUint64*)aParam; 
-                *pVal = iSize; //-- physical drive size
+		*pVal = iSize; //-- physical drive size
 
                 //-- take into account space occupied by FAT table, etc.
                 *pVal -= ClusterBasePosition(); 
@@ -1069,7 +1073,7 @@
 			TInt readLength = (TInt)Min((TInt64)(aLength-readTotal),(clusterListLen<<ClusterSizeLog2())-pos);
 			__ASSERT_DEBUG(readLength>0,Fault(EReadFileSectionFailed));
 			TInt64 dataAddress=(FAT().DataPositionInBytes(cluster))+pos;
-			iRawDisk->ReadL(dataAddress,readLength,aTrg,aMessage,readTotal);
+			iRawDisk->ReadL(dataAddress,readLength,aTrg,aMessage,readTotal, 0);
 			readTotal += readLength;
 
 			if (readTotal == aLength)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/userlibandfileserver/fileserver/sfile/efile.mmh	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,109 @@
+// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// f32\sfile\efile.mmp
+// efile.exe File Server
+// 
+//
+
+/**
+ @file
+*/
+
+
+SOURCEPATH		../sfsrv
+USERINCLUDE		../sfsrv
+
+USERINCLUDE		../ftrace
+USERINCLUDE		../sfile/traces
+
+SOURCE			 cl_file.cpp
+SOURCE			 cl_cli.cpp
+SOURCE			 cl_dir.cpp
+
+SOURCEPATH		../sfile
+USERINCLUDE		.
+SOURCE			 sf_amh.cpp sf_dat.cpp sf_debug.cpp sf_dir.cpp
+SOURCE			 sf_drv.cpp sf_file.cpp sf_fmt.cpp
+SOURCE			 sf_ldr.cpp sf_main.cpp sf_nbs.cpp sf_ses.cpp
+SOURCE			 sf_svr.cpp sf_sys.cpp sf_utl.cpp sf_mnt.cpp
+SOURCE			 sf_raw.cpp sf_prel.cpp sf_disk.cpp
+SOURCE			 sf_request.cpp sf_ops.cpp sf_notify.cpp
+SOURCE			 sf_thread.cpp sf_local.cpp sf_obj.cpp
+SOURCE			 sf_ext.cpp sf_hash.cpp
+SOURCE			 sf_plugin.cpp sf_plugin_ops.cpp sf_plugin_man.cpp
+SOURCE			 Sf_plugin_util.cpp
+SOURCE			 sf_cache_man.cpp sf_cache_client.cpp
+SOURCE			 sf_file_cache.cpp
+SOURCE			 sf_memory_man.cpp sf_memory_client.cpp
+SOURCE			 sf_plugin_shim.cpp
+SOURCE			 sf_notifier_handlers.cpp
+#ifdef SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION
+SOURCE			 sf_pool.cpp sf_notifier.cpp
+#endif
+
+#ifdef WINS
+SOURCE			 sf_lwins.cpp
+
+library			emulator.lib
+#else
+SOURCE			 sf_lepoc.cpp  sf_inflate.cpp sf_cache.cpp sf_decomp.cpp
+SOURCE			 sf_pgcompr.cpp
+
+#ifdef MARM
+SOURCEPATH	../../../kernel/eka/kernel/arm
+SOURCE			 byte_pair.cia
+#else
+SOURCEPATH	../../../kernel/eka/kernel
+SOURCE			 byte_pair.cpp
+#endif
+
+
+SOURCEPATH	../srom
+SOURCE			 sr_rom.cpp
+#endif
+
+STRICTDEPEND
+
+SOURCEPATH	.
+DOCUMENT		 ../group/release.txt
+
+TARGETTYPE		exexp
+
+DEFFILE			efile.def
+
+USERINCLUDE	../inc ../sfsrv/traces
+#ifdef SYMBIAN_OLD_EXPORT_LOCATION
+SYSTEMINCLUDE	../inc
+#endif
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+USERINCLUDE	../../../kernel/eka/include
+
+LIBRARY			 efsrv.lib euser.lib hal.lib
+
+EPOCSTACKSIZE	0x6000
+EPOCHEAPSIZE	0x00001000	0x800000
+
+START WINS
+BASEADDRESS		0x62000000
+WIN32_LIBRARY	kernel32.lib
+END
+UID		0x1000008c 0x100039e3
+VENDORID 0x70000001
+
+unpagedcode
+unpageddata
+
+SMPSAFE
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/userlibandfileserver/fileserver/sfile/efile.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,42 @@
+// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// f32/sfile/efile.mmp
+// efile.exe File Server
+// 
+//
+
+/**
+ @file
+*/
+
+
+TARGET			efile.exe
+
+#include "f32caps.mmh"  // Capabilities of File Server process
+#include "f32.mmh"  	// Generic definitions for the whole f32 component
+
+MACRO			SYMBIAN_PRIVATE_EFSRV
+
+// By default, tracepoints are compiled in to UDEB version only
+#ifdef SYMBIAN_TRACE_SYSTEM_INCLUDE
+macro SYMBIAN_FTRACE_ENABLE_UDEB
+//macro SYMBIAN_FTRACE_ENABLE_UREL
+#endif
+
+#include "efile.mmh"
+
+
+
+
+
--- a/userlibandfileserver/fileserver/sfile/sf_cache_client.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_cache_client.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -635,6 +635,13 @@
 	return EFalse;
 	}
 
+// return true if more than half of the segments in this file are locked
+TBool CCacheClient::LockedSegmentsHalfUsed()
+	{
+	if (LockedBytes() > (iMaxBytesCached >> 1))
+		return ETrue;
+	return EFalse;
+	}
 
 TInt CCacheClient::CachedBytes()
 	{
--- a/userlibandfileserver/fileserver/sfile/sf_cache_client.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_cache_client.h	Thu Jul 22 16:46:39 2010 +0100
@@ -57,6 +57,7 @@
 	TBool SegmentEmpty(TInt64 aPos);
 	TBool SegmentDirty(TInt64 aPos);
 	TBool TooManyLockedSegments();
+	TBool LockedSegmentsHalfUsed();
 
 	inline TInt CacheOffset(TInt64 aLinAddr) const \
 		{return(I64LOW(aLinAddr)& ((1 << iManager.SegmentSizeLog2())-1));}
--- a/userlibandfileserver/fileserver/sfile/sf_cache_man.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_cache_man.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -177,7 +177,7 @@
 	iMaxLockedSegments = TGlobalFileCacheSettings::MaxLockedSize() >> KSegmentSizeLog2;
 
 #ifdef __SIMULATE_LOCK_FAILURES__
-	iSimulateLockFailureMode = ETrue;
+	iSimulateLockFailureMode = EFalse;	// off by default unless switched on by KControlIoSimulateLockFailureMode
 #endif
 	}
 
--- a/userlibandfileserver/fileserver/sfile/sf_dat.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_dat.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -51,7 +51,6 @@
 TBool StartupInitCompleted;
 TBool LocalDriveMappingSet;
 CKernEventNotifier* TheKernEventNotifier;
-RFTrace TheFtrace;
 
 
 GLDEF_D TCodePageUtils TheCodePage;
--- a/userlibandfileserver/fileserver/sfile/sf_debug.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_debug.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -19,8 +19,9 @@
 #include <f32dbg.h>
 #include "f32image.h"
 #include <F32plugin.h>
+#include <filesystem_fat.h>
 #include "sf_file_cache.h"
-
+#include "sf_memory_man.h"
 
 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
 
@@ -28,6 +29,29 @@
 // ONLY INCLUDED IN DEBUG BUILDS
 //
 
+void PrintOpenFiles()
+	{
+	CCacheManager* manager = CCacheManagerFactory::CacheManager();
+	TInt allocatedSegmentCount = manager ? manager->Stats().iAllocatedSegmentCount : 0;
+	TInt lockedSegmentCount = manager ? manager->Stats().iLockedSegmentCount : 0;
+	TInt fileCount = manager ? manager->Stats().iFileCount : 0;
+	TInt filesOnClosedQueue = manager ? manager->Stats().iFilesOnClosedQueue : 0;
+
+	RDebug::Print(_L("TRACE: Open files %d allocatedSegmentCount %d lockedSegmentCount %d fileCount %d filesOnClosedQueue %d\n"), 
+		Files->Count(), allocatedSegmentCount, lockedSegmentCount, fileCount, filesOnClosedQueue);
+
+	Files->Lock();
+	TInt count=Files->Count();
+
+	for (TInt n=0; n<count; n++)
+		{
+		CFileCB* file=(CFileCB*)(*Files)[n];
+
+		RDebug::Print(_L("%3d: %C:%S fc %x sz %lx\n"), n, file->Drive().DriveNumber() + 'A', &file->FileNameF(), file->FileCache(), file->CachedSize64());
+		}
+	Files->Unlock();
+	}
+
 void PrintHeapSize(const TDesC& aMessage)
 //
 // Display the total memory available
@@ -625,6 +649,101 @@
         	
         	return KErrNone;
         	}
+        case KControlIoGlobalCacheConfig:
+		// read ESTART.TXT file for global memory settings
+            {
+            TGlobalCacheConfig globalCacheConfig;
+            TInt32 rel;
+            
+            const TInt KByteToByteShift = 10;
+            _LIT8(KLitSectionNameCacheMemory,"CacheMemory");
+            
+            if (F32Properties::GetInt(KLitSectionNameCacheMemory, _L8("GlobalCacheMemorySize"), rel))
+                globalCacheConfig.iGlobalCacheSizeInBytes = rel << KByteToByteShift;
+            else
+                globalCacheConfig.iGlobalCacheSizeInBytes = KErrNotFound;
+
+            if (F32Properties::GetInt(KLitSectionNameCacheMemory, _L8("LowMemoryThreshold"), rel))
+                globalCacheConfig.iGlobalLowMemoryThreshold = rel;
+            else
+                globalCacheConfig.iGlobalLowMemoryThreshold = KErrNotFound;
+
+            TPckgBuf<TGlobalCacheConfig> pkgBuf(globalCacheConfig);
+            TInt r=aRequest->Write(2,pkgBuf);
+            return r;
+            }
+        case KControlIoGlobalCacheInfo:
+    	// get system's current global cache memory info
+            {
+            TGlobalCacheInfo info;
+            info.iGlobalCacheSizeInBytes = TGlobalCacheMemorySettings::CacheSize();
+            info.iGlobalLowMemoryThreshold = TGlobalCacheMemorySettings::LowMemoryThreshold();
+            TPckgBuf<TGlobalCacheInfo> pkgBuf(info);
+            TInt r=aRequest->Write(2,pkgBuf);
+            return r;
+            }
+         case KControlIoDirCacheConfig:
+         // read ESTART.TXT file for per-drive directory cache settings
+            {
+            TInt driveNumber = aRequest->Drive()->DriveNumber();
+            TDirCacheConfig dirCacheConfig;
+            TInt32 rel;
+            dirCacheConfig.iDrive = driveNumber;
+            TBuf8<32> driveSection;
+            driveSection.Format(_L8("Drive%c"), 'A' + driveNumber);
+            
+            if (F32Properties::GetInt(driveSection, _L8("FAT_LeafDirCacheSize"), rel))
+                dirCacheConfig.iLeafDirCacheSize = rel;
+            else
+                dirCacheConfig.iLeafDirCacheSize = KErrNotFound;
+
+            if (F32Properties::GetInt(driveSection, _L8("FAT_DirCacheSizeMin"), rel))
+                dirCacheConfig.iDirCacheSizeMin = rel << KByteToByteShift;
+            else
+                dirCacheConfig.iDirCacheSizeMin = KErrNotFound;
+
+            if (F32Properties::GetInt(driveSection, _L8("FAT_DirCacheSizeMax"), rel))
+                dirCacheConfig.iDirCacheSizeMax = rel << KByteToByteShift;
+            else
+                dirCacheConfig.iDirCacheSizeMax = KErrNotFound;
+
+            TPckgBuf<TDirCacheConfig> pkgBuf(dirCacheConfig);
+            TInt r=aRequest->Write(2,pkgBuf);
+            return r;
+            }
+         case KControlIoDirCacheInfo:
+         // get system's current per-drive directory cache settings
+		 //  currently only supports FAT file system
+             {
+             TFSName fsName;
+             aRequest->Drive()->CurrentMount().FileSystemName(fsName);
+             if (fsName.CompareF(KFileSystemName_FAT) == 0)
+                 {
+                 // 16 is the control cmd used for FAT
+                 //  see EFATDirCacheInfo in FAT code please. 
+                 const TInt KFATDirCacheInfo = 16;
+                 return(aRequest->Drive()->ControlIO(aRequest->Message(),KFATDirCacheInfo,param1,param2));
+                 }
+             return KErrNotSupported;
+             }
+         case KControlIoSimulateMemoryLow:
+             {
+             CCacheMemoryManager* cacheMemManager = CCacheMemoryManagerFactory::CacheMemoryManager();
+             if (cacheMemManager)
+                 cacheMemManager->SetMemoryLow(ETrue);
+             else
+                 return KErrNotSupported;
+             return KErrNone;
+             }
+         case KControlIoStopSimulateMemoryLow:
+             {
+             CCacheMemoryManager* cacheMemManager = CCacheMemoryManagerFactory::CacheMemoryManager();
+             if (cacheMemManager)
+                 cacheMemManager->SetMemoryLow(EFalse);
+             else
+                 return KErrNotSupported;
+             return KErrNone;
+             }
 		
 		}
 #endif
--- a/userlibandfileserver/fileserver/sfile/sf_dir.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_dir.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -17,6 +17,10 @@
 
 #include "sf_std.h"
 
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "sf_dirTraces.h"
+#endif
+
 LOCAL_C CDirCB* GetDirFromHandle(TInt aHandle,CSessionFs* aSession)
 //
 // Get the dir control block from its handle.
@@ -52,19 +56,18 @@
 		{
 		TEntry e;
 
-		TRACE1(UTF::EBorder, UTraceModuleFileSys::ECDirCBReadL, EF32TraceUidFileSys, &aDir);
+		OstTrace1(TRACE_FILESYSTEM, FSYS_ECDIRCBREADL2, "fsDirReadPacked this %x", &aDir);
 		aDir.ReadL(e);
-		TRACE5(UTF::EBorder, UTraceModuleFileSys::ECDirCBReadLRet, EF32TraceUidFileSys, 
-			KErrNone, e.iAtt, I64LOW(e.iModified.Int64()), I64HIGH(e.iModified.Int64()), e.iSize);
+		OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECDIRCBREADL2RET, "fsDirReadPacked r %d att %x modified %x:%x  size %d", (TUint) KErrNone, (TUint) e.iAtt, (TUint) I64HIGH(e.iModified.Int64()), (TUint) I64LOW(e.iModified.Int64()), (TUint) e.iSize);
 		TInt len=EntrySize(e, EFalse);
 		TInt rLen=EntrySize(e, ETrue);
 		TEntry* pX=PtrAdd(pE,rLen);
 		if (pX>pEnd)
 			{
 
-			TRACE1(UTF::EBorder, UTraceModuleFileSys::ECDirCBStoreLongEntryNameL, EF32TraceUidFileSys, &aDir);
+			OstTrace1(TRACE_FILESYSTEM, FSYS_ECDIRCBSTORELONGENTRYNAMEL, "fsDirReadPacked this %x", &aDir);
 			aDir.StoreLongEntryNameL(e.iName);
-			TRACE1(UTF::EBorder, UTraceModuleFileSys::ECDirCBStoreLongEntryNameLRet, EF32TraceUidFileSys, KErrNone);
+			OstTrace1(TRACE_FILESYSTEM, FSYS_ECDIRCBSTORELONGENTRYNAMELRET, "fsDirReadPacked r %d", KErrNone);
 
 			aDir.SetPending(ETrue);
 			break;
@@ -163,10 +166,10 @@
 		return(r);
 	TEntry e;
 
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECDirCBReadL, EF32TraceUidFileSys, &dir);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECDIRCBREADL1, "this %x", &dir);
 	TRAP(r,dir->ReadL(e))
-	TRACE5(UTF::EBorder, UTraceModuleFileSys::ECDirCBReadLRet, EF32TraceUidFileSys, 
-		KErrNone, e.iAtt, I64LOW(e.iModified.Int64()), I64HIGH(e.iModified.Int64()), e.iSize);
+	OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECDIRCBREADL1RET, "r %d att %x modified %x:%x  size %d", (TUint) KErrNone, (TUint) e.iAtt, (TUint) I64HIGH(e.iModified.Int64()), (TUint) I64LOW(e.iModified.Int64()), (TUint) e.iSize);
+		
 
 
 	if (r==KErrNone)
--- a/userlibandfileserver/fileserver/sfile/sf_drv.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_drv.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -17,8 +17,9 @@
 
 #include "sf_std.h"
 #include "sf_file_cache.h"
-
-
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "sf_drvTraces.h"
+#endif
 //const TInt KMaxNotifierAttempts=4; // not used anywhere
 
 static TPtrC StripBackSlash(const TDesC& aName)
@@ -84,7 +85,7 @@
 	return(KErrNone);
 	}
 
-void ValidateAtts(TUint /*anEntryAtts*/,TUint& aSetAttMask,TUint& aClearAttMask)
+void ValidateAtts(TUint& aSetAttMask,TUint& aClearAttMask)
 //
 // Do not allow the entry type to be changed
 //
@@ -286,12 +287,12 @@
 	if (!aMount.IsDismounted() && !aMount.ProxyDriveDismounted())
 		{
 		aMount.SetDrive(this);
-		TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBReMount, EF32TraceUidFileSys, DriveNumber());
+		OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREMOUNT1, "drive %d", DriveNumber());
 		
         //-- actually, this is asking CMountCB to see if it belongs to the current media. 
         iReason = aMount.ReMount();
 
-		TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBReMountRet, EF32TraceUidFileSys, iReason);
+		OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREMOUNT1RET, "success %d", iReason);
 		
         if (iReason == KErrNone)	//	ReMount succeeded
 			{
@@ -327,13 +328,13 @@
     
     apMount = NULL;
 
-    TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountL, EF32TraceUidFileSys, &FSys(), DriveNumber());
+    OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber());
    
     //-- construct a new CmountCB object.
     //-- on return pMountsFs will be the pointer to the factory object of CFileSystem that produced this mount
     apMount = FSys().NewMountExL(this, &pMountsFs, aForceMount, aFsNameHash);
 
-	TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountLRet, EF32TraceUidFileSys, KErrNone, apMount);
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTLRET, "r %d CMountCB %x", (TUint) KErrNone, (TUint) apMount);
 	__PRINT2(_L("TDrive::MountMediaL created mount:0x%x FileSys:0x%x"), apMount, pMountsFs);
 
     ASSERT(pMountsFs && apMount);
@@ -402,10 +403,10 @@
 */
 TInt TDrive::MountControl(TInt aLevel, TInt aOption, TAny* aParam)
     {
-	TRACE4(UTF::EBorder, UTraceModuleFileSys::ECMountCBMountControl, EF32TraceUidFileSys, DriveNumber(), aLevel, aOption, aParam);
+	OstTraceExt4(TRACE_FILESYSTEM, FSYS_ECMOUNTCBMOUNTCONTROL, "drive %d aLevel %d aOption %x aParam %x", (TUint) DriveNumber(), (TUint) aLevel, (TUint) aOption, (TUint) aParam);
     TInt r = CurrentMount().MountControl(aLevel, aOption, aParam);
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBMountControlRet, EF32TraceUidFileSys, r);
-
+	
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBMOUNTCONTROLRET, "r %d", r);
 	return r;
     }
 
@@ -434,9 +435,9 @@
     //-- the caller will be suspended until aFreeSpaceRequired bytes is available or scanning process finishes
     {
         TUint64 freeSpaceReq = aFreeSpaceRequired;
-		TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBFreeSpace, EF32TraceUidFileSys, DriveNumber());
+		OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFREESPACE, "drive %d", DriveNumber());
         nRes = CurrentMount().RequestFreeSpace(freeSpaceReq);
-		TRACERET3(UTF::EBorder, UTraceModuleFileSys::ECMountCBFreeSpaceRet, EF32TraceUidFileSys, nRes, I64LOW(freeSpaceReq), I64HIGH(freeSpaceReq));
+		OstTraceExt3(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFREESPACERET, "r %d FreeSpace %x:%x", (TUint) nRes, (TUint) I64HIGH(freeSpaceReq), (TUint) I64LOW(freeSpaceReq));
         if(nRes == KErrNone)
             {
             return (freeSpaceReq >= aFreeSpaceRequired) ? KErrNone : KErrDiskFull;
@@ -466,11 +467,10 @@
     nRes = CheckMount();
     if(nRes != KErrNone)
         return nRes;
-
     //-- 1. Try mount-specific request first. It won't block this call as CMountCB::VolumeL() can do if some background activity is going on the mount
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBVolumeSize, EF32TraceUidFileSys, DriveNumber());
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBVOLUMESIZE, "drive %d", DriveNumber());
     nRes = CurrentMount().MountedVolumeSize(aSize);
-	TRACERET3(UTF::EBorder, UTraceModuleFileSys::ECMountCBVolumeSize, EF32TraceUidFileSys, nRes, I64LOW(aSize), I64HIGH(aSize));
+	OstTraceExt3(TRACE_FILESYSTEM, FSYS_ECMOUNTCBVOLUMESIZERET, "r %d aSize %x:%x", (TUint) nRes, (TUint) I64HIGH(aSize), (TUint) I64LOW(aSize));
     if(nRes == KErrNone)
         return nRes;
 
@@ -503,9 +503,9 @@
         return nRes;
 
     //-- 1. Try mount-specific request first. It won't block this call as CMountCB::VolumeL() can do 
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBCurrentFreeSpace, EF32TraceUidFileSys, DriveNumber());
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCURRENTFREESPACE, "drive %d", DriveNumber());
     nRes = CurrentMount().GetCurrentFreeSpaceAvailable(aFreeDiskSpace);
-	TRACERET3(UTF::EBorder, UTraceModuleFileSys::ECMountCBCurrentFreeSpaceRet, EF32TraceUidFileSys, nRes, I64LOW(aFreeDiskSpace), I64HIGH(aFreeDiskSpace));
+	OstTraceExt3(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCURRENTFREESPACERET, "r %d FreeSpace %x:%x", (TUint) nRes, (TUint) I64HIGH(aFreeDiskSpace), (TUint) I64LOW(aFreeDiskSpace));
     if(nRes == KErrNone)
         return nRes;
 
@@ -543,9 +543,9 @@
 	if(IsWriteProtected())
 		return(KErrAccessDenied);
 
-	TRACE4(UTF::EBorder, UTraceModuleFileSys::ECMountCBFinaliseMount2, EF32TraceUidFileSys, DriveNumber(), aOperation, aParam1, aParam2);
+	OstTraceExt4(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFINALISEMOUNT2, "drive %d aOperation %d aParam1 %x aParam2 %x", (TUint) DriveNumber(), (TUint) aOperation, (TUint) aParam1, (TUint) aParam2);
 	TRAP(r,CurrentMount().FinaliseMountL(aOperation, aParam1, aParam2));
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBFinaliseMount2Ret, EF32TraceUidFileSys, r);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFINALISEMOUNT2RET, "r %d", r);
 	
 	// Pass FinaliseDrive notification down to media driver
 	TInt driveNumber = DriveNumber();
@@ -578,9 +578,10 @@
 	if(IsWriteProtected())
 		return(KErrAccessDenied);
 
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBFinaliseMount1, EF32TraceUidFileSys, DriveNumber());
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFINALISEMOUNT1, "drive %d", DriveNumber());
 	TRAP(r,CurrentMount().FinaliseMountL());
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBFinaliseMount1Ret, EF32TraceUidFileSys, r);
+	
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFINALISEMOUNT1RET, "r %d", r);
 	
     return r;
 	}
@@ -887,7 +888,6 @@
 
 	return KErrNone;
 	}
-
 void TDrive::DriveInfo(TDriveInfo& anInfo)
 //
 // Get the drive info.
@@ -900,10 +900,9 @@
 
 	if(iFSys)
 		{
-		TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemDriveInfo, EF32TraceUidFileSys, &FSys(), DriveNumber());
+		OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMDRIVEINFO, "this %x aDriveNumber %d", (TUint) &FSys(), (TUint) DriveNumber());
 		FSys().DriveInfo(anInfo,DriveNumber());
-		TRACE3(UTF::EBorder, UTraceModuleFileSys::ECFileSystemDriveInfoRet, EF32TraceUidFileSys, 
-			anInfo.iType, anInfo.iDriveAtt, anInfo.iMediaAtt);
+		OstTraceExt3(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMDRIVEINFORET, "type %d driveAtt %x mediaAtt %x", (TUint) anInfo.iType, (TUint) anInfo.iDriveAtt, (TUint) anInfo.iMediaAtt);
 		}
 
 	anInfo.iDriveAtt=Att();
@@ -923,12 +922,10 @@
 		aVolume.iUniqueID=m.iUniqueID;
 		aVolume.iSize=m.iSize;
 
-		TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBVolumeL, EF32TraceUidFileSys, DriveNumber());
+		OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBVOLUMEL, "drive %d", DriveNumber());
 		TRAP(r,m.VolumeL(aVolume))
-		TRACE7(UTF::EBorder, UTraceModuleFileSys::ECMountCBVolumeLRet, EF32TraceUidFileSys, 
-			r, aVolume.iUniqueID, I64LOW(aVolume.iSize), I64HIGH(aVolume.iSize),
-			I64LOW(aVolume.iFree), I64HIGH(aVolume.iFree), aVolume.iFileCacheFlags);
-
+		OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECMOUNTCBVOLUMELRETA, "r %d iSize %x:%x iFree %x:%x", (TUint) r, (TUint) I64HIGH(aVolume.iSize), (TUint) I64LOW(aVolume.iSize), (TUint) I64HIGH(aVolume.iFree), (TUint) I64LOW(aVolume.iFree));
+		OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECMOUNTCBVOLUMELRETB, "iUniqueID %x iFileCacheFlags %x", (TUint) aVolume.iUniqueID, (TUint) aVolume.iFileCacheFlags);
 		}
 	return(r);
 	}
@@ -942,12 +939,11 @@
 	__CHECK_DRIVETHREAD(iDriveNumber);
 	aBuf=aName.AllocL();
 	TPtr volumeName=aBuf->Des();
-
-	TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBSetVolumeL, EF32TraceUidFileSys, DriveNumber(), aName);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSETVOLUMEL, "drive %d", DriveNumber());
+	OstTraceData(TRACE_FILESYSTEM, FSYS_EVOLUMENAME, "VolumeName %S", aName.Ptr(), aName.Length()<<1);
+	
 	CurrentMount().SetVolumeL(volumeName);
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBSetVolumeLRet, EF32TraceUidFileSys, KErrNone);
-
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSETVOLUMELRET, "r %d", KErrNone);
 	delete &CurrentMount().VolumeName();
 	CurrentMount().SetVolumeName(aBuf);
 	}
@@ -982,14 +978,12 @@
 		return(KErrAccessDenied);
 	TParse newDirName;
 	newDirName.Set(aName,NULL,NULL);
-
-	TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBMkDirL, EF32TraceUidFileSys, DriveNumber(), aName);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBMKDIRL, "drive %d", DriveNumber());
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBMKDIRLYS_EDIRNAME, "Dir %S", aName.Ptr(), aName.Length()<<1);
 	TRAP(r,CurrentMount().MkDirL(newDirName.FullName()))
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBMkDirLRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBMKDIRLRET, "r %d", r);
 	return(r);
 	}
-
 TInt TDrive::RmDir(const TDesC& aName)
 //
 // Remove a directory.
@@ -1006,11 +1000,10 @@
 		return(KErrPathNotFound);
 	if ((entry.iAtt&KEntryAttReadOnly) || IsWriteProtected())
 		return(KErrAccessDenied);
-
-	TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBRmDirL, EF32TraceUidFileSys, DriveNumber(), aName);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRMDIRL, "drive %d", DriveNumber());
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRMDIRLYS_EDIRNAME, "Dir %S", aName.Ptr(), aName.Length()<<1);
 	TRAP(r,CurrentMount().RmDirL(aName))
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBRmDirLRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRMDIRLRET, "r %d", r);
 	return(r);
 	}
 
@@ -1031,12 +1024,10 @@
 
     if (IsWriteProtected())
 		return(KErrAccessDenied);
-
-    //-- filesystems' CMountCB::DeleteL() implementations shall check the entry attributes themeselves. 
-	TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBDeleteL, EF32TraceUidFileSys, DriveNumber(), aName);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDELETEL1, "drive %d", DriveNumber());
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDELETEL1_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	TRAP(r,CurrentMount().DeleteL(aName))
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBDeleteLRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDELETEL1_RET, "r %d", r);
 	return r;
 	}
 
@@ -1107,11 +1098,11 @@
 	// remove from closed queue
 	LocateClosedFile(anOldName, EFalse);
 	LocateClosedFile(aNewName, EFalse);
-
-	TRACEMULT3(UTF::EBorder, UTraceModuleFileSys::ECMountCBRenameL, EF32TraceUidFileSys, DriveNumber(), oldEntryName,newEntryName);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRENAMEL, "drive %d", DriveNumber());
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRENAMELYS_EOLDNAME, "OldName %S", oldEntryName.Ptr(), oldEntryName.Length()<<1);
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRENAMELYS_ENEWNAME, "NewName %S", newEntryName.Ptr(), newEntryName.Length()<<1);
 	TRAP(r,CurrentMount().RenameL(oldEntryName,newEntryName))
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBRenameLRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRENAMELRET, "r %d", r);
 	return(r);
 	}
 
@@ -1145,11 +1136,11 @@
 	// remove from closed queue
 	LocateClosedFile(anOldName, EFalse);
 	LocateClosedFile(aNewName, EFalse);
-
-	TRACEMULT3(UTF::EBorder, UTraceModuleFileSys::ECMountCBReplaceL, EF32TraceUidFileSys, DriveNumber(), anOldName, aNewName);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREPLACEL, "drive %d", DriveNumber());
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREPLACEL_EOLDNAME, "OldName %S", anOldName.Ptr(), anOldName.Length()<<1);
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREPLACEL_ENEWNAME, "NewName %S", aNewName.Ptr(), aNewName.Length()<<1);
 	TRAP(r,CurrentMount().ReplaceL(anOldName,aNewName))
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBReplaceLRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREPLACELRET, "r %d", r);
 	return(r);
 	}
 
@@ -1178,28 +1169,44 @@
 // Get entry details
 //
 	{
-	FlushCachedFileInfoL();
-
-	TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBEntryL, EF32TraceUidFileSys, DriveNumber(), aName);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBENTRYL, "drive %d", DriveNumber());
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBENTRYL_EFILEPATH, "FilePath %S", aName.Ptr(), aName.Length()<<1);
 	CurrentMount().EntryL(aName,anEntry);
-	TRACE5(UTF::EBorder, UTraceModuleFileSys::ECMountCBEntryLRet, EF32TraceUidFileSys, 
-		KErrNone, anEntry.iAtt, 
-		I64LOW(anEntry.iModified.Int64()), I64HIGH(anEntry.iModified.Int64()), 
-		anEntry.iSize);
+
+	// If the file is already open then read the file attributes directly from the file
+	TFileName foldedName;
+	TUint32 nameHash=0;
+	foldedName.CopyF(aName);
+	nameHash=CalcNameHash(foldedName);
 
+	__CHECK_DRIVETHREAD(iDriveNumber);
+	TDblQueIter<CFileCB> q(CurrentMount().iMountQ);
+	CMountCB* currentMount = &CurrentMount();
+	CFileCB* file;
+	while ((file=q++)!=NULL)
+		{
+		if ((&file->Drive()==this) && 
+			&file->Mount() == currentMount &&
+			nameHash == file->NameHash() && 
+			file->FileNameF().Match(foldedName)==KErrNone)
+			{
+			anEntry.iAtt = file->Att() & ~KEntryAttModified;
+			anEntry.SetFileSize(file->CachedSize64());
+			anEntry.iModified = file->Modified();
+			break;
+			}
+		}
+
+
+	OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECMOUNTCBENTRYLRET, "att %x modified %x:%x  size %x:%x", (TUint) anEntry.iAtt, (TUint) I64HIGH(anEntry.iModified.Int64()), (TUint) I64LOW(anEntry.iModified.Int64()), (TUint) I64HIGH(anEntry.FileSize()), (TUint) anEntry.FileSize());
 	}
 
-TInt TDrive::CheckAttributes(const TDesC& aName,TUint& aSetAttMask,TUint& aClearAttMask)
+TInt TDrive::CheckAttributes(TUint& aSetAttMask,TUint& aClearAttMask)
 //
 // Validate the changes against the current entry attributes
 //
 	{
-
-	TEntry entry;
-	TRAPD(r,DoEntryL(aName,entry));
-	if (r!=KErrNone)
-		return(r);
-	ValidateAtts(entry.iAtt,aSetAttMask,aClearAttMask);
+	ValidateAtts(aSetAttMask,aClearAttMask);
 	return(KErrNone);
 	}
 
@@ -1216,7 +1223,7 @@
 	CFileCB* pF=LocateFile(entryName);
 	if (pF!=NULL)
 		return(KErrInUse);
-	r=CheckAttributes(entryName,aSetAttMask,aClearAttMask);
+	r=CheckAttributes(aSetAttMask,aClearAttMask);
 	if (r!=KErrNone)
 		return(r);
 	if (IsWriteProtected())
@@ -1224,12 +1231,10 @@
 	TTime nullTime(0);
 	if (aTime!=nullTime)
 		aSetAttMask|=KEntryAttModified;
-
-	TRACEMULT6(UTF::EBorder, UTraceModuleFileSys::ECMountCBSetEntryL, EF32TraceUidFileSys, 
-		DriveNumber(), aName, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()), aSetAttMask, aClearAttMask);
+	OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSETENTRYL, "drive %d aTime %x:%x  aSetAttMask %x aClearAttMask %x", (TUint) DriveNumber(), (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()), (TUint) aSetAttMask, (TUint) aClearAttMask);
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSETENTRYL_EFILEPATH, "FilePath %S", aName.Ptr(), aName.Length()<<1);
 	TRAP(r,CurrentMount().SetEntryL(entryName,aTime,aSetAttMask,aClearAttMask))
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBSetEntryLRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSETENTRYLRET, "r %d", r);
 	return(r);
 	}
 
@@ -1365,12 +1370,11 @@
 		}
 	else
 		{
-		TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewFileL, EF32TraceUidFileSys, &FSys(), DriveNumber());
-
+		OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWFILEL, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber());
         //-- construct CFileCB object, belonging to the corresponding mount
         pFile = aFileCB = CurrentMount().NewFileL();
 
-		TRACERET2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewFileLRet, EF32TraceUidFileSys, r, pFile);
+		OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWFILELRET, "r %d CFileCB %x", (TUint) r, (TUint) pFile);
 		TDrive* createdDrive=!aRequest->SubstedDrive() ? this : aRequest->SubstedDrive();
 
     	HBufC* fileName = CreateFileNameL(aName);
@@ -1401,10 +1405,10 @@
 
 	if (openFile)
 		{
-		TRACEMULT5(UTF::EBorder, UTraceModuleFileSys::ECMountCBFileOpenL, EF32TraceUidFileSys, DriveNumber(), aName, aMode, (TUint) anOpen, (TUint) pFile);
+		OstTraceExt4(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFILEOPENL, "drive %d aMode %x anOpen %d aFile %x", (TUint) DriveNumber(), (TUint) aMode, (TUint) anOpen, (TUint) pFile);
+		OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFILEOPENL_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 		CurrentMount().FileOpenL(aName,aMode,anOpen,pFile);
-		TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBFileOpenLRet, EF32TraceUidFileSys, KErrNone);
-
+		OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFILEOPENLRET, "r %d", KErrNone);
 		// Delete on close may now be safely flagged if required.
 		// The file did not exist on the media prior to the
 		// CMountCB::FileOpenL() call for the case of a create.
@@ -1475,11 +1479,10 @@
 // Open a directory listing. Leave on error.
 //
 	{
-	TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewDirL, EF32TraceUidFileSys, &FSys(), DriveNumber());
-
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWDIRL, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber());
     CDirCB* pD = aDir = CurrentMount().NewDirL(); //-- construct CDirCB object, belonging to the corresponding mount
 
-	TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewDirLRet, EF32TraceUidFileSys, KErrNone, pD);
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWDIRLRET, "r %d CDirCB %x", (TUint) KErrNone, (TUint) pD);
 	pD->InitL(this);
 	// modify resource counter after initialisation to ensure correct cleanup
 	AddResource(CurrentMount());
@@ -1487,10 +1490,10 @@
 	pD->iUidType=aUidType;
 	Dirs->AddL(pD,ETrue);
 	aHandle=aSession->Handles().AddL(pD,ETrue);
-
-	TRACEMULT3(UTF::EBorder, UTraceModuleFileSys::ECMountCBDirOpenL, EF32TraceUidFileSys, DriveNumber(), aName, (TUint) pD);
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDIROPENL, "drive %d aDir %x", (TUint) DriveNumber(), (TUint) pD);
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDIROPENL_EDIRNAME, "Dir %S", aName.Ptr(), aName.Length()<<1);
 	CurrentMount().DirOpenL(aName,pD);
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBDirOpenLRet, EF32TraceUidFileSys, KErrNone);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDIROPENLRET, "r %d", KErrNone);
 	}
 
 TInt TDrive::DirOpen(CSessionFs* aSession,TInt& aHandle,const TDesC& aName,TUint anAtt,const TUidType& aUidType)
@@ -1549,13 +1552,11 @@
 	if (r!=KErrNone)
 		return(r);
 	TPtrC entryName(StripBackSlash(aName));
-
 	TRACETHREADID(aMessage);
-	TRACEMULT7(UTF::EBorder, UTraceModuleFileSys::ECMountCBReadFileSectionL, EF32TraceUidFileSys, 
-		DriveNumber(), aName, I64LOW(aPos), I64HIGH(aPos), (TUint) aTrg, aLength, I64LOW(threadId));
+	OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREADFILESECTIONL, "drive %d clientThreadId %x aPos %x:%x aLength %d", (TUint) DriveNumber(), (TUint) threadId, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREADFILESECTIONL_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	TRAP(r,ReadSectionL(entryName,aPos,aTrg,aLength,aMessage));
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBReadFileSectionLRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREADFILESECTIONLRET, "r %d", r);
 	if (r==KErrHidden)
 		r=KErrNotFound;	
 	else if (r==KErrPathHidden)
@@ -1587,9 +1588,9 @@
 		TRAP(r,FlushCachedFileInfoL());
 	if (r==KErrNone)
 		{
-		TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBCheckDisk1, EF32TraceUidFileSys, DriveNumber());
+		OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCHECKDISK1, "drive %d", DriveNumber());
 		r=CurrentMount().CheckDisk();
-		TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBCheckDisk1Ret, EF32TraceUidFileSys, r);
+		OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCHECKDISK1RET, "r %d", r);
 		}
 	return(r);
 	}
@@ -1604,9 +1605,9 @@
 		TRAP(r,FlushCachedFileInfoL());
 	if (r==KErrNone)
 		{
-		TRACE4(UTF::EBorder, UTraceModuleFileSys::ECMountCBCheckDisk2, EF32TraceUidFileSys, DriveNumber(), aOperation, aParam1, aParam2);
+		OstTraceExt4(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCHECKDISK2, "drive %d aOperation %d aParam1 %x aParam2 %x", (TUint) DriveNumber(), (TUint) aOperation, (TUint) aParam1, (TUint) aParam2);
 		r=CurrentMount().CheckDisk(aOperation, aParam1, aParam2);
-		TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBCheckDisk2Ret, EF32TraceUidFileSys, r);
+		OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCHECKDISK2RET, "r %d", r);
 		}
 
 	return(r);
@@ -1628,10 +1629,9 @@
 	// Empty closed file queue
 	TClosedFileUtils::Remove(DriveNumber());
 
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBScanDrive1, EF32TraceUidFileSys, DriveNumber());
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSCANDRIVE1, "drive %d", DriveNumber());
 	r = CurrentMount().ScanDrive();
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBScanDrive1Ret, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSCANDRIVE1RET, "r %d", r);
 	return r;
 	}
 
@@ -1655,10 +1655,9 @@
 	// Empty closed file queue
 	TClosedFileUtils::Remove(DriveNumber());
 
-	TRACE4(UTF::EBorder, UTraceModuleFileSys::ECMountCBScanDrive2, EF32TraceUidFileSys, DriveNumber(), aOperation, aParam1, aParam2);
+	OstTraceExt4(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSCANDRIVE2, "drive %d aOperation %d aParam1 %x aParam2 %x", (TUint) DriveNumber(), (TUint) aOperation, (TUint) aParam1, (TUint) aParam2);
 	r = CurrentMount().ScanDrive(aOperation, aParam1, aParam2);
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBScanDrive2Ret, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSCANDRIVE2RET, "r %d", r);
 	return r;
 	}
 
@@ -1672,11 +1671,11 @@
 	if (r!=KErrNone)
 		return(r);
 	TPtrC entryName(StripBackSlash(aName));
-
-	TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBGetShortNameL, EF32TraceUidFileSys, DriveNumber(), entryName);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETSHORTNAMEL, "drive %d", DriveNumber());
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETSHORTNAMEL_ELONGNAME, "LongName %S", entryName.Ptr(), entryName.Length()<<1);
 	TRAP(r,CurrentMount().GetShortNameL(entryName,aShortName));
-	TRACERETMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBGetShortNameLRet, EF32TraceUidFileSys, r, aShortName);
-
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETSHORTNAMEL_ESHORTNAME, "ShortName %S", aShortName.Ptr(), aShortName.Length()<<1);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETSHORTNAMEL_ECMOUNTCBGETSHORTNAMELRET, "r %d", r);
 	return(r);
 	}
 
@@ -1689,11 +1688,11 @@
 	if (r!=KErrNone)
 		return(r);
 	TPtrC entryName(StripBackSlash(aShortName));
-
-	TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBGetLongNameL, EF32TraceUidFileSys, DriveNumber(), entryName);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETLONGNAMEL, "drive %d", DriveNumber());
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETLONGNAMEL_ESHORTNAME, "ShortName %S", entryName.Ptr(), entryName.Length()<<1);
 	TRAP(r,CurrentMount().GetLongNameL(entryName,aLongName));
-	TRACERETMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBGetLongNameLRet, EF32TraceUidFileSys, r, aLongName);
-
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETLONGNAMEL_ELONGNAME, "LongName %S", aLongName.Ptr(), aLongName.Length()<<1);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETLONGNAMELRET, "r %d", r);
 	return(r);
 	}
 
@@ -1857,22 +1856,18 @@
 		return(KErrNotReady);
 	TInt r;
 	CMountCB* pM=NULL;
-	TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountL, EF32TraceUidFileSys, &FSys(), DriveNumber());
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL1, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber());
 	TRAP(r,pM=FSys().NewMountL());
-	TRACERET2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountLRet, EF32TraceUidFileSys, r, pM);
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL1RET, "r %d CMountCB %x", (TUint) r, (TUint) pM);
 	if(r!=KErrNone)
 		return(r);
 	pM->SetDrive(this);
-
-	TRACE4(UTF::EBorder, UTraceModuleFileSys::ECMountCBForceRemountDrive, EF32TraceUidFileSys, 
-		DriveNumber(), aMountInfo, aMountInfoMessageHandle, aFlags);
+	OstTraceExt4(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFORCEREMOUNTDRIVE, "drive %d aMountInfo %x aMountInfoMessageHandle %x aFlags %x", (TUint) DriveNumber(), (TUint) aMountInfo, (TUint) aMountInfoMessageHandle, (TUint) aFlags);
 	r=pM->ForceRemountDrive(aMountInfo,aMountInfoMessageHandle,aFlags);
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBForceRemountDriveRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBFORCEREMOUNTDRIVERET, "r %d", r);
 	pM->Close();
 	return(r);
 	}
-
 TBool TDrive::IsExtensionMounted(CProxyDriveFactory* aFactory)
 //
 // return ETrue if extension mounted on the drive
@@ -1885,7 +1880,6 @@
 		}
 	return(EFalse);
 	}
-
 TInt TDrive::MountExtension(CProxyDriveFactory* aFactory,TBool aIsPrimary)
 //
 // Mount an extension
@@ -1909,7 +1903,7 @@
 	if(iFSys==NULL)
 		return(KErrNotReady);
 	TBool extSupported = iFSys->IsExtensionSupported();
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECFileSystemIsExtensionSupported, EF32TraceUidFileSys, extSupported);
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMISEXTENSIONSUPPORTED1, "%x r %d", (TUint) iFSys, (TUint) extSupported);
 	if(!extSupported)
 		return(KErrNotSupported);
 	if(IsExtensionMounted(aFactory))
@@ -1997,17 +1991,16 @@
 		return(KErrNotReady);
 	TInt r;
 	CMountCB* pM=NULL;
-	TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountL, EF32TraceUidFileSys, &FSys(), DriveNumber());
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL2, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber());
 	TRAP(r,pM=FSys().NewMountL());
-	TRACERET2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountLRet, EF32TraceUidFileSys, r, pM);
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL2RET, "r %d CMountCB %x", (TUint) r, (TUint) pM);
 	if(r!=KErrNone)
 		return(r);
 	pM->SetDrive(this);
 
-	TRACE2(UTF::EBorder, UTraceModuleFileSys::ECMountCBLock, EF32TraceUidFileSys, DriveNumber(), aStore);
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECMOUNTCBLOCK, "drive %d aStore %d", (TUint) DriveNumber(), (TUint) aStore);
 	r=pM->Lock(aOld,aNew,aStore);
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBLockRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBLOCKRET, "r %d", r);
 	pM->Close();
 	return(r);
 	}
@@ -2023,9 +2016,9 @@
 		return(KErrNotReady);
 	TInt r;
 	CMountCB* pM=NULL;
-	TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountL, EF32TraceUidFileSys, &FSys(), DriveNumber());
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL3, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber());
 	TRAP(r,pM=FSys().NewMountL());
-	TRACERET2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountLRet, EF32TraceUidFileSys, r, pM);
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL3RET, "r %d CMountCB %x", (TUint) r, (TUint) pM);
 	if(r!=KErrNone)
 		return(r);
 
@@ -2034,10 +2027,9 @@
 
 	pM->SetDrive(this);
 
-	TRACE2(UTF::EBorder, UTraceModuleFileSys::ECMountCBUnlock, EF32TraceUidFileSys, DriveNumber(), aStore);
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECMOUNTCBUNLOCK, "drive %d aStore %d", (TUint) DriveNumber(), (TUint) aStore);
 	r=pM->Unlock(aPassword,aStore);
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBUnlockRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBUNLOCKRET, "r %d", r);
 	pM->Close();
 	return(r);
 	}
@@ -2053,9 +2045,9 @@
 		return(KErrNotReady);
 	TInt r;
 	CMountCB* pM=NULL;
-	TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountL, EF32TraceUidFileSys, &FSys(), DriveNumber());
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL4, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber());
 	TRAP(r,pM=FSys().NewMountL());
-	TRACERET2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountLRet, EF32TraceUidFileSys, r, pM);
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL4RET, "r %d CMountCB %x", (TUint) r, (TUint) pM);
 	if(r!=KErrNone)
 		return(r);
 	pM->SetDrive(this);
@@ -2069,10 +2061,9 @@
 	if (info.iMediaAtt & KMediaAttLocked)
 		UnlockDevice(aPassword, EFalse);
 
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBClearPassword, EF32TraceUidFileSys, DriveNumber());
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCLEARPASSWORD, "drive %d", DriveNumber());
 	r=pM->ClearPassword(aPassword);
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBClearPasswordRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCLEARPASSWORDRET, "r %d", r);
 	pM->Close();
 	return(r);
 	}
@@ -2088,17 +2079,16 @@
 		return(KErrNotReady);
 	TInt r;
 	CMountCB* pM=NULL;
-	TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountL, EF32TraceUidFileSys, &FSys(), DriveNumber());
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL5, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber());
 	TRAP(r,pM=FSys().NewMountL());
-	TRACERET2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewMountLRet, EF32TraceUidFileSys, r, pM);
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWMOUNTL5RET, "r %d CMountCB %x", (TUint) r, (TUint) pM);
 	if(r!=KErrNone)
 		return(r);
 	pM->SetDrive(this);
 
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBErasePassword, EF32TraceUidFileSys, DriveNumber());
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBERASEPASSWORD, "drive %d", DriveNumber());
 	r=pM->ErasePassword();
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBErasePasswordRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBERASEPASSWORDRET, "r %d", r);
 	pM->Close();
 	return(r);
 	}
@@ -2237,10 +2227,9 @@
 	if (!iCurrentMount)
 		return;
 
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBDismounted, EF32TraceUidFileSys, DriveNumber());
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDISMOUNTED, "drive %d", DriveNumber());
     iCurrentMount->Dismounted();
-	TRACE0(UTF::EBorder, UTraceModuleFileSys::ECMountCBDismountedRet, EF32TraceUidFileSys);
-
+	OstTrace0(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDISMOUNTEDRET, "");
 	iCurrentMount->Close();
 	iCurrentMount=NULL;
     }
@@ -2337,7 +2326,6 @@
 	}
 
 
-
 TInt TDrive::ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2)
 //
 // General purpose test interface - .FSY specific.
@@ -2347,10 +2335,9 @@
 	if(r==KErrNone || (r==KErrInUse && iReason==KErrNone))
 		{
 		TRACETHREADID(aMessage);
-		TRACE5(UTF::EBorder, UTraceModuleFileSys::ECMountCBControlIO, EF32TraceUidFileSys, 
-			DriveNumber(), aCommand, aParam1, aParam2, I64LOW(threadId));
+		OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCONTROLIO, "drive %d aCommand %d aParam1 %x aParam2 %x clientThreadId %x", (TUint) DriveNumber(), (TUint) aCommand, (TUint) aParam1, (TUint) aParam2, (TUint) threadId);
 		r=CurrentMount().ControlIO(aMessage,aCommand,aParam1,aParam2);
-		TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBControlIORet, EF32TraceUidFileSys, r);
+		OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBCONTROLIORET, "r %d", r);
 		}
 	return(r);
 	}
@@ -2567,11 +2554,10 @@
     {
     ASSERT(!(apLDFormatInfo && apVolFormatParam));  //-- these parameters are mutually exclusive
     
-    TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewFormatL, EF32TraceUidFileSys, &FSys(), DriveNumber()); 
-
+    OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWFORMATL, "this %x drive %d", (TUint) &FSys(), (TUint) DriveNumber()); 
     CFormatCB* pFormat = CurrentMount().NewFormatL(); 
 
-	TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewFormatLRet, EF32TraceUidFileSys, KErrNone, pFormat); 
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWFORMATLRET, "r %d CFormatCB %x", (TUint) KErrNone, (TUint) pFormat); 
 	
     Formats->AddL(pFormat, ETrue); 
 	pFormat->InitL(this, aFmtMode); 
--- a/userlibandfileserver/fileserver/sfile/sf_ext.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_ext.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -15,9 +15,10 @@
 // 
 //
 
-
 #include "sf_std.h"
-
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "sf_extTraces.h"
+#endif
 typedef CProxyDriveFactory*(*TExtensionNew)();
 typedef CExtProxyDriveFactory*(*TProxyDriveNew)();
 
@@ -51,7 +52,7 @@
 */
 CProxyDrive::~CProxyDrive()
 	{
-	
+	delete iBody;
 	}
 
 
@@ -174,6 +175,32 @@
 	}	
 
 
+TInt CProxyDrive::SetAndOpenLibrary(RLibrary aLibrary)
+	{
+	TInt r = KErrNone;
+	if (iBody)
+		{
+		iBody->iLibrary = aLibrary;
+		r = iBody->iLibrary.Duplicate(RThread(), EOwnerProcess);
+		}
+	return r;
+	}
+
+/**
+Gets a copy of the Proxy Drive library (previously opened by OpenLibrary()) prior to deleting the proxy drive itself.
+After deleting the proxy drive, RLibrary::Close() should be called on the returned RLibrary object.
+*/
+RLibrary CProxyDrive::GetLibrary()
+	{
+	RLibrary lib;
+	if (iBody)
+		{
+		lib = iBody->iLibrary;
+		iBody->iLibrary.SetHandle(NULL);
+		}
+	return lib;
+	}
+
 /**
 Constructor.
 */
@@ -188,8 +215,12 @@
 EXPORT_C CLocDrvMountCB::~CLocDrvMountCB()
 	{
 	__PRINT1(_L("CLocDrvMountCB::~CLocDrvMountCB() 0x%x"),this);
-	if(iProxyDrive && !LocalDrives::IsProxyDrive(Drive().DriveNumber()) && LocalDrives::IsValidDriveMapping(Drive().DriveNumber()))
-		delete(iProxyDrive);
+	if(iProxyDrive && !LocalDrives::IsProxyDrive(Drive().DriveNumber()))
+		{
+		RLibrary lib = iProxyDrive->GetLibrary();
+		delete iProxyDrive;
+		lib.Close();
+		}
 	}
 
 
@@ -281,7 +312,6 @@
 	{
 	__ASSERT_ALWAYS(iProxyDrive!=NULL,Fault(ELocDrvDismountedLocalDrive));
 	iProxyDrive->Dismounted();
-	iProxyDrive->SetMount(NULL);
 	}
 
 
@@ -297,12 +327,10 @@
 */
 CLocalProxyDrive* CLocalProxyDrive::New(CMountCB* aMount,TBusLocalDrive& aLocDrv)
 	{
-	TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveNew, EF32TraceUidProxyDrive, 
-		aMount, aMount->DriveNumber());
-
+	OstTraceExt2(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVENEW, "aMount %x drive %d", (TUint) aMount, (TUint) aMount->DriveNumber());
 	CLocalProxyDrive* proxyDrive = new CLocalProxyDrive(aMount,aLocDrv);
 	
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveNewRet, EF32TraceUidProxyDrive, proxyDrive);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVENEWRET, "proxyDrive %x", proxyDrive);
 	return proxyDrive;
 	}
 
@@ -328,9 +356,8 @@
 */
 TInt CLocalProxyDrive::Initialise()
 	{
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveInitialise, EF32TraceUidProxyDrive, this);
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveInitialiseRet, EF32TraceUidProxyDrive, KErrNone);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEINITIALISE, "this %x", this);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEINITIALISERET, "r %d", KErrNone);
 	return(KErrNone);
 	}
 
@@ -344,9 +371,8 @@
 */
 TInt CLocalProxyDrive::Dismounted()
 	{
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveDismounted, EF32TraceUidProxyDrive, this);
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveDismountedRet, EF32TraceUidProxyDrive, KErrNone);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEDISMOUNTED, "this %x", this);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEDISMOUNTEDRET, "r %d", KErrNone);
 	return(KErrNone);
 	}
 
@@ -360,11 +386,9 @@
 */
 TInt CLocalProxyDrive::Enlarge(TInt aLength)
 	{
-	TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveEnlarge, EF32TraceUidProxyDrive, this, aLength);
-
+	OstTraceExt2(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEENLARGE, "this %x aLength %d", (TUint) this, (TUint) aLength);
 	TInt r = iLocDrv.Enlarge(aLength);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveEnlargeRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEENLARGERET, "r %d", r);
 	return r;
 	}
 
@@ -382,11 +406,9 @@
 */
 TInt CLocalProxyDrive::ReduceSize(TInt aPos, TInt aLength)
 	{
-	TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveReduceSize, EF32TraceUidProxyDrive, this, aPos, aLength);
-
+	OstTraceExt3(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEREDUCESIZE, "this %x aPos %x aLength %d", (TUint) this, (TUint) aPos, (TUint) aLength);
 	TInt r = iLocDrv.ReduceSize(aPos,aLength);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveReduceSizeRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEREDUCESIZERET, "r %d", r);
 	return r;
 	}
 
@@ -406,12 +428,9 @@
 TInt CLocalProxyDrive::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset, TInt aFlags)
 	{
 	TRACETHREADIDH(aThreadHandle);
-	TRACE8(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead1, EF32TraceUidProxyDrive, 
-		this, I64LOW(aPos), I64HIGH(aPos), aLength, aTrg, threadId, aOffset, aFlags);
-
+	OstTraceExt5(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEREAD1, "this %x clientThreadId %x aPos %x:%x aLength %d", (TUint) this, (TUint) threadId, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), aLength);
 	TInt r = iLocDrv.Read(aPos,aLength,aTrg,aThreadHandle,aOffset,aFlags);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead1Ret, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEREAD1RET, "r %d", r);
 	return r;
 	}
 
@@ -429,12 +448,9 @@
 TInt CLocalProxyDrive::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset)
 	{
 	TRACETHREADIDH(aThreadHandle);
-	TRACE7(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead2, EF32TraceUidProxyDrive, 
-		this, I64LOW(aPos), I64HIGH(aPos), aLength, aTrg, threadId, anOffset);
-
+	OstTraceExt5(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEREAD2, "this %x clientThreadId %x aPos %x:%x aLength %d", (TUint) this, (TUint) threadId, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), aLength);
 	TInt r = iLocDrv.Read(aPos,aLength,aTrg,aThreadHandle,anOffset);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead2Ret, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEREAD2RET, "r %d", r);
 	return r;
 	}
 
@@ -449,12 +465,9 @@
 */
 TInt CLocalProxyDrive::Read(TInt64 aPos,TInt aLength,TDes8& aTrg)
 	{
-	TRACE5(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead3, EF32TraceUidProxyDrive, 
-		this, I64LOW(aPos), I64HIGH(aPos), aLength, &aTrg);
-
+	OstTraceExt5(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEREAD3, "this %x aPos %x:%x aLength %d aTrg %x", (TUint) this, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), aLength, (TUint) &aTrg);
 	TInt r = iLocDrv.Read(aPos,aLength,aTrg);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead3Ret, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEREAD3RET, "r %d", r);
 	return r;
 	}
 
@@ -474,13 +487,9 @@
 TInt CLocalProxyDrive::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags)
 	{
 	TRACETHREADIDH(aThreadHandle);
-	TRACE8(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite1, EF32TraceUidProxyDrive, 
-		this, I64LOW(aPos), I64HIGH(aPos), aLength, aSrc, threadId, aOffset, aFlags);
-
+	OstTraceExt5(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEWRITE1, "this %x clientThreadId %x aPos %x:%x aLength %d", (TUint) this, (TUint) threadId, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), aLength);
 	TInt r = iLocDrv.Write(aPos,aLength,aSrc,aThreadHandle,aOffset,aFlags);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite1Ret, EF32TraceUidProxyDrive, r);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEWRITE1RET, "r %d", r);
 	return r;
 	}
 
@@ -499,12 +508,9 @@
 TInt CLocalProxyDrive::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset)
 	{
 	TRACETHREADIDH(aThreadHandle);
-	TRACE7(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite2, EF32TraceUidProxyDrive, 
-		this, I64LOW(aPos), I64HIGH(aPos), aLength, aSrc, threadId, anOffset);
-
+	OstTraceExt5(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEWRITE2, "this %x clientThreadId %x aPos %x:%x aLength %d", (TUint) this, (TUint) threadId, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), aLength);
 	TInt r = iLocDrv.Write(aPos,aLength,aSrc,aThreadHandle,anOffset);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite2Ret, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEWRITE2RET, "r %d", r);
 	return r;
 	}
 
@@ -519,12 +525,9 @@
 */
 TInt CLocalProxyDrive::Write(TInt64 aPos,const TDesC8& aSrc)
 	{
-	TRACE5(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite3, EF32TraceUidProxyDrive, 
-		this, I64LOW(aPos), I64HIGH(aPos), aSrc.Length(), &aSrc);
-
+	OstTraceExt5(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEWRITE3, "this %x aPos %x:%x aLength %d aSrc %x", (TUint) this, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), aSrc.Length(), (TUint) &aSrc);
 	TInt r = iLocDrv.Write(aPos,aSrc);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite3Ret, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEWRITE3RET, "r %d", r);
 	return r;
 	}
 	
@@ -538,11 +541,9 @@
 */
 TInt CLocalProxyDrive::Caps(TDes8& anInfo)
 	{
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveCaps, EF32TraceUidProxyDrive, this);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVECAPS, "this %x", this);
 	TInt r = iLocDrv.Caps(anInfo);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveCapsRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVECAPSRET, "r %d", r);
 	return r;
 	}
 
@@ -556,12 +557,9 @@
 */
 TInt CLocalProxyDrive::Format(TFormatInfo& anInfo)
 	{
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveFormat1, EF32TraceUidProxyDrive, this);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEFORMAT1, "this %x", this);
 	TInt r = iLocDrv.Format(anInfo);
-
-	TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveFormat1Ret, EF32TraceUidProxyDrive, 
-		r, anInfo.iFormatIsCurrent, anInfo.i512ByteSectorsFormatted, anInfo.iMaxBytesPerFormat);
+	OstTraceExt4(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEFORMAT1RET, "r %d iFormatIsCurrent %d i512ByteSectorsFormatted %d iMaxBytesPerFormat %d", (TUint) r, (TUint) anInfo.iFormatIsCurrent, (TUint) anInfo.i512ByteSectorsFormatted, (TUint) anInfo.iMaxBytesPerFormat);
 	return r;
 	}
 
@@ -576,12 +574,9 @@
 */
 TInt CLocalProxyDrive::Format(TInt64 aPos,TInt aLength)
 	{
-	TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveFormat2, EF32TraceUidProxyDrive, 
-		this, I64LOW(aPos), I64HIGH(aPos), aLength);
-
+	OstTraceExt4(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEFORMAT2, "this %x aPos %x:%x aLength %d", (TUint) this, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
 	TInt r = iLocDrv.Format(aPos,aLength);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveFormat2Ret, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEFORMAT2RET, "r %d", r);
 	return r;
 	}
 
@@ -596,11 +591,9 @@
 */
 TInt CLocalProxyDrive::SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle)
 	{
-	TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveSetMountInfo, EF32TraceUidProxyDrive, this, aMountInfo, aMountInfoThreadHandle);
-
+	OstTraceExt3(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVESETMOUNTINFO, "this %x aMountInfo %x aMountInfoThreadHandle %d", (TUint) this, (TUint) aMountInfo, (TUint) aMountInfoThreadHandle);
 	TInt r = iLocDrv.SetMountInfo(aMountInfo,aMountInfoThreadHandle);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveSetMountInfoRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVESETMOUNTINFORET, "r %d", r);
 	return r;
 	}
 
@@ -614,11 +607,9 @@
 */
 TInt CLocalProxyDrive::ForceRemount(TUint aFlags)
 	{
-	TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveForceRemount, EF32TraceUidProxyDrive, this, aFlags);
-
+	OstTraceExt2(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEFORCEREMOUNT, "this %x aFlags %x", (TUint) this, (TUint) aFlags);
 	TInt r = iLocDrv.ForceRemount(aFlags);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveForceRemountRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEFORCEREMOUNTRET, "r %d", r);
 	return r;
 	}
 
@@ -635,11 +626,9 @@
 */
 TInt CLocalProxyDrive::ControlIO(const RMessagePtr2& /*aMessage*/,TInt aCommand,TAny* aParam1,TAny* aParam2)
 	{
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveControlIO, EF32TraceUidProxyDrive, this);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVECONTROLIO, "this %x", this);
 	TInt r = iLocDrv.ControlIO(aCommand,aParam1,aParam2);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveControlIORet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVECONTROLIORET, "r %d", r);
 	return r;
 	}
 	
@@ -654,11 +643,9 @@
 */
 TInt CLocalProxyDrive::Unlock(TMediaPassword &aPassword, TBool aStorePassword)
 	{
-	TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveUnlock, EF32TraceUidProxyDrive, this, aStorePassword);
-
+	OstTraceExt2(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEUNLOCK, "this %x aPassword %d", (TUint) this, (TUint) aStorePassword);
 	TInt r = iLocDrv.Unlock(aPassword,aStorePassword);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveUnlockRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEUNLOCKRET, "r %d", r);
 	return r;
 	}
 
@@ -674,11 +661,9 @@
 */
 TInt CLocalProxyDrive::Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword)
 	{
-	TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveLock, EF32TraceUidProxyDrive, this, aStorePassword);
-
+	OstTraceExt2(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVELOCK, "this %x aPassword %d", (TUint) this, (TUint) aStorePassword);
 	TInt r = iLocDrv.SetPassword(aOldPassword,aNewPassword,aStorePassword);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveLockRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVELOCKRET, "r %d", r);
 	return r;
 	}
 
@@ -692,11 +677,9 @@
 */
 TInt CLocalProxyDrive::Clear(TMediaPassword &aPassword)
 	{
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveClear, EF32TraceUidProxyDrive, this);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVECLEAR, "this %x", this);
 	TInt r = iLocDrv.Clear(aPassword);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveClearRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVECLEARRET, "r %d", r);
 	return r;
 	}
 
@@ -707,11 +690,9 @@
 */
 TInt CLocalProxyDrive::ErasePassword()
 	{
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveErasePassword, EF32TraceUidProxyDrive, this);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEERASEPASSWORD, "this %x", this);
 	TInt r = iLocDrv.ErasePassword();
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveErasePasswordRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEERASEPASSWORDRET, "r %d", r);
 	return r;
 	}
 
@@ -721,17 +702,13 @@
 
 @param aPos    The position of the data which is being deleted.
 @param aLength The length of the data which is being deleted.
-
 @return System wide error code.
 */
 TInt CLocalProxyDrive::DeleteNotify(TInt64 aPos, TInt aLength)
 	{
-	TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveDeleteNotify, EF32TraceUidProxyDrive, 
-		this, I64LOW(aPos), I64HIGH(aPos), aLength);
-
+	OstTraceExt4(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEDELETENOTIFY, "this %x aPos %x:%x aLength %d", (TUint) this, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
 	TInt r = iLocDrv.DeleteNotify(aPos, aLength);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveDeleteNotifyRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEDELETENOTIFYRET, "r %d", r);
 	return r;
 	}
 
@@ -745,20 +722,16 @@
 */	
 TInt CLocalProxyDrive::GetLastErrorInfo(TDes8 &aErrorInfo)
 	{
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveGetLastErrorInfo, EF32TraceUidProxyDrive, this);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEGETLASTERRORINFO, "this %x", this);
 	TInt r = iLocDrv.GetLastErrorInfo(aErrorInfo);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveGetLastErrorInfoRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEGETLASTERRORINFORET, "r %d", r);
 	return r;
 	}
 
 
 TInt CLocalProxyDrive::GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput)
 	{
-	TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveGetInterface, EF32TraceUidProxyDrive, 
-		this, aInterfaceId, aInput);
-
+	OstTraceExt3(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEGETINTERFACE, "this %x aInterfaceId %d aInput %x", (TUint) this, (TUint) aInterfaceId, (TUint) aInput);
 	TInt r;
 	switch(aInterfaceId)
 		{
@@ -776,8 +749,7 @@
 		default:
 			r= CProxyDrive::GetInterface(aInterfaceId,aInterface,aInput);
 		}
-
-	TRACERET2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveGetInterfaceRet, EF32TraceUidProxyDrive, r, aInterface);
+	OstTraceExt2(TRACE_DRIVE, PROXYDRIVE_ECLOCALPROXYDRIVEGETINTERFACERET, "r %d aInterface %x", (TUint) r, (TUint) aInterface);
 	return r;
 	}
 
@@ -814,11 +786,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::Initialise()
 	{
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveInitialise, EF32TraceUidProxyDrive, this);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEINITIALISE, "this %x", this);
 	TInt r = iProxy->Initialise();
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveInitialiseRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEINITIALISERET, "r %d", r);
 	return r;
 	}
 
@@ -830,11 +800,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::Dismounted()
 	{
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveDismounted, EF32TraceUidProxyDrive, this);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEDISMOUNTED, "this %x", this);
 	TInt r = iProxy->Dismounted();
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveDismountedRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEDISMOUNTEDRET, "r %d", r);
 	return r;
 	}
 
@@ -847,11 +815,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::Enlarge(TInt aLength)
 	{
-	TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveEnlarge, EF32TraceUidProxyDrive, this, aLength);
-
+	OstTraceExt2(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEENLARGE, "this %x aLength %d", (TUint) this, (TUint) aLength);
 	TInt r = iProxy->Enlarge(aLength);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveEnlargeRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEENLARGERET, "r %d", r);
 	return r;
 	}
 
@@ -869,11 +835,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::ReduceSize(TInt aPos, TInt aLength)
 	{
-	TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveReduceSize, EF32TraceUidProxyDrive, this, aPos, aLength);
-
+	OstTraceExt3(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEREDUCESIZE, "this %x aPos %x aLength %d", (TUint) this, (TUint) aPos, (TUint) aLength);
 	TInt r = iProxy->ReduceSize(aPos,aLength);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveReduceSizeRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEREDUCESIZERET, "r %d", r);
 	return r;
 	}
 
@@ -893,13 +857,9 @@
 EXPORT_C TInt CBaseExtProxyDrive::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags)
 	{
 	TRACETHREADIDH(aThreadHandle);
-	TRACE8(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead1, EF32TraceUidProxyDrive, 
-		this, I64LOW(aPos), I64HIGH(aPos), aLength, aTrg, threadId, aOffset, aFlags);
-
+	OstTraceExt5(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEREAD1, "this %x clientThreadId %x aPos %x:%x aLength %d", (TUint) this, (TUint) threadId, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), aLength);
 	TInt r = iProxy->Read(aPos,aLength,aTrg,aThreadHandle,aOffset,aFlags);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead1Ret, EF32TraceUidProxyDrive, r);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEREAD1RET, "r %d", r);
 	return r;
 	}
 
@@ -918,12 +878,9 @@
 EXPORT_C TInt CBaseExtProxyDrive::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset)
 	{
 	TRACETHREADIDH(aThreadHandle);
-	TRACE7(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead2, EF32TraceUidProxyDrive, 
-		this, I64LOW(aPos), I64HIGH(aPos), aLength, aTrg, threadId, anOffset);
-
+	OstTraceExt5(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEREAD2, "this %x clientThreadId %x aPos %x:%x aLength %d", (TUint) this, (TUint) threadId, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), aLength);
 	TInt r = iProxy->Read(aPos,aLength,aTrg,aThreadHandle,anOffset);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead2Ret, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEREAD2RET, "r %d", r);
 	return r;
 	}
 
@@ -939,12 +896,10 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::Read(TInt64 aPos,TInt aLength,TDes8& aTrg)
 	{
-	TRACE5(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead3, EF32TraceUidProxyDrive, 
-		this, I64LOW(aPos), I64HIGH(aPos), aLength, &aTrg);
-
+	OstTraceExt5(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEREAD3, "this %x aPos %x:%x aLength %d aTrg %x", (TUint) this, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), aLength, (TUint) &aTrg);
+		
 	TInt r = iProxy->Read(aPos,aLength,aTrg);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead3Ret, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEREAD3RET, "r %d", r);
 	return r;
 	}
 
@@ -964,12 +919,9 @@
 EXPORT_C TInt CBaseExtProxyDrive::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags)
 	{
 	TRACETHREADIDH(aThreadHandle);
-	TRACE8(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite1, EF32TraceUidProxyDrive, 
-		this, I64LOW(aPos), I64HIGH(aPos), aLength, aSrc, threadId, aOffset, aFlags);
-
+	OstTraceExt5(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEWRITE1, "this %x clientThreadId %x aPos %x:%x aLength %d", (TUint) this, (TUint) threadId, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), aLength);
 	TInt r = iProxy->Write(aPos,aLength,aSrc,aThreadHandle,aOffset,aFlags);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite1Ret, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEWRITE1RET, "r %d", r);
 	return r;
 	}
 
@@ -988,12 +940,9 @@
 EXPORT_C TInt CBaseExtProxyDrive::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset)
 	{
 	TRACETHREADIDH(aThreadHandle);
-	TRACE7(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite2, EF32TraceUidProxyDrive, 
-		this, I64LOW(aPos), I64HIGH(aPos), aLength, aSrc, threadId, anOffset);
-
+	OstTraceExt5(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEWRITE2, "this %x clientThreadId %x aPos %x:%x aLength %d", (TUint) this, (TUint) threadId, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), aLength);
 	TInt r = iProxy->Write(aPos,aLength,aSrc,aThreadHandle,anOffset);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite2Ret, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEWRITE2RET, "r %d", r);
 	return r;
 	}
 
@@ -1008,12 +957,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::Write(TInt64 aPos,const TDesC8& aSrc)
 	{
-	TRACE5(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite3, EF32TraceUidProxyDrive, 
-		this, I64LOW(aPos), I64HIGH(aPos), aSrc.Length(), &aSrc);
-
+	OstTraceExt5(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEWRITE3, "this %x aPos %x:%x aLength %d aSrc %x", (TUint) this, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), aSrc.Length(), (TUint) &aSrc);
 	TInt r = iProxy->Write(aPos,aSrc);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite3Ret, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEWRITE3RET, "r %d", r);
 	return r;
 	}
 
@@ -1027,11 +973,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::Caps(TDes8& anInfo)
 	{
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveCaps, EF32TraceUidProxyDrive, this);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVECAPS, "this %x", this);
 	TInt r = iProxy->Caps(anInfo);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveCapsRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVECAPSRET, "r %d", r);
 	return r;
 	}
 
@@ -1045,12 +989,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::Format(TFormatInfo& anInfo)
 	{
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveFormat1, EF32TraceUidProxyDrive, this);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEFORMAT1, "this %x", this);
 	TInt r = iProxy->Format(anInfo);
-
-	TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveFormat1Ret, EF32TraceUidProxyDrive, 
-		r, anInfo.iFormatIsCurrent, anInfo.i512ByteSectorsFormatted, anInfo.iMaxBytesPerFormat);
+	OstTraceExt4(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEFORMAT1RET, "r %d iFormatIsCurrent %d i512ByteSectorsFormatted %d iMaxBytesPerFormat %d", (TUint) r, (TUint) anInfo.iFormatIsCurrent, (TUint) anInfo.i512ByteSectorsFormatted, (TUint) anInfo.iMaxBytesPerFormat);
 	return r;
 	}
 
@@ -1065,12 +1006,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::Format(TInt64 aPos,TInt aLength)
 	{
-	TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveFormat2, EF32TraceUidProxyDrive, 
-		this, I64LOW(aPos), I64HIGH(aPos), aLength);
-
+	OstTraceExt4(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEFORMAT2, "this %x aPos %x:%x aLength %d", (TUint) this, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
 	TInt r = iProxy->Format(aPos,aLength);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveFormat2Ret, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEFORMAT2RET, "r %d", r);
 	return r;
 	}
 
@@ -1085,11 +1023,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle)
 	{
-	TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveSetMountInfo, EF32TraceUidProxyDrive, this, aMountInfo, aMountInfoThreadHandle);
-
+	OstTraceExt3(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVESETMOUNTINFO, "this %x aMountInfo %x aMountInfoThreadHandle %x", (TUint) this, (TUint) aMountInfo, (TUint) aMountInfoThreadHandle);
 	TInt r = iProxy->SetMountInfo(aMountInfo,aMountInfoThreadHandle);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveSetMountInfoRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVESETMOUNTINFORET, "r %d", r);
 	return r;
 	}
 
@@ -1103,11 +1039,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::ForceRemount(TUint aFlags)
 	{
-	TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveForceRemount, EF32TraceUidProxyDrive, this, aFlags);
-
+	OstTraceExt2(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEFORCEREMOUNT, "this %x aFlags%x", (TUint) this, (TUint) aFlags);
 	TInt r = iProxy->ForceRemount(aFlags);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveForceRemountRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEFORCEREMOUNTRET, "r %d", r);
 	return r;
 	}
 
@@ -1122,11 +1056,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::Unlock(TMediaPassword &aPassword, TBool aStorePassword)
 	{
-	TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveUnlock, EF32TraceUidProxyDrive, this, aStorePassword);
-
+	OstTraceExt2(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEUNLOCK, "this %x aPassword %d", (TUint) this, (TUint) aStorePassword);
 	TInt r = iProxy->Unlock(aPassword,aStorePassword);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveUnlockRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEUNLOCKRET, "r %d", r);
 	return r;
 	}
 
@@ -1142,11 +1074,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword)
 	{
-	TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveLock, EF32TraceUidProxyDrive, this, aStorePassword);
-
+	OstTraceExt2(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVELOCK, "this %x aPassword %d", (TUint) this, (TUint) aStorePassword);
 	TInt r = iProxy->Lock(aOldPassword,aNewPassword,aStorePassword);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveLockRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVELOCKRET, "r %d", r);
 	return r;
 	}
 
@@ -1160,11 +1090,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::Clear(TMediaPassword &aPassword)
 	{
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveClear, EF32TraceUidProxyDrive, this);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVECLEAR, "this %x", this);
 	TInt r = iProxy->Clear(aPassword);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveClearRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVECLEARRET, "r %d", r);
 	return r;
 	}
 
@@ -1175,11 +1103,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::ErasePassword()
 	{
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveErasePassword, EF32TraceUidProxyDrive, this);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEERASEPASSWORD, "this %x", this);
 	TInt r = iProxy->ErasePassword();
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveErasePasswordRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEERASEPASSWORDRET, "r %d", r);
 	return r;
 	}
 
@@ -1196,11 +1122,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2)
 	{
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveControlIO, EF32TraceUidProxyDrive, this);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVECONTROLIO, "this %x", this);
 	TInt r = iProxy->ControlIO(aMessage,aCommand,aParam1,aParam2);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveControlIORet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVECONTROLIORET, "r %d", r);
 	return r;
 	}
 
@@ -1216,9 +1140,8 @@
 */	
 EXPORT_C TInt CBaseExtProxyDrive::GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput)
 	{
-	TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveGetInterface, EF32TraceUidProxyDrive, 
-		this, aInterfaceId, aInput);
-
+	OstTraceExt3(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEGETINTERFACE, "this %x aInterfaceId %d aInput %x", (TUint) this, (TUint) aInterfaceId, (TUint) aInput);
+		
 	TInt r;
 	if (aInterfaceId==EGetLocalDrive)
 		{
@@ -1226,8 +1149,7 @@
 		}
 	else	
 		r = CProxyDrive::GetInterface(aInterfaceId,aInterface,aInput);
-
-	TRACERET2(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveGetInterfaceRet, EF32TraceUidProxyDrive, r, aInterface);
+	OstTraceExt2(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEGETINTERFACERET, "r %d aInterface %x", (TUint) r, (TUint) aInterface);
 	return r;
 	}	
 
@@ -1241,11 +1163,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::GetLastErrorInfo(TDes8 &aErrorInfo)
 	{
-	TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveGetLastErrorInfo, EF32TraceUidProxyDrive, this);
-
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEGETLASTERRORINFO, "this %x", this);
 	TInt r = iProxy->GetLastErrorInfo(aErrorInfo);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveGetLastErrorInfoRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEGETLASTERRORINFORET, "r %d", r);
 	return r;
 	}
 
@@ -1261,12 +1181,9 @@
 */
 EXPORT_C TInt CBaseExtProxyDrive::DeleteNotify(TInt64 aPos, TInt aLength)
     {
-	TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveDeleteNotify, EF32TraceUidProxyDrive, 
-		this, I64LOW(aPos), I64HIGH(aPos), aLength);
-
+	OstTraceExt4(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEDELETENOTIFY, "this %x aPos %x:%x aLength %d", (TUint) this, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
     TInt r = iProxy->DeleteNotify(aPos, aLength);
-
-	TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveDeleteNotifyRet, EF32TraceUidProxyDrive, r);
+	OstTrace1(TRACE_DRIVE, PROXYDRIVE_ECBASEEXTPROXYDRIVEDELETENOTIFYRET, "r %d", r);
 	return r;
     }
 
@@ -1339,7 +1256,7 @@
 		return(aConcreteDrive);
 
 	TBool extSupported = drive.FSys().IsExtensionSupported();
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECFileSystemIsExtensionSupported, EF32TraceUidProxyDrive, extSupported);
+	OstTraceExt2(TRACE_DRIVE, FSYS_ECFILESYSTEMISEXTENSIONSUPPORTED2, "%x r %d", (TUint) &drive.FSys(), (TUint) extSupported);
 	if(!extSupported)
 		{
 		delete(aConcreteDrive);
--- a/userlibandfileserver/fileserver/sfile/sf_file.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_file.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -16,7 +16,9 @@
 #include "sf_std.h"
 #include "sf_file_cache.h"
 #include "cl_std.h"
-
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "sf_fileTraces.h"
+#endif
 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
 
 TInt OutputTraceInfo(CFsRequest* aRequest,TCorruptNameRec* aNameRec)
@@ -241,7 +243,7 @@
     TUint32 mode=aRequest->Message().Int1();
 	if (anOpen==EFileCreate || anOpen==EFileReplace)
 		{
-		r = CheckDiskSpace(0, aRequest);
+		r = CheckDiskSpace(KMinFsCreateObjTreshold, aRequest);
 		if(r != KErrNone)
             return r;
         
@@ -601,7 +603,7 @@
 	{
 	__PRINT(_L("TFsFileTemp::DoRequestL(CFsRequest* aRequest)"));
     
-    TInt r = CheckDiskSpace(0, aRequest);
+    TInt r = CheckDiskSpace(KMinFsCreateObjTreshold, aRequest);
     if(r != KErrNone)
         return r;
 	
@@ -699,8 +701,18 @@
 			// Current operation points to a local buffer
 			// The request originated from the file server (e.g. file cache) with a local message handle (KLocalMessageHandle)
 			TPtr8 dataDesc((TUint8*) currentOperation.iReadWriteArgs.iData + currentOperation.iReadWriteArgs.iOffset, len, len);
-			const RLocalMessage msg;
-			TRAP(r,file->ReadL(pos, len, &dataDesc, msg, 0));
+
+			// save the client's RMessage2
+			const RMessage2 msgClient = aRequest->Message();
+			
+			// overwrite RMessage2 in CFsMessageRequest with RLocalMessage 
+			const RLocalMessage msgLocal;					
+			const_cast<RMessage2&> (aRequest->Message()) = msgLocal;
+
+			TRAP(r,file->ReadL(pos, len, &dataDesc, aRequest->Message(), 0));
+							
+			// restore the client's RMessage2
+			const_cast<RMessage2&> (aRequest->Message()) = msgClient;
 			}
 		}
 
@@ -1014,9 +1026,6 @@
 			{
 			file->SetNotifyAsyncReadersPending(ETrue);
 			}
-		
-        file->iAtt |= KEntryAttModified;
-
 		}
 	else if (aRetVal == KErrCorrupt)
 		file->SetFileCorrupt(ETrue);
@@ -1097,8 +1106,18 @@
 		else
 			{
 			TPtr8 dataDesc((TUint8*) currentOperation.iReadWriteArgs.iData + currentOperation.iReadWriteArgs.iOffset, len, len);
-			const RLocalMessage msg;
-			TRAP(r,file->WriteL(pos, len, &dataDesc, msg, 0));
+
+			// save the client's RMessage2
+			const RMessage2 msgClient = aRequest->Message();
+			
+			// overwrite RMessage2 in CFsMessageRequest with RLocalMessage 
+			const RLocalMessage msgLocal;					
+			const_cast<RMessage2&> (aRequest->Message()) = msgLocal;
+
+			TRAP(r,file->WriteL(pos, len, &dataDesc, aRequest->Message(), 0));
+							
+			// restore the client's RMessage2
+			const_cast<RMessage2&> (aRequest->Message()) = msgClient;
 			}
 		}
 
@@ -1494,11 +1513,9 @@
 	r=share->CheckMount();
 	if (r!=KErrNone)
 		return(r);
-
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECFileCBFlushDataL, EF32TraceUidFileSys, &share->File());
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILECBFLUSHDATAL1, "this %x", &share->File());
 	TRAP(r,share->File().FlushDataL());
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECFileCBFlushDataLRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILECBFLUSHDATAL1RET, "r %d", r);
 	return(r);
 	}
 
@@ -1652,7 +1669,7 @@
 	{
 	__PRINT(_L("TFsFileSetAtt::DoRequestL(CSessionFs* aSession)"));
     
-    TInt r = CheckDiskSpace(0, aRequest);
+    TInt r = CheckDiskSpace(KMinFsCreateObjTreshold, aRequest);
     if(r != KErrNone)
         return r;
 
@@ -1666,12 +1683,10 @@
 	
     TUint setAttMask=(TUint)(aRequest->Message().Int0());
 	TUint clearAttMask=(TUint)aRequest->Message().Int1();
-	ValidateAtts(share->File().Att(),setAttMask,clearAttMask);
-
-	TRACE5(UTF::EBorder, UTraceModuleFileSys::ECFileCBSetEntryL, EF32TraceUidFileSys, &share->File(), 0, 0, setAttMask,clearAttMask);
+	ValidateAtts(setAttMask,clearAttMask);
+	OstTraceExt3(TRACE_FILESYSTEM, FSYS_ECFILECBSETENTRYL1, "this %x aSetAttMask %x aClearAttMask %x", (TUint) &share->File(), (TUint) setAttMask, (TUint) clearAttMask);
 	TRAP(r,share->File().SetEntryL(TTime(0),setAttMask,clearAttMask))
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECFileCBSetEntryLRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILECBSETENTRYL1RET, "r %d", r);
 	return(r);
 	}
 
@@ -1717,7 +1732,7 @@
 	{
 	__PRINT(_L("TFsFileSetModified::DoRequestL(CFsRequest* aRequest)"));
     
-    TInt r = CheckDiskSpace(0, aRequest);
+    TInt r = CheckDiskSpace(KMinFsCreateObjTreshold, aRequest);
     if(r != KErrNone)
         return r;
 
@@ -1733,11 +1748,9 @@
 	TTime time;
 	TPtr8 t((TUint8*)&time,sizeof(TTime));
 	aRequest->ReadL(KMsgPtr0,t);
-
-	TRACE5(UTF::EBorder, UTraceModuleFileSys::ECFileCBSetEntryL, EF32TraceUidFileSys, &share->File(), 0, 0, KEntryAttModified,0);
+	OstTraceExt3(TRACE_FILESYSTEM, FSYS_ECFILECBSETENTRYL2, "this %x aSetAttMask %x aClearAttMask %x", (TUint) &share->File(), (TUint) KEntryAttModified, (TUint) 0);
 	TRAP(r,share->File().SetEntryL(time,KEntryAttModified,0))
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECFileCBSetEntryLRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILECBSETENTRYL2RET, "r %d", r);
 	return(r);
 	}
 
@@ -1757,7 +1770,7 @@
 	{
 	__PRINT(_L("TFsFileSet::DoRequestL(CFsRequest* aRequest)"));
 
-    TInt r = CheckDiskSpace(0, aRequest);
+    TInt r = CheckDiskSpace(KMinFsCreateObjTreshold, aRequest);
     if(r != KErrNone)
         return r;
 
@@ -1780,12 +1793,11 @@
 	aRequest->ReadL(KMsgPtr0,t);
 	TUint setAttMask=(TUint)(aRequest->Message().Int1()|KEntryAttModified);
 	TUint clearAttMask=(TUint)aRequest->Message().Int2();
-	ValidateAtts(share->File().Att(),setAttMask,clearAttMask);//	Validate attributes
-
-	TRACE5(UTF::EBorder, UTraceModuleFileSys::ECFileCBSetEntryL, EF32TraceUidFileSys, &share->File(), 0, 0, setAttMask,clearAttMask);
+	ValidateAtts(setAttMask,clearAttMask);//	Validate attributes
+
+	OstTraceExt3(TRACE_FILESYSTEM, FSYS_ECFILECBSETENTRYL3, "this %x aSetAttMask %x aClearAttMask %x", (TUint) &share->File(), (TUint) setAttMask, (TUint) clearAttMask);
 	TRAP(r,share->File().SetEntryL(time,setAttMask,clearAttMask))
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECFileCBSetEntryLRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILECBSETENTRYL3RET, "r %d", r);
 	return(r);
 	}
 
@@ -1869,7 +1881,7 @@
 	{
 	__PRINT(_L("TFsFileRename::DoRequestL(CFsRequest* aRequest)"));
 
-    TInt r = CheckDiskSpace(0, aRequest);
+    TInt r = CheckDiskSpace(KMinFsCreateObjTreshold, aRequest);
     if(r != KErrNone)
         return r;
 
@@ -1887,12 +1899,10 @@
 
 	TPtrC filePath = aRequest->Dest().FullName().Mid(2);
 	CFileCB& file = share->File();
-
-	TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECFileCBRenameL, EF32TraceUidFileSys, 
-		(TUint) &file, filePath);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILECBRENAMEL, "this %x", (TUint) &file);
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECFILECBRENAMELYS_EFILENAME, "FileName %S", filePath.Ptr(), filePath.Length()<<1);
 	TRAP(r,file.RenameL(filePath));
-	TRACERETMULT1(UTF::EBorder, UTraceModuleFileSys::ECFileCBRenameLRet, EF32TraceUidFileSys, r);
-
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILECBRENAMELRET, "r %d", r);
 	// Re-write the file's folded name & re-calculate the hash
 	if (r == KErrNone)
 		{
@@ -2337,10 +2347,11 @@
 		FileCache()->Close();
 	if (iBody && iBody->iDeleteOnClose)
 		{
-		TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBDeleteL, EF32TraceUidFileSys, DriveNumber(), FileName());
+		OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDELETEL2, "drive %d", DriveNumber());
+		OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDELETEL2_EFILENAME, "FileName %S", FileName().Ptr(), FileName().Length()<<1);
 		TInt r;
 		TRAP(r, iMount->DeleteL(FileName()));
-		TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBDeleteLRet, EF32TraceUidFileSys, r);
+		OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBDELETEL2RET, "r %d", r);
 		}
 
 	if(iMount)
@@ -2958,32 +2969,25 @@
 void CFileCB::ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset)
 	{
 	TRACETHREADID(aMessage);
-	TRACE7(UTF::EBorder, UTraceModuleFileSys::ECFileCBReadL, EF32TraceUidFileSys, 
-		this, I64LOW(aPos), I64HIGH(aPos), aLength, aDes, threadId, aOffset);
-
+	OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECFILECBREADLA, "this %x clientThreadId %x aPos %x:%x aLength %d", (TUint) this, (TUint) threadId, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
 	iBody->iExtendedFileInterface->ReadL(aPos,aLength,aDes,aMessage,aOffset);
 
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECFileCBReadLRet, EF32TraceUidFileSys, KErrNone);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILECBREADLRET, "r %d", KErrNone);
 	}
 
 void CFileCB::WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset)
 	{
 	TRACETHREADID(aMessage);
-	TRACE7(UTF::EBorder, UTraceModuleFileSys::ECFileCBWriteL, EF32TraceUidFileSys, 
-		this, I64LOW(aPos), I64HIGH(aPos), aLength, aDes, threadId, aOffset);
-
+	OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECFILECBWRITEL, "this %x clientThreadId %x aPos %x:%x aLength %d", (TUint) this, (TUint) threadId, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
 	iBody->iExtendedFileInterface->WriteL(aPos,aLength,aDes,aMessage,aOffset);
-
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECFileCBWriteLRet, EF32TraceUidFileSys, KErrNone);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILECBWRITELRET, "r %d", KErrNone);
 	}
 
 void CFileCB::SetSizeL(TInt64 aSize)
 	{
-	TRACE3(UTF::EBorder, UTraceModuleFileSys::ECFileCBSetSizeL, EF32TraceUidFileSys, this, I64LOW(aSize), I64HIGH(aSize));
-
+	OstTraceExt3(TRACE_FILESYSTEM, FSYS_ECFILECBSETSIZEL, "this %x aSize %x:%x", (TUint) this, (TUint) I64HIGH(aSize), (TUint) I64LOW(aSize));
 	iBody->iExtendedFileInterface->SetSizeL(aSize);
-
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECFileCBSetSizeLRet, EF32TraceUidFileSys, KErrNone);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILECBSETSIZELRET, "r %d", KErrNone);
 	}
 
 TBool CFileCB::ExtendedFileInterfaceSupported()
@@ -3029,12 +3033,9 @@
 
 TInt CFileCB::GetInterfaceTraced(TInt aInterfaceId, TAny*& aInterface, TAny* aInput)
 	{
-	TRACE2(UTF::EBorder, UTraceModuleFileSys::ECFileCBGetInterface, EF32TraceUidFileSys, aInterfaceId, aInput);
-
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILECBGETINTERFACE, "aInterfaceId %d aInput %x", (TUint) aInterfaceId, (TUint) aInput);
 	TInt r = GetInterface(aInterfaceId, aInterface, aInput);
-
-	TRACERET2(UTF::EBorder, UTraceModuleFileSys::ECFileCBGetInterfaceRet, EF32TraceUidFileSys, r, aInterface);
-
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFILECBGETINTERFACERET, "r %d aInterface %x", (TUint) r, (TUint) aInterface);
 	return r;
 	}
 
@@ -3115,11 +3116,9 @@
 		r=share->CheckMount();
 		if (r!=KErrNone)
 			return(r);
-
-		TRACE1(UTF::EBorder, UTraceModuleFileSys::ECFileCBFlushDataL, EF32TraceUidFileSys, &share->File());
+		OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILECBFLUSHDATAL2, "this %x", &share->File());
 		TRAP(r,share->File().FlushDataL());
-		TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECFileCBFlushDataLRet, EF32TraceUidFileSys, r);
-
+		OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILECBFLUSHDATAL2RET, "r %d", r);
 		if(r!=KErrNone)
 			return(r);
 		}
@@ -3442,20 +3441,12 @@
 the file size shall be modified after acquiring the iLock mutex and if it is ETrue, 
 the file size shall be modified without aquiring the iLock mutex.  
 */
-EXPORT_C void CFileCB::SetSize64(TInt64 aSize, TBool aDriveLocked)
+EXPORT_C void CFileCB::SetSize64(TInt64 aSize, TBool /*aDriveLocked*/)
 	{
-	if(aDriveLocked)
-		{
-		iSize = (TInt)I64LOW(aSize);
-		iBody->iSizeHigh = (TInt)I64HIGH(aSize);
-		}
-	else
-		{
-		Drive().Lock();
-		iSize = (TInt)I64LOW(aSize);
-		iBody->iSizeHigh = (TInt)I64HIGH(aSize);
-		Drive().UnLock();
-		}
+	// cuurently this should only be called from the drive thread
+	ASSERT(FsThreadManager::IsDriveThread(Drive().DriveNumber(),EFalse));
+	iSize = (TInt)I64LOW(aSize);
+	iBody->iSizeHigh = (TInt)I64HIGH(aSize);
 	}
 
 
@@ -3688,14 +3679,25 @@
 
 
 
-
-
-
-
-
-
-
-
-
-
-
+EXPORT_C TBool CFileCB::DirectIOMode(const RMessagePtr2& aMessage)
+	{
+	CFsMessageRequest* msgRequest = CFsMessageRequest::RequestFromMessage(aMessage);
+
+	TInt func = msgRequest->Operation()->Function();
+	ASSERT(func == EFsFileRead || func == EFsFileWrite || func == EFsFileWriteDirty || func == EFsReadFileSection);
+
+	CFileShare* share;
+	CFileCB* file;
+	GetFileFromScratch(msgRequest, share, file);
+	if (share == NULL)		// no share indicates this is a request originating from the file cache
+		return EFalse;
+
+	return func == EFsFileRead ? share->iMode & EFileReadDirectIO : share->iMode & EFileWriteDirectIO; 
+	}
+
+
+
+
+
+
+
--- a/userlibandfileserver/fileserver/sfile/sf_file_cache.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_file_cache.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -32,10 +32,17 @@
 #include "sf_cache_client.h"
 #include "sf_file_cache_defs.h"
 
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "sf_file_cacheTraces.h"
+#endif
+
 
 // disables flushing of stale cachelines before each write
 #define LAZY_WRITE
 
+// call SetSizeL() to pre-allocate FAT clusters before flushing dirty data
+#define SETSIZE_BEFORE_WRITE	
+
 enum TFileCacheFault
 	{
 	ECacheSettingsInitFailed,
@@ -63,6 +70,7 @@
 	EUnexpectedReNewLFailure,
 	EDirtyDataOwnerNull,
 	EFlushingWithSessionNull,
+	EFlushingWithAllocatedRequest,
 	};
 
 
@@ -76,6 +84,10 @@
 
 const TInt KMinSequentialReadsBeforeReadAhead = 3;
 
+#ifdef DOUBLE_BUFFERED_WRITING
+const TInt KMinSequentialAppendsBeforeFlush = 3;
+#endif
+
 //************************************
 // CFileCache
 //************************************
@@ -985,7 +997,7 @@
 				// with any dirty data already in the file cache
 				if (aMode & EFileWriteBuffered)
 					{
-					TInt r = DoFlushDirty(aNewRequest, &aMsgRequest, ETrue);
+					TInt r = DoFlushDirty(aNewRequest, &aMsgRequest, EFlushAll);
 					if (r == CFsRequest::EReqActionBusy || r != CFsRequest::EReqActionComplete)
 						return r;
 					}
@@ -1159,13 +1171,25 @@
 					currentPos = iSize64;
 				iInitialSize = iSize64;
 
+
+#ifdef DOUBLE_BUFFERED_WRITING
+				// count the number of sequential write-appends
+				if (currentOperation->iClientRequest)
+					{
+					if (currentPos == iSize64)
+						iSequentialAppends++;
+					else
+						iSequentialAppends = 0;
+					}
+#endif // DOUBLE_BUFFERED_WRITING
+
 				// if EFileWriteDirectIO OR 
 				// (caching writes and requested write len > size of the cache), 
 				// flush the write cache
 				if ((aMode & EFileWriteBuffered) == 0 || 
 					(cachingWrites && totalLen > iCacheSize))
 					{
-					TInt r = DoFlushDirty(aNewRequest, &aMsgRequest, ETrue);
+					TInt r = DoFlushDirty(aNewRequest, &aMsgRequest, EFlushAll);
 					if (r == CFsRequest::EReqActionBusy || r != CFsRequest::EReqActionComplete)
 						return r;
 					}
@@ -1237,7 +1261,7 @@
 					// If there's nothing to flush then the dirty (locked) data
 					// must belong to another drive, so there's not much we can do
 					// but write through 
-					TInt r = DoFlushDirty(aNewRequest, &aMsgRequest, EFalse);
+					TInt r = DoFlushDirty(aNewRequest, &aMsgRequest, EFlushSingle);
 					if (r == CFsRequest::EReqActionBusy)
 						return CFsRequest::EReqActionBusy;
 					if (r != KErrInUse)
@@ -1262,11 +1286,18 @@
 					// or wait if already flushing
 					if (iFlushBusy)
 						return CFsRequest::EReqActionBusy;
-					TInt r = DoFlushDirty(aNewRequest, &aMsgRequest, EFalse);
+					TInt r = DoFlushDirty(aNewRequest, &aMsgRequest, EFlushSingle);
 					if (r != CFsRequest::EReqActionBusy && r != CFsRequest::EReqActionComplete)
 						lastError = r;
 					}
 #endif
+#ifdef DOUBLE_BUFFERED_WRITING
+				if (cachingWrites && lastError == KErrNone && 
+					iSequentialAppends >= KMinSequentialAppendsBeforeFlush && iCacheClient->LockedSegmentsHalfUsed())
+					{
+					DoFlushDirty(aNewRequest, &aMsgRequest, EFlushHalf);
+					}
+#endif
 				// if no cacheline found & write caching is enabled, allocate a new cacheline
 				if (cachingWrites && addr == NULL && lastError == KErrNone)
 					{
@@ -1495,7 +1526,7 @@
 
 				if (cachingWrites)
 					{
-					TInt r = DoFlushDirty(aNewRequest, &aMsgRequest, ETrue);
+					TInt r = DoFlushDirty(aNewRequest, &aMsgRequest, EFlushAll);
 #ifdef _DEBUG
 					if (r == CFsRequest::EReqActionBusy)
 						CCacheManagerFactory::CacheManager()->Stats().iWriteThroughWithDirtyDataCount++;
@@ -1503,6 +1534,11 @@
 					// Need to reset currentOperation.iReadWriteArgs.iTotalLength here to make sure 
 					// TFsFileWrite::PostInitialise() doesn't think there's no data left to process
 					aMsgRequest.ReStart();
+					
+					//Need to preserve the current state otherwise if we are over the ram threshold 
+					//the request can end up in a livelock trying to repeatedly flush.
+					currentOperation->iState = EStWriteThrough;
+					
 					if (r == CFsRequest::EReqActionBusy || r != CFsRequest::EReqActionComplete)
 						return r;
 					}
@@ -1568,7 +1604,7 @@
 
 	CFsClientMessageRequest* newRequest = NULL;
 
-	TInt r = DoFlushDirty(newRequest, aOldRequest, ETrue);
+	TInt r = DoFlushDirty(newRequest, aOldRequest, EFlushAll);
 
 	iLock.Signal();
 
@@ -1606,7 +1642,7 @@
 /**
 CFileCache::DoFlushDirty()
 
-@param aFlushAll. If EFalse then only a single cacheline will be flushed
+@param aFlushMode. The flush mode which indicates how many cache-lines to flush. @See TFlushMode
 
 returns	CFsRequest::EReqActionBusy if a flush is in progress OR cacheline already in use
 		CFsRequest::EReqActionComplete if nothing to flush / flush completed 
@@ -1614,11 +1650,13 @@
 		or one of the system wide error codes
 
  */
-TInt CFileCache::DoFlushDirty(CFsClientMessageRequest*& aNewRequest, CFsRequest* aOldRequest, TBool aFlushAll)
+TInt CFileCache::DoFlushDirty(CFsClientMessageRequest*& aNewRequest, CFsRequest* aOldRequest, TFlushMode aFlushMode)
 	{
 	TInt64  pos;
 	TUint8* addr;
 
+	__ASSERT_ALWAYS(aNewRequest == NULL, Fault(EFlushingWithAllocatedRequest));
+
 	if (iFlushBusy)
 		return CFsRequest::EReqActionBusy;
 
@@ -1672,10 +1710,8 @@
 		return r;
 		}
 
-	// set the number of segments to flush - either all dirty data or the equivalent of one full cacheline
-	aNewRequest->CurrentOperation().iScratchValue0 = 
-		(TAny*) (aFlushAll?KMaxTInt:iCacheClient->CacheLineSizeInSegments());
-
+	// set the flush mode
+	aNewRequest->CurrentOperation().iScratchValue0 = (TAny*) aFlushMode;
 
 	// issue flush request
 	r = FlushDirtySm(*aNewRequest);
@@ -1692,6 +1728,11 @@
 		}
 	else	// CFsRequest::EReqActionComplete
 		{
+		// Return any allocation failures etc to client
+		TInt lastError = aNewRequest->LastError();
+		if (lastError != KErrNone)
+			r = lastError;
+
 		aNewRequest->PopOperation();
 		aNewRequest->Free();
 		aNewRequest = NULL;
@@ -1769,9 +1810,6 @@
 				TUint8* addr;
 				TInt segmentCount = iCacheClient->FindFirstDirtySegment(pos, addr);
 				
-				// keep track of how many segments we've written
-				currentOperation->iScratchValue0 = (TAny*) ((TInt) currentOperation->iScratchValue0 - segmentCount);
-
 				// if no more dirty segments of if a genuine error then finish
 				// NB if the request has been cancelled then we still need to proceed and mark all the
 				// segments as clean, otherwise they will never get freed !
@@ -1798,6 +1836,28 @@
 					break;
 					}
 
+#ifdef SETSIZE_BEFORE_WRITE	
+				TInt64 physicalFileSize = iFileCB->Size64();
+				if ((pos + (TInt64) len) > physicalFileSize)
+					{
+					// Need to switch to drive thread before calling CFileCB::SetSizeL()
+					if (!IsDriveThread())
+						{
+						aMsgRequest.SetState(CFsRequest::EReqStatePostInitialise);
+						return CFsRequest::EReqActionBusy;
+						}
+					__CACHE_PRINT2(_L("CACHEFILE: Increasing uncached size from %ld to %ld"), iFileCB->Size64(), iSize64);
+					TInt r;
+
+					r = CheckDiskSpace(iSize64 - physicalFileSize, &aMsgRequest);
+			        if(r == KErrNone)
+						TRAP(r, iFileCB->SetSizeL(iSize64))
+					if (r == KErrNone)
+						{
+ 						iFileCB->SetSize64(iSize64, ETrue);	// NB drive might be locked
+						}
+					}
+#endif
 				__CACHE_PRINT3(_L("CACHEFILE: FlushDirty first dirty pos %d, addr %08X count %d"), I64LOW(pos), addr, segmentCount);
 
 				TInt filledSegmentCount;
@@ -1891,12 +1951,24 @@
 					}
 
 
-				if (TInt(currentOperation->iScratchValue0) > 0)
-					currentOperation->iState = EStWriteToDisk;
-				else
-					currentOperation->iState = EStEnd;
-
-
+				switch((TFlushMode) (TInt) currentOperation->iScratchValue0)
+					{
+					case EFlushSingle:
+						currentOperation->iState = EStEnd;
+						break;
+					case EFlushHalf:
+						if (iCacheClient->LockedSegmentsHalfUsed())
+							currentOperation->iState = EStWriteToDisk;
+						else
+							currentOperation->iState = EStEnd;
+						break;
+					case EFlushAll:
+						currentOperation->iState = EStWriteToDisk;
+						break;
+					default:
+						ASSERT(0);
+						break;
+					}
 				}
 				break;
 
@@ -1991,11 +2063,11 @@
 			// However if the write error is to the bootsector remounting will always fail because the boot
 			// sector will have changed and hence the disk is useless.
 			// 
-			TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBReMount, EF32TraceUidFileSys, DriveNumber());
+			OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREMOUNT2, "drive %d", DriveNumber());
 
 			TInt remountSuccess = iDrive->ReMount(*iMount);
 
-			TRACE1(UTF::EBorder, UTraceModuleFileSys::ECMountCBReMountRet, EF32TraceUidFileSys, remountSuccess);
+			OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBREMOUNT2RET, "success %d", remountSuccess);
 			if (!remountSuccess)
 				continue;
 			
--- a/userlibandfileserver/fileserver/sfile/sf_file_cache.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_file_cache.h	Thu Jul 22 16:46:39 2010 +0100
@@ -28,6 +28,9 @@
 
 //#define _DEBUG_READ_AHEAD
 
+// if writing sequentially, start flushing dirty data when the cache is half full
+//#define DOUBLE_BUFFERED_WRITING
+
 
 NONSHARABLE_CLASS(CFileCache) : public CFsDispatchObject
 	{
@@ -75,7 +78,8 @@
 
 	TInt DoReadBuffered(CFsMessageRequest& aMsgRequest, TUint aMode, CFsClientMessageRequest*& aNewRequest);
 	TInt DoWriteBuffered(CFsMessageRequest& aMsgRequest, CFsClientMessageRequest*& aNewRequest, TUint aMode);
-	TInt DoFlushDirty(CFsClientMessageRequest*& aNewRequest, CFsRequest* aOldRequest, TBool aFlushAll);
+	enum TFlushMode {EFlushSingle, EFlushHalf, EFlushAll};
+	TInt DoFlushDirty(CFsClientMessageRequest*& aNewRequest, CFsRequest* aOldRequest, TFlushMode aFlushMode);
 
 
 	inline TInt SegmentSize() const;
@@ -156,6 +160,11 @@
 	TBool iFileCacheReadAsync;
 	CFsClientMessageRequest* iReadAheadRequest;
 
+#ifdef DOUBLE_BUFFERED_WRITING
+	// sequential append-write detection
+	TInt iSequentialAppends;
+#endif
+
 	friend class TClosedFileUtils;
 	friend class TFsFileWriteDirty;
 	};
--- a/userlibandfileserver/fileserver/sfile/sf_fmt.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_fmt.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -17,6 +17,10 @@
 
 #include "sf_std.h"
 
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "sf_fmtTraces.h"
+#endif
+
 LOCAL_C CFormatCB* GetFormatFromHandle(TInt aHandle,CSessionFs* aSession)
 //
 // Get the format control block from aHandle
@@ -466,9 +470,11 @@
 	TPtr8 pStep((TUint8*)&format->CurrentStep(),sizeof(TInt));
 	aRequest->ReadL(KMsgPtr0,pStep);
 
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECFormatCBDoFormatStepL, EF32TraceUidFileSys, format);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFORMATCBDOFORMATSTEPL, "this %x", format);
+
 	TRAP(r,format->DoFormatStepL());
-	TRACERET2(UTF::EBorder, UTraceModuleFileSys::ECFormatCBDoFormatStepLRet, EF32TraceUidFileSys, r, format->CurrentStep());
+
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECFORMATCBDOFORMATSTEPLRET, "r %d  iCurrentStep %d", r, (TUint) format->CurrentStep());
 
 	if (r==KErrNone)
 		aRequest->WriteL(KMsgPtr0,pStep);
--- a/userlibandfileserver/fileserver/sfile/sf_lepoc.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_lepoc.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -287,9 +287,22 @@
 		}
 	}
 
-// A version that will work in user or supervisor mode
-void MyPrintf(const char* aFmt, ...)
+/**
+It would be nice to be able to print debug information from the various functions
+supervisor-mode functions below. Unfortunately, we can't call RDebug::Printf() or
+any of its relatives in supervisor mode, and of course we can't call the equivalent
+kernel functions even when we're already in supervisor mode, because the entry
+points aren't visible.
+
+So this function just wraps and guards the call to RDebug, so we won't call it
+in SVC mode. The outcome is that trace messages are only generated if using the
+flexible memory model, where the code doesn't actually run in SVC mode anyway.
+*/
+void svPrintf(const char* aFmt, ...)
 	{
+	if (gExecutesInSupervisorMode)
+		return;
+
 	VA_LIST list;
 	VA_START(list, aFmt);
 	TPtrC8 fmt((const TText8*)aFmt);
@@ -379,15 +392,15 @@
 	E32Image& exporter = *(E32Image*)aPtr;
 
 	// Dump everything potentially useful that we know about the exporter ...
-	__LDRTRACE(MyPrintf("RelocateExports: paged? %d, iRomImageHeader@%08x, iHeader@%08x",
+	__LDRTRACE(svPrintf("RelocateExports: paged? %d, iRomImageHeader@%08x, iHeader@%08x",
 						exporter.iUseCodePaging, exporter.iRomImageHeader, exporter.iHeader));
-	__LDRTRACE(MyPrintf("  iCodeLoadAddress %08x, iCodeRunAddress %08x, iCodeSize %x iTextSize %x",
+	__LDRTRACE(svPrintf("  iCodeLoadAddress %08x, iCodeRunAddress %08x, iCodeSize %x iTextSize %x",
 						exporter.iCodeLoadAddress, exporter.iCodeRunAddress,
 						exporter.iCodeSize, exporter.iTextSize))
-	__LDRTRACE(MyPrintf("  iDataLoadAddress %08x, iDataRunAddress %08x, iDataSize %x iBssSize %x iTotalDataSize %x",
+	__LDRTRACE(svPrintf("  iDataLoadAddress %08x, iDataRunAddress %08x, iDataSize %x iBssSize %x iTotalDataSize %x",
 						exporter.iDataLoadAddress, exporter.iDataRunAddress,
 						exporter.iDataSize, exporter.iBssSize, exporter.iTotalDataSize));
-	__LDRTRACE(MyPrintf("  iCodeDelta, %x iDataDelta %x, iExportDirEntryDelta %x",
+	__LDRTRACE(svPrintf("  iCodeDelta, %x iDataDelta %x, iExportDirEntryDelta %x",
 						exporter.iCodeDelta, exporter.iDataDelta, exporter.iExportDirEntryDelta));
 
 	// It turns out that very little of the exporter info is useful! For
@@ -429,7 +442,7 @@
 			newValue = relocAddr;					// unknown - just leave it alone
 		*destExport++ = newValue;
 
-		__LDRTRACE(MyPrintf("RelocateExports: export %d %08x => %08x %c",
+		__LDRTRACE(svPrintf("RelocateExports: export %d %08x => %08x %c",
 							exporter.iExportDirCount-i, relocAddr, newValue,
 							(relocAddr >= codeStart && relocAddr < codeFinish) ? 'C' :
 							(relocAddr >= dataStart && relocAddr < dataFinish) ? 'D' : 'X'));
@@ -471,39 +484,39 @@
 	E32Image& exporter = *info.iExporter;
 
 #ifdef _DEBUG
-	__LDRTRACE(MyPrintf(">svFixupImportAddresses %d imports, code@%08x, fixup@%08x exporter@%08x",
+	__LDRTRACE(svPrintf(">svFixupImportAddresses %d imports, code@%08x, fixup@%08x exporter@%08x",
 						info.iNumImports, info.iCodeLoadAddress, info.iFixup64, info.iExporter));
 
 	// Dump everything potentially useful that we know about the exporter ...
-	__LDRTRACE(MyPrintf("%S: paged? %d, iRomImageHeader@%08x, iHeader@%08x",
+	__LDRTRACE(svPrintf("%S: paged? %d, iRomImageHeader@%08x, iHeader@%08x",
 						&exporter.iFileName, exporter.iUseCodePaging,
 						exporter.iRomImageHeader, exporter.iHeader));
-	__LDRTRACE(MyPrintf("iCodeLoadAddress %08x, iCodeRunAddress %08x, iCodeSize %x iTextSize %x",
+	__LDRTRACE(svPrintf("iCodeLoadAddress %08x, iCodeRunAddress %08x, iCodeSize %x iTextSize %x",
 						exporter.iCodeLoadAddress, exporter.iCodeRunAddress,
 						exporter.iCodeSize, exporter.iTextSize))
-	__LDRTRACE(MyPrintf("iDataLoadAddress %08x, iDataRunAddress %08x, iDataSize %x iBssSize %x iTotalDataSize %x",
+	__LDRTRACE(svPrintf("iDataLoadAddress %08x, iDataRunAddress %08x, iDataSize %x iBssSize %x iTotalDataSize %x",
 						exporter.iDataLoadAddress, exporter.iDataRunAddress,
 						exporter.iDataSize, exporter.iBssSize, exporter.iTotalDataSize));
-	__LDRTRACE(MyPrintf("iCodeDelta, %x iDataDelta %x, iExportDirEntryDelta %x",
+	__LDRTRACE(svPrintf("iCodeDelta, %x iDataDelta %x, iExportDirEntryDelta %x",
 						exporter.iCodeDelta, exporter.iDataDelta, exporter.iExportDirEntryDelta));
 
 	if (exporter.iRomImageHeader)
 		{
 		const TRomImageHeader& rh = *exporter.iRomImageHeader;
-		__LDRTRACE(MyPrintf("ROM: iCodeAddress %08x, iCodeSize %x, iTextSize %x",
+		__LDRTRACE(svPrintf("ROM: iCodeAddress %08x, iCodeSize %x, iTextSize %x",
 							rh.iCodeAddress, rh.iCodeSize, rh.iTextSize));
-		__LDRTRACE(MyPrintf("ROM: iDataAddress %08x, iDataSize %x, iBssSize %x",
+		__LDRTRACE(svPrintf("ROM: iDataAddress %08x, iDataSize %x, iBssSize %x",
 							rh.iDataAddress, rh.iDataSize, rh.iBssSize));
-		__LDRTRACE(MyPrintf("ROM: iDataBssLinearBase %08x, iTotalDataSize %x",
+		__LDRTRACE(svPrintf("ROM: iDataBssLinearBase %08x, iTotalDataSize %x",
 							rh.iDataBssLinearBase, rh.iTotalDataSize));
 		}
 
 	if (exporter.iHeader)
 		{
 		const E32ImageHeader& ih = *exporter.iHeader;
-		__LDRTRACE(MyPrintf("HEAD: iCodeBase %08x, iCodeSize %x, iTextSize %x",
+		__LDRTRACE(svPrintf("HEAD: iCodeBase %08x, iCodeSize %x, iTextSize %x",
 							ih.iCodeBase, ih.iCodeSize, ih.iTextSize));
-		__LDRTRACE(MyPrintf("HEAD: iDataBase %08x, iDataSize %x, iBssSize %x",
+		__LDRTRACE(svPrintf("HEAD: iDataBase %08x, iDataSize %x, iBssSize %x",
 							ih.iDataBase, ih.iDataSize, ih.iBssSize));
 		}
 #endif // _DEBUG
@@ -538,7 +551,7 @@
 			newValue = expAddr;
 			}
 
-		__LDRTRACE(MyPrintf("svFixupImportAddresses: import[%d]@%08x is export[%d] == %08x",
+		__LDRTRACE(svPrintf("svFixupImportAddresses: import[%d]@%08x is export[%d] == %08x",
 							iat - info.iIat, iat, ordinal, newValue));
 
 		// In non-paged code, we can simply replace the ordinals in the IAT with the
@@ -573,39 +586,39 @@
 	E32Image& exporter = *info.iExporter;
 
 #ifdef _DEBUG
-	__LDRTRACE(MyPrintf(">svElfDerivedFixupImportAddresses %d imports, code@%08x, fixup@%08x exporter@%08x",
+	__LDRTRACE(svPrintf(">svElfDerivedFixupImportAddresses %d imports, code@%08x, fixup@%08x exporter@%08x",
 						info.iNumImports, info.iCodeLoadAddress, info.iFixup64, info.iExporter));
 
 	// Dump everything potentially useful that we know about the exporter ...
-	__LDRTRACE(MyPrintf("%S: paged? %d, iRomImageHeader@%08x, iHeader@%08x",
+	__LDRTRACE(svPrintf("%S: paged? %d, iRomImageHeader@%08x, iHeader@%08x",
 						&exporter.iFileName, exporter.iUseCodePaging,
 						exporter.iRomImageHeader, exporter.iHeader));
-	__LDRTRACE(MyPrintf("iCodeLoadAddress %08x, iCodeRunAddress %08x, iCodeSize %x iTextSize %x",
+	__LDRTRACE(svPrintf("iCodeLoadAddress %08x, iCodeRunAddress %08x, iCodeSize %x iTextSize %x",
 						exporter.iCodeLoadAddress, exporter.iCodeRunAddress,
 						exporter.iCodeSize, exporter.iTextSize))
-	__LDRTRACE(MyPrintf("iDataLoadAddress %08x, iDataRunAddress %08x, iDataSize %x iBssSize %x iTotalDataSize %x",
+	__LDRTRACE(svPrintf("iDataLoadAddress %08x, iDataRunAddress %08x, iDataSize %x iBssSize %x iTotalDataSize %x",
 						exporter.iDataLoadAddress, exporter.iDataRunAddress,
 						exporter.iDataSize, exporter.iBssSize, exporter.iTotalDataSize));
-	__LDRTRACE(MyPrintf("iCodeDelta, %x iDataDelta %x, iExportDirEntryDelta %x",
+	__LDRTRACE(svPrintf("iCodeDelta, %x iDataDelta %x, iExportDirEntryDelta %x",
 						exporter.iCodeDelta, exporter.iDataDelta, exporter.iExportDirEntryDelta));
 
 	if (exporter.iRomImageHeader)
 		{
 		const TRomImageHeader& rh = *exporter.iRomImageHeader;
-		__LDRTRACE(MyPrintf("ROM: iCodeAddress %08x, iCodeSize %x, iTextSize %x",
+		__LDRTRACE(svPrintf("ROM: iCodeAddress %08x, iCodeSize %x, iTextSize %x",
 							rh.iCodeAddress, rh.iCodeSize, rh.iTextSize));
-		__LDRTRACE(MyPrintf("ROM: iDataAddress %08x, iDataSize %x, iBssSize %x",
+		__LDRTRACE(svPrintf("ROM: iDataAddress %08x, iDataSize %x, iBssSize %x",
 							rh.iDataAddress, rh.iDataSize, rh.iBssSize));
-		__LDRTRACE(MyPrintf("ROM: iDataBssLinearBase %08x, iTotalDataSize %x",
+		__LDRTRACE(svPrintf("ROM: iDataBssLinearBase %08x, iTotalDataSize %x",
 							rh.iDataBssLinearBase, rh.iTotalDataSize));
 		}
 
 	if (exporter.iHeader)
 		{
 		const E32ImageHeader& ih = *exporter.iHeader;
-		__LDRTRACE(MyPrintf("HEAD: iCodeBase %08x, iCodeSize %x, iTextSize %x",
+		__LDRTRACE(svPrintf("HEAD: iCodeBase %08x, iCodeSize %x, iTextSize %x",
 							ih.iCodeBase, ih.iCodeSize, ih.iTextSize));
-		__LDRTRACE(MyPrintf("HEAD: iDataBase %08x, iDataSize %x, iBssSize %x",
+		__LDRTRACE(svPrintf("HEAD: iDataBase %08x, iDataSize %x, iBssSize %x",
 							ih.iDataBase, ih.iDataSize, ih.iBssSize));
 		}
 #endif // _DEBUG
@@ -700,7 +713,7 @@
 			newValue = expAddr + sectionDelta + adjustment;
 			}
 
-		__LDRTRACE(MyPrintf("svElfDerivedFixupImportAddresses: import[%d] (%08x:%08x) is export[%d] %08x+%08x => %08x",
+		__LDRTRACE(svPrintf("svElfDerivedFixupImportAddresses: import[%d] (%08x:%08x) is export[%d] %08x+%08x => %08x",
 							iol - info.iImportOffsetList, codePtr, importInfo, ordinal, expAddr, adjustment, newValue));
 
 		// In non-paged code, we can simply replace the ordinals in the IAT with the
@@ -3248,30 +3261,6 @@
 	}
 
 
-/**
-This function is defined because RArray does not natively support
-sorting 64-bit integers.
-
-It is used by FixupDlls to order the import fixup locations in the image
-so they can be organized by page.
-
-@param	aLeft			64-bit unsigned integer to compare against aRight.
-@param	aRight			64-bit unsigned integer to compare against aLeft.
-@return					-1 if aLeft < aRight; 0 if aLeft == aRight; and
-						+1 if aLeft > aRight.  This conforms to the behavior
-						which is expected from a function used by TLinearOrder.
-*/
-static TInt Uint64LinearOrderFunc(const TUint64& aLeft, const TUint64& aRight)
-	{
-	if (aLeft < aRight)
-		return -1;
-	else if (aLeft > aRight)
-		return 1;
-	else
-		return 0;
-	}
-
-
 TUint64* E32Image::ExpandFixups(TInt aNumFixups)
 	{
 	__IF_DEBUG(Printf("ExpandFixups,%d+%d", iFixupCount,aNumFixups));
@@ -3315,8 +3304,10 @@
 
 	// sort the array in address order, to organize by page
 	RArray<TUint64> fixup64ToSort(sizeof(TUint64), iFixups, iFixupCount);
-	// SortUnsigned doesn't work on TUint64
-	fixup64ToSort.Sort(TLinearOrder<TUint64>(Uint64LinearOrderFunc));
+
+	// address is in high word of entry, offset 4
+	fixup64ToSort.SetKeyOffset(4);
+	fixup64ToSort.SortUnsigned();
 
 	// now have <address | new-value> pairs, organize into pages.
 	// Each page is stored as fXXX YYYY ZZZZ where YYYY ZZZZ is written
--- a/userlibandfileserver/fileserver/sfile/sf_local.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_local.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -320,8 +320,31 @@
 	// Create the actual proxy drive...
 	CProxyDrive* pD = NULL;
 	TInt r = pF->CreateProxyDrive(pD, NULL);
-	__ASSERT_ALWAYS(r == KErrNone, User::Panic(_L("CreateProxyDrive Error"), r));
-	__ASSERT_ALWAYS(pD != NULL, User::Panic(_L("CreateProxyDrive returned NULL"), -999));
+	if (r != KErrNone)
+		{
+		delete pD;
+		return r;
+		}
+	if (pD == NULL)
+		return KErrNoMemory;
+
+	// Create the proxy drive body... which is used to store the library handle
+	CProxyDriveBody* pBody = new CProxyDriveBody();
+	if (pBody == NULL)
+		{
+		delete pD;
+		return KErrNoMemory;
+		}
+	pD->iBody = pBody;
+
+	// Re-open the library so that it is safe to call RFs::RemoveProxyDrive() before the proxy drive has been deleted -
+	// which can happen if the file system is dismounted with open file handles
+	r = pD->SetAndOpenLibrary(pF->Library());
+	if (r != KErrNone)
+		{
+		delete pD;
+		return r;
+		}
 
 	iMapping[drive] = i+KMaxLocalDrives;
 
@@ -386,7 +409,12 @@
 	__ASSERT_ALWAYS(aDrive>=0 && aDrive<KMaxDrives,Fault(EClearProxyDriveMapping1));
 	__ASSERT_DEBUG(iMapping[aDrive]>= KMaxLocalDrives && iProxyDriveMapping[iMapping[aDrive]-KMaxLocalDrives],Fault(EClearProxyDriveMapping2));
 	TInt idx = iMapping[aDrive]-KMaxLocalDrives;
-	delete iProxyDriveMapping[idx];
+	if (iProxyDriveMapping[idx]->Mount() == NULL)	// don't delete if it's still owned by its mount
+		{
+		RLibrary lib = iProxyDriveMapping[idx]->GetLibrary();
+		delete iProxyDriveMapping[idx];
+		lib.Close();
+		}
 	iProxyDriveMapping[idx] = NULL;
 	iMapping[aDrive] = KDriveInvalid;
 	}
--- a/userlibandfileserver/fileserver/sfile/sf_main.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_main.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -26,9 +26,6 @@
 #endif
 #include "d32btrace.h"
 
-// define this macro to enable tracing very early on in the boot sequence
-//#define __ENABLE_TRACE__
-
 #ifdef __EPOC32__
 _LIT(KStartupExeSysBinName,"Z:\\Sys\\Bin\\ESTART.EXE");
 #else
@@ -286,35 +283,6 @@
 	User::SetCritical(User::ESystemCritical);
 
 	TInt r;
-#ifdef SYMBIAN_FTRACE_ENABLE
-	r = User::LoadLogicalDevice(_L("D_FTRACE"));	
-	__PRINT1(_L("User::LoadLogicalDevice(D_FTRACE) returns %d"),r);
-	__ASSERT_ALWAYS(r==KErrNone || r==KErrAlreadyExists,Fault(ETraceLddLoadFailure));
-
-	r = TheFtrace.Open(EOwnerProcess);
-	__ASSERT_ALWAYS(r==KErrNone || r==KErrAlreadyExists,Fault(ETraceLddLoadFailure));
-#endif
-
-#if defined (__ENABLE_TRACE__)
-		{
-		RBTrace trace;
-		
-		trace.Open();
-		
-//		trace.SetMode(RBTrace::EEnable + RBTrace::EFreeRunning);
-		trace.SetFilter(BTrace::EThreadIdentification,1);
-
-		trace.SetFilter(UTF::EBorder,1);
-		trace.SetFilter(UTF::EError,1);
-
-		trace.SetFilter2(EF32TraceUidEfsrv,1);
-//		trace.SetFilter2(EF32TraceUidFileSys,1);
-//		trace.SetFilter2(EF32TraceUidProxyDrive,1);
-
-		trace.Close();	
-		}
-
-#endif
 
 //
 // Load the file system's device driver
--- a/userlibandfileserver/fileserver/sfile/sf_memory_client.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_memory_client.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -170,7 +170,8 @@
        	return addr;
        	}
     
-	// if we have used up reserved region, get new pages from reusable pool first
+    TBool touchedMore = EFalse;
+	// if we have touched beyond reserved region, get new pages from reusable pool first
     if (iReusablePagePool.Count())
     	{
 		addr = iReusablePagePool[0];
@@ -181,7 +182,7 @@
     else
     	{
     	addr = iBase + (iTouchedRegionFlag << iSegSizeInBytesLog2);
-    	iTouchedRegionFlag += aSegmentCount;
+    	touchedMore = ETrue;
 //       	__PRINT2(_L("!! GROW TOUCHED SEGS: addr=0x%x, touched=%d"), addr, iTouchedRegionFlag);
     	}
 	
@@ -197,6 +198,10 @@
 	if (r != KErrNone)
 		return NULL;
 
+	if (touchedMore)
+	    {
+	    iTouchedRegionFlag += aSegmentCount;
+	    }
 	return addr;
 	}
 
--- a/userlibandfileserver/fileserver/sfile/sf_memory_man.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_memory_man.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -81,7 +81,7 @@
 	TInt r = UserHal::MemoryInfo(meminfo);
 	ASSERT(r==KErrNone);
 	User::LeaveIfError(r);
-	iLowMemoryThreshold = (meminfo().iTotalRamInBytes * TGlobalCacheMemorySettings::LowMemoryThreshold()) / 100;
+	iLowMemoryThreshold = (TInt) (meminfo().iTotalRamInBytes * (TGlobalCacheMemorySettings::LowMemoryThreshold() / 100.00));
 	TChunkCreateInfo createInfo;
 	createInfo.SetCache(iSizeInBytes);
 	createInfo.SetOwner(EOwnerProcess);
@@ -287,6 +287,10 @@
 */
 void CCacheMemoryManagerFactory::CreateL()
 	{
+	// Panic in DEBUG mode when GlobalCacheMemorySize is set as a negative value.  
+	ASSERT(TGlobalCacheMemorySettings::CacheSize() >= 0);
+	ASSERT(TGlobalCacheMemorySettings::LowMemoryThreshold() >= 0);
+	
 	if (TGlobalCacheMemorySettings::CacheSize() > 0)
 	    iCacheMemoryManager = CCacheMemoryManager::NewL(TGlobalCacheMemorySettings::CacheSize());
 	else
@@ -337,12 +341,12 @@
 		iLowMemoryThreshold = lowMemoryThreshold;
 	}
 
-TInt TGlobalCacheMemorySettings::CacheSize()
+TInt32 TGlobalCacheMemorySettings::CacheSize()
 	{
 	return iCacheSizeInBytes;
 	}
 
-TInt TGlobalCacheMemorySettings::LowMemoryThreshold()
+TInt32 TGlobalCacheMemorySettings::LowMemoryThreshold()
 	{
 	return iLowMemoryThreshold;
 	}
--- a/userlibandfileserver/fileserver/sfile/sf_memory_man.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_memory_man.h	Thu Jul 22 16:46:39 2010 +0100
@@ -47,6 +47,10 @@
 	TUint8* Base();
 	void 	FreeMemoryChanged(TBool aIsMemoryLow);
 
+#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
+	void    SetMemoryLow(TBool aSetMemoryLow) {isMemoryLow = aSetMemoryLow;}; 
+#endif //defined(_DEBUG) || defined(_DEBUG_RELEASE)
+
 private:
 	~CCacheMemoryManager();
 	CCacheMemoryManager(TUint32 aMaxSize);
@@ -91,8 +95,8 @@
 public:
 	static void ReadPropertiesFile();
 
-	static TInt CacheSize();
-	static TInt LowMemoryThreshold();
+	static TInt32 CacheSize();
+	static TInt32 LowMemoryThreshold();
 private:
 	static TInt32 iCacheSizeInBytes;
 	static TInt32 iLowMemoryThreshold;
--- a/userlibandfileserver/fileserver/sfile/sf_mnt.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_mnt.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -15,6 +15,10 @@
 
 #include "sf_std.h"
 
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "sf_mntTraces.h"
+#endif
+
 
 
 
@@ -369,12 +373,11 @@
 
 TInt CMountCB::GetInterfaceTraced(TInt aInterfaceId, TAny*& aInterface, TAny* aInput)
 	{
-	TRACE3(UTF::EBorder, UTraceModuleFileSys::ECMountCBGetInterface, EF32TraceUidFileSys, 
-		DriveNumber(), aInterfaceId, aInput);
+	OstTraceExt3(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETINTERFACE, "drive %d aInterfaceId %d aInput %x", (TUint) DriveNumber(), (TUint) aInterfaceId, (TUint) aInput);
 
 	TInt r = GetInterface(aInterfaceId, aInterface, aInput);
 
-	TRACERET2(UTF::EBorder, UTraceModuleFileSys::ECMountCBGetInterfaceRet, EF32TraceUidFileSys, r, aInterface);
+	OstTraceExt2(TRACE_FILESYSTEM, FSYS_ECMOUNTCBGETINTERFACERET, "r %d aInterface %x", (TUint) r, (TUint) aInterface);
 
 	return r;
 	}
--- a/userlibandfileserver/fileserver/sfile/sf_nbs.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_nbs.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -22,7 +22,7 @@
 	{
 	__PRINT(_L("TFsMkDir::DoRequestL(CFsRequest* aRequest)"));
 
-    TInt r = CheckDiskSpace(0, aRequest);
+    TInt r = CheckDiskSpace(KMinFsCreateObjTreshold, aRequest);
     if(r != KErrNone)
         return r;
 
@@ -143,7 +143,7 @@
 //
 	{
 	__PRINT(_L("TFsRename::DoRequestL(CFsRequest* aRequest)"));
-    TInt r = CheckDiskSpace(0, aRequest);
+    TInt r = CheckDiskSpace(KMinFsCreateObjTreshold, aRequest);
     if(r != KErrNone)
         return r;
 	
@@ -182,7 +182,7 @@
 	{
 	__PRINT(_L("TFsReplace::DoRequestL(CFsRequest* aRequest)"));
 
-    TInt r = CheckDiskSpace(0, aRequest);
+    TInt r = CheckDiskSpace(KMinFsCreateObjTreshold, aRequest);
     if(r != KErrNone)
         return r;
 
@@ -226,12 +226,6 @@
 	if (r!=KErrNone)
 		return(r);
 
-	// If the file is open, get the file size from the CFileCB object as there may be cached data
-	CFileCB* file;
-	aRequest->Drive()->IsFileOpen(filePath, file);
-	if (file)
-		t.SetFileSize(file->CachedSize64());
-
 	TPckgC<TEntry> p(t);
 	aRequest->WriteL(KMsgPtr1,p);
 	return(KErrNone);
@@ -261,7 +255,7 @@
 	{
 	__PRINT(_L("TFsSetEntry::DoRequestL(CFsRequest* aRequest)"));
 
-    TInt r = CheckDiskSpace(0, aRequest);
+    TInt r = CheckDiskSpace(KMinFsCreateObjTreshold, aRequest);
     if(r != KErrNone)
         return r;
 
@@ -892,7 +886,7 @@
 //	create the private path unless it already exists
 //
 	{
-    TInt ret = CheckDiskSpace(0, aRequest);
+    TInt ret = CheckDiskSpace(KMinFsCreateObjTreshold, aRequest);
     if(ret != KErrNone)
         return ret;
 
--- a/userlibandfileserver/fileserver/sfile/sf_plugin.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_plugin.h	Thu Jul 22 16:46:39 2010 +0100
@@ -66,7 +66,7 @@
 	static TInt IsInChain(TInt aUPos, TInt aPos,TInt aDrive, CFsPluginFactory* aPluginFactory);
 	static CFsPlugin* FindByUniquePosition(TInt aPos);
 
-	static TInt InitPlugin(CFsPlugin& aPlugin);
+	static TInt InitPlugin(CFsPlugin& aPlugin, RLibrary aLibrary);
 	static void TransferRequests(CPluginThread* aPluginThread);
 	static void CancelPlugin(CFsPlugin* aPlugin,CSessionFs* aSession);
 	static TInt ChainCount();
--- a/userlibandfileserver/fileserver/sfile/sf_plugin_man.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_plugin_man.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -162,7 +162,7 @@
 		return err;
 		}
 
-	err = InitPlugin(*pP);
+	err = InitPlugin(*pP, aPluginFactory.Library());
 	if(err != KErrNone)
 		{
 		return err;
@@ -624,13 +624,13 @@
 Create a plugin thread
 Should only by called from main file server thread with plugin thread unavailable
 */
-TInt FsPluginManager::InitPlugin(CFsPlugin& aPlugin)
+TInt FsPluginManager::InitPlugin(CFsPlugin& aPlugin, RLibrary aLibrary)
 	{
 	TInt err = KErrNone;
 
 	if(!aPlugin.iThreadP)
 		{
-		TRAP(err,aPlugin.iThreadP=CPluginThread::NewL(aPlugin));
+		TRAP(err,aPlugin.iThreadP=CPluginThread::NewL(aPlugin, aLibrary));
 		if(err!=KErrNone)
 			return err;
 		}
@@ -745,11 +745,12 @@
 
 	FsPluginManager::LockChain();
 	TInt count = FsPluginManager::ChainCount();
+	TInt oldCount = count;
 	TInt i;
 	for(i=0; i<count; i++)
 	    {
 	    CFsPlugin* plugin = NULL;
-	    User::LeaveIfError(FsPluginManager::Plugin(plugin, i));
+	    (void) FsPluginManager::Plugin(plugin, i); // (void) as chain is locked.
 	    __ASSERT_DEBUG(plugin, User::Leave(KErrNotFound));
 	    aRequest->iCurrentPlugin = plugin;
 	    aRequest->Status() = KRequestPending;
@@ -761,6 +762,12 @@
 	    FsPluginManager::LockChain();
 	    __ASSERT_ALWAYS(aRequest->Status().Int()==KErrNone||aRequest->Status().Int()==KErrCancel,Fault(ESessionDisconnectThread2));
 	    count = FsPluginManager::ChainCount();
+	    //If a plugin was removed whilst the chain was unlocked we need to make sure we don't skip any plugins
+	    if(count != oldCount)
+	        {
+	        i=0;
+	        oldCount = count;
+	        }
 	    }
 	FsPluginManager::UnlockChain();
 	
--- a/userlibandfileserver/fileserver/sfile/sf_plugin_ops.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_plugin_ops.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -252,8 +252,11 @@
 	CFsPlugin* plugin=NULL;
 	FsPluginManager::LockChain();
 	TInt err = FsPluginManager::Plugin(plugin, aRequest->Message().Int2());
-	if(err != KErrNone)
+	if(err != KErrNone) //should be ok but just in case
+	    {
+	    FsPluginManager::UnlockChain();
 		return err;
+	    }
 
 	TInt r = KErrNotFound;
 	if(plugin)
--- a/userlibandfileserver/fileserver/sfile/sf_plugin_shim.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_plugin_shim.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -703,11 +703,6 @@
 	TPckgBuf<TInt> reply;
 	args.Set(3,&reply);
 
-	// copy session pointer
-	RLocalMessage message = iMessage;
-	message.SetFunction(aFunction);
-	message.SetArgs(args);
-
 	TInt err = Dispatch(aFunction, args);
 	if (err == KErrNone)
 		*aReply = reply();
--- a/userlibandfileserver/fileserver/sfile/sf_prel.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_prel.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -242,10 +242,15 @@
 void CreateCorruptFileNamesList()
 	{
 	RFs fs;
-	fs.Connect();
-	TInt r=FindHitListFile(fs);
+	
+    TInt r = fs.Connect();
 	if(r!=KErrNone)
 		return;
+	
+    r=FindHitListFile(fs);
+	if(r!=KErrNone)
+		return;
+	
 	RFile f;
 	r=f.Open(fs,*gCorruptFileNamesListFile,EFileShareExclusive|EFileStreamText|EFileRead);
 	if(r!=KErrNone)
--- a/userlibandfileserver/fileserver/sfile/sf_raw.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_raw.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -18,6 +18,10 @@
 #include "sf_std.h"
 #include "sf_file_cache.h"
 
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "sf_rawTraces.h"
+#endif
+
 LOCAL_C CRawDiskCB* GetRawDiskFromHandle(TInt aHandle, CSessionFs* aSession)
 //
 // Get the rawdisk control block from aHandle
@@ -112,10 +116,11 @@
 	const TAny* pDes=aRequest->Message().Ptr0();
 
 	TRACETHREADID(aRequest->Message());
-	TRACE7(UTF::EBorder, UTraceModuleFileSys::ECMountCBRawReadL, EF32TraceUidFileSys, 
-		aRequest->DriveNumber(), I64LOW(pos), I64HIGH(pos), length, pDes, 0, I64LOW(threadId));
+	OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRAWREADL, "drive %d clientThreadId %x aPos %x:%x aLength %d", (TUint) aRequest->DriveNumber(), (TUint) threadId, (TUint) I64HIGH(pos), (TUint) I64LOW(pos), (TUint) length);
+
 	TRAP(r,rawDisk->Mount().RawReadL(pos,length,pDes,0,aRequest->Message()));
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBRawReadLRet, EF32TraceUidFileSys, r);
+
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRAWREADLRET, "r %d", r);
 
 	return(r);
 	}
@@ -159,10 +164,11 @@
 	const TAny* pDes=aRequest->Message().Ptr0();
 
 	TRACETHREADID(aRequest->Message());
-	TRACE7(UTF::EBorder, UTraceModuleFileSys::ECMountCBRawWriteL, EF32TraceUidFileSys, 
-		aRequest->DriveNumber(), I64LOW(pos), I64HIGH(pos), length, pDes, 0, I64LOW(threadId));
+	OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRAWWRITEL, "drive %d clientThreadId %x aPos %x:%x aLength %d", (TUint) aRequest->DriveNumber(), (TUint) threadId, (TUint) I64HIGH(pos), (TUint) I64LOW(pos), (TUint) length);
+
 	TRAP(r,rawDisk->Mount().RawWriteL(pos,length,pDes,0,aRequest->Message()));
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBRawWriteLRet, EF32TraceUidFileSys, r);
+
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBRAWWRITELRET, "r %d", r);
 
 	rawDisk->SetChanged();
 	return(r);
--- a/userlibandfileserver/fileserver/sfile/sf_std.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_std.h	Thu Jul 22 16:46:39 2010 +0100
@@ -34,7 +34,6 @@
 #include "sf_func.h"
 #include <F32plugin.h>
 #include "f32trace.h"
-#include <utraceefile.h>
 
 #define __PRINT1TEMP_ALWAYS(t,a) {{TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}}
 #define __PRINT2TEMP_ALWAYS(t,a,b) {{TBuf<KMaxFileName>temp(b);RDebug::Print(t,a,&temp);}}
@@ -115,6 +114,8 @@
 #define __PLUGIN_PRINT3(t,a,b,c)
 #endif
 
+#define _LOFF(p,T,f) ((T*)(((TUint8*)(p))-_FOFF(T,f)))
+
 const TInt KMaxTotalDriveReserved	=0x100000;
 const TInt KMaxSessionDriveReserved	=0x10000;
 
@@ -144,6 +145,13 @@
 //-- absolute maximum file size that file server supports
 const TUint64 KMaxSupportedFileSize = KMaxTUint64;
 
+//-- this is a speculative value of a min. amount of free space on the volume necessary to create a file, directory etc.
+//-- it is used mostly in "reserve drive space" functionality, which is, actually, fundamentally flawed.
+//-- the problem is that the file server can't know exactly how much space is required to create some fs object on the volume, 
+//-- so, it has to guess. This is a default "sector size" value; the file system can round it up internally to its cluster size if any.
+const TInt KMinFsCreateObjTreshold = KDefaultVolumeBlockSize;
+
+
 //__DATA_CAGING__
 const TUint SHA1_LBLOCK=16;
 const TUint SHA1_HASH=20;
@@ -801,7 +809,7 @@
 NONSHARABLE_CLASS(CPluginThread) : public CRequestThread
 	{
 public:
-	CPluginThread(CFsPlugin& aPlugin);
+	CPluginThread(CFsPlugin& aPlugin, RLibrary aLibrary);
 	~CPluginThread();
 	
 	void CompleteSessionRequests(CSessionFs* aSession, TInt aValue);
@@ -813,7 +821,7 @@
 	void OperationLockSignal();
 
 private:
-	static CPluginThread* NewL(CFsPlugin& aPlugin);
+	static CPluginThread* NewL(CFsPlugin& aPlugin, RLibrary aLibrary);
 	TUint StartL();
 	virtual TInt DoThreadInitialise();
 private:
@@ -822,6 +830,7 @@
 	/** @prototype */
 	RSemaphore iOperationLock;
 
+	RLibrary iLib;	// contains a handle to the library	which created the plugin
 friend class FsPluginManager;
 	};
 
@@ -1305,6 +1314,7 @@
 	inline void Init();
 	void ReStart();
 	TBool IsPluginRequest();
+	static inline CFsMessageRequest* RequestFromMessage(const RMessagePtr2& aMessage);
 	
    // UID of the process to touching the file. (To be used in notification framework).
    // TUid iUID;
@@ -1705,7 +1715,6 @@
 extern HBufC* TheDriveNames[];
 extern TDrive TheDrives[KMaxDrives];
 extern TFileName TheDefaultPath;
-extern RFTrace TheFtrace;
 
 extern SCapabilitySet AllCapabilities;
 extern SCapabilitySet DisabledCapabilities;
@@ -1743,7 +1752,7 @@
 
  TInt  ValidateDrive(TInt aDriveNumber,CFsRequest* aRequest);
  TInt  ValidateDriveDoSubst(TInt aDriveNumber,CFsRequest* aRequest);
- void  ValidateAtts(TUint anEntryAtt,TUint& aSetAttMask,TUint& aClearAttMask);
+ void  ValidateAtts(TUint& aSetAttMask,TUint& aClearAttMask);
  TInt  ParseSubstPtr0(CFsRequest* aRequest,TParse& aParse, TBool aUseSessionPath = ETrue);
  TInt  ParseNoWildSubstPtr0(CFsRequest* aRequest,TParse& aParse, TBool aUseSessionPath = ETrue);
  TInt  ParseNoWildSubstPtr1(CFsRequest* aRequest,TParse& aParse);
@@ -1839,10 +1848,6 @@
 
 typedef TPckgBuf<TMediaPswdReplyNotifyInfoV1> TMediaPswdReplyNotifyInfoV1Buf;
 
-#if defined(__WINS__)
- TInt MapWindowsFileName(TDes& aBuffer,const TDesC& aFileName);
-#endif
-
 enum TDllFindMethod {EFindInPath, EFindInSystemLibs, EFindInSystemBin, EFindExhausted};
 
 //---------------------------------------------------------------------------------------------------------------------
@@ -1948,6 +1953,12 @@
 friend class CMountCB;
 	};
 
+// extension to CProxyDrive
+class CProxyDriveBody : public CBase
+	{
+public:
+	RLibrary iLibrary;
+	};
 
 #include "sf_ops.h"
 #include "sf_std.inl"
--- a/userlibandfileserver/fileserver/sfile/sf_std.inl	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_std.inl	Thu Jul 22 16:46:39 2010 +0100
@@ -252,6 +252,11 @@
 void CFsMessageRequest::SetMessage(RMessage2& aMessage) 
 	{iMessage=aMessage;}
 
+
+CFsMessageRequest* CFsMessageRequest::RequestFromMessage(const RMessagePtr2& aMessage)
+	{return _LOFF(&aMessage, CFsMessageRequest, iMessage);}
+
+
 TMsgOperation* CFsMessageRequest::CurrentOperationPtr()
 	{return iCurrentOperation;}
 
--- a/userlibandfileserver/fileserver/sfile/sf_svr.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_svr.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -590,7 +590,7 @@
 // Set the volume name.
 //
 	{
-    TInt r = CheckDiskSpace(0, aRequest);
+    TInt r = CheckDiskSpace(KMinFsCreateObjTreshold, aRequest);
     if(r != KErrNone)
         return r;
 
--- a/userlibandfileserver/fileserver/sfile/sf_sys.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_sys.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -21,6 +21,10 @@
 #include <kernel/localise.h>
 #include <f32file.h>
 
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "sf_sysTraces.h"
+#endif
+
 typedef CFileSystem*(*TFileSystemNew)();
 extern CProxyDriveFactory* GetExtension(const TDesC& aName);
 
@@ -39,8 +43,8 @@
 */
 EXPORT_C CFileSystem::CFileSystem()
 	{
-	TRACE0(UTF::EBorder, UTraceModuleFileSys::ECFileSystemConstructor, EF32TraceUidFileSys);
-	TRACE0(UTF::EBorder, UTraceModuleFileSys::ECFileSystemConstructorReturn, EF32TraceUidFileSys);
+	OstTrace0(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMCONSTRUCTOR, "");
+	OstTrace0(TRACE_FILESYSTEM,FILESYS_ECFILESYSTEMCONSTRUCTORRETURN, "");
 	}
 
 /**
@@ -48,8 +52,8 @@
 */
 EXPORT_C CFileSystem::~CFileSystem()
 	{
-	TRACE0(UTF::EBorder, UTraceModuleFileSys::ECFileSystemDestructor, EF32TraceUidFileSys);
-	TRACE0(UTF::EBorder, UTraceModuleFileSys::ECFileSystemDestructorReturn, EF32TraceUidFileSys);
+	OstTrace0(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMDESTRUCTOR, "");
+	OstTrace0(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMDESTRUCTORRETURN, "");
 	}
 
 /**
@@ -266,22 +270,25 @@
 //
 	{
 
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECFileSystemInstall, EF32TraceUidFileSys, aSys);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMINSTALL, "this %x", aSys);
+
 	TInt r=aSys->Install();
-	TRACERETMULT2(UTF::EBorder, UTraceModuleFileSys::ECFileSystemInstallRet, EF32TraceUidFileSys, r, aSys->Name());
+
+	OstTraceData(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMINSTALLYS_EFILESYSTEMNAME, "FileSystemName %S", aSys->Name().Ptr(), aSys->Name().Length()<<1);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMINSTALLRET, "r %d", r);
 
 	__PRINT1TEMP(_L("InstallFileSystem %S"),aSys->Name());
 	if (r==KErrNone)
 		{TRAP(r,FileSystems->AddL(aSys,ETrue))}
 	if (r!=KErrNone)
 		{
-		TRACE1(UTF::EBorder, UTraceModuleFileSys::ECFileSystemRemove, EF32TraceUidFileSys, aSys);
-#ifdef SYMBIAN_FTRACE_ENABLE
+		OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMREMOVE1, "this %x", aSys);
+#ifdef OST_TRACE_COMPILER_IN_USE
 		TInt r = 
 #endif
 			aSys->Remove();
 		
-		TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECFileSystemRemoveRet, EF32TraceUidFileSys, r);
+		OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMREMOVE1RET, "r %d", r);
 		}
 	if (r==KErrNone)
 		aSys->SetLibrary(aLib);
@@ -320,9 +327,9 @@
 	if (!f)
 		return KErrCorrupt;
 	
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNew, EF32TraceUidFileSys, lib.Handle());
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEW, "handle %x", lib.Handle());
 	CFileSystem* pS=(*f)();
-	TRACE1(UTF::EBorder, UTraceModuleFileSys::ECFileSystemNewRet, EF32TraceUidFileSys, pS);
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMNEWRET, "fileSystem %x", pS);
 	if (!pS)
 		return KErrNoMemory;
 	TInt r=InstallFileSystem(pS,lib);
@@ -374,9 +381,12 @@
 			return KErrInUse;
 		}
 	
-    TRACE1(UTF::EBorder, UTraceModuleFileSys::ECFileSystemRemove, EF32TraceUidFileSys, pF);
+    OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMREMOVE2, "this %x", pF);
+
 	TInt r=pF->Remove();
-	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECFileSystemRemoveRet, EF32TraceUidFileSys, r);
+
+	OstTrace1(TRACE_FILESYSTEM, FSYS_ECFILESYSTEMREMOVE2RET, "r %d", r);
+
 	if (r!=KErrNone)
 		return(r);
 	
--- a/userlibandfileserver/fileserver/sfile/sf_thread.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_thread.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -834,10 +834,9 @@
 //
 	{
 	__ASSERT_ALWAYS(FsThreadManager::IsDriveThread(iDriveNumber,EFalse),Fault(EDriveThreadNotifyUser1));
-	// NB For read-ahead or a flush-dirty write request generated by the file cache, the session will be NULL: 
+	// NB For read-ahead or a flush-dirty write request generated by the file cache, the request or the session may be NULL: 
 	// in this case assume that notify user is set (as it's the safest option)
-	CSessionFs* session = iRequest->Session();
-	return session ?  session->GetNotifyUser() : ETrue;
+	return iRequest && iRequest->Session() ?  iRequest->Session()->GetNotifyUser() : ETrue;
 	}
 
 void CDriveThread::StartFinalisationTimer()
@@ -926,24 +925,34 @@
 	}
 
 
-CPluginThread::CPluginThread(CFsPlugin& aPlugin)
-  : iPlugin(aPlugin)
+CPluginThread::CPluginThread(CFsPlugin& aPlugin, RLibrary aLibrary)
+  : iPlugin(aPlugin), iLib(aLibrary)
 	{
 	/** @prototype */
 	iOperationLock.Close();
 	iPlugin.Open();
+	
+    /* 
+    Duplicate the handle to the DLL which created the plugin to prevent 
+    TFsRemovePlugin::DoRequestL() from unmapping the DLL's code segment before
+    this thread's destructor has been called as the destructor closes the plugin 
+    which results in a call to the plugin's derived destructor contained in the DLL (!)
+    */ 
+    TInt r = iLib.Duplicate(iThread, EOwnerProcess);
+    __ASSERT_ALWAYS(r==KErrNone, Fault(EFsThreadConstructor));
 	}
 
 CPluginThread::~CPluginThread()
     {
     iPlugin.Close();
+	iLib.Close();
     }
 
 
-CPluginThread* CPluginThread::NewL(CFsPlugin& aPlugin)
+CPluginThread* CPluginThread::NewL(CFsPlugin& aPlugin, RLibrary aLibrary)
 	{
 	__PRINT(_L("CPluginThread::NewL()"));
-	CPluginThread* pT=new(ELeave) CPluginThread(aPlugin);
+	CPluginThread* pT=new(ELeave) CPluginThread(aPlugin, aLibrary);
 	TInt r=pT->Initialise();
 
 	/** @prototype */
--- a/userlibandfileserver/fileserver/sfile/sf_utl.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_utl.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1067,6 +1067,8 @@
 	if(KReservedSpace == 0 || KDriveNumber == EDriveZ)
 	    return KErrNone;
 
+    ASSERT(aThreshold);
+
     //-- if the drive has a reserved space, take it into account
 	CSessionFs* session=aRequest->Session(); 
 
@@ -1074,8 +1076,7 @@
         aThreshold += KReservedSpace;
 
     //-- ask the corresponding file system if there is aThreshold bytes available.
-    //-- for some reason it's required to be strictly > than aThreshold
-    return aRequest->Drive()->RequestFreeSpaceOnMount(aThreshold+1);
+    return aRequest->Drive()->RequestFreeSpaceOnMount(aThreshold);
 	}								
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/userlibandfileserver/fileserver/sfile/traces/OstTraceDefinitions.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,21 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <OpenSystemTrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/userlibandfileserver/fileserver/sfile/traces/fixed_id.definitions	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,740 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_BORDER=0x42
+[GROUP]TRACE_DRIVE=0x41
+[GROUP]TRACE_FILESYSTEM=0x40
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EDIRCLOSE=0x124
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EDIRCLOSERETURN=0x125
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EDIROPEN1=0x11e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EDIROPEN1RETURN=0x120
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EDIROPEN1_EDIRNAME=0x11f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EDIROPEN2=0x121
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EDIROPEN2RETURN=0x123
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EDIROPEN2_EDIRNAME=0x122
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EDIRREAD1=0x126
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EDIRREAD1RETURN=0x127
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EDIRREAD2=0x128
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EDIRREAD2RETURN=0x129
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EDIRREAD3=0x12a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EDIRREAD3RETURN=0x12b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EDIRREAD4=0x12c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EDIRREAD4RETURN=0x12d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64ADOPTFROMCLIENT=0x1b1
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64ADOPTFROMCLIENTRETURN1=0x1b2
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64ADOPTFROMCLIENTRETURN2=0x1b3
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64ADOPTFROMCLIENTRETURN3=0x1b4
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64ADOPTFROMCREATOR=0x1b8
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64ADOPTFROMCREATORRETURN1=0x1b9
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64ADOPTFROMCREATORRETURN2=0x1ba
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64ADOPTFROMCREATORRETURN3=0x1bb
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64ADOPTFROMSERVER=0x1b5
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64ADOPTFROMSERVERRETURN1=0x1b6
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64ADOPTFROMSERVERRETURN2=0x1b7
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64CREATE=0x1a7
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64CREATERETURN=0x1a9
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64CREATE_EFILENAME=0x1a8
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64LOCK=0x1d2
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64LOCKRETURN=0x1d3
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64OPEN=0x1a4
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64OPENRETURN=0x1a6
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64OPEN_EFILENAME=0x1a5
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64READ10=0x1be
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64READ10RETURN=0x1bf
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64READ11=0x1c2
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64READ11RETURN=0x1c3
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64READ12=0x1d8
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64READ12RETURN=0x1d9
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64READ13=0x1dc
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64READ13RETURN=0x1dd
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64READ14=0x1d6
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64READ14RETURN=0x1d7
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64READ15=0x1c0
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64READ15RETURN=0x1c1
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64READ16=0x1da
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64READ16RETURN=0x1db
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64READ8=0x1bc
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64READ8RETURN=0x1bd
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64REPLACE=0x1aa
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64REPLACERETURN=0x1ac
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64REPLACE_EFILENAME=0x1ab
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64SEEK2=0x1cc
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64SEEK2RETURN=0x1cd
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64SETSIZE2=0x1d0
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64SETSIZE2RETURN=0x1d1
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64SIZE2=0x1ce
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64SIZE2RETURN=0x1cf
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64TEMP=0x1ad
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64TEMPRETURN=0x1b0
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64TEMP_EDIRNAME=0x1ae
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64TEMP_EFILENAME=0x1af
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64UNLOCK=0x1d4
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64UNLOCKRETURN=0x1d5
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64WRITE11=0x1ca
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64WRITE11RETURN=0x1cb
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64WRITE12=0x1e4
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64WRITE12RETURN=0x1e5
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64WRITE13=0x1c4
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64WRITE13RETURN=0x1c5
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64WRITE14=0x1de
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64WRITE14RETURN=0x1df
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64WRITE15=0x1c6
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64WRITE15RETURN=0x1c7
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64WRITE16=0x1e0
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64WRITE16RETURN=0x1e1
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64WRITE7=0x1c8
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64WRITE7RETURN=0x1c9
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64WRITE8=0x1e2
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILE64WRITE8RETURN=0x1e3
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEADOPT=0x12e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEADOPTFROMCLIENT=0x135
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEADOPTFROMCLIENTRETURN1=0x136
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEADOPTFROMCLIENTRETURN2=0x137
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEADOPTFROMCLIENTRETURN3=0x138
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEADOPTFROMCREATOR=0x139
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEADOPTFROMCREATORRETURN1=0x13a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEADOPTFROMCREATORRETURN2=0x13b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEADOPTFROMCREATORRETURN3=0x13c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEADOPTFROMSERVER=0x132
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEADOPTFROMSERVERRETURN1=0x133
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEADOPTFROMSERVERRETURN2=0x134
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEADOPTRETURN1=0x12f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEADOPTRETURN2=0x130
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEADOPTRETURN3=0x131
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEATT=0x18d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEATTRETURN=0x18e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEBLOCKMAPA=0x1a1
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEBLOCKMAPB=0x1a2
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEBLOCKMAPRETURN=0x1a3
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILECHANGEMODE=0x198
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILECHANGEMODERETURN=0x199
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILECLAMP=0x19f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILECLAMPRETURN=0x1a0
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILECLOSE=0x153
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILECLOSERETURN=0x154
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILECREATE=0x155
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILECREATERETURN=0x157
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILECREATE_EFILENAME=0x156
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEDRIVE=0x19d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEDRIVERETURN=0x19e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEDUPLICATE=0x13d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEDUPLICATERETURN1=0x13e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEDUPLICATERETURN2=0x13f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEDUPLICATERETURN3=0x140
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEFLUSH1=0x185
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEFLUSH1RETURN=0x186
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEFLUSH2=0x187
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEFLUSH2RETURN=0x188
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEFULLNAME=0x14d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEFULLNAMERETURN=0x14f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEFULLNAME_EFILENAME=0x14e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEGETNAME=0x14a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEGETNAMERETURN=0x14c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEGETNAME_EFILENAME=0x14b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILELOCK=0x17f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILELOCKRETURN=0x180
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEMODIFIED=0x191
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEMODIFIEDRETURN=0x192
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEOPEN=0x150
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEOPENRETURN=0x152
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEOPEN_EFILENAME=0x151
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREAD1=0x15f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREAD1RETURN=0x160
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREAD2=0x161
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREAD2RETURN=0x162
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREAD3=0x167
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREAD3RETURN=0x168
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREAD4=0x169
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREAD4RETURN=0x16a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREAD5=0x163
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREAD5RETURN=0x164
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREAD6=0x165
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREAD6RETURN=0x166
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREAD7=0x16b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREAD7RETURN=0x16c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREAD9=0x16d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREAD9RETURN=0x16e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILERENAME=0x19a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILERENAMERETURN=0x19c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILERENAME_ENEWNAME=0x19b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREPLACE=0x158
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREPLACERETURN=0x15a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEREPLACE_EFILENAME=0x159
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILESEEK1=0x183
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILESEEK1RETURN=0x184
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILESETA=0x195
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILESETATT=0x18f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILESETATTRETURN=0x190
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILESETB=0x196
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILESETMODIFIED=0x193
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILESETMODIFIEDRETURN=0x194
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILESETRETURN=0x197
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILESETSIZE1=0x18b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILESETSIZE1RETURN=0x18c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILESIZE=0x189
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILESIZERETURN=0x18a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILETEMP=0x15b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILETEMPRETURN=0x15e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILETEMP_EDIRNAME=0x15c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILETEMP_EFILENAME=0x15d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILETRANSFERTOCLIENT=0x144
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILETRANSFERTOCLIENTRETURN1=0x145
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILETRANSFERTOCLIENTRETURN2=0x146
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILETRANSFERTOCLIENTRETURN3=0x147
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILETRANSFERTOPROCESS=0x148
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILETRANSFERTOPROCESSRETURN=0x149
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILETRANSFERTOSERVER=0x141
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILETRANSFERTOSERVERRETURN1=0x142
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILETRANSFERTOSERVERRETURN2=0x143
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEUNLOCK=0x181
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEUNLOCKRETURN=0x182
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEWRITE1=0x16f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEWRITE10=0x17d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEWRITE10RETURN=0x17e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEWRITE1RETURN=0x170
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEWRITE2=0x171
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEWRITE2RETURN=0x172
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEWRITE3=0x177
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEWRITE3RETURN=0x178
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEWRITE4=0x179
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEWRITE4RETURN=0x17a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEWRITE5=0x173
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEWRITE5RETURN=0x174
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEWRITE6=0x17b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEWRITE6RETURN=0x17c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEWRITE9=0x175
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFILEWRITE9RETURN=0x176
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSADDCOMPOSITEMOUNT=0xfe
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSADDCOMPOSITEMOUNTRETURN=0x100
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSADDCOMPOSITEMOUNT_EFILESYSTEMNAME=0xff
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSADDEXTENSION=0x3b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSADDEXTENSIONRETURN=0x3d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSADDEXTENSION_EEXTENSIONNAME=0x3c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSADDFILESYSTEM=0x17
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSADDFILESYSTEMRETURN=0x19
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSADDFILESYSTEM_EFILENAME=0x18
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSALLOWDISMOUNT=0x10d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSALLOWDISMOUNTRETURN=0x10e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSATT=0xa0
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSATTRETURN=0xa2
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSATT_EFILENAME=0xa1
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSCHECKDISK=0xc1
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSCHECKDISKRETURN=0xc3
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSCHECKDISK_EDIRNAME=0xc2
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSCLEARPASSWORD=0xec
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSCLEARPASSWORDRETURN=0xed
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSCLOSE=0x11c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSCLOSERETURN=0x11d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSCONNECT=0xc
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSCONNECTRETURN=0xd
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSCREATEPRIVATEPATH=0x13
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSCREATEPRIVATEPATHRETURN=0x14
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDELETE=0x95
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDELETERETURN=0x97
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDELETE_EFILENAME=0x96
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDISMOUNTEXTENSION=0x41
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDISMOUNTEXTENSIONRETURN=0x43
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDISMOUNTEXTENSION_EEXTENSIONNAME=0x42
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDISMOUNTFILESYSTEM=0x32
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDISMOUNTFILESYSTEMRETURN=0x34
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDISMOUNTFILESYSTEM_EFILESYSTEMNAME=0x33
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDRIVE=0x5f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDRIVELIST1=0x5b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDRIVELIST1RETURN=0x5c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDRIVELIST2=0x5d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDRIVELIST2RETURN=0x5e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDRIVERETURN=0x60
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDRIVETOCHAR=0x1
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSDRIVETOCHARRETURN=0x2
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSENTRY=0xac
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSENTRYRETURN=0xae
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSENTRY_EFILENAME=0xad
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSERASEPASSWORD=0xee
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSERASEPASSWORDRETURN=0xef
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSEXTENSIONNAME=0x47
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSEXTENSIONNAMERETURN=0x49
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSEXTENSIONNAME_EEXTENSIONNAME=0x48
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSFILESYSTEMNAME=0x35
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSFILESYSTEMNAMERETURN=0x37
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSFILESYSTEMNAME_EFILESYSTEMNAME=0x36
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSFILESYSTEMNAME_ESUPPORTEDFILESYSTEMNAME=0x39
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSFILESYSTEMSUBTYPE=0x119
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSFILESYSTEMSUBTYPERETURN=0x11b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSFILESYSTEMSUBTYPE_EFILESYSTEMNAME=0x11a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSFINALISEDRIVE=0xf5
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSFINALISEDRIVERETURN=0xf6
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSFINALISEDRIVES=0xf7
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSFINALISEDRIVESRETURN1=0xf8
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSFINALISEDRIVESRETURN2=0xf9
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETDIR1=0x85
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETDIR1RETURN=0x87
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETDIR1_EDIRNAME=0x86
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETDIR2=0x88
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETDIR2RETURN=0x8a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETDIR2_EDIRNAME=0x89
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETDIR3=0x8b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETDIR3RETURN=0x8d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETDIR3_EDIRNAME=0x8c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETDRIVENAME=0xe2
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETDRIVENAMERETURN=0xe4
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETDRIVENAME_EDRIVENAME=0xe3
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETLONGNAME=0xcb
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETLONGNAMERETURN=0xce
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETLONGNAME_ELONGNAME=0xcd
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETLONGNAME_ESHORTNAME=0xcc
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETMEDIASERIALNUMBER=0x73
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETMEDIASERIALNUMBERRETURN=0x74
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETMEDIASERIALNUMBER_ESERIALNUMBER=0x75
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETNOTIFYUSER=0xd2
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETNOTIFYUSERRETURN=0xd3
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETRESERVEACCESS=0x103
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETRESERVEACCESSRETURN=0x104
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETSHORTNAME=0xc7
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETSHORTNAMERETURN=0xca
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETSHORTNAME_ELONGNAME=0xc8
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETSHORTNAME_ESHORTNAME=0xc9
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETSYSTEMDRIVE=0x5
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETSYSTEMDRIVECHAR=0x8
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETSYSTEMDRIVECHARRETURN=0x9
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETSYSTEMDRIVERETURN1=0x6
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSGETSYSTEMDRIVERETURN2=0x7
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSINITIALISEPROPERTIESFILE=0x113
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSINITIALISEPROPERTIESFILERETURN=0x114
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISFILEINROM=0xd6
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISFILEINROMRETURN=0xd8
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISFILEINROM_EFILENAME=0xd7
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISFILEOPEN=0xcf
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISFILEOPENRETURN=0xd1
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISFILEOPEN_EFILENAME=0xd0
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISROMADDRESS=0x3
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISROMADDRESSRETURN=0x4
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISVALIDNAME1=0xd9
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISVALIDNAME1RETURN=0xdb
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISVALIDNAME1_EFILENAME=0xda
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISVALIDNAME2=0xdc
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISVALIDNAME2RETURN=0xde
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISVALIDNAME2_EFILENAME=0xdd
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISVALIDNAME3=0xdf
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISVALIDNAME3RETURN=0xe1
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSISVALIDNAME3_EFILENAME=0xe0
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSLOCKDRIVE=0xe8
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSLOCKDRIVERETURN=0xe9
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMKDIR=0x7c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMKDIRALL=0x7f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMKDIRALLRETURN=0x81
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMKDIRALL_EDIRNAME=0x80
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMKDIRRETURN=0x7e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMKDIR_EDIRNAME=0x7d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMODIFIED=0xa6
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMODIFIEDRETURN=0xa8
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMODIFIED_EFILENAME=0xa7
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTEXTENSION=0x3e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTEXTENSIONRETURN=0x40
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTEXTENSION_EEXTENSIONNAME=0x3f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEM1=0x1d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEM1RETURN=0x1f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEM1_EFILESYSTEMNAME=0x1e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEM2=0x20
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEM2RETURN=0x22
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEM2_EFILESYSTEMNAME=0x21
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEM3=0x23
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEM3RETURN=0x26
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEM3_EEXTENSIONNAME=0x24
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEM3_EFILESYSTEMNAME=0x25
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEM4=0x27
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEM4RETURN=0x2a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEM4_EEXTENSIONNAME=0x29
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEM4_EFILESYSTEMNAME=0x28
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEMANDSCAN1=0x2b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEMANDSCAN1RETURN=0x2d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEMANDSCAN1_EFILESYSTEMNAME=0x2c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEMANDSCAN2=0x2e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEMANDSCAN2RETURN=0x31
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEMANDSCAN2_EEXTENSIONNAME=0x30
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSMOUNTFILESYSTEMANDSCAN2_EFILESYSTEMNAME=0x2f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYCHANGE1=0x4c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYCHANGE1RETURN=0x4d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYCHANGE2=0x4e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYCHANGE2RETURN=0x50
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYCHANGE2_EDIRNAME=0x4f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYCHANGECANCEL1=0x51
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYCHANGECANCEL1RETURN=0x52
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYCHANGECANCEL2=0x53
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYCHANGECANCEL2RETURN=0x54
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYDISKSPACE=0x55
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYDISKSPACECANCEL1=0x57
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYDISKSPACECANCEL1RETURN=0x58
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYDISKSPACECANCEL2=0x59
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYDISKSPACECANCEL2RETURN=0x5a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYDISKSPACERETURN=0x56
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYDISMOUNT=0x107
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYDISMOUNTCANCEL1=0x109
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYDISMOUNTCANCEL1RETURN=0x10a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYDISMOUNTCANCEL2=0x10b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYDISMOUNTCANCEL2RETURN=0x10c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSNOTIFYDISMOUNTRETURN=0x108
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSPARSE1=0x8e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSPARSE1RETURN=0x90
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSPARSE1_EFILEPATH=0x8f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSPARSE2=0x91
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSPARSE2RETURN=0x94
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSPARSE2_EFILENAME=0x92
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSPARSE2_ERELATED=0x93
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSPRIVATEPATH=0x10
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSPRIVATEPATHRETURN=0x12
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSPRIVATEPATH_EDIRNAME=0x11
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSQUERYVOLUMEINFOEXT=0x115
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSQUERYVOLUMEINFOEXTRETURN=0x116
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREADFILESECTION=0xb2
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREADFILESECTIONRETURN1=0xb4
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREADFILESECTIONRETURN2=0xb5
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREADFILESECTIONRETURN3=0xb6
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREADFILESECTION_EFILENAME=0xb3
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREADFILESECTION_RESERVED=0xb7
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREADFILESECTION_RESERVED_EFILENAME=0xb8
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREADFILESECTION_RESERVED_RETURN1=0xb9
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREADFILESECTION_RESERVED_RETURN2=0xba
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREALNAME=0x6f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREALNAMERETURN=0x72
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREALNAME_EFILENAME1=0x70
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREALNAME_EFILENAME2=0x71
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRELEASERESERVEACCESS=0x105
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRELEASERESERVEACCESSRETURN=0x106
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREMOUNTDRIVE=0x4a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREMOUNTDRIVERETURN=0x4b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREMOVEEXTENSION=0x44
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREMOVEEXTENSIONRETURN=0x46
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREMOVEEXTENSION_EEXTENSIONNAME=0x45
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREMOVEFILESYSTEM=0x1a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREMOVEFILESYSTEMRETURN=0x1c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREMOVEFILESYSTEM_EFILESYSTEMNAME=0x1b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRENAME=0x98
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRENAMERETURN=0x9b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRENAME_ENEWNAME=0x9a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRENAME_EOLDNAME=0x99
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREPLACE=0x9c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREPLACERETURN=0x9f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREPLACE_ENEWNAME=0x9e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSREPLACE_EOLDNAME=0x9d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRESERVEDRIVESPACE=0x101
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRESERVEDRIVESPACERETURN=0x102
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRESOURCECOUNT=0xbf
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRESOURCECOUNTMARKEND=0xbd
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRESOURCECOUNTMARKENDRETURN=0xbe
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRESOURCECOUNTMARKSTART=0xbb
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRESOURCECOUNTMARKSTARTRETURN=0xbc
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRESOURCECOUNTRETURN=0xc0
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRMDIR=0x82
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRMDIRRETURN=0x84
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSRMDIR_EDIRNAME=0x83
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSCANDRIVE=0xc4
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSCANDRIVERETURN=0xc6
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSCANDRIVE_EDIRNAME=0xc5
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSESSIONPATH=0x76
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSESSIONPATHRETURN=0x77
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSESSIONPATH_EDIRNAME=0x78
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETATT=0xa3
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETATTRETURN=0xa5
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETATT_EFILENAME=0xa4
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETDRIVENAME=0xe5
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETDRIVENAMERETURN=0xe7
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETDRIVENAME_EDRIVENAME=0xe6
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETENTRY=0xaf
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETENTRYRETURN=0xb1
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETENTRY_EFILENAME=0xb0
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETLOCALDRIVEMAPPING=0xf2
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETLOCALDRIVEMAPPINGRETURN=0xf4
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETLOCALDRIVEMAPPING_ELOCALDRIVEMAPPING=0xf3
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETMODIFIED=0xa9
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETMODIFIEDRETURN=0xab
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETMODIFIED_EFILENAME=0xaa
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETNOTIFYCHANGE=0x111
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETNOTIFYCHANGERETURN=0x112
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETNOTIFYUSER=0xd4
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETNOTIFYUSERRETURN=0xd5
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETSESSIONPATH=0x79
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETSESSIONPATHRETURN=0x7b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETSESSIONPATH_EDIRNAME=0x7a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETSESSIONTOPRIVATE=0xe
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETSESSIONTOPRIVATERETURN=0xf
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETSTARTUPCONFIGURATION=0x10f
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETSTARTUPCONFIGURATIONRETURN=0x110
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETSUBST=0x6c
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETSUBSTRETURN=0x6e
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETSUBST_EDIRNAME=0x6d
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETSYSTEMDRIVE=0xa
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETSYSTEMDRIVERETURN=0xb
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETVOLUMELABEL=0x66
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETVOLUMELABELRETURN=0x68
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSETVOLUMELABEL_EVOLUMENAME=0x67
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSTARTUPINITCOMPLETE=0xf0
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSTARTUPINITCOMPLETERETURN=0xf1
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSUBST=0x69
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSUBSTRETURN=0x6b
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSUBST_EDIRNAME=0x6a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSUPPORTEDFILESYSTEMNAME=0x38
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSUPPORTEDFILESYSTEMNAMERETURN=0x3a
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSWAPFILESYSTEM=0xfa
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSWAPFILESYSTEMRETURN=0xfd
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSWAPFILESYSTEM_ENEWNAME=0xfc
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSSWAPFILESYSTEM_EOLDNAME=0xfb
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSUNLOCKDRIVE=0xea
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSUNLOCKDRIVERETURN=0xeb
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSVERSION=0x15
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSVERSIONRETURN=0x16
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSVOLUME1=0x61
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSVOLUME1RETURNA=0x62
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSVOLUME1RETURNB=0x63
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSVOLUME2=0x64
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSVOLUME2RETURN=0x65
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSVOLUMEIOPARAM=0x117
+[TRACE]TRACE_BORDER[0x42]_EFSRV_EFSVOLUMEIOPARAMRETURN=0x118
+[TRACE]TRACE_DRIVE[0x41]_FSYS_ECFILESYSTEMISEXTENSIONSUPPORTED2=0x5f
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVECAPS=0x45
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVECAPSRET=0x46
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVECLEAR=0x53
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVECLEARRET=0x54
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVECONTROLIO=0x57
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVECONTROLIORET=0x58
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEDELETENOTIFY=0x5d
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEDELETENOTIFYRET=0x5e
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEDISMOUNTED=0x33
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEDISMOUNTEDRET=0x34
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEENLARGE=0x35
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEENLARGERET=0x36
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEERASEPASSWORD=0x55
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEERASEPASSWORDRET=0x56
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEFORCEREMOUNT=0x4d
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEFORCEREMOUNTRET=0x4e
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEFORMAT1=0x47
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEFORMAT1RET=0x48
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEFORMAT2=0x49
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEFORMAT2RET=0x4a
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEGETINTERFACE=0x59
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEGETINTERFACERET=0x5a
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEGETLASTERRORINFO=0x5b
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEGETLASTERRORINFORET=0x5c
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEINITIALISE=0x31
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEINITIALISERET=0x32
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVELOCK=0x51
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVELOCKRET=0x52
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEREAD1=0x39
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEREAD1RET=0x3a
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEREAD2=0x3b
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEREAD2RET=0x3c
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEREAD3=0x3d
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEREAD3RET=0x3e
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEREDUCESIZE=0x37
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEREDUCESIZERET=0x38
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVESETMOUNTINFO=0x4b
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVESETMOUNTINFORET=0x4c
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEUNLOCK=0x4f
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEUNLOCKRET=0x50
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEWRITE1=0x3f
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEWRITE1RET=0x40
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEWRITE2=0x41
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEWRITE2RET=0x42
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEWRITE3=0x43
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECBASEEXTPROXYDRIVEWRITE3RET=0x44
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVECAPS=0x17
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVECAPSRET=0x18
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVECLEAR=0x27
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVECLEARRET=0x28
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVECONTROLIO=0x21
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVECONTROLIORET=0x22
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEDELETENOTIFY=0x2b
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEDELETENOTIFYRET=0x2c
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEDISMOUNTED=0x5
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEDISMOUNTEDRET=0x6
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEENLARGE=0x7
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEENLARGERET=0x8
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEERASEPASSWORD=0x29
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEERASEPASSWORDRET=0x2a
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEFORCEREMOUNT=0x1f
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEFORCEREMOUNTRET=0x20
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEFORMAT1=0x19
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEFORMAT1RET=0x1a
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEFORMAT2=0x1b
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEFORMAT2RET=0x1c
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEGETINTERFACE=0x2f
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEGETINTERFACERET=0x30
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEGETLASTERRORINFO=0x2d
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEGETLASTERRORINFORET=0x2e
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEINITIALISE=0x3
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEINITIALISERET=0x4
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVELOCK=0x25
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVELOCKRET=0x26
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVENEW=0x1
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVENEWRET=0x2
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEREAD1=0xb
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEREAD1RET=0xc
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEREAD2=0xd
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEREAD2RET=0xe
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEREAD3=0xf
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEREAD3RET=0x10
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEREDUCESIZE=0x9
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEREDUCESIZERET=0xa
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVESETMOUNTINFO=0x1d
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVESETMOUNTINFORET=0x1e
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEUNLOCK=0x23
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEUNLOCKRET=0x24
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEWRITE1=0x11
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEWRITE1RET=0x12
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEWRITE2=0x13
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEWRITE2RET=0x14
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEWRITE3=0x15
+[TRACE]TRACE_DRIVE[0x41]_PROXYDRIVE_ECLOCALPROXYDRIVEWRITE3RET=0x16
+[TRACE]TRACE_FILESYSTEM[0x40]_FILESYS_ECFILESYSTEMCONSTRUCTORRETURN=0x91
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECDIRCBREADL1=0x5
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECDIRCBREADL1RET=0x6
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECDIRCBREADL2=0x1
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECDIRCBREADL2RET=0x2
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECDIRCBSTORELONGENTRYNAMEL=0x3
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECDIRCBSTORELONGENTRYNAMELRET=0x4
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBFLUSHDATAL1=0x6e
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBFLUSHDATAL1RET=0x6f
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBFLUSHDATAL2=0x84
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBFLUSHDATAL2RET=0x85
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBGETINTERFACE=0x82
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBGETINTERFACERET=0x83
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBREADLA=0x7c
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBREADLRET=0x7d
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBRENAMEL=0x76
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBRENAMELRET=0x78
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBRENAMELYS_EFILENAME=0x77
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBSETENTRYL1=0x70
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBSETENTRYL1RET=0x71
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBSETENTRYL2=0x72
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBSETENTRYL2RET=0x73
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBSETENTRYL3=0x74
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBSETENTRYL3RET=0x75
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBSETSIZEL=0x80
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBSETSIZELRET=0x81
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBWRITEL=0x7e
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILECBWRITELRET=0x7f
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMCONSTRUCTOR=0x90
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMDESTRUCTOR=0x92
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMDESTRUCTORRETURN=0x93
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMDRIVEINFO=0x17
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMDRIVEINFORET=0x18
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMINSTALL=0x94
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMINSTALLRET=0x96
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMINSTALLYS_EFILESYSTEMNAME=0x95
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMISEXTENSIONSUPPORTED1=0x57
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEW=0x99
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWDIRL=0x3b
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWDIRLRET=0x3c
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWFILEL=0x36
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWFILELRET=0x37
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWFORMATL=0x6c
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWFORMATLRET=0x6d
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWMOUNTL=0x9
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWMOUNTL1=0x53
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWMOUNTL1RET=0x54
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWMOUNTL2=0x58
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWMOUNTL2RET=0x59
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWMOUNTL3=0x5c
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWMOUNTL3RET=0x5d
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWMOUNTL4=0x60
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWMOUNTL4RET=0x61
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWMOUNTL5=0x64
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWMOUNTL5RET=0x65
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWMOUNTLRET=0xa
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMNEWRET=0x9a
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMREMOVE1=0x97
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMREMOVE1RET=0x98
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMREMOVE2=0x9b
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFILESYSTEMREMOVE2RET=0x9c
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFORMATCBDOFORMATSTEPL=0x88
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECFORMATCBDOFORMATSTEPLRET=0x89
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBCHECKDISK1=0x43
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBCHECKDISK1RET=0x44
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBCHECKDISK2=0x45
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBCHECKDISK2RET=0x46
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBCLEARPASSWORD=0x62
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBCLEARPASSWORDRET=0x63
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBCONTROLIO=0x6a
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBCONTROLIORET=0x6b
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBCURRENTFREESPACE=0x11
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBCURRENTFREESPACERET=0x12
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBDELETEL1=0x25
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBDELETEL1_EFILENAME=0x26
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBDELETEL1_RET=0x27
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBDELETEL2=0x79
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBDELETEL2RET=0x7b
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBDELETEL2_EFILENAME=0x7a
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBDIROPENL=0x3d
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBDIROPENLRET=0x3f
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBDIROPENL_EDIRNAME=0x3e
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBDISMOUNTED=0x68
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBDISMOUNTEDRET=0x69
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBENTRYL=0x30
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBENTRYLRET=0x32
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBENTRYL_EFILEPATH=0x31
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBERASEPASSWORD=0x66
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBERASEPASSWORDRET=0x67
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBFILEOPENL=0x38
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBFILEOPENLRET=0x3a
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBFILEOPENL_EFILENAME=0x39
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBFINALISEMOUNT1=0x15
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBFINALISEMOUNT1RET=0x16
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBFINALISEMOUNT2=0x13
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBFINALISEMOUNT2RET=0x14
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBFORCEREMOUNTDRIVE=0x55
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBFORCEREMOUNTDRIVERET=0x56
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBFREESPACE=0xd
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBFREESPACERET=0xe
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBGETINTERFACE=0x8a
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBGETINTERFACERET=0x8b
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBGETLONGNAMEL=0x4f
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBGETLONGNAMELRET=0x52
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBGETLONGNAMEL_ELONGNAME=0x51
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBGETLONGNAMEL_ESHORTNAME=0x50
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBGETSHORTNAMEL=0x4b
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBGETSHORTNAMEL_ECMOUNTCBGETSHORTNAMELRET=0x4e
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBGETSHORTNAMEL_ELONGNAME=0x4c
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBGETSHORTNAMEL_ESHORTNAME=0x4d
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBLOCK=0x5a
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBLOCKRET=0x5b
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBMKDIRL=0x1f
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBMKDIRLRET=0x21
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBMKDIRLYS_EDIRNAME=0x20
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBMOUNTCONTROL=0xb
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBMOUNTCONTROLRET=0xc
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBRAWREADL=0x8c
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBRAWREADLRET=0x8d
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBRAWWRITEL=0x8e
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBRAWWRITELRET=0x8f
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBREADFILESECTIONL=0x40
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBREADFILESECTIONLRET=0x42
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBREADFILESECTIONL_EFILENAME=0x41
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBREMOUNT1=0x7
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBREMOUNT1RET=0x8
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBREMOUNT2=0x86
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBREMOUNT2RET=0x87
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBRENAMEL=0x28
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBRENAMELRET=0x2b
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBRENAMELYS_ENEWNAME=0x2a
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBRENAMELYS_EOLDNAME=0x29
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBREPLACEL=0x2c
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBREPLACELRET=0x2f
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBREPLACEL_ENEWNAME=0x2e
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBREPLACEL_EOLDNAME=0x2d
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBRMDIRL=0x22
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBRMDIRLRET=0x24
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBRMDIRLYS_EDIRNAME=0x23
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBSCANDRIVE1=0x47
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBSCANDRIVE1RET=0x48
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBSCANDRIVE2=0x49
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBSCANDRIVE2RET=0x4a
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBSETENTRYL=0x33
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBSETENTRYLRET=0x35
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBSETENTRYL_EFILEPATH=0x34
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBSETVOLUMEL=0x1c
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBSETVOLUMELRET=0x1e
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBUNLOCK=0x5e
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBUNLOCKRET=0x5f
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBVOLUMEL=0x19
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBVOLUMELRETA=0x1a
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBVOLUMELRETB=0x1b
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBVOLUMESIZE=0xf
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_ECMOUNTCBVOLUMESIZERET=0x10
+[TRACE]TRACE_FILESYSTEM[0x40]_FSYS_EVOLUMENAME=0x1d
--- a/userlibandfileserver/fileserver/sfsrv/cl_cli.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfsrv/cl_cli.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -17,13 +17,9 @@
 
 #include "cl_std.h"
 #include <f32fsys.h>
-
-
-
-
-
-
-
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cl_cliTraces.h"
+#endif
 EFSRV_EXPORT_C TBool RFs::IsValidDrive(TInt aDrive)
 /**
 Tests whether the specified drive number is valid.
@@ -97,7 +93,7 @@
 
 	if (aDrive==KDefaultDrive)
 		{
-		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsDriveToChar, MODULEUID, aDrive);
+		OstTrace1(TRACE_BORDER, EFSRV_EFSDRIVETOCHAR, "aDrive %d", aDrive);
 		RFs fs;
 		TFileName path;
 		TInt r=fs.Connect();
@@ -108,7 +104,7 @@
 		if (r!=KErrNone)
 			return(r);
 		aChar=path[0];
-		TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsDriveToCharReturn, MODULEUID, KErrNone, aChar);
+		OstTraceExt2(TRACE_BORDER, EFSRV_EFSDRIVETOCHARRETURN, "r %d aChar %x", (TUint) KErrNone, (TUint) aChar);
 		return(KErrNone);
 		}
 	if (!IsValidDrive(aDrive))
@@ -129,14 +125,12 @@
 @return True, if the address is in ROM; false, if not.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsIsRomAddress, MODULEUID, aPtr);
-
+	OstTrace1(TRACE_BORDER, EFSRV_EFSISROMADDRESS, "aPtr %x", aPtr);
 	TBool res;
 	TInt r=User::IsRomAddress(res,aPtr); // Only returns error on WINS
 	if (r!=KErrNone)
 		res=EFalse;
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsIsRomAddressReturn, MODULEUID, res);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSISROMADDRESSRETURN, "r %d", res);
 	return(res);
 	}
 
@@ -166,19 +160,18 @@
  */
 EFSRV_EXPORT_C TDriveNumber RFs::GetSystemDrive()
     {
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsGetSystemDrive, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSGETSYSTEMDRIVE, "");
     TInt drive;
 	TInt err = RProperty::Get(TSecureId(KFileServerUidValue), KSystemDriveKey, drive);
     if(err==KErrNone)
         {
         if((drive>=EDriveA) && (drive<=EDriveZ))
             {
-			TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsGetSystemDriveReturn, MODULEUID, drive);
+			OstTrace1(TRACE_BORDER, EFSRV_EFSGETSYSTEMDRIVERETURN1, "r %d", drive);
             return static_cast<TDriveNumber>(drive);
             }
         }
-
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsGetSystemDriveReturn, MODULEUID, EDriveC);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSGETSYSTEMDRIVERETURN2, "r %d", EDriveC);
     return EDriveC;
 	}
     
@@ -193,11 +186,9 @@
 */
 EFSRV_EXPORT_C TChar RFs::GetSystemDriveChar()
 	{
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsGetSystemDriveChar, MODULEUID);
-
+	OstTrace0(TRACE_BORDER, EFSRV_EFSGETSYSTEMDRIVECHAR, "");
 	TInt r = 'A' + GetSystemDrive();
-
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsGetSystemDriveCharReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSGETSYSTEMDRIVECHARRETURN, "RFs::GetSystemDriveChar() r %x", (char) r);
 	return r;
 	}
 
@@ -217,10 +208,9 @@
 */
 EFSRV_EXPORT_C TInt RFs::SetSystemDrive(TDriveNumber aSystemDrive)
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsSetSystemDrive, MODULEUID, Handle(), aSystemDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSSETSYSTEMDRIVE, "sess %x aSystemDrive %d", (TUint) Handle(), (TUint) aSystemDrive);
     TInt r = SendReceive(EFsSetSystemDrive, TIpcArgs(aSystemDrive));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetSystemDriveReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSETSYSTEMDRIVERETURN, "r %d", r);
 	return r;
 	}
 
@@ -247,11 +237,10 @@
         error codes.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsConnect, MODULEUID, aMessageSlots);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSCONNECT, "aMessageSlots %d", aMessageSlots);
 	_LIT(KFileServerName,"!FileServer");
 	TInt r = CreateSession(KFileServerName,Version(),aMessageSlots);
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFsConnectReturn, MODULEUID, r, Handle());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSCONNECTRETURN, "r %d sess %x", (TUint) r, (TUint) Handle());
 	return r;
 	}
 
@@ -275,10 +264,9 @@
         error codes.
 */
 	{	
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsSetSessionToPrivate, MODULEUID, Handle(), aDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSSETSESSIONTOPRIVATE, "sess %x  aDrive %d", (TUint) Handle(), (TUint) aDrive);
 	TInt r = SendReceive(EFsSessionToPrivate,TIpcArgs(aDrive));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetSessionToPrivateReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSETSESSIONTOPRIVATERETURN, "r %d", r);
 	return r;
 	}
 
@@ -294,10 +282,10 @@
 @param aPath On successful return, contains the private path for a process.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsPrivatePath, MODULEUID, Handle());
+	OstTrace1(TRACE_BORDER, EFSRV_EFSPRIVATEPATH, "sess %x", Handle());
 	TInt r = SendReceive(EFsPrivatePath,TIpcArgs(&aPath));
-
-	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsPrivatePathReturn, MODULEUID, r, aPath);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSPRIVATEPATH_EDIRNAME, "Dir %S", aPath.Ptr(), aPath.Length()<<1);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSPRIVATEPATHRETURN, "r %d", r);
 	return r;
 	}
 
@@ -318,10 +306,9 @@
         error codes.
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsCreatePrivatePath, MODULEUID, Handle(), aDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSCREATEPRIVATEPATH, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
 	TInt r = SendReceive(EFsCreatePrivatePath,TIpcArgs(aDrive));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsCreatePrivatePathReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSCREATEPRIVATEPATHRETURN, "r %d", r);
 	return r;
 	}	
 
@@ -335,11 +322,9 @@
 @return The client side version number.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsVersion, MODULEUID, Handle());
-
+	OstTrace1(TRACE_BORDER, EFSRV_EFSVERSION, "sess %x", Handle());
 	TVersion r = TVersion(KF32MajorVersionNumber,KF32MinorVersionNumber,KF32BuildVersionNumber);
-
-	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFsVersionReturn, MODULEUID, r.iMajor, r.iMinor, r.iBuild);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSVERSIONRETURN, "iMajor %d iMinor %d iBuild %d", (TUint) r.iMajor, (TUint) r.iMinor, (TUint) r.iBuild);
 	return r;
 	}
 
@@ -364,7 +349,8 @@
 @see RFs::MountFileSystem        
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsAddFileSystem, MODULEUID, Handle(), aFileName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSADDFILESYSTEM, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSADDFILESYSTEM_EFILENAME, "FileName %S", aFileName.Ptr(), aFileName.Length()<<1);
 	RLoader loader;
 	TInt r = loader.Connect();
 	if (r==KErrNone)
@@ -372,8 +358,7 @@
 		r = loader.SendReceive(ELoadFileSystem, TIpcArgs(0, &aFileName, 0));
 		loader.Close();
 		}
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsAddFileSystemReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSADDFILESYSTEMRETURN, "r %d", r);
 	return r;
 	}
 
@@ -395,10 +380,10 @@
 
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRemoveFileSystem, MODULEUID, Handle(), aFileSystemName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSREMOVEFILESYSTEM, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSREMOVEFILESYSTEM_EFILESYSTEMNAME, "FileSystemName %S", aFileSystemName.Ptr(), aFileSystemName.Length()<<1);
 	TInt r = SendReceive(EFsRemoveFileSystem,TIpcArgs(&aFileSystemName));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRemoveFileSystemReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSREMOVEFILESYSTEMRETURN, "r %d", r);
 	return r;
 	}
 
@@ -423,10 +408,10 @@
 @see RFs::FileSystemName
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem1, MODULEUID, Handle(), aFileSystemName, aDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEM1, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEM1_EFILESYSTEMNAME, "FileSystemName %S", aFileSystemName.Ptr(), aFileSystemName.Length()<<1);
 	TInt r = SendReceive(EFsMountFileSystem,TIpcArgs(&aFileSystemName,aDrive,NULL,EFalse));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEM1RETURN, "r %d", r);
 	return r;
 	}
 
@@ -454,16 +439,14 @@
 
 @return KErrNone if successful, otherwise one of the other system-wide error codes.
 @capability DiskAdmin
-
 @see RFs::AddFileSystem
 @see RFs::FileSystemName
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem2, MODULEUID, Handle(), aFileSystemName, aDrive, aIsSync);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEM2, "sess %x aDrive %d aIsSync %d", (TUint) Handle(), (TUint) aDrive, (TUint) aIsSync);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEM2_EFILESYSTEMNAME, "FileSystemName %S", aFileSystemName.Ptr(), aFileSystemName.Length()<<1);
 	TInt r = SendReceive(EFsMountFileSystem,TIpcArgs(&aFileSystemName,aDrive,NULL,aIsSync));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem2Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEM2RETURN, "r %d", r);
 	return r;
 	}
 
@@ -489,11 +472,11 @@
 @see RFs::FileSystemName
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem3, MODULEUID, Handle(), aFileSystemName, aExtensionName, aDrive);
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEM3, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEM3_EEXTENSIONNAME, "ExtensionName %S", aExtensionName.Ptr(), aExtensionName.Length()<<1);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEM3_EFILESYSTEMNAME, "FileSystemName %S", aFileSystemName.Ptr(), aFileSystemName.Length()<<1);
 	TInt r = SendReceive(EFsMountFileSystem,TIpcArgs(&aFileSystemName,aDrive,&aExtensionName,EFalse));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem3Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEM3RETURN, "r %d", r);
 	return r;
 	}
 
@@ -528,10 +511,11 @@
 @see RFs::FileSystemName
 */
 	{
-	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem4, MODULEUID, Handle(), aFileSystemName, aExtensionName, aDrive, aIsSync);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEM4, "sess %x aDrive %d aIsSync %d", (TUint) Handle(), (TUint) aDrive, (TUint) aIsSync);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEM4_EFILESYSTEMNAME, "FileSystemName %S", aFileSystemName.Ptr(), aFileSystemName.Length()<<1);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEM4_EEXTENSIONNAME, "ExtensionName %S", aExtensionName.Ptr(), aExtensionName.Length()<<1);
 	TInt r = SendReceive(EFsMountFileSystem,TIpcArgs(&aFileSystemName,aDrive,&aExtensionName,aIsSync));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem4Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEM4RETURN, "r %d", r);
 	return r;
 	}
 
@@ -560,12 +544,12 @@
 @see RFs::FileSystemName
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystemAndScan1, MODULEUID, Handle(), aFileSystemName, aDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEMANDSCAN1, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEMANDSCAN1_EFILESYSTEMNAME, "FileSystemName %S", aFileSystemName.Ptr(), aFileSystemName.Length()<<1);
 	aIsMountSuccess=EFalse;
 	TPckg<TInt> pckg(aIsMountSuccess);
 	TInt r = SendReceive(EFsMountFileSystemScan,TIpcArgs(&aFileSystemName,aDrive,NULL,&pckg));
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystemAndScan1Return, MODULEUID, r, aIsMountSuccess);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEMANDSCAN1RETURN, "r %d aIsMountSuccess %d", (TUint) r, (TUint) aIsMountSuccess);
 	return r;
 	}
 
@@ -598,14 +582,13 @@
 @see RFs::FileSystemName
 */
 	{
-	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystemAndScan2, MODULEUID, 
-		Handle(), aFileSystemName, aExtensionName, aDrive, aIsMountSuccess);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEMANDSCAN2, "sess %x aDrive %d aIsMountSuccess %d", (TUint) Handle(), (TUint) aDrive, (TUint) aIsMountSuccess);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEMANDSCAN2_EFILESYSTEMNAME, "FileSystemName %S", aFileSystemName.Ptr(), aFileSystemName.Length()<<1);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEMANDSCAN2_EEXTENSIONNAME, "ExtensionName %S", aExtensionName.Ptr(), aExtensionName.Length()<<1);
 	aIsMountSuccess=EFalse;
 	TPckg<TInt> pckg(aIsMountSuccess);
 	TInt r = SendReceive(EFsMountFileSystemScan,TIpcArgs(&aFileSystemName,aDrive,&aExtensionName,&pckg));
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystemAndScan2Return, MODULEUID, r, aIsMountSuccess);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSMOUNTFILESYSTEMANDSCAN2RETURN, "r %d aIsMountSuccess %d", (TUint) r, (TUint) aIsMountSuccess);
 	return r;
 	}
 
@@ -632,10 +615,10 @@
 @see RFs::FileSystemName 		
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsDismountFileSystem, MODULEUID, Handle(), aFileSystemName, aDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSDISMOUNTFILESYSTEM, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSDISMOUNTFILESYSTEM_EFILESYSTEMNAME, "FileSystemName %S", aFileSystemName.Ptr(), aFileSystemName.Length()<<1);
 	TInt r = SendReceive(EFsDismountFileSystem,TIpcArgs(&aFileSystemName,aDrive));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDismountFileSystemReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSDISMOUNTFILESYSTEMRETURN, "r %d", r);
 	return r;
 	}
 
@@ -661,12 +644,11 @@
 */
 EFSRV_EXPORT_C TInt RFs::FileSystemName(TDes& aName,TInt aDrive) const
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemName, MODULEUID, Handle(), aDrive);
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSFILESYSTEMNAME, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
 	//-- ipc argument "-1" here is to indicate legacy FileSystemName() API
     TInt r = SendReceive(EFsFileSystemName,TIpcArgs(&aName, aDrive, -1)); 
-
-	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemNameReturn, MODULEUID, r, aName);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSFILESYSTEMNAME_EFILESYSTEMNAME, "FileSystemName %S", aName.Ptr(), aName.Length()<<1);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSFILESYSTEMNAMERETURN, "r %d", r);
 	return r;
 	}
 
@@ -701,12 +683,11 @@
     {
 	if(aFsEnumerator < 0)
         return KErrArgument; //-- see RFs::FileSystemName(). "-1" is a reserved value
-
-    TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemName, MODULEUID, Handle(), aDrive);
+    OstTraceExt2(TRACE_BORDER, EFSRV_EFSSUPPORTEDFILESYSTEMNAME, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
     
     TInt r = SendReceive(EFsFileSystemName,TIpcArgs(&aName, aDrive, aFsEnumerator));
-
-	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemNameReturn, MODULEUID, r, aName);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSFILESYSTEMNAME_ESUPPORTEDFILESYSTEMNAME, "SupportedFileSystemName %S", aName.Ptr(), aName.Length()<<1);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSUPPORTEDFILESYSTEMNAMERETURN, "r %d", r);
 	return r;
     }
 
@@ -723,7 +704,8 @@
 @return KErrNone, if successful; otherwise one of the other system wide error codes.
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsAddExtension, MODULEUID, Handle(), aFileName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSADDEXTENSION, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSADDEXTENSION_EEXTENSIONNAME, "ExtensionName %S", aFileName.Ptr(), aFileName.Length()<<1);
 	RLoader loader;
 	TInt r = loader.Connect();
 	if (r==KErrNone)
@@ -731,8 +713,7 @@
 		r = loader.SendReceive(ELoadFSExtension, TIpcArgs(0, &aFileName, 0));
 		loader.Close();
 		}
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsAddExtensionReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSADDEXTENSIONRETURN, "r %d", r);
 	return r;
 	}
 
@@ -756,10 +737,10 @@
 @see RFs::ExtensionName
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsMountExtension, MODULEUID, Handle(), aExtensionName, aDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSMOUNTEXTENSION, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSMOUNTEXTENSION_EEXTENSIONNAME, "ExtensionName %S", aExtensionName.Ptr(), aExtensionName.Length()<<1);
 	TInt r = SendReceive(EFsMountExtension,TIpcArgs(&aExtensionName,aDrive));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountExtensionReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSMOUNTEXTENSIONRETURN, "r %d", r);
 	return r;
 	}
 
@@ -780,10 +761,10 @@
 */
 EFSRV_EXPORT_C TInt RFs::DismountExtension(const TDesC& aExtensionName,TInt aDrive)
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsDismountExtension, MODULEUID, Handle(), aExtensionName, aDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSDISMOUNTEXTENSION, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSDISMOUNTEXTENSION_EEXTENSIONNAME, "ExtensionName %S", aExtensionName.Ptr(), aExtensionName.Length()<<1);
 	TInt r = SendReceive(EFsDismountExtension,TIpcArgs(&aExtensionName,aDrive));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDismountExtensionReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSDISMOUNTEXTENSIONRETURN, "r %d", r);
 	return r;
 	}
 
@@ -800,10 +781,10 @@
         otrherwise one of the other system-wide error codes.
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRemoveExtension, MODULEUID, Handle(), aExtensionName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSREMOVEEXTENSION, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSREMOVEEXTENSION_EEXTENSIONNAME, "ExtensionName %S", aExtensionName.Ptr(), aExtensionName.Length()<<1);
 	TInt r = SendReceive(EFsRemoveExtension,TIpcArgs(&aExtensionName));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRemoveExtensionReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSREMOVEEXTENSIONRETURN, "r %d", r);
 	return r;
 	}
 
@@ -823,10 +804,10 @@
         KErrNotFound if the extension name is not found;
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsExtensionName, MODULEUID, Handle(), aExtensionName, aDrive, aPos);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSEXTENSIONNAME, "sess %x aDrive %d aPos %x", (TUint) Handle(), (TUint) aDrive, (TUint) aPos);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSEXTENSIONNAME_EEXTENSIONNAME, "ExtensionName %S", aExtensionName.Ptr(), aExtensionName.Length()<<1);
 	TInt r = SendReceive(EFsExtensionName,TIpcArgs(&aExtensionName,aDrive,aPos));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsExtensionNameReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSEXTENSIONNAMERETURN, "r %d", r);
 	return r;
 	}
 
@@ -850,10 +831,9 @@
         the other system wide error codes.
 */
 	{
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFsRemountDrive, MODULEUID, Handle(), aDrive, aMountInfo, aFlags);
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFSREMOUNTDRIVE, "sess %x aDrive %d aMountInfo %x aFlags %x", (TUint) Handle(), aDrive, (TUint) aMountInfo, (TUint) aFlags);
 	TInt r = SendReceive(EFsRemountDrive,TIpcArgs(aDrive,aMountInfo,aFlags));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRemountDriveReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSREMOUNTDRIVERETURN, "r %d", r);
 	return r;
 	}
 
@@ -899,7 +879,7 @@
 
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChange1, MODULEUID, Handle(), aType, &aStat);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSNOTIFYCHANGE1, "sess %x aType %x status %x", (TUint) Handle(), (TUint) aType, (TUint) &aStat);
 	aStat=KRequestPending;
 	// for backward compatibility
 	TNotifyType type = (aType == 0 ? ENotifyEntry : aType);
@@ -907,7 +887,7 @@
 	//This call is to synchronise with the file server when this functions stack varibles can go out of scope
 	SendReceive(EFsSynchroniseDriveThread, TIpcArgs(-1));		
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChange1Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSNOTIFYCHANGE1RETURN, "");
 	}
 
 
@@ -966,7 +946,8 @@
 
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChange2, MODULEUID, Handle(), (TUint) aType, (TUint) &aStat, aPathName);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSNOTIFYCHANGE2, "sess %x aType %x status %x", (TUint) Handle(), (TUint) aType, (TUint) &aStat);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSNOTIFYCHANGE2_EDIRNAME, "Dir %S", aPathName.Ptr(), aPathName.Length()<<1);
 	aStat=KRequestPending;
 	// for backward compatibility
 	TNotifyType type = (aType == 0 ? ENotifyEntry : aType);
@@ -974,7 +955,7 @@
 	//This call is to synchronise with the file server when this functions stack varibles can go out of scope
 	SendReceive(EFsSynchroniseDriveThread, TIpcArgs(-1));
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChange2Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSNOTIFYCHANGE2RETURN, "");
 	}
 
 
@@ -991,10 +972,10 @@
 
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChangeCancel1, MODULEUID, Handle());
+	OstTrace1(TRACE_BORDER, EFSRV_EFSNOTIFYCHANGECANCEL1, "sess %x", Handle());
 	RSessionBase::SendReceive(EFsNotifyChangeCancel);
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChangeCancel1Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSNOTIFYCHANGECANCEL1RETURN, "");
 	}
 
 
@@ -1015,11 +996,11 @@
 
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChangeCancel2, MODULEUID, Handle(), &aStat);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSNOTIFYCHANGECANCEL2, "sess %x status %x", (TUint) Handle(), (TUint) &aStat);
 	if (aStat==KRequestPending)			//	May be better to ASSERT this?
 		SendReceive(EFsNotifyChangeCancelEx,TIpcArgs(&aStat));
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChangeCancel2Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSNOTIFYCHANGECANCEL2RETURN, "");
 	}
 
 
@@ -1070,8 +1051,8 @@
 @see TDriveNumber
 */
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpace, MODULEUID, 
-		Handle(), I64LOW(aThreshold),I64HIGH(aThreshold), aDrive,(TUint) &aStat);
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFSNOTIFYDISKSPACE, "sess %x aThreshold %x:%x aDrive %d status %x", (TUint) Handle(), (TUint) I64HIGH(aThreshold), (TUint) I64LOW(aThreshold), (TUint) aDrive, (TUint) &aStat);
+		
 	aStat=KRequestPending;
 	TPtrC8 tBuf((TUint8*)&aThreshold,sizeof(TInt64));
 	RSessionBase::SendReceive(EFsNotifyDiskSpace,TIpcArgs(&tBuf,aDrive,&aStat), aStat);
@@ -1081,7 +1062,7 @@
 	SendReceive(EFsSynchroniseDriveThread, TIpcArgs(aDrive));
 
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpaceReturn, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSNOTIFYDISKSPACERETURN, "");
 	}
 
 
@@ -1098,12 +1079,12 @@
 			 notification request.
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpaceCancel1, MODULEUID, Handle(), &aStat);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSNOTIFYDISKSPACECANCEL1, "sess %x status %x", (TUint) Handle(), (TUint) &aStat);
 	
 	if(aStat==KRequestPending)
 		SendReceive(EFsNotifyDiskSpaceCancel,TIpcArgs(&aStat));
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpaceCancel1Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSNOTIFYDISKSPACECANCEL1RETURN, "");
 	}
 
 
@@ -1117,10 +1098,10 @@
 Outstanding requests complete with KErrCancel.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpaceCancel2, MODULEUID, Handle());
+	OstTrace1(TRACE_BORDER, EFSRV_EFSNOTIFYDISKSPACECANCEL2, "sess %x", Handle());
 	SendReceive(EFsNotifyDiskSpaceCancel,TIpcArgs(NULL));
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpaceCancel2Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSNOTIFYDISKSPACECANCEL2RETURN, "");
 	}
 
 
@@ -1146,10 +1127,9 @@
 @return KErrNone, successful, otherwise one of the other system-wide error codes.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsDriveList1, MODULEUID, Handle());
+	OstTrace1(TRACE_BORDER, EFSRV_EFSDRIVELIST1, "sess %x", Handle());
 	TInt r = SendReceive(EFsDriveList,TIpcArgs(&aList, KDriveAttExclude|KDriveAttRemote|KDriveAttHidden));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDriveList1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSDRIVELIST1RETURN, "r %d", r);
 	return r;
 	}
 
@@ -1180,10 +1160,9 @@
 		KErrArgument, If aFlags contains an invalid attribute combination.
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsDriveList2, MODULEUID, Handle(), aFlags);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSDRIVELIST2, "sess %x aFlags %x", (TUint) Handle(), (TUint) aFlags);
 	TInt r = SendReceive(EFsDriveList,TIpcArgs(&aList,aFlags));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDriveList2Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSDRIVELIST2RETURN, "r %d", r);
 	return r;
 	}
 
@@ -1213,12 +1192,10 @@
 @see RFs::Volume
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsDrive, MODULEUID, Handle(), aDrive);
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSDRIVE, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
 	TPckg<TDriveInfo> m(anInfo);
 	TInt r = SendReceive(EFsDrive,TIpcArgs(&m,aDrive));
-
-	TRACERET4(UTF::EBorder, UTraceModuleEfsrv::EFsDriveReturn, MODULEUID, r, anInfo.iDriveAtt, anInfo.iMediaAtt, anInfo.iType);
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFSDRIVERETURN, "r %d driveAtt %x mediaAtt %x type %x", r, (TUint) anInfo.iDriveAtt, (TUint) anInfo.iMediaAtt, (TUint) anInfo.iType);
 	return r;
 	}
 
@@ -1250,13 +1227,11 @@
 @see RFs::Drive
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsVolume1, MODULEUID, Handle(), aDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSVOLUME1, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
 	TPckg<TVolumeInfo> v(aVol);
     TInt r = SendReceive(EFsVolume,TIpcArgs(&v,aDrive,NULL));
-
-	TRACE7(UTF::EBorder, UTraceModuleEfsrv::EFsVolume1Return, MODULEUID, 
-		r, aVol.iUniqueID, I64LOW(aVol.iSize), I64HIGH(aVol.iSize),
-		I64LOW(aVol.iFree), I64HIGH(aVol.iFree), aVol.iFileCacheFlags);
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFSVOLUME1RETURNA, "r %d iSize %x:%x iFree %x:%x", (TUint) r, (TUint) I64HIGH(aVol.iSize), (TUint) I64LOW(aVol.iSize), (TUint) I64HIGH(aVol.iFree), (TUint) I64LOW(aVol.iFree));
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSVOLUME1RETURNB, "iUniqueID %x iFileCacheFlags %x", (TUint) aVol.iUniqueID, (TUint) aVol.iFileCacheFlags);
 	return r;
 	}
 
@@ -1279,12 +1254,12 @@
 */
 EFSRV_EXPORT_C void RFs::Volume(TVolumeInfo& aVol,TInt aDrive, TRequestStatus& aStat) const
     {
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsVolume2, MODULEUID, Handle(), aDrive, &aStat);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSVOLUME2, "sess %x aDrive %d status %x", (TUint) Handle(), (TUint) aDrive, (TUint) &aStat);
 	TPckg<TVolumeInfo> v(aVol);
     aStat=KRequestPending;
     RSessionBase::SendReceive(EFsVolume,TIpcArgs(&v,aDrive,&aStat), aStat);
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsVolume2Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSVOLUME2RETURN, "");
     }
 
 
@@ -1314,12 +1289,11 @@
 @see RFs::Volume
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsSetVolumeLabel, MODULEUID, 
-		Handle(), aName, aDrive);
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSSETVOLUMELABEL, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
+		
+	OstTraceData(TRACE_BORDER, EFSRV_EFSSETVOLUMELABEL_EVOLUMENAME, "VolumeName %S", aName.Ptr(), aName.Length()<<1);
 	TInt r = SendReceive(EFsSetVolume,TIpcArgs(&aName,aDrive));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetVolumeLabelReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSETVOLUMELABELRETURN, "r %d", r);
 	return r;
 	}
 
@@ -1350,10 +1324,10 @@
 @see RFs::Drive
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsSubst, MODULEUID, Handle(), aPath, aDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSSUBST, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSSUBST_EDIRNAME, "Dir %S", aPath.Ptr(), aPath.Length()<<1);
 	TInt r = SendReceive(EFsSubst,TIpcArgs(&aPath,aDrive));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSubstReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSUBSTRETURN, "r %d", r);
 	return r;
 	}
 
@@ -1402,10 +1376,10 @@
 @capability Dependent If aPath is /Resource then Tcb capability is required.
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsSetSubst, MODULEUID, Handle(), aPath, aDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSSETSUBST, "sess %x aPath %d", (TUint) Handle(), (TUint) aDrive);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSSETSUBST_EDIRNAME, "Dir %S", aPath.Ptr(), aPath.Length()<<1);
 	TInt r = SendReceive(EFsSetSubst,TIpcArgs(&aPath,aDrive));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetSubstReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSETSUBSTRETURN, "r %d", r);
 	return r;
 	}
 
@@ -1433,10 +1407,11 @@
 
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRealName, MODULEUID, Handle(), aName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSREALNAME, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSREALNAME_EFILENAME1, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	TInt r = SendReceive(EFsRealName,TIpcArgs(&aName,&aResult));
-
-	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRealNameReturn, MODULEUID, r, aResult);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSREALNAME_EFILENAME2, "FileName %S", aResult.Ptr(), aResult.Length()<<1);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSREALNAMERETURN, "r %d", r);
 	return r;
 	}
 
@@ -1460,10 +1435,10 @@
 */
 EFSRV_EXPORT_C TInt RFs::GetMediaSerialNumber(TMediaSerialNumber& aSerialNum, TInt aDrive)
     {
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsGetMediaSerialNumber, MODULEUID, Handle(), aDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSGETMEDIASERIALNUMBER, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
     TInt r = SendReceive(EFsGetMediaSerialNumber, TIpcArgs(&aSerialNum, aDrive));
-
-	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetMediaSerialNumberReturn, MODULEUID, r, aSerialNum);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSGETMEDIASERIALNUMBERRETURN, "r %d", r);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSGETMEDIASERIALNUMBER_ESERIALNUMBER, "SerialNum %x", aSerialNum.Ptr(), aSerialNum.Length());
 	return r;
     }
 
@@ -1485,10 +1460,10 @@
         system-wide error codes.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsSessionPath, MODULEUID, Handle());
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSESSIONPATH, "sess %x", Handle());
 	TInt r = SendReceive(EFsSessionPath,TIpcArgs(&aPath));
-
-	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsSessionPathReturn, MODULEUID, r, aPath);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSESSIONPATHRETURN, "r %d", r);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSSESSIONPATH_EDIRNAME, "Dir %S", aPath.Ptr(), aPath.Length()<<1);
 	return r;
 	}
 
@@ -1526,10 +1501,10 @@
 
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsSetSessionPath, MODULEUID, Handle(), aPath);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSETSESSIONPATH, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSSETSESSIONPATH_EDIRNAME, "Dir %S", aPath.Ptr(), aPath.Length()<<1);
 	TInt r = SendReceive(EFsSetSessionPath,TIpcArgs(&aPath));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetSessionPathReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSETSESSIONPATHRETURN, "r %d", r);
 	return r;
 	}
 
@@ -1603,10 +1578,10 @@
 */
 EFSRV_EXPORT_C TInt RFs::MkDir(const TDesC& aPath)
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsMkDir, MODULEUID, Handle(), aPath);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSMKDIR, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSMKDIR_EDIRNAME, "Dir %S", aPath.Ptr(), aPath.Length()<<1);
 	TInt r = SendReceive(EFsMkDir,TIpcArgs(&aPath,NULL));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMkDirReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSMKDIRRETURN, "r %d", r);
 	return r;
 	}
 
@@ -1653,10 +1628,10 @@
 */
 EFSRV_EXPORT_C TInt RFs::MkDirAll(const TDesC& aPath)
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsMkDirAll, MODULEUID, Handle(), aPath);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSMKDIRALL, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSMKDIRALL_EDIRNAME, "Dir %S", aPath.Ptr(), aPath.Length()<<1);
 	TInt r = SendReceive(EFsMkDir,TIpcArgs(&aPath,TRUE));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMkDirAllReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSMKDIRALLRETURN, "r %d", r);
 	return r;
 	}
 
@@ -1707,10 +1682,10 @@
 @see CFileMan
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRmDir, MODULEUID, Handle(), aPath);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSRMDIR, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSRMDIR_EDIRNAME, "Dir %S", aPath.Ptr(), aPath.Length()<<1);
 	TInt r = SendReceive(EFsRmDir,TIpcArgs(&aPath));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRmDirReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSRMDIRRETURN, "r %d", r);
 	return r;
 	}
 
@@ -1825,9 +1800,8 @@
 @see TEntryKey
 */
 	{
-	TRACEMULT6(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir1, MODULEUID, 
-		Handle(), aName, aUidType[0].iUid, aUidType[1].iUid, aUidType[2].iUid, aKey);
-
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFSGETDIR1, "sess %x aUidType0 %x aUidType1 %x aUidType2 %x aKey %x", (TUint) Handle(), (TUint) aUidType[0].iUid, (TUint) aUidType[1].iUid, (TUint) aUidType[2].iUid, (TUint) aKey);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSGETDIR1_EDIRNAME, "Dir %S", aName.Ptr(), aName.Length()<<1);
 	RDir d;
 	TRAPD(r,GetDirL(aName,aUidType,aKey,aFileList,d))
 	d.Close();
@@ -1836,8 +1810,7 @@
 		delete aFileList;
 		aFileList=NULL;
 		}
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSGETDIR1RETURN, "r %d", r);
 	return r;
 	}
 
@@ -1883,8 +1856,8 @@
 @see TEntryKey
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir2, MODULEUID, Handle(), aName, anAttMask, aKey);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSGETDIR2, "sess %x anAttMask %x aKey %x", (TUint) Handle(), (TUint) anAttMask, (TUint) aKey);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSGETDIR2_EDIRNAME, "Dir %S", aName.Ptr(), aName.Length()<<1);
 	RDir d;
 	if ((aKey&0xff)==ESortByUid)
 		anAttMask|=KEntryAttAllowUid;
@@ -1895,8 +1868,7 @@
 		delete aFileList;
 		aFileList=NULL;
 		}
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir2Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSGETDIR2RETURN, "r %d", r);
 	return r;
 	}
 
@@ -1949,8 +1921,8 @@
 @see TEntryKey
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir3, MODULEUID, Handle(), aName, anAttMask, aKey);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSGETDIR3, "sess %x anAttMask %x aKey %x", (TUint) Handle(), (TUint) anAttMask, (TUint) aKey);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSGETDIR3_EDIRNAME, "Dir %S", aName.Ptr(), aName.Length()<<1);
 	RDir d;
 	if (aKey&ESortByUid)
 		anAttMask|=KEntryAttAllowUid;
@@ -1963,8 +1935,7 @@
 		delete aDirList;
 		aDirList=NULL;
 		}
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir3Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSGETDIR3RETURN, "r %d", r);
 	return r;
 	}
 
@@ -2011,13 +1982,13 @@
         system-wide error codes.
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsParse1, MODULEUID, Handle(), aName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSPARSE1, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSPARSE1_EFILEPATH, "FilePath %S", aName.Ptr(), aName.Length()<<1);
 	TFileName session_path;
 	TInt r = SessionPath(session_path);
 	if (r==KErrNone)
 		r = aParse.Set(aName, NULL, &session_path);
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsParse1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSPARSE1RETURN, "r %d", r);
 	return r;
 	}
 
@@ -2066,13 +2037,14 @@
         system-wide error codes.
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsParse2, MODULEUID, Handle(), aName, aRelated);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSPARSE2, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSPARSE2_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSPARSE2_ERELATED, "Related %S", aRelated.Ptr(), aRelated.Length()<<1);
 	TFileName session_path;
 	TInt r = SessionPath(session_path);
 	if (r==KErrNone)
 		r = aParse.Set(aName, &aRelated, &session_path);
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsParse2Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSPARSE2RETURN, "r %d", r);
 	return r;
 	}
 
@@ -2105,10 +2077,10 @@
 @see CFileMan        
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsDelete, MODULEUID, Handle(), aName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSDELETE, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSDELETE_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	TInt r = SendReceive(EFsDelete,TIpcArgs(&aName));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDeleteReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSDELETERETURN, "r %d", r);
 	return r;
 	}
 
@@ -2167,15 +2139,15 @@
 @see CFileMan        
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsRename, MODULEUID, Handle(), anOldName, aNewName);
-
+	OstTrace1(TRACE_BORDER, EFSRV_EFSRENAME, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSRENAME_EOLDNAME, "OldName %S", anOldName.Ptr(), anOldName.Length()<<1);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSRENAME_ENEWNAME, "NewName %S", aNewName.Ptr(), aNewName.Length()<<1);
 	TInt r;
 	if (anOldName.Length() <= 0 || aNewName.Length() <= 0 )
 		r = KErrBadName;
 	else
 		r = SendReceive(EFsRename,TIpcArgs(&anOldName,&aNewName));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRenameReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSRENAMERETURN, "r %d", r);
 	return r;
 	}
 
@@ -2226,10 +2198,11 @@
 
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsReplace, MODULEUID, Handle(), anOldName, aNewName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSREPLACE, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSREPLACE_EOLDNAME, "OldName %S", anOldName.Ptr(), anOldName.Length()<<1);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSREPLACE_ENEWNAME, "NewName %S", aNewName.Ptr(), aNewName.Length()<<1);
 	TInt r = SendReceive(EFsReplace,TIpcArgs(&anOldName,&aNewName));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReplaceReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSREPLACERETURN, "r %d", r);
 	return r;
 	}
 
@@ -2256,14 +2229,13 @@
 @see KEntryAttNormal
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsAtt, MODULEUID, Handle(), aName);
-
+	OstTrace1(TRACE_BORDER, EFSRV_EFSATT, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSATT_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	TEntry e;
 	TInt r=Entry(aName,e);
 	if (r==KErrNone)
 		aVal=e.iAtt;
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFsAttReturn, MODULEUID, r, aVal);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSATTRETURN, "r %d aVal %x", (TUint) r, (TUint) aVal);
 	return r;
 	}
 
@@ -2303,12 +2275,10 @@
 
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsSetAtt, MODULEUID, 
-		Handle(), aName, aSetAttMask, aClearAttMask);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSSETATT, "sess %x aSetAttMask %x aClearAttMask %x", (TUint) Handle(), (TUint) aSetAttMask, (TUint) aClearAttMask);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSSETATT_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
  	TInt r = SetEntry(aName,TTime(0),aSetAttMask,aClearAttMask);
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetAttReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSETATTRETURN, "r %d", r);
 	return r;
 	}
 
@@ -2336,14 +2306,13 @@
 
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsModified, MODULEUID, Handle(), aName);
-
+	OstTrace1(TRACE_BORDER, EFSRV_EFSMODIFIED, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSMODIFIED_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	TEntry e;
 	TInt r=Entry(aName,e);
 	if (r==KErrNone)
 		aTime=e.iModified;
-
-	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFsModifiedReturn, MODULEUID, r, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()));
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSMODIFIEDRETURN, "r %d aTime %x:%x ", (TUint) r, (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()));
 	return r;
 	}
 
@@ -2370,11 +2339,10 @@
 
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsSetModified, MODULEUID, Handle(), aName, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()) );
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSSETMODIFIED, "sess %x aTime %x:%x ", (TUint) Handle(), (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()) );
+	OstTraceData(TRACE_BORDER, EFSRV_EFSSETMODIFIED_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	TInt r = SetEntry(aName,aTime,KEntryAttModified,0);
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetModifiedReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSETMODIFIEDRETURN, "r %d", r);
 	return r;
 	}
 
@@ -2403,14 +2371,11 @@
 					  readable with AllFiles capability or if <n> matches the process' SID.
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsEntry, MODULEUID, Handle(), aName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSENTRY, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSENTRY_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	TPckg<TEntry> e(anEntry);
 	TInt r = SendReceive(EFsEntry,TIpcArgs(&aName,&e));
-
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFsEntryReturn, MODULEUID, 
-		r, anEntry.iAtt, 
-		I64LOW(anEntry.iModified.Int64()), I64HIGH(anEntry.iModified.Int64()), 
-		anEntry.iSize);
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFSENTRYRETURN, "r %d att %x modified %x:%x  size %d", (TUint) r, (TUint) anEntry.iAtt, (TUint) I64HIGH(anEntry.iModified.Int64()), (TUint) I64LOW(anEntry.iModified.Int64()), (TUint) anEntry.iSize);
 	return r;
 	}
 
@@ -2450,16 +2415,12 @@
 @see KEntryAttVolume
 */
 	{
-	TRACEMULT6(UTF::EBorder, UTraceModuleEfsrv::EFsSetEntry, MODULEUID, 
-		Handle(), aName, 
-		I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()), 
-		aSetAttMask, aClearAttMask);
-
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFSSETENTRY, "sess %x aTime %x:%x  aSetAttMask %x aClearAttMask %x", (TUint) Handle(), (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()), (TUint) aSetAttMask, (TUint) aClearAttMask);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSSETENTRY_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	__ASSERT_ALWAYS((aSetAttMask&aClearAttMask)==0,Panic(EAttributesIllegal));
 	TPtrC8 timeBuf((TUint8*)&aTime,sizeof(TTime));
 	TInt r = SendReceive(EFsSetEntry,TIpcArgs(&aName,&timeBuf,aSetAttMask,aClearAttMask));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetEntryReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSETENTRYRETURN, "r %d", r);
 	return r;
 	}
 
@@ -2496,15 +2457,14 @@
 */
 EFSRV_EXPORT_C TInt RFs::ReadFileSection(const TDesC& aName,TInt64 aPos,TDes8& aDes,TInt aLength) const
 	{
-	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSection, MODULEUID, 
-		Handle(), aName, I64LOW(aPos), I64HIGH(aPos), aLength);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFSREADFILESECTION, "sess %x aPos %x:%x aLength %d", (TUint) Handle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), aLength);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSREADFILESECTION_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	
 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
 	if(aPos > KMaxTInt)
 		{
-		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSectionReturn, MODULEUID, KErrTooBig);
+		OstTrace1(TRACE_BORDER, EFSRV_EFSREADFILESECTIONRETURN1, "r %d", KErrTooBig);
 		return KErrTooBig;
 		}
 	if((aPos + aLength) > KMaxTInt)
@@ -2517,7 +2477,7 @@
 	else
 		{
 		aDes.Zero();
-		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSectionReturn, MODULEUID, KErrNone);
+		OstTrace1(TRACE_BORDER, EFSRV_EFSREADFILESECTIONRETURN2, "r %d", KErrNone);
 		return(KErrNone);
 		}
 		
@@ -2533,19 +2493,17 @@
 		TPckgC<TInt64> pkPos(aPos);
 		r = SendReceive(EFsReadFileSection|KIpcArgSlot2Desc,TIpcArgs(&aDes,&aName,&pkPos,aLength));
 		}
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSectionReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSREADFILESECTIONRETURN3, "r %d", r);
 	return r;
 	}
 /**
 Maintained for BC
-
 @internalTechnology
 */
 EFSRV_EXPORT_C TInt RFs::ReadFileSection_RESERVED(const TDesC& aName,TInt aPos,TDes8& aDes,TInt aLength) const
 	{
-	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSection, MODULEUID, 
-		Handle(), aName, aPos, 0, aLength);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSREADFILESECTION_RESERVED, "sess %x aPos %x aLength %d", (TUint) Handle(), (TUint) aPos, aLength);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSREADFILESECTION_RESERVED_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	
 	if (aLength)	//	Number of characters to read
@@ -2555,15 +2513,14 @@
 	else
 		{
 		aDes.Zero();
-		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSectionReturn, MODULEUID, KErrNone);
+		OstTrace1(TRACE_BORDER, EFSRV_EFSREADFILESECTION_RESERVED_RETURN1, "r %d", KErrNone);
 		return(KErrNone);
 		}
 		
 	__ASSERT_ALWAYS(aDes.MaxLength()>=aLength,Panic(EBadLength));
 		
 	TInt r = SendReceive(EFsReadFileSection,TIpcArgs(&aDes,&aName,aPos,aLength));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSectionReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSREADFILESECTION_RESERVED_RETURN2, "r %d", r);
 	return r;
 	}
 
@@ -2578,11 +2535,11 @@
 to the file server, and before any resources are opened.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountMarkStart, MODULEUID, Handle());
+	OstTrace1(TRACE_BORDER, EFSRV_EFSRESOURCECOUNTMARKSTART, "sess %x", Handle());
 	
 	RSessionBase::SendReceive(EFsResourceCountMarkStart);
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountMarkStartReturn, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSRESOURCECOUNTMARKSTARTRETURN, "");
 	}
 
 
@@ -2597,11 +2554,10 @@
        count checking is not equal to the number of resources closed.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountMarkEnd, MODULEUID, Handle());
-
+	OstTrace1(TRACE_BORDER, EFSRV_EFSRESOURCECOUNTMARKEND, "sess %x", Handle());
 	RSessionBase::SendReceive(EFsResourceCountMarkEnd);
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountMarkEndReturn, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSRESOURCECOUNTMARKENDRETURN, "");
 	}
 
 
@@ -2618,14 +2574,12 @@
 @return The number of resources currently open.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCount, MODULEUID, Handle());
-
+	OstTrace1(TRACE_BORDER, EFSRV_EFSRESOURCECOUNT, "sess %x", Handle());
 	TInt count;
 	TPckg<TInt> pckg(count);
 	SendReceive(EFsResourceCount,TIpcArgs(&pckg));
 	TInt r = *(TInt*)pckg.Ptr();
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSRESOURCECOUNTRETURN, "r %d", r);
 	return r;
 	}
 
@@ -2664,10 +2618,10 @@
 */
 EFSRV_EXPORT_C TInt RFs::CheckDisk(const TDesC& aDrive) const
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsCheckDisk, MODULEUID, Handle(), aDrive);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSCHECKDISK, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSCHECKDISK_EDIRNAME, "Dir %S", aDrive.Ptr(), aDrive.Length()<<1);
 	TInt r = SendReceive(EFsCheckDisk,TIpcArgs(&aDrive));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsCheckDiskReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSCHECKDISKRETURN, "r %d", r);
 	return r;
 	}
 
@@ -2714,10 +2668,10 @@
 Therefore, do not treat ScanDrive on removable media as a generic "disk repair utility".
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsScanDrive, MODULEUID, Handle(), aDrive);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSCANDRIVE, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSSCANDRIVE_EDIRNAME, "Dir %S", aDrive.Ptr(), aDrive.Length()<<1);
 	TInt r = SendReceive(EFsScanDrive,TIpcArgs(&aDrive));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsScanDriveReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSCANDRIVERETURN, "r %d", r);
 	return r;
 	}
 
@@ -2746,10 +2700,11 @@
 					  have the relevant SID capability AllFiles is required
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetShortName, MODULEUID, Handle(), aLongName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSGETSHORTNAME, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSGETSHORTNAME_ELONGNAME, "LongName %S", aLongName.Ptr(), aLongName.Length()<<1);
 	TInt r = SendReceive(EFsGetShortName,TIpcArgs(&aLongName,&aShortName));
-
-	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetShortNameReturn, MODULEUID, r, aShortName);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSGETSHORTNAME_ESHORTNAME, "ShortName %S", aShortName.Ptr(), aShortName.Length()<<1);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSGETSHORTNAMERETURN, "r %d", r);
 	return r;
 	}
 
@@ -2778,10 +2733,11 @@
 
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetLongName, MODULEUID, Handle(), aShortName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSGETLONGNAME, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSGETLONGNAME_ESHORTNAME, "ShortName %S", aShortName.Ptr(), aShortName.Length()<<1);
 	TInt r = SendReceive(EFsGetLongName,TIpcArgs(&aShortName,&aLongName));
-
-	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetLongNameReturn, MODULEUID, r, aLongName);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSGETLONGNAME_ELONGNAME, "LongName %S", aLongName.Ptr(), aLongName.Length()<<1);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSGETLONGNAMERETURN, "r %d", r);
 	return r;
 	}
 
@@ -2814,11 +2770,11 @@
 @see RFs::Replace
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsFileOpen, MODULEUID, Handle(), aFileName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSISFILEOPEN, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSISFILEOPEN_EFILENAME, "FileName %S", aFileName.Ptr(), aFileName.Length()<<1);
 	TPckg<TBool> b(anAnswer);
 	TInt r = SendReceive(EFsIsFileOpen,TIpcArgs(&aFileName,&b));
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFsIsFileOpenReturn, MODULEUID, r, anAnswer);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSISFILEOPENRETURN, "r %d anAnswer %d", (TUint) r, (TUint) anAnswer);
 	return r;
 	}
 
@@ -2850,14 +2806,12 @@
 @return True if notification in effect, false if not.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsGetNotifyUser, MODULEUID, Handle());
-
+	OstTrace1(TRACE_BORDER, EFSRV_EFSGETNOTIFYUSER, "sess %x", Handle());
 	TInt notifyUser;
 	TPckg<TInt> pckgNotify(notifyUser);
 	SendReceive(EFsGetNotifyUser,TIpcArgs(&pckgNotify));
 	TBool r = notifyUser;
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetNotifyUserReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSGETNOTIFYUSERRETURN, "r %d", r);
 	return r;
 	}
 
@@ -2874,10 +2828,10 @@
               EFalse, for no notification.
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsSetNotifyUser, MODULEUID, Handle(), aValue);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSSETNOTIFYUSER, "sess %x aValue %d", (TUint) Handle(), (TUint) aValue);
 	SendReceive(EFsSetNotifyUser,TIpcArgs(aValue));
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsSetNotifyUserReturn, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSSETNOTIFYUSERRETURN, "");
 	}
 
 
@@ -2907,8 +2861,8 @@
 
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsFileInRom, MODULEUID, Handle(), aFileName);
-
+	OstTrace1(TRACE_BORDER, EFSRV_EFSISFILEINROM, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSISFILEINROM_EFILENAME, "FileName %S", aFileName.Ptr(), aFileName.Length()<<1);
 	TPckgBuf<TUint8*> start;
 
 	TUint8* r;
@@ -2917,7 +2871,7 @@
 	else
 		r = start();
 
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsIsFileInRomReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSISFILEINROMRETURN, "r %d", r);
 	return r;
 	}
 
@@ -2957,7 +2911,8 @@
 */
 EFSRV_EXPORT_C TBool RFs::IsValidName(const TDesC& aFileName) const
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName1, MODULEUID, Handle(), aFileName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSISVALIDNAME1, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSISVALIDNAME1_EFILENAME, "FileName %S", aFileName.Ptr(), aFileName.Length()<<1);
 	TBool returnInvalidChar=EFalse;
 	TPckg<TBool> bPckg(returnInvalidChar);
 	TBool b;
@@ -2965,7 +2920,7 @@
 		b = EFalse;
 	else
 		b = ETrue;
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName1Return, MODULEUID, b);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSISVALIDNAME1RETURN, "r %d", b);
 	return b;
 	}
 
@@ -3008,7 +2963,8 @@
 */
 EFSRV_EXPORT_C TBool RFs::IsValidName(const TDesC& aFileName,TText& aBadChar) const
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName2, MODULEUID, Handle(), aFileName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSISVALIDNAME2, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSISVALIDNAME2_EFILENAME, "FileName %S", aFileName.Ptr(), aFileName.Length()<<1);
 	TBool returnInvalidChar=ETrue;
 	TPckg<TBool> boolPckg(returnInvalidChar);
 	TPckg<TText> textPckg(aBadChar);
@@ -3017,7 +2973,7 @@
 		b = EFalse;
 	else 
 		b = ETrue;
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName2Return, MODULEUID, b, aBadChar);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSISVALIDNAME2RETURN, "r %d aBadChar %x", (TUint) b, (TUint) aBadChar);
 	return b;
 	}
 /**
@@ -3066,14 +3022,15 @@
 */
 EFSRV_EXPORT_C TBool RFs::IsValidName(const TDesC& aName, TNameValidParam& aParam )
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName3, MODULEUID, Handle(), aName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSISVALIDNAME3, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSISVALIDNAME3_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	TPckg<TNameValidParam> paramPckg(aParam);
 	TBool b;
 	if (SendReceive(EFsIsValidName,TIpcArgs(&aName,NULL,NULL,&paramPckg))!=KErrNone)
 		b = EFalse;
 	else
 		b = ETrue;
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName3Return, MODULEUID, b, aParam.ErrorCode());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSISVALIDNAME3RETURN, "r %d err %d", (TUint) b, (TUint) aParam.ErrorCode());
 	return b;
 	}
 
@@ -3099,10 +3056,10 @@
 @see TDriveNumber
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsGetDriveName, MODULEUID, Handle(), aDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSGETDRIVENAME, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
 	TInt r = SendReceive(EFsGetDriveName,TIpcArgs(aDrive,&aDriveName));
-
-	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetDriveNameReturn, MODULEUID, r, aDriveName);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSGETDRIVENAME_EDRIVENAME, "DriveName %S", aDriveName.Ptr(), aDriveName.Length()<<1);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSGETDRIVENAMERETURN, "r %d", r);
 	return r;
 	}
 
@@ -3130,10 +3087,10 @@
 
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsSetDriveName, MODULEUID, Handle(), aDrive, aDriveName);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSSETDRIVENAME, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSSETDRIVENAME_EDRIVENAME, "DriveName %S", aDriveName.Ptr(), aDriveName.Length()<<1);
 	TInt r = SendReceive(EFsSetDriveName,TIpcArgs(aDrive,&aDriveName));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetDriveNameReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSETDRIVENAMERETURN, "r %d", r);
 	return r;
 	}
 
@@ -3164,10 +3121,9 @@
 
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsLockDrive, MODULEUID, Handle(), aDrv, aStore);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSLOCKDRIVE, "sess %x aDrv %d aStore %d", (TUint) Handle(), (TUint) aDrv, (TUint) aStore);
 	TInt r = SendReceive(EFsLockDrive,TIpcArgs(aDrv,&aOld,&aNew,aStore));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsLockDriveReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSLOCKDRIVERETURN, "r %d", r);
 	return r;
 	}
 
@@ -3196,10 +3152,9 @@
 
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsUnlockDrive, MODULEUID, Handle(), aDrive, aStore);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSUNLOCKDRIVE, "sess %x aDrv %d aStore %d", (TUint) Handle(), (TUint) aDrive, (TUint) aStore);
 	TInt r = SendReceive(EFsUnlockDrive,TIpcArgs(aDrive,&aPassword,aStore));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsUnlockDriveReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSUNLOCKDRIVERETURN, "r %d", r);
 	return r;
 	}
 
@@ -3225,10 +3180,9 @@
 
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsClearPassword, MODULEUID, Handle(), aDrv);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSCLEARPASSWORD, "sess %x aDrv %d", (TUint) Handle(), (TUint) aDrv);
 	TInt r = SendReceive(EFsClearPassword,TIpcArgs(aDrv,&aPswd));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsClearPasswordReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSCLEARPASSWORDRETURN, "r %d", r);
 	return r;
 	}
 
@@ -3253,10 +3207,9 @@
 
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsErasePassword, MODULEUID, Handle(), aDrv);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSERASEPASSWORD, "sess %x aDrv %d", (TUint) Handle(), (TUint) aDrv);
 	TInt r = SendReceive(EFsErasePassword,TIpcArgs(aDrv));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsErasePasswordReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSERASEPASSWORDRETURN, "r %d", r);
 	return r;
 	}
 
@@ -3273,11 +3226,11 @@
 // Notify file server that startup initialisation has been completed
 //
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsStartupInitComplete, MODULEUID, Handle(), &aStat);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSSTARTUPINITCOMPLETE, "sess %x status %x", (TUint) Handle(), (TUint) &aStat);
 	aStat=KRequestPending;
 	RSessionBase::SendReceive(EFsStartupInitComplete,aStat);
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsStartupInitCompleteReturn, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSSTARTUPINITCOMPLETERETURN, "");
 	}
 
 
@@ -3288,11 +3241,11 @@
 // Set the local drive mapping
 //
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsSetLocalDriveMapping, MODULEUID, Handle(), aMapping);
-
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSETLOCALDRIVEMAPPING, "sess %x", Handle());
+	
+	OstTraceData( TRACE_BORDER, EFSRV_EFSSETLOCALDRIVEMAPPING_ELOCALDRIVEMAPPING, "aMapping %{int32[]}", aMapping.Ptr(), aMapping.Length());
 	TInt r = SendReceive(EFsSetLocalDriveMapping,TIpcArgs(&aMapping));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetLocalDriveMappingReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSETLOCALDRIVEMAPPINGRETURN, "r %d", r);
 	return r;
 	}
 
@@ -3314,10 +3267,9 @@
 */
 EFSRV_EXPORT_C TInt RFs::FinaliseDrive(TInt aDriveNo, TFinaliseDrvMode aMode) const
     {
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDrive, MODULEUID, Handle(), aDriveNo, aMode);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSFINALISEDRIVE, "sess %x aDriveNo %d aMode %d", (TUint) Handle(), (TUint) aDriveNo, (TUint) aMode);
     TInt r = SendReceive(EFsFinaliseDrive,TIpcArgs(aDriveNo, (TInt)aMode));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDriveReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSFINALISEDRIVERETURN, "r %d", r);
 	return r;
     }
 
@@ -3333,7 +3285,7 @@
 */
 EFSRV_EXPORT_C TInt RFs::FinaliseDrives()
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDrives, MODULEUID, Handle());
+	OstTrace1(TRACE_BORDER, EFSRV_EFSFINALISEDRIVES, "sess %x", Handle());
 	TInt nRes;
 	TDriveList driveList;
 	TDriveInfo driveInfo;
@@ -3341,7 +3293,7 @@
 	nRes=DriveList(driveList);
 	if(nRes != KErrNone)
 		{
-		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDrivesReturn, MODULEUID, nRes);
+		OstTrace1(TRACE_BORDER, EFSRV_EFSFINALISEDRIVESRETURN1, "r %d", nRes);
 	    return nRes; //-- unable to obtain drives list
 		}
 	
@@ -3363,7 +3315,7 @@
 	    }
 	
 
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDrivesReturn, MODULEUID, KErrNone);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSFINALISEDRIVESRETURN2, "r %d", KErrNone);
 	return 	KErrNone;
 	}
 
@@ -3390,10 +3342,11 @@
 @capability DiskAdmin
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsSwapFileSystem, MODULEUID, Handle(), aOldFileSystemName, aNewFileSystemName, aDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSSWAPFILESYSTEM, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSSWAPFILESYSTEM_EOLDNAME, "OldName %S", aOldFileSystemName.Ptr(), aOldFileSystemName.Length()<<1);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSSWAPFILESYSTEM_ENEWNAME, "NewName %S", aNewFileSystemName.Ptr(), aNewFileSystemName.Length()<<1);
 	TInt r = SendReceive(EFsSwapFileSystem,TIpcArgs(&aNewFileSystemName,aDrive,&aOldFileSystemName));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSwapFileSystemReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSWAPFILESYSTEMRETURN, "r %d", r);
 	return r;
 	}
 
@@ -3418,11 +3371,10 @@
 @capability DiskAdmin
 */
 	{
-	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EFsAddCompositeMount, MODULEUID, 
-		Handle(), aFileSystemName, aLocalDriveToMount, aCompositeDrive, aSync);
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFSADDCOMPOSITEMOUNT, "sess %x aLocalDriveToMount %d aCompositeDrive %d aSync %d", (TUint) Handle(), aLocalDriveToMount, aCompositeDrive, aSync);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSADDCOMPOSITEMOUNT_EFILESYSTEMNAME, "FileSystemName %S", aFileSystemName.Ptr(), aFileSystemName.Length()<<1);
 	TInt r = SendReceive(EFsAddCompositeMount,TIpcArgs(&aFileSystemName,aLocalDriveToMount,aCompositeDrive,aSync));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsAddCompositeMountReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSADDCOMPOSITEMOUNTRETURN, "r %d", r);
 	return r;
 	}
 
@@ -3461,10 +3413,9 @@
         any of the possible error return codes from TDrive::Volume()
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsReserveDriveSpace, MODULEUID, Handle(), aDriveNo, aSpace);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSRESERVEDRIVESPACE, "sess %x aDriveNo %d aSpace %d", (TUint) Handle(), (TUint) aDriveNo, (TUint) aSpace);
 	TInt r = SendReceive(EFsReserveDriveSpace, TIpcArgs(aDriveNo, aSpace));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReserveDriveSpaceReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSRESERVEDRIVESPACERETURN, "r %d", r);
 	return r;
 	}
 
@@ -3482,10 +3433,9 @@
         KErrPermissionDenied if the drive has no spare reserved space
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsGetReserveAccess, MODULEUID, Handle(), aDriveNo);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSGETRESERVEACCESS, "sess %x aDriveNo %d", (TUint) Handle(), (TUint) aDriveNo);
 	TInt r = SendReceive(EFsGetReserveAccess, TIpcArgs(aDriveNo));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetReserveAccessReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSGETRESERVEACCESSRETURN, "r %d", r);
 	return r;
 	}
 
@@ -3499,10 +3449,9 @@
 
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsReleaseReserveAccess, MODULEUID, Handle(), aDriveNo);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSRELEASERESERVEACCESS, "sess %x aDriveNo %d", (TUint) Handle(), (TUint) aDriveNo);
 	TInt r = SendReceive(EFsReleaseReserveAccess, TIpcArgs(aDriveNo));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReleaseReserveAccessReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSRELEASERESERVEACCESSRETURN, "r %d", r);
 	return r;
 	}
 
@@ -3559,7 +3508,7 @@
 */
 EFSRV_EXPORT_C void RFs::NotifyDismount(TInt aDrive, TRequestStatus& aStat, TNotifyDismountMode aMode /*=EFsDismountRegisterClient*/) const
 	{
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismount, MODULEUID, Handle(), aDrive, &aStat, aMode);
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFSNOTIFYDISMOUNT, "sess %x aDrive %d status %x aMode %d", (TUint) Handle(), aDrive, (TUint) &aStat, (TInt) aMode);
 	aStat = KRequestPending;
 	RSessionBase::SendReceive(EFsNotifyDismount, TIpcArgs(aDrive,aMode,&aStat), aStat);
 	// This call is to synchronise with the driver thread as the corresponding cancel function (NotifyDismountCancel)
@@ -3567,7 +3516,7 @@
 	// This call guarantees that the notify request has been added to queue.
 	SendReceive(EFsSynchroniseDriveThread, TIpcArgs(aDrive));
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountReturn, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSNOTIFYDISMOUNTRETURN, "");
 	}
 
 
@@ -3582,12 +3531,12 @@
 */
 EFSRV_EXPORT_C void RFs::NotifyDismountCancel(TRequestStatus& aStat) const
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountCancel1, MODULEUID, Handle(), &aStat);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSNOTIFYDISMOUNTCANCEL1, "sess %x status %x", (TUint) Handle(), (TUint) &aStat);
 	
 	if (aStat == KRequestPending)
 		SendReceive(EFsNotifyDismountCancel, TIpcArgs(&aStat));
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountCancel1Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSNOTIFYDISMOUNTCANCEL1RETURN, "");
 	}
 
 
@@ -3599,11 +3548,10 @@
 */
 EFSRV_EXPORT_C void RFs::NotifyDismountCancel() const
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountCancel2, MODULEUID, Handle());
-
+	OstTrace1(TRACE_BORDER, EFSRV_EFSNOTIFYDISMOUNTCANCEL2, "sess %x", Handle());
 	SendReceive(EFsNotifyDismountCancel, TIpcArgs(NULL));
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountCancel2Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSNOTIFYDISMOUNTCANCEL2RETURN, "");
 	}
 
 
@@ -3623,10 +3571,9 @@
 */
 EFSRV_EXPORT_C TInt RFs::AllowDismount(TInt aDrive) const
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsAllowDismount, MODULEUID, Handle(), aDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSALLOWDISMOUNT, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
 	TInt r = SendReceive(EFsAllowDismount, TIpcArgs(aDrive));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsAllowDismountReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSALLOWDISMOUNTRETURN, "r %d", r);
 	return r;
 	}
 
@@ -3647,10 +3594,9 @@
 @return KErrNone if successful, KErrPermissionDenied if called outside estart
 */
     {
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFsSetStartupConfiguration, MODULEUID, Handle(), aCommand, aParam1, aParam2);
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFSSETSTARTUPCONFIGURATION, "sess %x aCommand %d aParam1 %x aParam2 %x", (TUint) Handle(), aCommand, (TUint) aParam1, (TUint) aParam2);
     TInt r = SendReceive(EFsSetStartupConfiguration, TIpcArgs(aCommand,aParam1,aParam2));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetStartupConfigurationReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSETSTARTUPCONFIGURATIONRETURN, "r %d", r);
 	return r;
     }
 
@@ -3670,10 +3616,9 @@
 @see RFs::NotifyChange
  */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsSetNotifyChange, MODULEUID, Handle(), aNotifyChange);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSSETNOTIFYCHANGE, "sess %x aNotifyChange %d", (TUint) Handle(), (TUint) aNotifyChange);
 	TInt r = SendReceive(EFsSetSessionFlags, TIpcArgs(aNotifyChange ? EFsSessionNotifyChange: 0, aNotifyChange ? 0 : EFsSessionNotifyChange));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetNotifyChangeReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSSETNOTIFYCHANGERETURN, "r %d", r);
 	return r;
 	}
 
@@ -3707,10 +3652,9 @@
 @capability KDiskAdmin
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsInitialisePropertiesFile, MODULEUID, Handle(), aPtr.Ptr(), aPtr.Length());
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSINITIALISEPROPERTIESFILE, "sess %x filePtr %x fileLen %d", (TUint) Handle(), (TUint) aPtr.Ptr(), (TUint) aPtr.Length());
 	TInt r = SendReceive(EFsInitialisePropertiesFile, TIpcArgs(aPtr.Ptr(), aPtr.Length(), ETrue));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsInitialisePropertiesFileReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSINITIALISEPROPERTIESFILERETURN, "r %d", r);
 	return r;
 	}
 
@@ -3729,10 +3673,9 @@
 @see TVolumeIOParamInfo
  */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsQueryVolumeInfoExt, MODULEUID, Handle(), aDrive, aCommand);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSQUERYVOLUMEINFOEXT, "sess %x aDrive %d aCommand %d", (TUint) Handle(), (TUint) aDrive, (TUint) aCommand);
 	TInt r = SendReceive(EFsQueryVolumeInfoExt, TIpcArgs(aDrive, aCommand, &aInfo));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsQueryVolumeInfoExtReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSQUERYVOLUMEINFOEXTRETURN, "r %d", r);
 	return r;
 	}
 
@@ -3751,8 +3694,7 @@
 @return KErrNone if successful; otherwise, another system wide error code is returned.
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsVolumeIOParam, MODULEUID, Handle(), aDrive);
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSVOLUMEIOPARAM, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
 	TInt r = KErrNone;
 
 	if (!IsValidDrive(aDrive))
@@ -3765,9 +3707,8 @@
 		if (r == KErrNone)
 			aParamInfo = infoPckg();
 		}
-
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFsVolumeIOParamReturn, MODULEUID, 
-		r, aParamInfo.iBlockSize, aParamInfo.iClusterSize, aParamInfo.iRecReadBufSize, aParamInfo.iRecWriteBufSize);
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFSVOLUMEIOPARAMRETURN, "r %d iBlockSize %d iClusterSize %d iRecReadBufSize %d iRecWriteBufSize %d", (TUint) r, (TUint) aParamInfo.iBlockSize, (TUint) aParamInfo.iClusterSize, (TUint) aParamInfo.iRecReadBufSize, (TUint) aParamInfo.iRecWriteBufSize);
+		
 	return r;
 	}
 
@@ -3796,7 +3737,7 @@
 */
 EFSRV_EXPORT_C TInt RFs::FileSystemSubType(TInt aDrive, TDes& aName) const
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemSubType, MODULEUID, Handle(), aDrive, aName);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSFILESYSTEMSUBTYPE, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
 
 	TInt r = KErrNone;
 
@@ -3810,8 +3751,11 @@
 		if (r == KErrNone || r == KErrNotSupported)
 			aName = namePckg();
 		}
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemSubTypeReturn, MODULEUID, r);
+	
+	OstTraceData(TRACE_BORDER, EFSRV_EFSFILESYSTEMSUBTYPE_EFILESYSTEMNAME, "FileSystemName %S", aName.Ptr(), aName.Length()<<1);
+
+	OstTrace1(TRACE_BORDER, EFSRV_EFSFILESYSTEMSUBTYPERETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -3894,14 +3838,21 @@
 	return SendReceive(EFsDismountProxyDrive,TIpcArgs(aProxyDriveNumber));
 	}
 
+
+/**
+Closes the file server session.
+
+NB This function was added to support tracing and was not present in earlier versions of Symbian OS.
+For this reason no extra funcitonality should be added to this function.
+
+*/
 EFSRV_EXPORT_C void RFs::Close()
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsClose, MODULEUID, Handle());
-	RFTRACE_CLOSE;
+	OstTrace1(TRACE_BORDER, EFSRV_EFSCLOSE, "sess %x", Handle());
 
 	RSessionBase::Close();
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsCloseReturn, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFSCLOSERETURN, "");
 	}
 
 
--- a/userlibandfileserver/fileserver/sfsrv/cl_dir.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfsrv/cl_dir.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -17,6 +17,10 @@
 
 #include "cl_std.h"
 
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cl_dirTraces.h"
+#endif
+
 
 
 
@@ -48,13 +52,14 @@
 
 */
 	{
-	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EDirOpen1, MODULEUID,
-		Session().Handle(), aName, aUidType[0].iUid, aUidType[1].iUid, aUidType[2].iUid);
+	OstTraceExt4(TRACE_BORDER, EFSRV_EDIROPEN1, "sess %x aUidType0 %x aUidType1 %x aUidType2 %x", (TUint) Session().Handle(), (TUint) aUidType[0].iUid, (TUint) aUidType[1].iUid, (TUint) aUidType[2].iUid);
+	OstTraceData(TRACE_BORDER, EFSRV_EDIROPEN1_EDIRNAME, "Dir %S", aName.Ptr(), aName.Length()<<1);
 
 	TPckgC<TUidType> pckgUid(aUidType);
 	TInt r = CreateSubSession(aFs,EFsDirOpen,TIpcArgs(&aName,KEntryAttAllowUid,&pckgUid));
 
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EDirOpen1Return, MODULEUID, r, SubSessionHandle());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EDIROPEN1RETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
+
 	return r;
 	}
 
@@ -92,13 +97,15 @@
 
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EDirOpen2, MODULEUID, Session().Handle(), aName, anAttMask);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EDIROPEN2, "sess %x anAttMask %x", (TUint) Session().Handle(), (TUint) anAttMask);
+	OstTraceData(TRACE_BORDER, EFSRV_EDIROPEN2_EDIRNAME, "Dir %S", aName.Ptr(), aName.Length()<<1);
 
 	TUidType uidType(TUid::Null(),TUid::Null(),TUid::Null());
 	TPckgC<TUidType> pckgUid(uidType);
 	TInt r = CreateSubSession(aFs,EFsDirOpen,TIpcArgs(&aName,anAttMask,&pckgUid));
 
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EDirOpen2Return, MODULEUID, r, SubSessionHandle());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EDIROPEN2RETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
+
 	return r;
 	}
 
@@ -112,11 +119,11 @@
 it completed successfully or not.
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EDirClose, MODULEUID, Session().Handle(), SubSessionHandle());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EDIRCLOSE, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
 
 	CloseSubSession(EFsDirSubClose);
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EDirCloseReturn, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EDIRCLOSERETURN, "");
 	}
 
 
@@ -140,12 +147,13 @@
         (e.g. KErrCorrupt, KErrNoMemory etc).
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EDirRead1, MODULEUID, Session().Handle(), SubSessionHandle());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EDIRREAD1, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
 
 	anArray.iCount=KCountNeeded;
 	TInt r = SendReceive(EFsDirReadPacked,TIpcArgs(&anArray.iBuf));
 
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EDirRead1Return, MODULEUID, r, anArray.Count());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EDIRREAD1RETURN, "r %d count %d", (TUint) r, (TUint) anArray.Count());
+
 	return r;
 	}
 
@@ -171,12 +179,12 @@
                (e.g. KErrCorrupt, KErrNoMemory etc).
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EDirRead2, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EDIRREAD2, "sess %x subs %x status %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) &aStatus);
 
 	anArray.iCount=KCountNeeded;
 	RSubSessionBase::SendReceive(EFsDirReadPacked,TIpcArgs(&anArray.iBuf),aStatus);
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EDirRead2Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EDIRREAD2RETURN, "");
 	}
 
 
@@ -194,12 +202,13 @@
         codes.
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EDirRead3, MODULEUID, Session().Handle(), SubSessionHandle());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EDIRREAD3, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
 
 	TPckg<TEntry> e(anEntry);
 	TInt r = SendReceive(EFsDirReadOne,TIpcArgs(&e));
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EDirRead3Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EDIRREAD3RETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -218,9 +227,9 @@
                error codes.
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EDirRead4, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EDIRREAD4, "sess %x subs %x status %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) &aStatus);
 
 	RSubSessionBase::SendReceive(EFsDirReadOne,TIpcArgs(&anEntry),aStatus);
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EDirRead4Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EDIRREAD4RETURN, "");
 	}
--- a/userlibandfileserver/fileserver/sfsrv/cl_file.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfsrv/cl_file.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -16,7 +16,9 @@
 //
 
 #include "cl_std.h"
-
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cl_fileTraces.h"
+#endif
 static _LIT_SECURITY_POLICY_S1(KFileServerPolicy,KFileServerUidValue,ECapabilityTCB);
 
 EFSRV_EXPORT_C TInt RFile::Adopt(RFs& aFs, TInt aHandle)
@@ -34,26 +36,23 @@
 */
 	{
 
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileAdopt, MODULEUID, aFs.Handle(), aHandle);
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEADOPT, "sess %x subs %x", (TUint) aFs.Handle(), (TUint) aHandle);
 	// duplicate the sub-session handle; don't panic if it's invalid.
 	RFile file;
 	TInt r = file.CreateSubSession(aFs, EFsFileDuplicate, TIpcArgs(aHandle, EFalse));
 	if (r == KErrArgument)
 		{
-		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptReturn, MODULEUID, KErrBadHandle);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTRETURN1, "r %d", KErrBadHandle);
 		return KErrBadHandle;
 		}
 	else if (r != KErrNone)
 		{
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptReturn, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTRETURN2, "r %d", r);
 		return r;
 		}
 	// adopt the duplicated handle
 	r = CreateAutoCloseSubSession(aFs, EFsFileAdopt, TIpcArgs(file.SubSessionHandle(), KFileAdopt32));
-
-	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEADOPTRETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	return r;
 	}
 
@@ -77,19 +76,16 @@
         error codes.
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServer, MODULEUID, aFsHandle, aFileHandle);
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEADOPTFROMSERVER, "sess %x subs %x", (TUint) aFsHandle, (TUint) aFileHandle);
 	RFs fs;
 	TInt r = fs.SetReturnedHandle(aFsHandle, KFileServerPolicy);
 	if (r != KErrNone)
 		{
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServerReturn, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTFROMSERVERRETURN1, "r %d", r);
 		return r;
 		}
 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle, KFileAdopt32));
-
-	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServerReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEADOPTFROMSERVERRETURN2, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	return r;
 	}
 
@@ -130,7 +126,7 @@
 	else
 		r = KErrArgument;
 
-#ifdef SYMBIAN_FTRACE_ENABLE
+#ifdef OST_TRACE_COMPILER_IN_USE
 	TInt handle = NULL;
 	if (aFsHandleIndex == 0)
 		handle = aMsg.Int0();
@@ -140,12 +136,12 @@
 		handle = aMsg.Int2();
 	else if (aFsHandleIndex == 3)
 		handle = aMsg.Int3();
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClient, MODULEUID, handle, fileHandle, aFsHandleIndex, aFileHandleIndex);
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEADOPTFROMCLIENT, "sess %x subs %x aFsHandleIndex %d aFileHandleIndex %d ", (TUint) handle, (TUint) fileHandle, (TUint) aFsHandleIndex, (TUint) aFileHandleIndex);
 #endif
 
 	if (r != KErrNone)
 		{
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTFROMCLIENTRETURN1, "r %d", r);
 		return r;
 		}
 
@@ -155,14 +151,12 @@
 	r = fs.Open(aMsg, aFsHandleIndex, KFileServerPolicy);
 	if (r != KErrNone)
 		{
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTFROMCLIENTRETURN2, "r %d", r);
 		return r;
 		}
 
 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt32));
-
-	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEADOPTFROMCLIENTRETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	return r;
 	}
 
@@ -193,11 +187,10 @@
 
 	TInt r = User::GetTIntParameter(aFileHandleIndex,  fileHandle);
 
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreator, MODULEUID, fileHandle, aFsHandleIndex, aFileHandleIndex);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEADOPTFROMCREATOR, "subs %x aFsHandleIndex %d aFileHandleIndex %d", (TUint) fileHandle, (TUint) aFsHandleIndex, (TUint) aFileHandleIndex);
 	if (r != KErrNone)
 		{
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTFROMCREATORRETURN1, "r %d", r);
 		return r;
 		}
 
@@ -208,14 +201,12 @@
 	r = fs.Open(aFsHandleIndex, KFileServerPolicy);
 	if (r != KErrNone)
 		{
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILEADOPTFROMCREATORRETURN2, "r %d", r);
 		return r;
 		}
 
 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt32));
-
-	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEADOPTFROMCREATORRETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	return r;
 	}
 
@@ -237,8 +228,7 @@
 */
 EFSRV_EXPORT_C TInt RFile::Duplicate(const RFile& aFile, TOwnerType aType)
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileDuplicate, MODULEUID, aFile.Session().Handle(), aFile.SubSessionHandle(), aType);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEDUPLICATE, "sess %x subs %x aType %d", (TUint) aFile.Session().Handle(), (TUint) aFile.SubSessionHandle(), (TUint) aType);
 	RFs fs;
 	fs.SetHandle(aFile.Session().Handle());
 
@@ -247,7 +237,7 @@
 	TInt r = fs.Duplicate(RThread(), aType);
 	if (r != KErrNone)
 		{
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileDuplicateReturn, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILEDUPLICATERETURN1, "r %d", r);
 		return r;
 		}
 	
@@ -256,15 +246,14 @@
 	r = aFile.DuplicateHandle(dupSubSessionHandle);
 	if (r != KErrNone)
 		{
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileDuplicateReturn, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILEDUPLICATERETURN2, "r %d", r);
 		return r;
 		}
 
 	// adopt the duplicated sub-session handle
 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(dupSubSessionHandle, KFileDuplicate));
 
-	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileDuplicateReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEDUPLICATERETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	return r;
 	}
 
@@ -321,11 +310,10 @@
 */
 EFSRV_EXPORT_C TInt RFile::TransferToServer(TIpcArgs& aIpcArgs, TInt aFsHandleIndex, TInt aFileHandleIndex) const
 	{
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToServer, MODULEUID, Session().Handle(), SubSessionHandle(), aFsHandleIndex, aFileHandleIndex);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILETRANSFERTOSERVER, "sess %x subs %x aFsHandleIndex %d aFileHandleIndex %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aFsHandleIndex, (TUint) aFileHandleIndex);
 	if ((aFsHandleIndex < 0) || (aFsHandleIndex > (KMaxMessageArguments-2)))
 		{
-		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToServerReturn, MODULEUID,  (TUint) KErrArgument);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOSERVERRETURN1, "r %d",  (TUint) KErrArgument);
 		return KErrArgument;
 		}
 
@@ -336,8 +324,7 @@
 		aIpcArgs.Set(aFsHandleIndex, Session());
 		aIpcArgs.Set(aFileHandleIndex, dupSubSessionHandle);
 		}
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToServerReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOSERVERRETURN2, "r %d", r);
 	return r;
 	}
 
@@ -368,11 +355,10 @@
 */
 EFSRV_EXPORT_C TInt RFile::TransferToClient(const RMessage2& aMsg, TInt aFileHandleIndex) const
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToClient, MODULEUID, Session().Handle(), SubSessionHandle(), aFileHandleIndex);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILETRANSFERTOCLIENT, "sess %x subs %x aFileHandleIndex %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aFileHandleIndex);
 	if (TUint(aFileHandleIndex) >= TUint(KMaxMessageArguments))
 		{
-		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToClientReturn, MODULEUID,  (TUint) KErrArgument);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOCLIENTRETURN1, "r %d",  (TUint) KErrArgument);
 		return KErrArgument;
 		}
 
@@ -383,14 +369,13 @@
 
 	if (r != KErrNone)
 		{
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToClientReturn, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOCLIENTRETURN2, "r %d", r);
 		return r;
 		}
 
 	aMsg.Complete(Session());
 	
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToClientReturn, MODULEUID, r);
-
+	OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOCLIENTRETURN3, "r %d", r);
 	return r;
 	}
 
@@ -423,8 +408,7 @@
 // NB slot 0 is reserved for the command line
 EFSRV_EXPORT_C TInt RFile::TransferToProcess(RProcess& aProcess, TInt aFsHandleIndex, TInt aFileHandleIndex) const
 	{
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToProcess, MODULEUID, Session().Handle(), SubSessionHandle(), aFsHandleIndex, aFileHandleIndex);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILETRANSFERTOPROCESS, "sess %x subs %x aFsHandleIndex %d aFileHandleIndex %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aFsHandleIndex, (TUint) aFileHandleIndex);
 	TInt dupSubSessionHandle;
 	TInt r = DuplicateHandle(dupSubSessionHandle);
 
@@ -433,9 +417,7 @@
 	
 	if (r == KErrNone)
 		r = aProcess.SetParameter(aFileHandleIndex, dupSubSessionHandle);
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToProcessReturn, MODULEUID, r);
-
+	OstTrace1(TRACE_BORDER, EFSRV_EFILETRANSFERTOPROCESSRETURN, "r %d", r);
 	return r;
 	}
 
@@ -455,12 +437,10 @@
 
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileName, MODULEUID, Session().Handle(), SubSessionHandle());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEGETNAME, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	TInt r = SendReceive(EFsFileName, TIpcArgs(&aName));
-
-	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFileNameReturn, MODULEUID, r, aName);
-
+	OstTraceData(TRACE_BORDER, EFSRV_EFILEGETNAME_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILEGETNAMERETURN, "r %d", r);
 	return r;
 	}
 
@@ -480,12 +460,10 @@
 
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileFullName, MODULEUID, Session().Handle(), SubSessionHandle());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEFULLNAME, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	TInt r = SendReceive(EFsFileFullName, TIpcArgs(&aName));
-
-	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFileFullNameReturn, MODULEUID, r, aName);
-
+	OstTraceData(TRACE_BORDER, EFSRV_EFILEFULLNAME_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILEFULLNAMERETURN, "r %d", r);
 	return r;
 	}
 
@@ -540,13 +518,11 @@
 
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileOpen, MODULEUID, aFs.Handle(), aMode, aName);
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEOPEN, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aMode);
+	OstTraceData(TRACE_BORDER, EFSRV_EFILEOPEN_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	aMode &= ~EFileBigFile;
 	TInt r = CreateSubSession(aFs,EFsFileOpen,TIpcArgs(&aName,aMode));
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileOpenReturn, MODULEUID, r, SubSessionHandle());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEOPENRETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
 	return r;
 	}
 
@@ -564,22 +540,11 @@
 no-operation.
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileClose, MODULEUID, Session().Handle(), SubSessionHandle());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILECLOSE, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	
-#if defined (SYMBIAN_FTRACE_ENABLE) && defined(__DLL__)
-	// Need to close the handle to the trace LDD if this is an auto-close subsession
-	// as these close their parent session by calling RHandleBase::Close(), i.e. they
-	// bypass RFs::Close() which would normally be responsible for closing the LDD
-	TInt h = Session().Handle() ^ CObjectIx::ENoClose;
-	if ( h != NULL && (!(h & CObjectIx::ENoClose)) ) 
-		{
-		RFTRACE_CLOSE;
-		}
-#endif
-
 	CloseSubSession(EFsFileSubClose);
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileCloseReturn, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILECLOSERETURN, "");
 	}
 
 
@@ -623,13 +588,10 @@
 */
 	{
 	aMode &= ~EFileBigFile;
-
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileCreate, MODULEUID, aFs.Handle(), aMode, aName);
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILECREATE, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aMode);
+	OstTraceData(TRACE_BORDER, EFSRV_EFILECREATE_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	TInt r = CreateSubSession(aFs,EFsFileCreate,TIpcArgs(&aName,aMode));
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileCreateReturn, MODULEUID, r, SubSessionHandle());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILECREATERETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
 	return r;
 	}
 
@@ -680,10 +642,11 @@
 
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileReplace, MODULEUID, aFs.Handle(), aMode, aName);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREPLACE, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aMode);
+	OstTraceData(TRACE_BORDER, EFSRV_EFILEREPLACE_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	aMode &= ~EFileBigFile;
 	TInt r = CreateSubSession(aFs,EFsFileReplace,TIpcArgs(&aName,aMode));
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileReplaceReturn, MODULEUID, r, SubSessionHandle());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREPLACERETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
 	return r;
 	}
 
@@ -717,10 +680,13 @@
 					  SID then AllFiles capability is required.
 */
 	{
-   	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileTemp, MODULEUID, aFs.Handle(), aPath, aMode);
+   	OstTraceExt2(TRACE_BORDER, EFSRV_EFILETEMP, "sess %x aMode %x", (TUint) aFs.Handle(), (TUint) aMode);
+	OstTraceData(TRACE_BORDER, EFSRV_EFILETEMP_EDIRNAME, "Dir %S", aPath.Ptr(), aPath.Length()<<1);
 	aMode &= ~EFileBigFile;
 	TInt r = CreateSubSession(aFs,EFsFileTemp,TIpcArgs(&aPath,aMode,&aName));
-	TRACERETMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileTempReturn, MODULEUID, r, SubSessionHandle(), aName);
+	OstTraceData(TRACE_BORDER, EFSRV_EFILETEMP_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILETEMPRETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
+	
 	return r;
 	}
 
@@ -748,12 +714,9 @@
 @see TDesC8::Length
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileRead1, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.MaxLength());
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEREAD1, "sess %x subs %x desmaxlen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aDes.MaxLength());
 	TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(KCurrentPosition64)));
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead1Return, MODULEUID, r, aDes.Length());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREAD1RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length());
 	return r;
 	}
 
@@ -787,11 +750,10 @@
 @see TDesC8::Length       
 */
 	{
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileRead2, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.MaxLength(), &aStatus);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEREAD2, "sess %x subs %x maxdeslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aDes.MaxLength());
     RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(KCurrentPosition64)),aStatus);
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead2Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILEREAD2RETURN, "");
 	}
 
 
@@ -826,8 +788,7 @@
         codes.
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileRead1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEREAD5, "sess %x subs %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aLength);
 	if (aLength==0)
 		{
 		aDes.Zero();
@@ -838,9 +799,7 @@
 		return(KErrOverflow);
 		}
 	TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)));
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead1Return, MODULEUID, r, aDes.Length());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREAD5RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length());
 	return r;
 	}
 
@@ -880,8 +839,7 @@
                otherwise one of the other system-wide error codes.
 */
 	{
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileRead2, MODULEUID, Session().Handle(), SubSessionHandle(), aLength, &aStatus);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEREAD6, "sess %x subs %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aLength);
 	if (aLength==0)
 		{
 		aDes.Zero();
@@ -897,8 +855,7 @@
 		}
 		
 	RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)),aStatus);
-
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead2Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILEREAD6RETURN, "");
 	}
 
 
@@ -932,14 +889,11 @@
 @panic FSCLIENT 19 if aPos is negative.        
 */
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.MaxLength());
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEREAD3, "sess %x subs %x aPos %x maxdeslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.MaxLength());
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 
 	TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos));
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREAD3RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length());
 	return r;
 	}
 
@@ -979,12 +933,11 @@
 @panic FSCLIENT 19 if aPos is negative.        
 */
 	{
-	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.MaxLength(), &aStatus);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEREAD4, "sess %x subs %x aPos %x maxdeslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.MaxLength());
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos),aStatus);
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILEREAD4RETURN, "");
 	}
 
 
@@ -1026,8 +979,7 @@
 @panic FSCLIENT 19 if aPos is negative.        
 */
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEREAD7, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	if (aLength==0)
 		{
@@ -1040,9 +992,7 @@
 		}
 		
 	TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos));
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEREAD7RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length());
 	return r;
 	}
 
@@ -1091,8 +1041,7 @@
 @panic FSCLIENT 19 if aPos is negative.                       
 */
 	{
-	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength, &aStatus);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEREAD9, "sess %x subs %x aPos %x maxlen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	if (aLength==0)
 		{
@@ -1109,8 +1058,7 @@
 		}
 		
 	RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos),aStatus);
-
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILEREAD9RETURN, "");
 	}
 
 
@@ -1162,9 +1110,9 @@
         codes.
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.Length());
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEWRITE1, "sess %x subs %x deslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aDes.Length());
 	TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(KCurrentPosition64)));
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILEWRITE1RETURN, "r %d", r);
 	return r;
 	}
 
@@ -1189,10 +1137,9 @@
                otherwise one of the other system-wide error codes.
 */
 	{
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.Length(), &aStatus);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEWRITE2, "sess %x subs %x deslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aDes.Length());
 	RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(KCurrentPosition64)),aStatus);
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILEWRITE2RETURN, "");
 	}
 
 
@@ -1219,12 +1166,10 @@
        of the descriptor aDes.  
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEWRITE5, "sess %x subs %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aLength);
 	__ASSERT_DEBUG(aDes.Length()>=aLength,Panic(EBadLength));
 	TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILEWRITE5RETURN, "r %d", r);
 	return r;
 	}
 
@@ -1257,11 +1202,10 @@
 
 */
 	{
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), aLength, &aStatus);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEWRITE9, "sess %x subs %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aLength);
 		
 	RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)),aStatus);
-
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILEWRITE9RETURN, "");
 	}
 
 
@@ -1291,12 +1235,10 @@
 @panic FSCLIENT 19 if aPos is negative.                       
 */
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.Length());
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEWRITE3, "sess %x subs %x aPos %x len %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.Length());
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILEWRITE3RETURN, "r %d", r);
 	return r;
 	}
 
@@ -1331,11 +1273,10 @@
 @panic FSCLIENT 19 if aPos is negative.                       
 */
 	{
-	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.Length(), &aStatus);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEWRITE4, "sess %x subs %x aPos %x deslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.Length());
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos),aStatus);
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILEWRITE4RETURN, "");
 	}
 
 
@@ -1365,12 +1306,10 @@
 @panic FSCLIENT 19 if aPos is negative.                       
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEWRITE6, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILEWRITE6RETURN, "r %d", r);
 	return r;
 	}
 
@@ -1408,11 +1347,10 @@
 @panic FSCLIENT 19 if aPos is negative.                       
 */
 	{
-	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength, &aStatus);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEWRITE10, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos),aStatus);
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILEWRITE10RETURN, "");
 	}
 
 
@@ -1446,13 +1384,10 @@
 
 */
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileLock, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILELOCK, "RFile::Lock() sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
-
 	TInt r = SendReceive(EFsFileLock,TIpcArgs(aPos,aLength));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileLockReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILELOCKRETURN, "r %d", r);
 	return r;
 	}
 
@@ -1480,12 +1415,10 @@
 @panic FSCLIENT 19 if aPos is negative. 
 */
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileUnLock, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEUNLOCK, "RFile::UnLock() sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	TInt r = SendReceive(EFsFileUnLock,TIpcArgs(aPos,aLength));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileUnLockReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILEUNLOCKRETURN, "r %d", r);
 	return r;
 	}
 
@@ -1529,15 +1462,13 @@
         codes.
 */
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileSeek, MODULEUID, Session().Handle(), SubSessionHandle(), aMode, aPos, 0);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILESEEK1, "sess %x subs %x aMode %x aPos %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aMode, (TUint) aPos);
 	TInt64 newPos = aPos;
 	TPckg<TInt64>  pkNewPos(newPos);
 	TInt r = SendReceive(EFsFileSeek|KIpcArgSlot2Desc,TIpcArgs(aPos,aMode,&pkNewPos));
 	if(KErrNone == r)
 		aPos = I64LOW(newPos);
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSeekReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILESEEK1RETURN, "r %d", r);
 	return r;
 	}
 
@@ -1559,11 +1490,9 @@
         codes.
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileFlush, MODULEUID, Session().Handle(), SubSessionHandle(), NULL);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEFLUSH1, "sess %x subs %x status %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) NULL);
 	TInt r = RSubSessionBase::SendReceive(EFsFileFlush);
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileFlushReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILEFLUSH1RETURN, "r %d", r);
 	return r;
 	}
 
@@ -1585,11 +1514,9 @@
                otherwise one of the other system-wide error codes.
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileFlush, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEFLUSH2, "sess %x subs %x status %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) &aStatus);
 	RSubSessionBase::SendReceive(EFsFileFlush, aStatus);
-
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileFlushReturn, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILEFLUSH2RETURN, "");
 	}
 
 
@@ -1605,8 +1532,7 @@
         codes.
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileSize, MODULEUID, Session().Handle(), SubSessionHandle());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILESIZE, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	TInt64 size = aSize;
 	TPckg<TInt64> pkSize(size);
 	TInt r = SendReceive(EFsFileSize|KIpcArgSlot0Desc,TIpcArgs(&pkSize));
@@ -1617,8 +1543,7 @@
 	if (size > KMaxTInt)
 		return (KErrTooBig);
 #endif
-
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileSizeReturn, MODULEUID, r, aSize);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILESIZERETURN, "r %d aSize %d", (TUint) r, (TUint) aSize);
 	return r;
 	}
 
@@ -1650,11 +1575,9 @@
 
 */
 	{
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileSetSize, MODULEUID, Session().Handle(), SubSessionHandle(), aSize, 0);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILESETSIZE1, "sess %x subs %x aSize %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aSize);
 	TInt r = SendReceive(EFsFileSetSize,TIpcArgs(aSize));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetSizeReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILESETSIZE1RETURN, "r %d", r);
 	return r;
 	}
 
@@ -1675,13 +1598,11 @@
 @see KEntryAttNormal        
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileAtt, MODULEUID, Session().Handle(), SubSessionHandle());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEATT, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	TPtr8 a((TUint8*)&aVal,sizeof(TUint));
 	
 	TInt r = SendReceive(EFsFileAtt,TIpcArgs(&a));
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileAttReturn, MODULEUID, r, aVal);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEATTRETURN, "r %d aVal %x", (TUint) r, (TUint) aVal);
 	return r;
 	}
 
@@ -1718,13 +1639,11 @@
 @panic FSCLIENT 21 if the same attribute bit is set in both bitmasks.
 */
 	{
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileSetAtt, MODULEUID, Session().Handle(), SubSessionHandle(), aSetAttMask, aClearAttMask);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILESETATT, "sess %x subs %x aSetAttMask %x aClearAttMask %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aSetAttMask, (TUint) aClearAttMask);
 	__ASSERT_ALWAYS((aSetAttMask&aClearAttMask)==0,Panic(EAttributesIllegal));
 
 	TInt r = SendReceive(EFsFileSetAtt,TIpcArgs(aSetAttMask,aClearAttMask));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetAttReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILESETATTRETURN, "r %d", r);
 	return r;
 	}
 
@@ -1741,12 +1660,10 @@
         codes.
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileModified, MODULEUID, Session().Handle(), SubSessionHandle());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEMODIFIED, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	TPtr8 t((TUint8*)&aTime,sizeof(TTime));
 	TInt r = SendReceive(EFsFileModified,TIpcArgs(&t));
-
-	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileModifiedReturn, MODULEUID, r, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()));
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILEMODIFIEDRETURN, "r %d aTime %x:%x ", (TUint) r, (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()));
 	return r;
 	}
 
@@ -1770,12 +1687,10 @@
         codes.
 */
 	{
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileSetModified, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()));
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILESETMODIFIED, "sess %x subs %x aTime %x:%x ", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()));
 	TPtrC8 t((TUint8*)&aTime,sizeof(TTime));
 	TInt r = SendReceive(EFsFileSetModified,TIpcArgs(&t));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetModifiedReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILESETMODIFIEDRETURN, "r %d", r);
 	return r;
 	}
 
@@ -1806,14 +1721,12 @@
 @see RFile::SetAtt
 */
 	{
-	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileSet, MODULEUID, 
-		Session().Handle(), SubSessionHandle(), I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()), aMask, aVal);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILESETA, "sess %x subs %x aSetAttMask %x aClearAttMask %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aMask, (TUint) aVal);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILESETB, "aTime %x:%x ", (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()));
 	__ASSERT_ALWAYS((aVal&aMask)==0,Panic(EAttributesIllegal));
 	TPtrC8 t((TUint8*)&aTime,sizeof(TTime));
 	TInt r = SendReceive(EFsFileSet,TIpcArgs(&t,aMask,aVal));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILESETRETURN, "r %d", r);
 	return r;
 	}
 
@@ -1842,13 +1755,11 @@
 
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileChangeMode, MODULEUID, Session().Handle(), SubSessionHandle(), aNewMode);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILECHANGEMODE, "sess %x subs %x aNewMode %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aNewMode);
 	if (aNewMode!=EFileShareExclusive && aNewMode!=EFileShareReadersOnly)
 		return(KErrArgument);
 	TInt r = SendReceive(EFsFileChangeMode,TIpcArgs(aNewMode));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileChangeModeReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILECHANGEMODERETURN, "r %d", r);
 	return r;
 	}
 
@@ -1894,11 +1805,10 @@
 
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileRename, MODULEUID, Session().Handle(), SubSessionHandle(), aNewName);
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILERENAME, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFILERENAME_ENEWNAME, "NewName %S", aNewName.Ptr(), aNewName.Length()<<1);
 	TInt r = SendReceive(EFsFileRename,TIpcArgs(&aNewName));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileRenameReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILERENAMERETURN, "r %d", r);
 	return r;
 	}
 
@@ -1921,13 +1831,11 @@
 @see RFs::Drive
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileDrive, MODULEUID, Session().Handle(), SubSessionHandle());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEDRIVE, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	TPckg<TInt> pki(aDriveNumber);
 	TPckg<TDriveInfo> pkdi(aDriveInfo);
 	TInt r = SendReceive(EFsFileDrive,TIpcArgs(&pki,&pkdi));
-
-	TRACERET4(UTF::EBorder, UTraceModuleEfsrv::EFileDriveReturn, MODULEUID, r, aDriveInfo.iDriveAtt, aDriveInfo.iMediaAtt, aDriveInfo.iType);
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILEDRIVERETURN, "r %d driveAtt %x mediaAtt %x type %x", (TUint) r, (TUint) aDriveInfo.iDriveAtt, (TUint) aDriveInfo.iMediaAtt, (TUint) aDriveInfo.iType);
 	return r;
 	}
 
@@ -1944,12 +1852,10 @@
 @see RFs::Unclamp
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileClamp, MODULEUID, Session().Handle(), SubSessionHandle());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILECLAMP, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	TPckg<RFileClamp> pkHandle(aHandle);
 	TInt r = SendReceive(EFsFileClamp,TIpcArgs(& pkHandle));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileClampReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILECLAMPRETURN, "r %d", r);
 	return r;
 	}
 
@@ -1979,9 +1885,8 @@
 */
 EFSRV_EXPORT_C TInt RFile::BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos, TInt aBlockMapUsage) const
 	{
-	TRACE7(UTF::EBorder, UTraceModuleEfsrv::EFileBlockMap, MODULEUID, 
-		Session().Handle(), SubSessionHandle(), I64LOW(aStartPos), I64HIGH(aEndPos), I64LOW(aEndPos), I64HIGH(aEndPos), aBlockMapUsage);
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILEBLOCKMAPA, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFILEBLOCKMAPB, "RFile::BlockMap() aStartPos %x:%x aEndPos %x:%x aBlockMapusage %d", (TUint) I64HIGH(aStartPos), (TUint) I64LOW(aStartPos), (TUint) I64HIGH(aEndPos), (TUint) I64LOW(aEndPos), (TUint) aBlockMapUsage);
 	SBlockMapArgs args;
 	args.iStartPos = aStartPos;
 	args.iEndPos = aEndPos;
@@ -1990,8 +1895,7 @@
  	TInt r = SendReceive(EFsBlockMap, TIpcArgs(&pkInfo, &pkArgs, aBlockMapUsage));
 	if(r==KErrNone)
 		aStartPos = args.iStartPos;
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileBlockMapReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILEBLOCKMAPRETURN, "r %d", r);
 	return r;
 	}
 
@@ -2044,11 +1948,12 @@
 */
 EFSRV_EXPORT_C TInt RFile64::Open(RFs& aFs,const TDesC& aName,TUint aFileMode)
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileOpen, MODULEUID, aFs.Handle(), aFileMode, aName);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64OPEN, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aFileMode);
+	OstTraceData(TRACE_BORDER, EFSRV_EFILE64OPEN_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	
 	TInt r = CreateSubSession(aFs,EFsFileOpen,TIpcArgs(&aName,aFileMode|EFileBigFile));
 	
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileOpenReturn, MODULEUID, r, SubSessionHandle());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64OPENRETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
 	return r;
 	}
 
@@ -2093,11 +1998,10 @@
 */
 EFSRV_EXPORT_C TInt RFile64::Create(RFs& aFs,const TDesC& aName,TUint aFileMode)
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileCreate, MODULEUID, aFs.Handle(), aFileMode, aName);
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64CREATE, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aFileMode);
+	OstTraceData(TRACE_BORDER, EFSRV_EFILE64CREATE_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	TInt r = CreateSubSession(aFs,EFsFileCreate,TIpcArgs(&aName,aFileMode|EFileBigFile));
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileCreateReturn, MODULEUID, r, SubSessionHandle());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64CREATERETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
 	return r;
 	}
 
@@ -2148,11 +2052,10 @@
 */
 EFSRV_EXPORT_C TInt RFile64::Replace(RFs& aFs,const TDesC& aName,TUint aFileMode)
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileReplace, MODULEUID, aFs.Handle(), aFileMode, aName);
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64REPLACE, "sess %x mode %x", (TUint) aFs.Handle(), (TUint) aFileMode);
+	OstTraceData(TRACE_BORDER, EFSRV_EFILE64REPLACE_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
 	TInt r = CreateSubSession(aFs,EFsFileReplace,TIpcArgs(&aName,aFileMode|EFileBigFile));
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileReplaceReturn, MODULEUID, r, SubSessionHandle());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64REPLACERETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
 	return r;
 	}
 
@@ -2189,9 +2092,12 @@
 */
 EFSRV_EXPORT_C TInt RFile64::Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode)
 	{
-   	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileTemp, MODULEUID, aFs.Handle(), aPath, aFileMode);
+   	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64TEMP, "sess %x aMode %x", (TUint) aFs.Handle(), (TUint) aFileMode);
+	OstTraceData(TRACE_BORDER, EFSRV_EFILE64TEMP_EDIRNAME, "Dir %S", aPath.Ptr(), aPath.Length()<<1);
 	TInt r = CreateSubSession(aFs,EFsFileTemp,TIpcArgs(&aPath,aFileMode|EFileBigFile,&aName));
-	TRACERETMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileTempReturn, MODULEUID, r, SubSessionHandle(), aName);
+	OstTraceData(TRACE_BORDER, EFSRV_EFILE64TEMP_EFILENAME, "FileName %S", aName.Ptr(), aName.Length()<<1);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64TEMPRETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
+	
 	return r;
 	}
 
@@ -2243,7 +2149,7 @@
 	else
 		r = KErrArgument;
 
-#ifdef SYMBIAN_FTRACE_ENABLE
+#ifdef OST_TRACE_COMPILER_IN_USE
 	TInt handle = NULL;
 	if (aFsHandleIndex == 0)
 		handle = aMsg.Int0();
@@ -2253,31 +2159,27 @@
 		handle = aMsg.Int2();
 	else if (aFsHandleIndex == 3)
 		handle = aMsg.Int3();
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClient, MODULEUID, handle, fileHandle, aFsHandleIndex, aFileHandleIndex);
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCLIENT, "sess %x subs %x aFsHandleIndex %d aFileHandleIndex %d ", (TUint) handle, (TUint) fileHandle, (TUint) aFsHandleIndex, (TUint) aFileHandleIndex);
 #endif
-
 	if (r != KErrNone)
 		{
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCLIENTRETURN1, "r %d", r);
 		return r;
 		}
-
 	// Duplicates the file server (RFs) session handle identified by an 
 	// existing handle contained in the message slot at index aFsHandleIndex
 	RFs fs;
 	r = fs.Open(aMsg, aFsHandleIndex, KFileServerPolicy);
 	if (r != KErrNone)
 		{
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCLIENTRETURN2, "r %d", r);
 		return r;
 		}
 
 	//return CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle));
 	// Slot 1: Indicate Large File Supportis required.
 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt64));
-
-	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCLIENTRETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	return r;
 	}
 
@@ -2311,22 +2213,19 @@
 */
 EFSRV_EXPORT_C TInt RFile64::AdoptFromServer(TInt aFsHandle, TInt aFileHandle)
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServer, MODULEUID, aFsHandle, aFileHandle);
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMSERVER, "sess %x subs %x", (TUint) aFsHandle, (TUint) aFileHandle);
 	RFs fs;
 	TInt r = fs.SetReturnedHandle(aFsHandle, KFileServerPolicy);
 	if (r != KErrNone)
 		{
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServerReturn, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMSERVERRETURN1, "r %d", r);
 		return r;
 		}
 
 	//return(CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle)));
 	// Slot 1: Indicate Large File Supportis required.
 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle, KFileAdopt64));
-
-	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServerReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMSERVERRETURN2, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	return r;
 	}
 
@@ -2368,11 +2267,10 @@
 	TInt fileHandle;
 	TInt r = User::GetTIntParameter(aFileHandleIndex,  fileHandle);
 
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreator, MODULEUID, fileHandle, aFsHandleIndex, aFileHandleIndex);
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCREATOR, "subs %x aFsHandleIndex %d aFileHandleIndex %d", (TUint) fileHandle, (TUint) aFsHandleIndex, (TUint) aFileHandleIndex);
 	if (r != KErrNone)
 		{
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCREATORRETURN1, "r %d", r);
 		return r;
 		}
 
@@ -2383,16 +2281,14 @@
 	r = fs.Open(aFsHandleIndex, KFileServerPolicy);
 	if (r != KErrNone)
 		{
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCREATORRETURN2, "r %d", r);
 		return r;
 		}
 
 	//return(CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle)));
 	// Slot 1: Indicate Large File Supportis required.
 	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt64));
-
-	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
-
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILE64ADOPTFROMCREATORRETURN3, "r %d sess %x subs %x", (TUint) r, (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	return r;
 	}
 
@@ -2431,8 +2327,7 @@
 */
 EFSRV_EXPORT_C TInt RFile64::Read(TInt64 aPos, TDes8& aDes) const
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aDes.MaxLength());
-
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64READ8, "RFile::Read() sess %x subs %x aPos %x:%x maxdeslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aDes.MaxLength());
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 
 	TInt r;
@@ -2445,9 +2340,7 @@
 		TPckgC<TInt64> pkPos(aPos);
  		r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos));
 		}
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64READ8RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length());
 	return r;
 	}
 
@@ -2491,8 +2384,7 @@
 */
 EFSRV_EXPORT_C void RFile64::Read(TInt64 aPos, TDes8& aDes, TRequestStatus& aStatus) const
 	{
-	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aDes.MaxLength(), &aStatus);
-
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64READ10, "RFile::Read() sess %x subs %x aPos %x:%x maxlen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aDes.MaxLength());
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	if (!(I64HIGH(aPos+1)))
 		{
@@ -2503,8 +2395,7 @@
 		TPckgC<TInt64> pkPos(aPos);
 		RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos),aStatus);
 		}
-
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILE64READ10RETURN, "");
 	}
 
 
@@ -2550,8 +2441,7 @@
 */    	
 EFSRV_EXPORT_C TInt RFile64::Read(TInt64 aPos, TDes8& aDes, TInt aLength) const
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength);
-
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64READ15, "RFile::Read() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	if (aLength==0)
 		{
@@ -2573,9 +2463,7 @@
 		TPckgC<TInt64> pkPos(aPos);
 		r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
 		}
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64READ15RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length());
 	return r;
 	}
 
@@ -2628,8 +2516,7 @@
 */
 EFSRV_EXPORT_C void RFile64::Read(TInt64 aPos, TDes8& aDes, TInt aLength,TRequestStatus& aStatus) const
 	{
-	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength, &aStatus);
-
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64READ11, "RFile::Read() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	if (aLength==0)
 		{
@@ -2654,8 +2541,7 @@
 		TPckgC<TInt64> pkPos(aPos);
 		RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
 		}
-
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILE64READ11RETURN, "");
 	}
 
 
@@ -2687,8 +2573,7 @@
 */
 EFSRV_EXPORT_C TInt RFile64::Write(TInt64 aPos, const TDesC8& aDes)
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aDes.Length());
-
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64WRITE13, "RFile::Write() sess %x subs %x aPos %x:%x deslen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aDes.Length());
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 
 	TInt r;
@@ -2701,8 +2586,7 @@
 		TPckgC<TInt64> pkPos(aPos);
 		r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos));
 		}
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILE64WRITE13RETURN, "r %d", r);
 	return r;
 	}
 
@@ -2740,8 +2624,7 @@
 */
 EFSRV_EXPORT_C void RFile64::Write(TInt64 aPos, const TDesC8& aDes,TRequestStatus& aStatus)
 	{
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.Length(), &aStatus);
-
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64WRITE15, "RFile::Write() sess %x subs %x pos %x:%x len %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aDes.Length());
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	
 	if (!(I64HIGH(aPos+1)))
@@ -2753,8 +2636,7 @@
 		TPckgC<TInt64> pkPos(aPos);
 		RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos),aStatus);
 		}
-
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILE64WRITE15RETURN, "");
 	}
 
 
@@ -2786,8 +2668,7 @@
 */
 EFSRV_EXPORT_C TInt RFile64::Write(TInt64 aPos, const TDesC8& aDes,TInt aLength)
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
-
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64WRITE7, "RFile::Write() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	
 	TInt r;
@@ -2800,8 +2681,7 @@
 		TPckgC<TInt64> pkPos(aPos);
 		r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
 		}
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILE64WRITE7RETURN, "r %d", r);
 	return r;
 	}
 
@@ -2841,8 +2721,7 @@
 */
 EFSRV_EXPORT_C void RFile64::Write(TInt64 aPos, const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus)
 	{
-	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength, &aStatus);
-
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64WRITE11, "RFile::Write() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	
 	if (!(I64HIGH(aPos+1)))
@@ -2854,8 +2733,7 @@
 		TPckgC<TInt64> pkPos(aPos);
 		RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
 		}
-
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILE64WRITE11RETURN, "");
 	}
 
 
@@ -2902,13 +2780,11 @@
 */
 EFSRV_EXPORT_C TInt RFile64::Seek(TSeek aMode, TInt64& aPos) const
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileSeek, MODULEUID, Session().Handle(), SubSessionHandle(), aMode, aPos, 0);
-
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64SEEK2, "RFile::Seek() sess %x subs %x aMode %x aPos %x:%x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aMode, (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos));
 	TPckgC<TInt64> pkOffset(aPos);
 	TPckg<TInt64> pkNewPos(aPos);
  	TInt r = SendReceive(EFsFileSeek|KIpcArgSlot0Desc|KIpcArgSlot2Desc,TIpcArgs(&pkOffset,aMode,&pkNewPos));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSeekReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILE64SEEK2RETURN, "r %d", r);
 	return r;
 	}
 
@@ -2930,12 +2806,10 @@
 */
 EFSRV_EXPORT_C TInt RFile64::Size(TInt64& aSize) const
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileSize2, MODULEUID, Session().Handle(), SubSessionHandle());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64SIZE2, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
 	TPckg<TInt64> pkSize(aSize);
 	TInt r = SendReceive(EFsFileSize|KIpcArgSlot0Desc,TIpcArgs(&pkSize));
-
-	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileSize2Return, MODULEUID, r, I64LOW(aSize), I64HIGH(aSize));
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFILE64SIZE2RETURN, "r %d aSize %x:%x", (TUint) r, (TUint) I64HIGH(aSize), (TUint) I64LOW(aSize));
 	return r;
 	}
 
@@ -2971,12 +2845,10 @@
 */
 EFSRV_EXPORT_C TInt RFile64::SetSize(TInt64 aSize)
 	{
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileSetSize, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aSize), I64HIGH(aSize));
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64SETSIZE2, "sess %x subs %x aSize %x:%x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aSize), (TUint) I64LOW(aSize));
 	TPckgC<TInt64> pkSize(aSize);
 	TInt r = SendReceive(EFsFileSetSize|KIpcArgSlot0Desc, TIpcArgs(&pkSize));
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetSizeReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILE64SETSIZE2RETURN, "r %d", r);
 	return r;
 	}
 
@@ -3013,8 +2885,7 @@
 */
 EFSRV_EXPORT_C TInt RFile64::Lock(TInt64 aPos, TInt64 aLength) const
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileLock, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength);
-
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64LOCK, "RFile::Lock() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	TPckgC<TInt64> pkPos(aPos);
 	TPckgC<TInt64> pkLength(aLength);
@@ -3029,7 +2900,7 @@
 		r = SendReceive(EFsFileLock|KIpcArgSlot0Desc,TIpcArgs(&pkPos, I64LOW(aLength)));
 	else 
 		r = SendReceive(EFsFileLock|KIpcArgSlot0Desc|KIpcArgSlot1Desc,TIpcArgs(&pkPos, &pkLength));
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileLockReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILE64LOCKRETURN, "r %d", r);
 	return r;
 	}
 
@@ -3060,8 +2931,7 @@
 */
 EFSRV_EXPORT_C TInt RFile64::UnLock(TInt64 aPos, TInt64 aLength) const
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileUnLock, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength);
-
+	OstTraceExt5(TRACE_BORDER, EFSRV_EFILE64UNLOCK, "RFile::UnLock() sess %x subs %x aPos %x:%x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) I64HIGH(aPos), (TUint) I64LOW(aPos), (TUint) aLength);
 	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
 	
 	TPckgC<TInt64> pkPos(aPos);
@@ -3078,7 +2948,7 @@
 	else 
 		r = SendReceive(EFsFileUnLock|KIpcArgSlot0Desc|KIpcArgSlot1Desc,TIpcArgs(&pkPos, &pkLength));
 	
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileUnLockReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILE64UNLOCKRETURN, "r %d", r);
 	return r;
 	}
 
@@ -3122,8 +2992,7 @@
 */
 EFSRV_EXPORT_C TInt RFile64::Read(TUint aPos,TDes8& aDes) const
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.MaxLength());
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64READ14, "sess %x subs %x aPos %x maxlen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.MaxLength());
 	TInt r;
 	if(!(aPos + 1))
 		{
@@ -3135,9 +3004,7 @@
 		TPckgC<TInt64> pkPos(pos);
  		r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos));
 		}
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64READ14RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length());
 	return r;
 	}
 
@@ -3186,8 +3053,7 @@
 */
 EFSRV_EXPORT_C void RFile64::Read(TUint aPos,TDes8& aDes,TRequestStatus& aStatus) const
 	{
-	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.MaxLength(), &aStatus);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64READ12, "sess %x subs %x aPos %x maxlen %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.MaxLength());
 	if(!(aPos + 1))
 		{
 		RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos),aStatus);
@@ -3198,8 +3064,7 @@
 		TPckgC<TInt64> pkPos(pos);
 		RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos),aStatus);
 		}
-
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILE64READ12RETURN, "");
 	}
 
 
@@ -3251,8 +3116,7 @@
 */    
 EFSRV_EXPORT_C TInt RFile64::Read(TUint aPos,TDes8& aDes,TInt aLength) const
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64READ16, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
 	if (aLength==0)
 		{
 		aDes.Zero();
@@ -3274,9 +3138,7 @@
 		TPckgC<TInt64> pkPos(pos);
 		r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
 		}
-
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
-
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFILE64READ16RETURN, "r %d len %d", (TUint) r, (TUint) aDes.Length());
 	return r;
 	}
 
@@ -3335,8 +3197,7 @@
 */
 EFSRV_EXPORT_C void RFile64::Read(TUint aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const
 	{
-	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength, &aStatus);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64READ13, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
 	if (aLength==0)
 		{
 		aDes.Zero();
@@ -3361,8 +3222,7 @@
 		TPckgC<TInt64> pkPos(pos);
 		RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
 		}
-
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILE64READ13RETURN, "");
 	}
 
 
@@ -3400,8 +3260,7 @@
 */
 EFSRV_EXPORT_C TInt RFile64::Write(TUint aPos,const TDesC8& aDes)
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.Length());
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64WRITE14, "sess %x subs %x aPos %x len %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.Length());
 	TInt r;
 	if(!(aPos + 1))
 		{
@@ -3413,8 +3272,7 @@
 		TPckgC<TInt64> pkPos(pos);
 		r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos));
 		}
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILE64WRITE14RETURN, "r %d", r);
 	return r;
 	}
 
@@ -3458,8 +3316,7 @@
 */
 EFSRV_EXPORT_C void RFile64::Write(TUint aPos,const TDesC8& aDes,TRequestStatus& aStatus)
 	{
-	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.Length(), &aStatus);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64WRITE16, "sess %x subs %x pos %x len %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aDes.Length());
 	if(!(aPos + 1))
 		{
 		RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos),aStatus);
@@ -3470,7 +3327,7 @@
 		TPckgC<TInt64> pkPos(pos);
 		RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos),aStatus);
 		}
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILE64WRITE16RETURN, "");
 	}
 
 
@@ -3508,8 +3365,7 @@
 */
 EFSRV_EXPORT_C TInt RFile64::Write(TUint aPos,const TDesC8& aDes,TInt aLength)
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64WRITE8, "sess %x subs %x aPos %x aLength %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
 	TInt r;
 	if(!(aPos + 1))
 		{
@@ -3521,8 +3377,7 @@
 		TPckgC<TInt64> pkPos(pos);
 		r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
 		}
-
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFILE64WRITE8RETURN, "r %d", r);
 	return r;
 	}
 
@@ -3569,8 +3424,7 @@
 */
 EFSRV_EXPORT_C void RFile64::Write(TUint aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus)
 	{
-	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength, &aStatus);
-
+	OstTraceExt4(TRACE_BORDER, EFSRV_EFILE64WRITE12, "sess %x subs %x aPos %x len %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aPos, (TUint) aLength);
 	if(!(aPos + 1))
 		{
 		RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos),aStatus);
@@ -3581,7 +3435,7 @@
 		TPckgC<TInt64> pkPos(pos);
 		RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
 		}
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFILE64WRITE12RETURN, "");
 	}
 #else
 EFSRV_EXPORT_C TInt RFile64::Open(RFs& /*aFs*/,const TDesC& /*aName*/,TUint /*aFileMode*/)
--- a/userlibandfileserver/fileserver/sfsrv/cl_fman.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfsrv/cl_fman.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -15,21 +15,10 @@
 
 #include "cl_std.h"
 
-#define RETURNIFERROR(a,b,t)  					\
-	{											\
-	if ((a=b)!=KErrNone)						\
-		{										\
-		if(iStatus)								\
-			User::RequestComplete(iStatus,a);	\
-		TInt _t = t;							\
-		if (_t)	{TRACE1(UTF::EBorder, t, MODULEUID, a);}	\
-		return(a);								\
-		}										\
-	}
-
-#define RETURNIFERRORD(a,b,t)  		 			\
-	TInt a; 									\
-	RETURNIFERROR(a,b,t)
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cl_fmanTraces.h"
+#endif
+
 
 const TUint KRecurseFlag	=	0x40000000;
 const TUint KScanDownFlag	=	0x20000000;
@@ -528,14 +517,14 @@
 @return Newly created CFileMan object.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManNewL1, MODULEUID, aFs.Handle());
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANNEWL1, "sess %x", aFs.Handle());
 
 	CFileMan* fileMan=new(ELeave) CFileMan(aFs);
 	CleanupStack::PushL(fileMan);
 	fileMan->CFileBase::ConstructL();
 	CleanupStack::Pop();
 
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManNewL1Return, MODULEUID, fileMan);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANNEWL1RETURN, "CFileMan* %x", fileMan);
 	return fileMan;
 	}
 
@@ -552,7 +541,7 @@
 @return Newly created CFileMan object.
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::ECFileManNewL2, MODULEUID, aFs.Handle(), anObserver);
+	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANNEWL2, "sess %x anObserver %x", (TUint) aFs.Handle(), (TUint) anObserver);
 
 	CFileMan* fileMan=new(ELeave) CFileMan(aFs);
 	CleanupStack::PushL(fileMan);
@@ -560,7 +549,7 @@
 	CleanupStack::Pop();
 	fileMan->SetObserver(anObserver);
 
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManNewL2Return, MODULEUID, fileMan);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANNEWL2RETURN, "CFileMan* %x", fileMan);
 	return fileMan;
 	}
 
@@ -576,9 +565,9 @@
 	}
 CFileMan::~CFileMan()
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManDestructor, MODULEUID, this);
-
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::ECFileManDestructorReturn, MODULEUID);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANDESTRUCTOR, "this %x", this);
+
+	OstTrace0(TRACE_BORDER, EFSRV_ECFILEMANDESTRUCTORRETURN, "");
 	}
 
 
@@ -589,7 +578,7 @@
 @return The action which CFileMan is carrying out.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCurrentAction, MODULEUID, this);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCURRENTACTION, "this %x", this);
 
 	TAction action = ENone;
 
@@ -628,7 +617,7 @@
 		Panic(EFManUnknownAction);
 		}
 
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCurrentActionReturn, MODULEUID, action);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCURRENTACTIONRETURN, "action %d", action);
 	return (action);
 	}
 
@@ -646,11 +635,12 @@
                 the current CFileMan operation
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManGetCurrentTarget, MODULEUID, this);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANGETCURRENTTARGET, "this %x", this);
 
 	GetSrcAndTrg(iTmpParse, aTrgName);
 
-	TRACEMULT1(UTF::EBorder, UTraceModuleEfsrv::ECFileManGetCurrentTargetReturn, MODULEUID, aTrgName);
+	OstTrace0(TRACE_BORDER, EFSRV_ECFILEMANGETCURRENTTARGETRETURN, "");
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANGETCURRENTTARGET_EFILENAME, "FileName %S", aTrgName.Ptr(), aTrgName.Length()<<1);
 	}
 
 
@@ -667,13 +657,14 @@
                 CFileMan operation.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManGetCurrentSource, MODULEUID, this);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANGETCURRENTSOURCE, "this %x", this);
 
     TPtrC fullPath(FullPath());
 	iTmpParse.Set(CurrentEntry().iName, &fullPath, NULL);
 	aSrcName = iTmpParse.FullName();
 
-	TRACEMULT1(UTF::EBorder, UTraceModuleEfsrv::ECFileManGetCurrentSourceReturn, MODULEUID, aSrcName);
+	OstTrace0(TRACE_BORDER, EFSRV_ECFILEMANGETCURRENTSOURCERETURN, "");
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANGETCURRENTSOURCE_EFILENAME, "FileName %S", aSrcName.Ptr(), aSrcName.Length()<<1);
 	}
 
 void CFileMan::GetSrcAndTrg(TParse& aSrcName,TFileName& aTrgName)
@@ -734,7 +725,7 @@
 @return The number of bytes transferred.
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::ECFileManBytesTransferredByCopyStep, MODULEUID, this, iBytesTransferred);
+	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANBYTESTRANSFERREDBYCOPYSTEP, "this %x BytesTransferred %d", (TUint) this, (TUint) iBytesTransferred);
 
 	return(iBytesTransferred);
 	}
@@ -904,8 +895,9 @@
 
 */
 	{
-	TRACEMULT8(UTF::EBorder, UTraceModuleEfsrv::ECFileManAttribs1, MODULEUID,
-		(TUint) this, aName, aSetMask, aClearMask, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()), aSwitches, (TUint) &aStatus);
+	OstTraceExt5(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS1A, "this %x aSetMask %x aClearMask %x aSwitches %d status %x", (TUint) this, (TUint) aSetMask, (TUint) aClearMask, (TUint) aSwitches, (TUint) &aStatus);
+	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS1B, "aTime %x:%x ", (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()));
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS1A_EFILEPATH, "FilePath %S", aName.Ptr(), aName.Length()<<1);
 
 	TInt r;
 	if (iSwitches&KFManBusyFlag)
@@ -918,7 +910,8 @@
 		r = Attribs(aName,aSetMask,aClearMask,aTime,aSwitches);
 		}
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManAttribs1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS1RETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -974,8 +967,9 @@
 
 */
 	{
-	TRACEMULT7(UTF::EBorder, UTraceModuleEfsrv::ECFileManAttribs2, MODULEUID,
-		(TUint) this, aName, aSetMask, aClearMask, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()), aSwitches);
+	OstTraceExt4(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS2A, "this %x aSetMask %x aClearMask %x aSwitches %x", (TUint) this, (TUint) aSetMask, (TUint) aClearMask, (TUint) aSwitches);
+	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS2B, "aTime %x:%x ", (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()));
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS2A_EFILEPATH, "FilePath %S", aName.Ptr(), aName.Length()<<1);
 
 	TInt ret;
 	if (iSwitches&KFManBusyFlag)
@@ -985,7 +979,15 @@
 	else
 		{
 		SetFlags(aSwitches&EOverWrite,aSwitches&ERecurse,ETrue,EFalse);
-		RETURNIFERRORD(r,iFs.Parse(aName,iSrcFile),UTraceModuleEfsrv::ECFileManAttribs2Return);
+		TInt r;
+		if ((r = iFs.Parse(aName,iSrcFile)) != KErrNone)
+			{
+			if(iStatus)
+				User::RequestComplete(iStatus,r);
+			OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS2RETURN1, "r %d", r);
+			return r;
+			}
+
 		iSetMask=aSetMask;
 		iClearMask=aClearMask;
 		iTime=aTime;
@@ -997,7 +999,8 @@
 		DoSynchronize(r);
 		}
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManAttribs2Return, MODULEUID, ret);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANATTRIBS2RETURN2, "r %d", ret);
+
 	return(ret);
 	}
 
@@ -1037,8 +1040,9 @@
 
 */
 	{
-	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy1, MODULEUID,
-		(TUint) this, anOld, aNew, aSwitches, (TUint) &aStatus);
+	OstTraceExt3(TRACE_BORDER, EFSRV_ECFILEMANCOPY1, "this %x aSwitches %x status %x", (TUint) this, (TUint) aSwitches, (TUint) &aStatus);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANCOPY1_EOLDNAME, "OldName %S", anOld.Ptr(), anOld.Length()<<1);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANCOPY1_ENEWNAME, "NewName %S", aNew.Ptr(), aNew.Length()<<1);
 
 	TInt r;
 	if (iSwitches&KFManBusyFlag)
@@ -1049,7 +1053,8 @@
 		r = Copy(anOld,aNew,aSwitches);
 		}
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY1RETURN, "r %d", r);
+
 	return(r);
 	}
 
@@ -1089,6 +1094,31 @@
 including any directories in the path specified by aNew which do not
 already exist.
 
+If the source (anOld) is a FILE and the recursive operation is set,
+then all the files with the same name as anOld in the source directory
+including those in subdirectories will be copied to the destination.
+
+For example, the initial directory structure is as follows:
+C:\dir1\file.txt
+C:\dir1\subdirA\file.txt
+C:\dir1\subdirB\file.txt
+
+@code
+CFileMan* fm(CFileMan::NewL(iFs));	// Where iFs is an RFs handle
+fm->Copy(_L("C:\\dir1\\file.txt"), _L("C:\\dir2\\file.txt"), CFileMan::ERecurse);
+// OR without specifying the filename in aNew:
+fm->Copy(_L("C:\\dir1\\file.txt"), _L("C:\\dir2\\"), CFileMan::ERecurse);
+@endcode
+
+Because of the recursive behaviour, the final directory structure after
+either one of the copy operations above will be as follows:
+C:\dir1\file.txt
+C:\dir1\subdirA\file.txt
+C:\dir1\subdirB\file.txt
+C:\dir2\file.txt
+C:\dir2\subdirA\file.txt
+C:\dir2\subdirB\file.txt
+
 If recursive operation is not set, only the matching files located in
 the single directory specified in anOld are copied.
 No intermediate directories will be created; if any directories in
@@ -1122,13 +1152,13 @@
  1.2	If there is no file to operate on i.e. if source directory is empty, the
  	function will do nothing and return error code KErrNotFound.
 
- 2. Files can be copied across drives.
-
- 3. Open files can be copied if they have been opened using
-      the EFileShareReadersOnly file share mode.
-
- 4. Read-only, hidden and system files can be copied and
-   the source file's attributes are preserved in the target file.
+ 2.	Files can be copied across drives.
+
+ 3.	Open files can be copied if they have been opened using
+	the EFileShareReadersOnly file share mode.
+
+ 4.	Read-only, hidden and system files can be copied and
+	the source file's attributes are preserved in the target file.
 
 @param anOld     Path indicating the file(s) to be copied.
                  Any path components which are not specified here will be
@@ -1153,21 +1183,38 @@
 
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy2, MODULEUID, (TUint) this, anOld, aNew, aSwitches);
+	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANCOPY2, "this %x aSwitches %d", (TUint) this, (TUint) aSwitches);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANCOPY2_EOLDNAME, "OldName %S", anOld.Ptr(), anOld.Length()<<1);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANCOPY2_ENEWNAME, "NewName %S", aNew.Ptr(), aNew.Length()<<1);
 
 	if (iSwitches&KFManBusyFlag)
 		{
-		TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy2Return, MODULEUID, KErrInUse);
+		OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY2RETURN1, "r %d", KErrInUse);
 		return(KErrInUse);
 		}
 	SetFlags(aSwitches&EOverWrite,aSwitches&ERecurse,ETrue,EFalse);
-	RETURNIFERRORD(r,iFs.Parse(anOld,iSrcFile),UTraceModuleEfsrv::ECFileManCopy2Return);
-	RETURNIFERROR(r,iFs.Parse(aNew,_L("*"),iTrgFile),UTraceModuleEfsrv::ECFileManCopy2Return);
+	TInt r;
+	if ((r = iFs.Parse(anOld,iSrcFile)) != KErrNone)
+		{
+		if(iStatus)
+			User::RequestComplete(iStatus,r);
+		OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY2RETURN2, "r %d", r);
+		return r;
+		}
+
+	if ((r = iFs.Parse(aNew,_L("*"),iTrgFile)) != KErrNone)
+		{
+		if(iStatus)
+			User::RequestComplete(iStatus,r);
+		OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY2RETURN3, "r %d", r);
+		return r;
+		}
+
 	CheckForDirectory();
 
 	if((iSwitches&KRecurseFlag) && iTrgFile.DriveAndPath().MatchF(iSrcFile.FullName()) != KErrNotFound)
 		{
-		TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy2Return, MODULEUID, KErrArgument);
+		OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY2RETURN4, "r %d", KErrArgument);
 		return(KErrArgument);
 		}
 
@@ -1178,7 +1225,8 @@
 	TInt ret=(r==KErrNone) ? iLastError : r;
 	DoSynchronize(r);
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy2Return, MODULEUID, ret);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY2RETURN5, "r %d", ret);
+
 	return(ret);
 	}
 
@@ -1218,7 +1266,8 @@
 @see KNullDesC
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::ECFileManDelete1, MODULEUID, (TUint) this, aName, aSwitches, (TUint) &aStatus);
+	OstTraceExt3(TRACE_BORDER, EFSRV_ECFILEMANDELETE1, "this %x aSwitches %x status %x", (TUint) this, (TUint) aSwitches, (TUint) &aStatus);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANDELETE1_EFILEPATH, "FilePath %S", aName.Ptr(), aName.Length()<<1);
 
 	TInt r;
 	if (iSwitches&KFManBusyFlag)
@@ -1231,7 +1280,8 @@
 		r = Delete(aName,aSwitches);
 		}
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManDelete1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANDELETE1RETURN, "r %d", r);
+
 	return(r);
 	}
 
@@ -1278,7 +1328,8 @@
 @see KNullDesC
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::ECFileManDelete2, MODULEUID, (TUint) this, aName, aSwitches);
+	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANDELETE2, "this %x aSwitches %d", (TUint) this, (TUint) aSwitches);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANDELETE2_EFILEPATH, "FilePath %S", aName.Ptr(), aName.Length()<<1);
 
 	TInt ret;
 	if (iSwitches&KFManBusyFlag)
@@ -1288,7 +1339,15 @@
 	else
 		{
 		SetFlags(aSwitches&EOverWrite,aSwitches&ERecurse,ETrue,EFalse);
-		RETURNIFERRORD(r,iFs.Parse(aName,iSrcFile),UTraceModuleEfsrv::ECFileManDelete2Return);
+		TInt r;
+		if ((r = iFs.Parse(aName,iSrcFile)) != KErrNone)
+			{
+			if(iStatus)
+				User::RequestComplete(iStatus,r);
+			OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANDELETE2RETURN1, "() r %d", r);
+			return r;
+			}
+
 		iAction = EInternalDelete;
 		iMatchEntry=KEntryAttHidden|KEntryAttMatchExclude|KEntryAttDir;
 	//	Exclude directories and system files - include hidden files
@@ -1298,7 +1357,8 @@
 		DoSynchronize(r);
 		}
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManDelete2Return, MODULEUID, ret);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANDELETE2RETURN2, "() r %d", ret);
+
 	return(ret);
 	}
 
@@ -1342,8 +1402,9 @@
 
 */
 	{
-	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::ECFileManMove1, MODULEUID,
-		(TUint) this, anOld, aNew, aSwitches, (TUint) &aStatus);
+	OstTraceExt3(TRACE_BORDER, EFSRV_ECFILEMANMOVE1, "this %x aSwitches %x status %x", (TUint) this, (TUint) aSwitches, (TUint) &aStatus);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANMOVE1_EOLDNAME, "OldName %S", anOld.Ptr(), anOld.Length()<<1);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANMOVE1_ENEWNAME, "NewName %S", aNew.Ptr(), aNew.Length()<<1);
 
 	TInt r;
 	if (iSwitches&KFManBusyFlag)
@@ -1356,7 +1417,8 @@
 		r = Move(anOld,aNew,aSwitches);
 		}
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManMove1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANMOVE1RETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -1393,7 +1455,7 @@
   recursively by default and moves both the last directory level and all of its content.
   Notice that no trailing backslash ("\") implies moving files recursively automatically.
 
-For example, if the directory level "b" contains the files F1,F2 and F3, then:
+For example, if the directory level "b" contains the files F1, F2 and F3, then:
 @code
 CFileMan* fm(CFileMan::NewL(iFs)); // Where iFs is an RFs handle
 ...
@@ -1421,7 +1483,7 @@
 0 is passed as an argument, the operation behaves the same way as by passing
 CFileMan::ERecurse flag.
 
-for example:
+For example:
 @code
 CFileMan* fm(CFileMan::NewL(iFs)); // Where iFs is an RFs handle
 ...
@@ -1436,6 +1498,31 @@
 fm->Move(_L("C:\\a\\b"), _L("C:\\x\\y\\"), CFileMan::ERecurse);
 @endcode
 
+If the source (anOld) is a FILE and the recursive operation is set,
+then all the files with the same name as anOld in the source directory
+including those in subdirectories will be moved to the destination.
+
+For example, the initial directory structure is as follows:
+C:\src\file.txt
+C:\src\subdirA\file.txt
+C:\src\subdirB\file.txt
+
+@code
+CFileMan* fm(CFileMan::NewL(iFs));	// Where iFs is an RFs handle
+fm->Move(_L("C:\\src\\file.txt"), _L("C:\\dest\\file.txt"), CFileMan::ERecurse);
+// OR without specifying the filename in aNew:
+fm->Move(_L("C:\\src\\file.txt"), _L("C:\\dest\\"), CFileMan::ERecurse);
+@endcode
+
+Because of the recursive behaviour, the final directory structure after
+either one of the move operations above will be as follows:
+C:\src\
+C:\src\subdirA\
+C:\src\subdirB\
+C:\dest\file.txt
+C:\dest\subdirA\file.txt
+C:\dest\subdirB\file.txt
+
 Notes:
 
 -# Read-only, hidden and system files can be moved and the source file's
@@ -1443,7 +1530,7 @@
    be moved. Attempting to move an open file will return an error for
    that file, as retrieved by CFileBase::GetLastError().
 
-@param anOld	 Path indicating the files to be moved. May be either a full path, or
+@param anOld	 Path indicating the directory/files to be moved. May be either a full path, or
 				 relative to the session path. Note that if you specify a directory level,
 				 then the behaviour of the move operation is sensitive to the presence
 				 (or absence) of a trailing backslash ("\") character. Any path components
@@ -1471,20 +1558,36 @@
 @see CFileBase::GetLastError()
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::ECFileManMove2, MODULEUID,
-		(TUint) this, anOld, aNew, aSwitches);
+	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANMOVE2, "this %x aSwitches %d", (TUint) this, (TUint) aSwitches);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANMOVE2_EOLDNAME, "OldName %S", anOld.Ptr(), anOld.Length()<<1);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANMOVE2_ENEWNAME, "NewName %S", aNew.Ptr(), aNew.Length()<<1);
 
 
 	if (iSwitches&KFManBusyFlag)
 		{
-		TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECFileManMove2Return, MODULEUID, KErrInUse);
+		OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANMOVE2RETURN1, "r %d", KErrInUse);
 		return(KErrInUse);
 		}
 
 	iNumberOfFilesProcessed = 0;
 
-	RETURNIFERRORD(r,iFs.Parse(anOld,iSrcFile),UTraceModuleEfsrv::ECFileManMove2Return);
-	RETURNIFERROR(r,iFs.Parse(aNew,_L("*"),iTrgFile),UTraceModuleEfsrv::ECFileManMove2Return);
+	TInt r;
+	if ((r = iFs.Parse(anOld,iSrcFile)) != KErrNone)
+		{
+		if(iStatus)
+			User::RequestComplete(iStatus,r);
+		OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANMOVE2RETURN2, "r %d", r);
+		return r;
+		}
+
+	if ((r = iFs.Parse(aNew,_L("*"),iTrgFile)) != KErrNone)
+		{
+		if(iStatus)
+			User::RequestComplete(iStatus,r);
+		OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANMOVE2RETURN3, "r %d", r);
+		return r;
+		}
+
 
 	TInt ret = KErrNone;
 	TBool aComplete = EFalse;
@@ -1503,7 +1606,7 @@
 			{
 			User::RequestComplete(iStatus, ret);
 			}
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManMove2Return, MODULEUID, ret);
+		OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANMOVE2RETURN4, "r %d", ret);
 		return(ret);
 		}
 
@@ -1518,7 +1621,8 @@
 	ret = (r==KErrNone) ? iLastError : r;
 	DoSynchronize(r);
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManMove2Return, MODULEUID, ret);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANMOVE2RETURN5, "r %d", ret);
+
 	return(ret);
 	}
 
@@ -1865,8 +1969,9 @@
 
 */
 	{
-	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::ECFileManRename1, MODULEUID,
-		(TUint) this, aName, aNewName, aSwitches, (TUint) &aStatus);
+	OstTraceExt3(TRACE_BORDER, EFSRV_ECFILEMANRENAME1, "this %x aSwitches %x status %x", (TUint) this, (TUint) aSwitches, (TUint) &aStatus);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRENAME1_EOLDNAME, "OldName %S", aName.Ptr(), aName.Length()<<1);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRENAME1_ENEWNAME, "NewName %S", aNewName.Ptr(), aNewName.Length()<<1);
 
 	TInt r;
 	if (iSwitches&KFManBusyFlag)
@@ -1879,7 +1984,8 @@
 		r = Rename(aName,aNewName,aSwitches);
 		}
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManRename1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRENAME1RETURN, "r %d", r);
+
 	return(r);
 	}
 
@@ -2045,8 +2151,9 @@
 
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::ECFileManRename2, MODULEUID,
-		(TUint) this, aName, aNewName, aSwitches);
+	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANRENAME2, "this %x aSwitches %d", (TUint) this, (TUint) aSwitches);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRENAME2_EOLDNAME, "OldName %S", aName.Ptr(), aName.Length()<<1);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRENAME2_ENEWNAME, "NewName %S", aNewName.Ptr(), aNewName.Length()<<1);
 
 	TInt ret;
 	if (iSwitches&KFManBusyFlag)
@@ -2056,8 +2163,22 @@
 	else
 		{
 		SetFlags(aSwitches&EOverWrite,EFalse,ETrue,EFalse);
-		RETURNIFERRORD(r,iFs.Parse(aName,iSrcFile),UTraceModuleEfsrv::ECFileManRename2Return);
-		RETURNIFERROR(r,iFs.Parse(aNewName,_L("*"),iTrgFile),UTraceModuleEfsrv::ECFileManRename2Return);
+		TInt r;
+		if ((r = iFs.Parse(aName,iSrcFile)) != KErrNone)
+			{
+			if(iStatus)
+				User::RequestComplete(iStatus,r);
+			OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRENAME2RETURN1, "r %d", r);
+			return r;
+			}
+
+		if ((r = iFs.Parse(aNewName,_L("*"),iTrgFile)) != KErrNone)
+			{
+			if(iStatus)
+				User::RequestComplete(iStatus,r);
+			OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRENAME2RETURN2, "r %d", r);
+			return r;
+			}
 
 		iAction = EInternalRename;
 		iMatchEntry=KEntryAttMaskSupported;
@@ -2067,7 +2188,8 @@
 		DoSynchronize(r);
 		}
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManRename2Return, MODULEUID, ret);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRENAME2RETURN3, "r %d", ret);
+
 	return(ret);
 	}
 
@@ -2097,7 +2219,8 @@
 
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::ECFileManRmDir1, MODULEUID, (TUint) this, aDirName, (TUint) &aStatus);
+	OstTraceExt2(TRACE_BORDER, EFSRV_ECFILEMANRMDIR1, "this %x status %x", (TUint) this, (TUint) &aStatus);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRMDIR1_EDIRNAME, "Dir %S", aDirName.Ptr(), aDirName.Length()<<1);
 
 	TInt r;
 	if (iSwitches&KFManBusyFlag)
@@ -2110,7 +2233,8 @@
 		r = RmDir(aDirName);
 		}
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManRmDir1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRMDIR1RETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -2145,7 +2269,8 @@
 
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::ECFileManRmDir2, MODULEUID, (TUint) this, aDirName);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRMDIR2, "this %x", (TUint) this);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANRMDIR2_EDIRNAME, "Dir %S", aDirName.Ptr(), aDirName.Length()<<1);
 
 	TInt ret;
 	if (iSwitches&KFManBusyFlag)
@@ -2155,7 +2280,15 @@
 	else
 		{
 		SetFlags(ETrue,ETrue,EFalse,EFalse);
-		RETURNIFERRORD(r,iFs.Parse(aDirName,iTrgFile),UTraceModuleEfsrv::ECFileManRmDir2Return);
+		TInt r;
+		if ((r = iFs.Parse(aDirName,iTrgFile)) != KErrNone)
+			{
+			if(iStatus)
+				User::RequestComplete(iStatus,r);
+			OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRMDIR2RETURN1, "r %d", r);
+			return r;
+			}
+
 		iSrcFile.Set(iTrgFile.DriveAndPath(),NULL,NULL);
 		iAction = EInternalRmDir;
 		iMatchEntry=KEntryAttMaskSupported;
@@ -2165,7 +2298,8 @@
 		ret = (r!=KErrNone) ? iLastError : KErrNone;
 		}
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManRmDir2Return, MODULEUID, ret);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANRMDIR2RETURN2, "r %d", ret);
+
 	return ret;
 	}
 
@@ -2563,8 +2697,8 @@
 @capability Dependent If the path for aNew begins with /Resource then Tcb capability is required.
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy3, MODULEUID,
-		(TUint) this, anOld.SubSessionHandle(), aNew, aSwitches);
+	OstTraceExt3(TRACE_BORDER, EFSRV_ECFILEMANCOPY3, "this %x anOldSubs %x aSwitches %x", (TUint) this, (TUint) anOld.SubSessionHandle(), (TUint) aSwitches);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANCOPY3_ENEWNAME, "NewName %S", aNew.Ptr(), aNew.Length()<<1);
 
 	TInt ret;
 	if (iSwitches&KFManBusyFlag)
@@ -2586,11 +2720,23 @@
 		iSwitches|= KCopyFromHandle;
 
 		TInt r;
-		RETURNIFERROR(r, iFs.Parse(aNew, iTrgFile),UTraceModuleEfsrv::ECFileManCopy3Return);
+		if ((r = iFs.Parse(aNew, iTrgFile)) != KErrNone)
+			{
+			if(iStatus)
+				User::RequestComplete(iStatus,r);
+			OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY3RETURN1, "r %d", r);
+			return r;
+			}
 
 		// Need to duplicate the RFile handle so that any threads owned
 		// by this process can use it - i.e. the worker thread
-		RETURNIFERROR(r, iSrcFileHandle.Duplicate(anOld, EOwnerProcess),UTraceModuleEfsrv::ECFileManCopy3Return);
+		if ((r = iSrcFileHandle.Duplicate(anOld, EOwnerProcess)) != KErrNone)
+			{
+			if(iStatus)
+				User::RequestComplete(iStatus,r);
+			OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY3RETURN2, "r %d", r);
+			return r;
+			}
 
 		iAction = EInternalCopyFromHandle;
 		iNumberOfFilesProcessed = 0;
@@ -2599,7 +2745,8 @@
 		DoSynchronize(r);
 		}
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy3Return, MODULEUID, ret);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY3RETURN3, "r %d", ret);
+
 	return(ret);
 	}
 
@@ -2635,8 +2782,8 @@
 @capability Dependent If the path for aNew begins with /Resource then Tcb capability is required.
 */
 	{
-	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy4, MODULEUID,
-		(TUint) this, anOld.SubSessionHandle(), aNew, aSwitches, (TUint) &aStatus);
+	OstTraceExt4(TRACE_BORDER, EFSRV_ECFILEMANCOPY4, "this %x anOldSubs %x aSwitches %dstatus %x", (TUint) this, (TUint) anOld.SubSessionHandle(), (TUint) aSwitches, (TUint) &aStatus);
+	OstTraceData(TRACE_BORDER, EFSRV_ECFILEMANCOPY4_ENEWNAME, "NewName %S", aNew.Ptr(), aNew.Length()<<1);
 
 	TInt r;
 	if (iSwitches&KFManBusyFlag)
@@ -2649,7 +2796,8 @@
 		r = Copy(anOld,aNew,aSwitches);
 		}
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECFileManCopy4Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_ECFILEMANCOPY4RETURN, "r %d", r);
+
 	return(r);
 	}
 
@@ -2711,8 +2859,21 @@
 	{
 	TInt64 rem;
 #endif
-	RETURNIFERRORD(r,aSrcFile.Size(rem),EFalse);
-	RETURNIFERROR(r, aDstFile.SetSize(rem),EFalse);
+	TInt r;
+	if ((r = aSrcFile.Size(rem)) != KErrNone)
+		{
+		if(iStatus)
+			User::RequestComplete(iStatus,r);
+		return r;
+		}
+
+
+	if ((r = aDstFile.SetSize(rem)) != KErrNone)
+		{
+		if(iStatus)
+			User::RequestComplete(iStatus,r);
+		return r;
+		}
 
 	HBufC8* bufPtr = NULL;
 	bufPtr = AllocateBuffer(rem);
--- a/userlibandfileserver/fileserver/sfsrv/cl_fmt.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfsrv/cl_fmt.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -17,6 +17,10 @@
 
 #include "cl_std.h"
 
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cl_fmtTraces.h"
+#endif
+
 
 
 
@@ -48,12 +52,14 @@
 
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFormat1Open, MODULEUID, aFs.Handle(), aName, aFormatMode);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFORMAT1OPEN, "sess %x aFormatMode %x", (TUint) aFs.Handle(), (TUint) aFormatMode);
+	OstTraceData(TRACE_BORDER, EFSRV_EFORMAT1OPEN_EDRIVENAME, "DriveName %S", aName.Ptr(), aName.Length()<<1);
 
 	TPtr8 c((TUint8*)&aCount,sizeof(TUint),sizeof(TUint));
 	TInt r = CreateSubSession(aFs,EFsFormatOpen,TIpcArgs(&aName,aFormatMode,&c));
 
-	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFormatOpen1Return, MODULEUID, r, SubSessionHandle(), aCount);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFORMATOPEN1RETURN, "r %d subs %x aCount %d", (TUint) r, (TUint) SubSessionHandle(), (TUint) aCount);
+
 	return r;
 	}
 
@@ -86,7 +92,8 @@
 @capability DiskAdmin
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFormat2Open, MODULEUID, aFs.Handle(), aName, aFormatMode, TUint(&aInfo));
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFORMAT2OPEN, "sess %x aFormatMode %x aInfo %x", (TUint) aFs.Handle(), (TUint) aFormatMode, (TUint) TUint(&aInfo));
+	OstTraceData(TRACE_BORDER, EFSRV_EFORMAT2OPEN_EDRIVENAME, "DriveName %S", aName.Ptr(), aName.Length()<<1);
 
 	TInt size = sizeof(TUint)+aInfo.Length();
 	TUint8* buf = new TUint8[size];
@@ -106,7 +113,8 @@
 		delete[] buf;
 		}
 
-	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFormatOpen2Return, MODULEUID, r, SubSessionHandle(), aCount);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFORMATOPEN2RETURN, "r %d subs %x aCount %d", (TUint) r, (TUint) SubSessionHandle(), (TUint) aCount);
+
 	return r;
 	}
 
@@ -122,11 +130,11 @@
 it completed successfully or not.
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFormatClose, MODULEUID, Session().Handle(), SubSessionHandle());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFORMATCLOSE, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
 
 	CloseSubSession(EFsFormatSubClose);
 	
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFormatCloseReturn, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFORMATCLOSERETURN, "");
 	}
 
 
@@ -152,12 +160,13 @@
 
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFormatNext1, MODULEUID, Session().Handle(), SubSessionHandle());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFORMATNEXT1, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
 
 	TPckg<TInt> e(aStep);
 	TInt r = SendReceive(EFsFormatNext,TIpcArgs(&e));
 
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFormatNext1Return, MODULEUID, r, aStep);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFORMATNEXT1RETURN, "r %d aStep %d", (TUint) r, (TUint) aStep);
+
 	return r;
 	}
 
@@ -187,9 +196,9 @@
 
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFormatNext2, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFORMATNEXT2, "sess %x subs %x status %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) &aStatus);
 
 	SendReceive(EFsFormatNext,TIpcArgs(&aStep),aStatus);
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFormatNext2Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EFORMATNEXT2RETURN, "");
 	}
--- a/userlibandfileserver/fileserver/sfsrv/cl_main.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfsrv/cl_main.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -17,12 +17,16 @@
 
 #include "cl_std.h"
 
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cl_mainTraces.h"
+#endif
+
 GLDEF_C void Panic(TClientPanic aPanic)
 //
 // Panic the current client with a file server client side panic.
 //
 	{
-	TRACE1(UTF::EPanic, UTraceModuleEfsrv::EPanic, MODULEUID, aPanic);
+	OstTrace1(TRACE_PANIC, EFSRV_EPANIC, "%d", aPanic);
 
 	User::Panic(_L("FSCLIENT panic"),aPanic);
 	}
--- a/userlibandfileserver/fileserver/sfsrv/cl_plugin.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfsrv/cl_plugin.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -17,6 +17,10 @@
 
 #include "cl_std.h"
 
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cl_pluginTraces.h"
+#endif
+
  
 EXPORT_C TInt RFs::AddPlugin(const TDesC& aFileName) const
 /**
@@ -31,7 +35,8 @@
 @capability DiskAdmin
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsAddPlugin, MODULEUID, Handle(), aFileName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSADDPLUGIN, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSADDPLUGIN_EFILENAME, "FileName %S", aFileName.Ptr(), aFileName.Length()<<1);
 
 	RLoader loader;
 	TInt r = loader.Connect();
@@ -41,7 +46,8 @@
 		loader.Close();
 		}
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsAddPluginReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSADDPLUGINRETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -60,11 +66,13 @@
 @capability DiskAdmin
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRemovePlugin, MODULEUID, Handle(), aPluginName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSREMOVEPLUGIN, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSREMOVEPLUGIN_EPLUGINNAME, "PluginName %S", aPluginName.Ptr(), aPluginName.Length()<<1);
 
 	TInt r = SendReceive(EFsRemovePlugin,TIpcArgs(&aPluginName));
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRemovePluginReturn, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSREMOVEPLUGINRETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -95,11 +103,13 @@
 @capability DiskAdmin      
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsMountPlugin1, MODULEUID, Handle(), aPluginName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSMOUNTPLUGIN1, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSMOUNTPLUGIN1_EPLUGINNAME, "PluginName %S", aPluginName.Ptr(), aPluginName.Length()<<1);
 
 	TInt r = SendReceive(EFsMountPlugin,TIpcArgs(&aPluginName,KPluginAutoAttach,KPluginAutoLocate));
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountPlugin1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSMOUNTPLUGIN1RETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -131,11 +141,13 @@
 @capability DiskAdmin      
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsMountPlugin2, MODULEUID, Handle(), aPluginName, aDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSMOUNTPLUGIN2, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSMOUNTPLUGIN2_EPLUGINNAME, "PluginName %S", aPluginName.Ptr(), aPluginName.Length()<<1);
 
 	TInt r = SendReceive(EFsMountPlugin,TIpcArgs(&aPluginName,aDrive,KPluginAutoLocate));
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountPlugin2Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSMOUNTPLUGIN2RETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -175,11 +187,13 @@
 @capability DiskAdmin        
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsMountPlugin3, MODULEUID, Handle(), aPluginName, aDrive, aPos);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSMOUNTPLUGIN3, "sess %x aDrive %d aPos %x", (TUint) Handle(), (TUint) aDrive, (TUint) aPos);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSMOUNTPLUGIN3_EPLUGINNAME, "PluginName %S", aPluginName.Ptr(), aPluginName.Length()<<1);
 
 	TInt r = SendReceive(EFsMountPlugin,TIpcArgs(&aPluginName,aDrive,aPos));
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountPlugin3Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSMOUNTPLUGIN3RETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -200,11 +214,13 @@
 @capability DiskAdmin       
 */
 	{
-	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsDismountPlugin1, MODULEUID, Handle(), aPluginName);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSDISMOUNTPLUGIN1, "sess %x", Handle());
+	OstTraceData(TRACE_BORDER, EFSRV_EFSDISMOUNTPLUGIN1_EPLUGINNAME, "PluginName %S", aPluginName.Ptr(), aPluginName.Length()<<1);
 
 	TInt r = SendReceive(EFsDismountPlugin,TIpcArgs(&aPluginName,KPluginAutoAttach,KPluginAutoLocate));
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDismountPlugin1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSDISMOUNTPLUGIN1RETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -233,11 +249,13 @@
 @capability DiskAdmin       
 */
 	{
-	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsDismountPlugin2, MODULEUID, Handle(), aPluginName, aDrive);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EFSDISMOUNTPLUGIN2, "sess %x aDrive %d", (TUint) Handle(), (TUint) aDrive);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSDISMOUNTPLUGIN2_EPLUGINNAME, "PluginName %S", aPluginName.Ptr(), aPluginName.Length()<<1);
 
 	TInt r = SendReceive(EFsDismountPlugin,TIpcArgs(&aPluginName,aDrive,KPluginAutoLocate));
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDismountPlugin2Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSDISMOUNTPLUGIN2RETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -269,11 +287,13 @@
 @capability DiskAdmin      
 */
 	{
-	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsDismountPlugin3, MODULEUID, Handle(), aPluginName, aDrive, aPos);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSDISMOUNTPLUGIN3, "sess %x aDrive %d aPos %x", (TUint) Handle(), (TUint) aDrive, (TUint) aPos);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSDISMOUNTPLUGIN3_EPLUGINNAME, "PluginName %S", aPluginName.Ptr(), aPluginName.Length()<<1);
 
 	TInt r = SendReceive(EFsDismountPlugin,TIpcArgs(&aPluginName,aDrive,aPos));
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDismountPlugin3Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EFSDISMOUNTPLUGIN3RETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -293,11 +313,14 @@
         KErrNotFound if the plugin name is not found;
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsPluginName, MODULEUID, Handle(), aDrive, aPos);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EFSPLUGINNAME, "sess %x aDrive %d aPos %x", (TUint) Handle(), (TUint) aDrive, (TUint) aPos);
 
 	TInt r = SendReceive(EFsPluginName,TIpcArgs(&aPluginName,aDrive,aPos));
 
-	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsPluginName, MODULEUID, r, aPluginName);
+	OstTraceData(TRACE_BORDER, EFSRV_EFSPLUGINNAME_EPLUGINNAME, "PluginName %S", aPluginName.Ptr(), aPluginName.Length()<<1);
+
+	OstTrace1(TRACE_BORDER, EFSRV_EFSPLUGINNAMERETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -313,11 +336,12 @@
 
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EPluginOpen, MODULEUID, aFs.Handle(), aPos);
+	OstTraceExt2(TRACE_BORDER, EFSRV_EPLUGINOPEN, "sess %x aPos %x", (TUint) aFs.Handle(), (TUint) aPos);
 
 	TInt r = CreateSubSession(aFs,EFsPluginOpen,TIpcArgs(aPos,0,0));
 
-	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EPluginOpenReturn, MODULEUID, r, SubSessionHandle());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EPLUGINOPENRETURN, "r %d subs %x", (TUint) r, (TUint) SubSessionHandle());
+
 	return r;
 	}
 
@@ -328,11 +352,11 @@
 Closes a plugin 
 */
 	{
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EPluginClose, MODULEUID, Session().Handle(), SubSessionHandle());
+	OstTraceExt2(TRACE_BORDER, EFSRV_EPLUGINCLOSE, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle());
 
 	CloseSubSession(EFsPluginSubClose);
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EPluginCloseReturn, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EPLUGINCLOSERETURN, "");
 	}
 
 EXPORT_C void RPlugin::DoRequest(TInt aReqNo, TRequestStatus& aStatus) const
@@ -345,12 +369,12 @@
 @param aStatus: status of the request
 */
 	{
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EPluginDoRequest1, MODULEUID, Session().Handle(), SubSessionHandle(), aReqNo, &aStatus);
+	OstTraceExt4(TRACE_BORDER, EFSRV_EPLUGINDOREQUEST1, "sess %x subs %x aReqNo %d status %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aReqNo, (TUint) &aStatus);
 
 	aStatus=KRequestPending;
 	SendReceive(EFsPluginDoRequest, TIpcArgs(aReqNo, NULL, NULL), aStatus);
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EPluginDoRequest1Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EPLUGINDOREQUEST1RETURN, "");
 	}
 
 EXPORT_C void RPlugin::DoRequest(TInt aReqNo, TRequestStatus& aStatus, TDes8& a1) const
@@ -364,12 +388,12 @@
 @param a1: returning value from plugin
 */
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EPluginDoRequest2, MODULEUID, Session().Handle(), SubSessionHandle(), aReqNo, &aStatus, &a1);
+	OstTraceExt5(TRACE_BORDER, EFSRV_EPLUGINDOREQUEST2, "sess %x subs %x aReqNo %d status %x a1 %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aReqNo, (TUint) &aStatus, (TUint) &a1);
 
 	aStatus=KRequestPending;
 	SendReceive(EFsPluginDoRequest, TIpcArgs(aReqNo, &a1, NULL), aStatus);
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EPluginDoRequest2Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EPLUGINDOREQUEST2RETURN, "");
 	}
 
 EXPORT_C void RPlugin::DoRequest(TInt aReqNo, TRequestStatus& aStatus, TDes8& a1, TDes8& a2) const
@@ -382,12 +406,12 @@
 @param a2: 2nd returning value from plugin
 */
 	{
-	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EPluginDoRequest3, MODULEUID, Session().Handle(), SubSessionHandle(), aReqNo, &aStatus, &a1, &a2);
+	OstTraceExt5(TRACE_BORDER, EFSRV_EPLUGINDOREQUEST3, "sess %x subs %x aReqNo %d a1 %x a2 %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aReqNo, (TUint) &a1, (TUint) &a2);
 
 	aStatus=KRequestPending;
 	SendReceive(EFsPluginDoRequest, TIpcArgs(aReqNo, &a1, &a2), aStatus);
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EPluginDoRequest3Return, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EPLUGINDOREQUEST3RETURN, "");
 	}
 
 EXPORT_C TInt RPlugin::DoControl(TInt aFunction) const
@@ -399,11 +423,12 @@
 @param	aFunction: The operation to be handled
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EPluginDoControl1, MODULEUID, Session().Handle(), SubSessionHandle(), aFunction);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EPLUGINDOCONTROL1, "sess %x subs %x aFunction %d", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aFunction);
 
 	TInt r = SendReceive(EFsPluginDoControl,TIpcArgs(aFunction,0,0));
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EPluginDoControl1Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EPLUGINDOCONTROL1RETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -417,11 +442,12 @@
 @param	a1: returned buffer from plugin on completion of the request
 */
 	{
-	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EPluginDoControl2, MODULEUID, Session().Handle(), SubSessionHandle(), aFunction, &a1);
+	OstTraceExt4(TRACE_BORDER, EFSRV_EPLUGINDOCONTROL2, "sess %x subs %x aFunction %d a1 %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aFunction, (TUint) &a1);
 
 	TInt r = SendReceive(EFsPluginDoControl,TIpcArgs(aFunction,&a1,0));
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EPluginDoControl2Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EPLUGINDOCONTROL2RETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -436,11 +462,12 @@
 @param  a2: 2nd returned buffer from plugin on completion of the request
 */
 	{
-	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EPluginDoControl3, MODULEUID, Session().Handle(), SubSessionHandle(), aFunction, &a1, &a2);
+	OstTraceExt5(TRACE_BORDER, EFSRV_EPLUGINDOCONTROL3, "sess %x subs %x aFunction %d a1 %x a2 %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aFunction, (TUint) &a1, (TUint) &a2);
 
 	TInt r = SendReceive(EFsPluginDoControl,TIpcArgs(aFunction,&a1,&a2));
 
-	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EPluginDoControl3Return, MODULEUID, r);
+	OstTrace1(TRACE_BORDER, EFSRV_EPLUGINDOCONTROL3RETURN, "r %d", r);
+
 	return r;
 	}
 
@@ -453,10 +480,10 @@
 @param	aReqMask: the bit mask for the operation to be cancelled
 */
 	{
-	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EPluginDoCancel, MODULEUID, Session().Handle(), SubSessionHandle(), aReqMask);
+	OstTraceExt3(TRACE_BORDER, EFSRV_EPLUGINDOCANCEL, "sess %x subs %x aReqMask %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) aReqMask);
 
 	SendReceive(EFsPluginDoCancel,TIpcArgs(KMaxTInt,aReqMask,0));
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EPluginDoCancelReturn, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_EPLUGINDOCANCELRETURN, "");
 	}
 
--- a/userlibandfileserver/fileserver/sfsrv/cl_scan.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfsrv/cl_scan.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -16,6 +16,10 @@
 #include "cl_std.h"
 #include "cl_scan.h"
 
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cl_scanTraces.h"
+#endif
+
 const TInt KDirStackGranularity=8;
 
 /** Replace long names in path and filename with their sohrter version (if exists). Optionally appends
@@ -115,13 +119,13 @@
 @return A pointer to the new directory scan object.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanNewLC, MODULEUID, aFs.Handle());
+	OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANNEWLC, "sess %x", aFs.Handle());
 
 	CDirScan* scan=new(ELeave) CDirScan(aFs);
 	CleanupStack::PushL(scan);
 	scan->iStack=CDirStack::NewL();
 
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanNewLCReturn, MODULEUID, scan);
+	OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANNEWLCRETURN, "CDirScan* %x", scan);
 	return scan;
 	}
 
@@ -137,12 +141,12 @@
 @return A pointer to the new directory scan object.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanNewL, MODULEUID, aFs.Handle());
+	OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANNEWL, "sess %x", aFs.Handle());
 
 	CDirScan* scan=CDirScan::NewLC(aFs);
 	CleanupStack::Pop();
 
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanNewLReturn, MODULEUID, scan);
+	OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANNEWLRETURN, "CDirScan* %x", scan);
 	return scan;
 	}
 
@@ -156,11 +160,11 @@
 Frees all resources owned by the object, prior to its destruction.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanDestructor, MODULEUID, this);
+	OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANDESTRUCTOR, "this %x", this);
 
 	delete iStack;
 
-	TRACE0(UTF::EBorder, UTraceModuleEfsrv::ECDirScanDestructorReturn, MODULEUID);
+	OstTrace0(TRACE_BORDER, EFSRV_ECDIRSCANDESTRUCTORRETURN, "");
 	}
 
 
@@ -214,13 +218,13 @@
 @param aScanDir       The direction of the scan. The default is downwards.
 */
 	{
-	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::ECDirScanSetScanDataL, MODULEUID, (TUint) 
-		this, aMatchName, anEntryAttMask, anEntrySortKey, (TUint) aScanDir);
+	OstTraceExt4(TRACE_BORDER, EFSRV_ECDIRSCANSETSCANDATAL, "this %x anEntryAttMask %x anEntrySortKey %d aScanDir %d", (TUint) this, (TUint) anEntryAttMask, (TUint) anEntrySortKey, (TUint) aScanDir);
+	OstTraceData(TRACE_BORDER, EFSRV_ECDIRSCANSETSCANDATAL_EFILEPATH, "FilePath %S", aMatchName.Ptr(), aMatchName.Length()<<1);
 
 	TInt r = Fs().Parse(aMatchName,iFullPath);
 	if (r != KErrNone)
 		{
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanSetScanDataLReturn, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANSETSCANDATALRETURN1, "r %d", r);
 		User::Leave(r);
 		}
 
@@ -234,7 +238,7 @@
 	if (aScanDir==EScanDownTree)
 		iFullPath.PopDir();
 
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanSetScanDataLReturn, MODULEUID, KErrNone);
+	OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANSETSCANDATALRETURN2, "r %d", KErrNone);
 	}
 
 void CDirScan::UpdateAbbreviatedPath()
@@ -278,15 +282,14 @@
                    no more directories in the structure.
 */
 	{
-	TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanNextL, MODULEUID, this);
+	OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANNEXTL, "this %x", this);
 
 	if (iScanDir==EScanUpTree)
 		ScanUpTreeL(aDirEntries);
 	else
 		ScanDownTreeL(aDirEntries);
 
-	TRACE2(UTF::EBorder, UTraceModuleEfsrv::ECDirScanNextLReturn, MODULEUID, 
-		KErrNone, aDirEntries ? (*aDirEntries).Count() : 0);
+	OstTraceExt2(TRACE_BORDER, EFSRV_ECDIRSCANNEXTLRETURN, "r %d DirEntries %d", (TUint) KErrNone, (TUint) aDirEntries ? (*aDirEntries).Count() : 0);
 	}
 
 void CDirScan::ScanUpTreeL(CDir*& aDirEntries)
@@ -337,7 +340,7 @@
 			}
 		if (r != KErrNone)
 			{
-			TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanLeave, MODULEUID, r);
+			OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANLEAVE1, "r %d", r);
 			User::LeaveIfError(r);
 			}
 
@@ -355,7 +358,7 @@
 		else if (r != KErrNone)
 			{
 			iScanning = EFalse;
-			TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanLeave, MODULEUID, r);
+			OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANLEAVE2, "r %d", r);
 			User::Leave(r);
 			}
 		
@@ -393,7 +396,7 @@
 	TInt r = Fs().GetDir(iFullPath.FullName(),iEntryAttMask,iEntrySortMask,aDirEntries);
 	if (r != KErrNone)
 		{
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanLeave, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANLEAVE3, "r %d", r);
 		User::Leave(r);
 		}
 	}
@@ -407,6 +410,10 @@
 	CDir* dirEntries = NULL;
 	TInt r;
 	aDirEntries=NULL;
+	
+	if(iStack && iStack->IsEmpty())
+	    return;
+	
 	CDirList* list=iStack->Peek();
 	while (!list->MoreEntries())
 		{
@@ -425,7 +432,7 @@
 	r=iFullPath.AddDir(dirName);
 	if (r==KErrGeneral)	//	Adding dirName makes iFullPath>256 characters
 		{
-		TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanLeave, MODULEUID, KErrTooBig);
+		OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANLEAVE4, "r %d", KErrTooBig);
 		User::Leave(KErrTooBig);
 		}
 
@@ -447,7 +454,7 @@
 									   iEntrySortMask,dirList);
 		if (r != KErrNone)
 			{
-			TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanLeave, MODULEUID, r);
+			OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANLEAVE5, "r %d", r);
 			User::Leave(r);
 			}
 		iStack->PushL(*dirList);
@@ -464,7 +471,7 @@
 	else
 		{
 		iScanning = EFalse;
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanLeave, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANLEAVE6, "r %d", r);
 		User::Leave(r);
 		}
 	}
@@ -568,7 +575,7 @@
 	if (r!=KErrNone)
 		{
 		delete nextLevel;
-		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanLeave, MODULEUID, r);
+		OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANLEAVE7, "r %d", r);
 		User::Leave(r);
 		}
 	}
@@ -706,7 +713,7 @@
 		TInt r = iFs->GetOpenFileList(iScanPos,iEntryListPos,theId,array);
 		if (r != KErrNone)
 			{
-			TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanLeave, MODULEUID, r);
+			OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANLEAVE8, "r %d", r);
 			User::Leave(r);
 			}
 		TInt count=array.Count();
--- a/userlibandfileserver/fileserver/sfsrv/cl_std.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/sfsrv/cl_std.h	Thu Jul 22 16:46:39 2010 +0100
@@ -26,7 +26,6 @@
 #include <f32ver.h>
 #include <e32svr.h>
 #include <f32plugin.h>
-#include <utraceefsrv.h>
 #include "f32trace.h"
 
 enum TClientPanic
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/userlibandfileserver/fileserver/sfsrv/efsrv.mmh	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,63 @@
+// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// f32\group\efsrv.mmp
+// efsrv.dll File Server client-side library
+// 
+//
+
+/**
+ @file
+*/
+
+
+
+USERINCLUDE		../ftrace
+
+USERINCLUDE		../sfsrv/traces
+
+SOURCEPATH		../sfsrv
+SOURCE			 cl_cdir.cpp cl_cli.cpp cl_debug.cpp cl_dir.cpp
+SOURCE			 cl_drive.cpp cl_entry.cpp cl_file.cpp cl_find.cpp
+SOURCE			 cl_fman.cpp cl_fmt.cpp cl_fraw.cpp cl_ftext.cpp
+SOURCE			 cl_main.cpp cl_parse.cpp cl_scan.cpp cl_insecure.cpp
+SOURCE			 cl_plugin.cpp cl_blockmap.cpp cl_clamp.cpp
+SOURCE			 cl_shim.cpp
+SOURCE			 cl_notification.cpp
+SOURCEPATH	../group
+DOCUMENT		 release.txt
+
+TARGETTYPE		dll
+
+DEFFILE			 efsrv.def
+
+USERINCLUDE	../inc
+#ifdef SYMBIAN_OLD_EXPORT_LOCATION
+SYSTEMINCLUDE	../inc
+#endif
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY			 euser.lib hal.lib
+
+START WINS
+BASEADDRESS		0x66000000
+END
+
+UID		0x1000008d 0x100039e4
+VENDORID 0x70000001
+CAPABILITY	All
+
+unpagedcode
+
+SMPSAFE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/userlibandfileserver/fileserver/sfsrv/efsrv.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,35 @@
+// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// f32/sfsrv/efsrv.mmp
+// efsrv.dll File Server client-side library
+// 
+//
+
+/**
+ @file
+*/
+
+
+TARGET			efsrv.dll
+
+#include "f32.mmh"  	// Generic definitions for the whole f32 component
+
+// By default, tracepoints are compiled in to UDEB version only
+#ifdef SYMBIAN_TRACE_SYSTEM_INCLUDE
+	macro SYMBIAN_FTRACE_ENABLE_UDEB
+//	macro SYMBIAN_FTRACE_ENABLE_UREL
+#endif
+
+
+#include "efsrv.mmh"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/userlibandfileserver/fileserver/sfsrv/traces/OstTraceDefinitions.h	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,21 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <OpenSystemTrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/userlibandfileserver/fileserver/sfsrv/traces/fixed_id.definitions	Thu Jul 22 16:46:39 2010 +0100
@@ -0,0 +1,646 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_BORDER=0x40
+[GROUP]TRACE_PANIC=0x41
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANDESTRUCTOR=0x273
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANDESTRUCTORRETURN=0x274
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANLEAVE1=0x27b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANLEAVE2=0x27c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANLEAVE3=0x27d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANLEAVE4=0x27e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANLEAVE5=0x27f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANLEAVE6=0x280
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANLEAVE7=0x281
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANLEAVE8=0x282
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANNEWL=0x271
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANNEWLC=0x26f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANNEWLCRETURN=0x270
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANNEWLRETURN=0x272
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANNEXTL=0x279
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANNEXTLRETURN=0x27a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANSETSCANDATAL=0x275
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANSETSCANDATALRETURN1=0x277
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANSETSCANDATALRETURN2=0x278
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECDIRSCANSETSCANDATAL_EFILEPATH=0x276
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANATTRIBS1A=0x1f5
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANATTRIBS1A_EFILEPATH=0x1f7
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANATTRIBS1B=0x1f6
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANATTRIBS1RETURN=0x1f8
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANATTRIBS2A=0x1f9
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANATTRIBS2A_EFILEPATH=0x1fb
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANATTRIBS2B=0x1fa
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANATTRIBS2RETURN1=0x1fc
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANATTRIBS2RETURN2=0x1fd
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANBYTESTRANSFERREDBYCOPYSTEP=0x1f4
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY1=0x1fe
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY1RETURN=0x201
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY1_ENEWNAME=0x200
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY1_EOLDNAME=0x1ff
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY2=0x202
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY2RETURN1=0x205
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY2RETURN2=0x206
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY2RETURN3=0x207
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY2RETURN4=0x208
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY2RETURN5=0x209
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY2_ENEWNAME=0x204
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY2_EOLDNAME=0x203
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY3=0x22e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY3RETURN1=0x230
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY3RETURN2=0x231
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY3RETURN3=0x232
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY3_ENEWNAME=0x22f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY4=0x233
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY4RETURN=0x235
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCOPY4_ENEWNAME=0x234
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCURRENTACTION=0x1ec
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANCURRENTACTIONRETURN=0x1ed
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANDELETE1=0x20a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANDELETE1RETURN=0x20c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANDELETE1_EFILEPATH=0x20b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANDELETE2=0x20d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANDELETE2RETURN1=0x20f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANDELETE2RETURN2=0x210
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANDELETE2_EFILEPATH=0x20e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANDESTRUCTOR=0x1ea
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANDESTRUCTORRETURN=0x1eb
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANGETCURRENTSOURCE=0x1f1
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANGETCURRENTSOURCERETURN=0x1f2
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANGETCURRENTSOURCE_EFILENAME=0x1f3
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANGETCURRENTTARGET=0x1ee
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANGETCURRENTTARGETRETURN=0x1ef
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANGETCURRENTTARGET_EFILENAME=0x1f0
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANMOVE1=0x211
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANMOVE1RETURN=0x214
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANMOVE1_ENEWNAME=0x213
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANMOVE1_EOLDNAME=0x212
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANMOVE2=0x215
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANMOVE2RETURN1=0x218
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANMOVE2RETURN2=0x219
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANMOVE2RETURN3=0x21a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANMOVE2RETURN4=0x21b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANMOVE2RETURN5=0x21c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANMOVE2_ENEWNAME=0x217
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANMOVE2_EOLDNAME=0x216
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANNEWL1=0x1e6
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANNEWL1RETURN=0x1e7
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANNEWL2=0x1e8
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANNEWL2RETURN=0x1e9
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRENAME1=0x21d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRENAME1RETURN=0x220
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRENAME1_ENEWNAME=0x21f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRENAME1_EOLDNAME=0x21e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRENAME2=0x221
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRENAME2RETURN1=0x224
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRENAME2RETURN2=0x225
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRENAME2RETURN3=0x226
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRENAME2_ENEWNAME=0x223
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRENAME2_EOLDNAME=0x222
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRMDIR1=0x227
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRMDIR1RETURN=0x229
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRMDIR1_EDIRNAME=0x228
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRMDIR2=0x22a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRMDIR2RETURN1=0x22c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRMDIR2RETURN2=0x22d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_ECFILEMANRMDIR2_EDIRNAME=0x22b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EDIRCLOSE=0x124
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EDIRCLOSERETURN=0x125
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EDIROPEN1=0x11e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EDIROPEN1RETURN=0x120
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EDIROPEN1_EDIRNAME=0x11f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EDIROPEN2=0x121
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EDIROPEN2RETURN=0x123
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EDIROPEN2_EDIRNAME=0x122
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EDIRREAD1=0x126
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EDIRREAD1RETURN=0x127
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EDIRREAD2=0x128
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EDIRREAD2RETURN=0x129
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EDIRREAD3=0x12a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EDIRREAD3RETURN=0x12b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EDIRREAD4=0x12c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EDIRREAD4RETURN=0x12d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64ADOPTFROMCLIENT=0x1b1
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64ADOPTFROMCLIENTRETURN1=0x1b2
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64ADOPTFROMCLIENTRETURN2=0x1b3
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64ADOPTFROMCLIENTRETURN3=0x1b4
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64ADOPTFROMCREATOR=0x1b8
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64ADOPTFROMCREATORRETURN1=0x1b9
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64ADOPTFROMCREATORRETURN2=0x1ba
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64ADOPTFROMCREATORRETURN3=0x1bb
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64ADOPTFROMSERVER=0x1b5
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64ADOPTFROMSERVERRETURN1=0x1b6
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64ADOPTFROMSERVERRETURN2=0x1b7
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64CREATE=0x1a7
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64CREATERETURN=0x1a9
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64CREATE_EFILENAME=0x1a8
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64LOCK=0x1d2
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64LOCKRETURN=0x1d3
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64OPEN=0x1a4
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64OPENRETURN=0x1a6
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64OPEN_EFILENAME=0x1a5
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64READ10=0x1be
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64READ10RETURN=0x1bf
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64READ11=0x1c2
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64READ11RETURN=0x1c3
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64READ12=0x1d8
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64READ12RETURN=0x1d9
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64READ13=0x1dc
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64READ13RETURN=0x1dd
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64READ14=0x1d6
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64READ14RETURN=0x1d7
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64READ15=0x1c0
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64READ15RETURN=0x1c1
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64READ16=0x1da
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64READ16RETURN=0x1db
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64READ8=0x1bc
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64READ8RETURN=0x1bd
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64REPLACE=0x1aa
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64REPLACERETURN=0x1ac
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64REPLACE_EFILENAME=0x1ab
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64SEEK2=0x1cc
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64SEEK2RETURN=0x1cd
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64SETSIZE2=0x1d0
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64SETSIZE2RETURN=0x1d1
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64SIZE2=0x1ce
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64SIZE2RETURN=0x1cf
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64TEMP=0x1ad
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64TEMPRETURN=0x1b0
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64TEMP_EDIRNAME=0x1ae
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64TEMP_EFILENAME=0x1af
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64UNLOCK=0x1d4
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64UNLOCKRETURN=0x1d5
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64WRITE11=0x1ca
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64WRITE11RETURN=0x1cb
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64WRITE12=0x1e4
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64WRITE12RETURN=0x1e5
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64WRITE13=0x1c4
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64WRITE13RETURN=0x1c5
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64WRITE14=0x1de
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64WRITE14RETURN=0x1df
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64WRITE15=0x1c6
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64WRITE15RETURN=0x1c7
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64WRITE16=0x1e0
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64WRITE16RETURN=0x1e1
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64WRITE7=0x1c8
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64WRITE7RETURN=0x1c9
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64WRITE8=0x1e2
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILE64WRITE8RETURN=0x1e3
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEADOPT=0x12e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEADOPTFROMCLIENT=0x135
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEADOPTFROMCLIENTRETURN1=0x136
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEADOPTFROMCLIENTRETURN2=0x137
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEADOPTFROMCLIENTRETURN3=0x138
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEADOPTFROMCREATOR=0x139
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEADOPTFROMCREATORRETURN1=0x13a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEADOPTFROMCREATORRETURN2=0x13b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEADOPTFROMCREATORRETURN3=0x13c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEADOPTFROMSERVER=0x132
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEADOPTFROMSERVERRETURN1=0x133
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEADOPTFROMSERVERRETURN2=0x134
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEADOPTRETURN1=0x12f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEADOPTRETURN2=0x130
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEADOPTRETURN3=0x131
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEATT=0x18d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEATTRETURN=0x18e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEBLOCKMAPA=0x1a1
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEBLOCKMAPB=0x1a2
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEBLOCKMAPRETURN=0x1a3
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILECHANGEMODE=0x198
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILECHANGEMODERETURN=0x199
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILECLAMP=0x19f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILECLAMPRETURN=0x1a0
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILECLOSE=0x153
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILECLOSERETURN=0x154
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILECREATE=0x155
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILECREATERETURN=0x157
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILECREATE_EFILENAME=0x156
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEDRIVE=0x19d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEDRIVERETURN=0x19e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEDUPLICATE=0x13d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEDUPLICATERETURN1=0x13e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEDUPLICATERETURN2=0x13f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEDUPLICATERETURN3=0x140
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEFLUSH1=0x185
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEFLUSH1RETURN=0x186
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEFLUSH2=0x187
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEFLUSH2RETURN=0x188
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEFULLNAME=0x14d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEFULLNAMERETURN=0x14f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEFULLNAME_EFILENAME=0x14e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEGETNAME=0x14a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEGETNAMERETURN=0x14c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEGETNAME_EFILENAME=0x14b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILELOCK=0x17f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILELOCKRETURN=0x180
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEMODIFIED=0x191
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEMODIFIEDRETURN=0x192
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEOPEN=0x150
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEOPENRETURN=0x152
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEOPEN_EFILENAME=0x151
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREAD1=0x15f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREAD1RETURN=0x160
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREAD2=0x161
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREAD2RETURN=0x162
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREAD3=0x167
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREAD3RETURN=0x168
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREAD4=0x169
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREAD4RETURN=0x16a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREAD5=0x163
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREAD5RETURN=0x164
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREAD6=0x165
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREAD6RETURN=0x166
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREAD7=0x16b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREAD7RETURN=0x16c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREAD9=0x16d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREAD9RETURN=0x16e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILERENAME=0x19a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILERENAMERETURN=0x19c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILERENAME_ENEWNAME=0x19b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREPLACE=0x158
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREPLACERETURN=0x15a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEREPLACE_EFILENAME=0x159
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILESEEK1=0x183
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILESEEK1RETURN=0x184
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILESETA=0x195
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILESETATT=0x18f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILESETATTRETURN=0x190
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILESETB=0x196
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILESETMODIFIED=0x193
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILESETMODIFIEDRETURN=0x194
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILESETRETURN=0x197
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILESETSIZE1=0x18b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILESETSIZE1RETURN=0x18c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILESIZE=0x189
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILESIZERETURN=0x18a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILETEMP=0x15b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILETEMPRETURN=0x15e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILETEMP_EDIRNAME=0x15c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILETEMP_EFILENAME=0x15d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILETRANSFERTOCLIENT=0x144
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILETRANSFERTOCLIENTRETURN1=0x145
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILETRANSFERTOCLIENTRETURN2=0x146
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILETRANSFERTOCLIENTRETURN3=0x147
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILETRANSFERTOPROCESS=0x148
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILETRANSFERTOPROCESSRETURN=0x149
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILETRANSFERTOSERVER=0x141
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILETRANSFERTOSERVERRETURN1=0x142
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILETRANSFERTOSERVERRETURN2=0x143
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEUNLOCK=0x181
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEUNLOCKRETURN=0x182
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEWRITE1=0x16f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEWRITE10=0x17d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEWRITE10RETURN=0x17e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEWRITE1RETURN=0x170
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEWRITE2=0x171
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEWRITE2RETURN=0x172
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEWRITE3=0x177
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEWRITE3RETURN=0x178
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEWRITE4=0x179
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEWRITE4RETURN=0x17a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEWRITE5=0x173
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEWRITE5RETURN=0x174
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEWRITE6=0x17b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEWRITE6RETURN=0x17c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEWRITE9=0x175
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFILEWRITE9RETURN=0x176
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFORMAT1OPEN=0x236
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFORMAT1OPEN_EDRIVENAME=0x237
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFORMAT2OPEN=0x239
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFORMAT2OPEN_EDRIVENAME=0x23a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFORMATCLOSE=0x23c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFORMATCLOSERETURN=0x23d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFORMATNEXT1=0x23e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFORMATNEXT1RETURN=0x23f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFORMATNEXT2=0x240
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFORMATNEXT2RETURN=0x241
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFORMATOPEN1RETURN=0x238
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFORMATOPEN2RETURN=0x23b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSADDCOMPOSITEMOUNT=0xfe
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSADDCOMPOSITEMOUNTRETURN=0x100
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSADDCOMPOSITEMOUNT_EFILESYSTEMNAME=0xff
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSADDEXTENSION=0x3b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSADDEXTENSIONRETURN=0x3d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSADDEXTENSION_EEXTENSIONNAME=0x3c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSADDFILESYSTEM=0x17
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSADDFILESYSTEMRETURN=0x19
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSADDFILESYSTEM_EFILENAME=0x18
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSADDPLUGIN=0x242
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSADDPLUGINRETURN=0x244
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSADDPLUGIN_EFILENAME=0x243
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSALLOWDISMOUNT=0x10d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSALLOWDISMOUNTRETURN=0x10e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSATT=0xa0
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSATTRETURN=0xa2
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSATT_EFILENAME=0xa1
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSCHECKDISK=0xc1
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSCHECKDISKRETURN=0xc3
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSCHECKDISK_EDIRNAME=0xc2
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSCLEARPASSWORD=0xec
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSCLEARPASSWORDRETURN=0xed
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSCLOSE=0x11c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSCLOSERETURN=0x11d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSCONNECT=0xc
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSCONNECTRETURN=0xd
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSCREATEPRIVATEPATH=0x13
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSCREATEPRIVATEPATHRETURN=0x14
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDELETE=0x95
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDELETERETURN=0x97
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDELETE_EFILENAME=0x96
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDISMOUNTEXTENSION=0x41
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDISMOUNTEXTENSIONRETURN=0x43
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDISMOUNTEXTENSION_EEXTENSIONNAME=0x42
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDISMOUNTFILESYSTEM=0x32
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDISMOUNTFILESYSTEMRETURN=0x34
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDISMOUNTFILESYSTEM_EFILESYSTEMNAME=0x33
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDISMOUNTPLUGIN1=0x251
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDISMOUNTPLUGIN1RETURN=0x253
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDISMOUNTPLUGIN1_EPLUGINNAME=0x252
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDISMOUNTPLUGIN2=0x254
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDISMOUNTPLUGIN2RETURN=0x256
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDISMOUNTPLUGIN2_EPLUGINNAME=0x255
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDISMOUNTPLUGIN3=0x257
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDISMOUNTPLUGIN3RETURN=0x259
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDISMOUNTPLUGIN3_EPLUGINNAME=0x258
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDRIVE=0x5f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDRIVELIST1=0x5b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDRIVELIST1RETURN=0x5c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDRIVELIST2=0x5d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDRIVELIST2RETURN=0x5e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDRIVERETURN=0x60
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDRIVETOCHAR=0x1
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSDRIVETOCHARRETURN=0x2
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSENTRY=0xac
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSENTRYRETURN=0xae
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSENTRY_EFILENAME=0xad
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSERASEPASSWORD=0xee
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSERASEPASSWORDRETURN=0xef
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSEXTENSIONNAME=0x47
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSEXTENSIONNAMERETURN=0x49
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSEXTENSIONNAME_EEXTENSIONNAME=0x48
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSFILESYSTEMNAME=0x35
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSFILESYSTEMNAMERETURN=0x37
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSFILESYSTEMNAME_EFILESYSTEMNAME=0x36
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSFILESYSTEMNAME_ESUPPORTEDFILESYSTEMNAME=0x39
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSFILESYSTEMSUBTYPE=0x119
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSFILESYSTEMSUBTYPERETURN=0x11b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSFILESYSTEMSUBTYPE_EFILESYSTEMNAME=0x11a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSFINALISEDRIVE=0xf5
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSFINALISEDRIVERETURN=0xf6
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSFINALISEDRIVES=0xf7
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSFINALISEDRIVESRETURN1=0xf8
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSFINALISEDRIVESRETURN2=0xf9
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETDIR1=0x85
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETDIR1RETURN=0x87
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETDIR1_EDIRNAME=0x86
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETDIR2=0x88
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETDIR2RETURN=0x8a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETDIR2_EDIRNAME=0x89
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETDIR3=0x8b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETDIR3RETURN=0x8d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETDIR3_EDIRNAME=0x8c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETDRIVENAME=0xe2
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETDRIVENAMERETURN=0xe4
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETDRIVENAME_EDRIVENAME=0xe3
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETLONGNAME=0xcb
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETLONGNAMERETURN=0xce
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETLONGNAME_ELONGNAME=0xcd
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETLONGNAME_ESHORTNAME=0xcc
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETMEDIASERIALNUMBER=0x73
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETMEDIASERIALNUMBERRETURN=0x74
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETMEDIASERIALNUMBER_ESERIALNUMBER=0x75
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETNOTIFYUSER=0xd2
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETNOTIFYUSERRETURN=0xd3
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETRESERVEACCESS=0x103
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETRESERVEACCESSRETURN=0x104
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETSHORTNAME=0xc7
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETSHORTNAMERETURN=0xca
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETSHORTNAME_ELONGNAME=0xc8
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETSHORTNAME_ESHORTNAME=0xc9
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETSYSTEMDRIVE=0x5
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETSYSTEMDRIVECHAR=0x8
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETSYSTEMDRIVECHARRETURN=0x9
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETSYSTEMDRIVERETURN1=0x6
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSGETSYSTEMDRIVERETURN2=0x7
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSINITIALISEPROPERTIESFILE=0x113
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSINITIALISEPROPERTIESFILERETURN=0x114
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISFILEINROM=0xd6
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISFILEINROMRETURN=0xd8
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISFILEINROM_EFILENAME=0xd7
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISFILEOPEN=0xcf
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISFILEOPENRETURN=0xd1
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISFILEOPEN_EFILENAME=0xd0
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISROMADDRESS=0x3
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISROMADDRESSRETURN=0x4
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISVALIDNAME1=0xd9
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISVALIDNAME1RETURN=0xdb
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISVALIDNAME1_EFILENAME=0xda
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISVALIDNAME2=0xdc
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISVALIDNAME2RETURN=0xde
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISVALIDNAME2_EFILENAME=0xdd
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISVALIDNAME3=0xdf
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISVALIDNAME3RETURN=0xe1
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSISVALIDNAME3_EFILENAME=0xe0
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSLOCKDRIVE=0xe8
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSLOCKDRIVERETURN=0xe9
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMKDIR=0x7c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMKDIRALL=0x7f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMKDIRALLRETURN=0x81
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMKDIRALL_EDIRNAME=0x80
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMKDIRRETURN=0x7e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMKDIR_EDIRNAME=0x7d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMODIFIED=0xa6
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMODIFIEDRETURN=0xa8
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMODIFIED_EFILENAME=0xa7
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTEXTENSION=0x3e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTEXTENSIONRETURN=0x40
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTEXTENSION_EEXTENSIONNAME=0x3f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEM1=0x1d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEM1RETURN=0x1f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEM1_EFILESYSTEMNAME=0x1e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEM2=0x20
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEM2RETURN=0x22
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEM2_EFILESYSTEMNAME=0x21
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEM3=0x23
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEM3RETURN=0x26
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEM3_EEXTENSIONNAME=0x24
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEM3_EFILESYSTEMNAME=0x25
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEM4=0x27
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEM4RETURN=0x2a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEM4_EEXTENSIONNAME=0x29
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEM4_EFILESYSTEMNAME=0x28
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEMANDSCAN1=0x2b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEMANDSCAN1RETURN=0x2d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEMANDSCAN1_EFILESYSTEMNAME=0x2c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEMANDSCAN2=0x2e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEMANDSCAN2RETURN=0x31
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEMANDSCAN2_EEXTENSIONNAME=0x30
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTFILESYSTEMANDSCAN2_EFILESYSTEMNAME=0x2f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTPLUGIN1=0x248
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTPLUGIN1RETURN=0x24a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTPLUGIN1_EPLUGINNAME=0x249
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTPLUGIN2=0x24b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTPLUGIN2RETURN=0x24d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTPLUGIN2_EPLUGINNAME=0x24c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTPLUGIN3=0x24e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTPLUGIN3RETURN=0x250
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSMOUNTPLUGIN3_EPLUGINNAME=0x24f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYCHANGE1=0x4c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYCHANGE1RETURN=0x4d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYCHANGE2=0x4e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYCHANGE2RETURN=0x50
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYCHANGE2_EDIRNAME=0x4f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYCHANGECANCEL1=0x51
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYCHANGECANCEL1RETURN=0x52
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYCHANGECANCEL2=0x53
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYCHANGECANCEL2RETURN=0x54
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYDISKSPACE=0x55
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYDISKSPACECANCEL1=0x57
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYDISKSPACECANCEL1RETURN=0x58
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYDISKSPACECANCEL2=0x59
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYDISKSPACECANCEL2RETURN=0x5a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYDISKSPACERETURN=0x56
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYDISMOUNT=0x107
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYDISMOUNTCANCEL1=0x109
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYDISMOUNTCANCEL1RETURN=0x10a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYDISMOUNTCANCEL2=0x10b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYDISMOUNTCANCEL2RETURN=0x10c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSNOTIFYDISMOUNTRETURN=0x108
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSPARSE1=0x8e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSPARSE1RETURN=0x90
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSPARSE1_EFILEPATH=0x8f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSPARSE2=0x91
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSPARSE2RETURN=0x94
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSPARSE2_EFILENAME=0x92
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSPARSE2_ERELATED=0x93
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSPLUGINNAME=0x25a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSPLUGINNAMERETURN=0x25c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSPLUGINNAME_EPLUGINNAME=0x25b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSPRIVATEPATH=0x10
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSPRIVATEPATHRETURN=0x12
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSPRIVATEPATH_EDIRNAME=0x11
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSQUERYVOLUMEINFOEXT=0x115
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSQUERYVOLUMEINFOEXTRETURN=0x116
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREADFILESECTION=0xb2
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREADFILESECTIONRETURN1=0xb4
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREADFILESECTIONRETURN2=0xb5
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREADFILESECTIONRETURN3=0xb6
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREADFILESECTION_EFILENAME=0xb3
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREADFILESECTION_RESERVED=0xb7
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREADFILESECTION_RESERVED_EFILENAME=0xb8
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREADFILESECTION_RESERVED_RETURN1=0xb9
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREADFILESECTION_RESERVED_RETURN2=0xba
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREALNAME=0x6f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREALNAMERETURN=0x72
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREALNAME_EFILENAME1=0x70
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREALNAME_EFILENAME2=0x71
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRELEASERESERVEACCESS=0x105
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRELEASERESERVEACCESSRETURN=0x106
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREMOUNTDRIVE=0x4a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREMOUNTDRIVERETURN=0x4b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREMOVEEXTENSION=0x44
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREMOVEEXTENSIONRETURN=0x46
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREMOVEEXTENSION_EEXTENSIONNAME=0x45
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREMOVEFILESYSTEM=0x1a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREMOVEFILESYSTEMRETURN=0x1c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREMOVEFILESYSTEM_EFILESYSTEMNAME=0x1b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREMOVEPLUGIN=0x245
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREMOVEPLUGINRETURN=0x247
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREMOVEPLUGIN_EPLUGINNAME=0x246
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRENAME=0x98
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRENAMERETURN=0x9b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRENAME_ENEWNAME=0x9a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRENAME_EOLDNAME=0x99
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREPLACE=0x9c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREPLACERETURN=0x9f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREPLACE_ENEWNAME=0x9e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSREPLACE_EOLDNAME=0x9d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRESERVEDRIVESPACE=0x101
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRESERVEDRIVESPACERETURN=0x102
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRESOURCECOUNT=0xbf
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRESOURCECOUNTMARKEND=0xbd
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRESOURCECOUNTMARKENDRETURN=0xbe
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRESOURCECOUNTMARKSTART=0xbb
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRESOURCECOUNTMARKSTARTRETURN=0xbc
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRESOURCECOUNTRETURN=0xc0
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRMDIR=0x82
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRMDIRRETURN=0x84
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSRMDIR_EDIRNAME=0x83
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSCANDRIVE=0xc4
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSCANDRIVERETURN=0xc6
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSCANDRIVE_EDIRNAME=0xc5
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSESSIONPATH=0x76
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSESSIONPATHRETURN=0x77
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSESSIONPATH_EDIRNAME=0x78
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETATT=0xa3
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETATTRETURN=0xa5
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETATT_EFILENAME=0xa4
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETDRIVENAME=0xe5
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETDRIVENAMERETURN=0xe7
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETDRIVENAME_EDRIVENAME=0xe6
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETENTRY=0xaf
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETENTRYRETURN=0xb1
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETENTRY_EFILENAME=0xb0
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETLOCALDRIVEMAPPING=0xf2
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETLOCALDRIVEMAPPINGRETURN=0xf4
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETLOCALDRIVEMAPPING_ELOCALDRIVEMAPPING=0xf3
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETMODIFIED=0xa9
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETMODIFIEDRETURN=0xab
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETMODIFIED_EFILENAME=0xaa
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETNOTIFYCHANGE=0x111
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETNOTIFYCHANGERETURN=0x112
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETNOTIFYUSER=0xd4
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETNOTIFYUSERRETURN=0xd5
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETSESSIONPATH=0x79
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETSESSIONPATHRETURN=0x7b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETSESSIONPATH_EDIRNAME=0x7a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETSESSIONTOPRIVATE=0xe
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETSESSIONTOPRIVATERETURN=0xf
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETSTARTUPCONFIGURATION=0x10f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETSTARTUPCONFIGURATIONRETURN=0x110
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETSUBST=0x6c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETSUBSTRETURN=0x6e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETSUBST_EDIRNAME=0x6d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETSYSTEMDRIVE=0xa
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETSYSTEMDRIVERETURN=0xb
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETVOLUMELABEL=0x66
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETVOLUMELABELRETURN=0x68
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSETVOLUMELABEL_EVOLUMENAME=0x67
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSTARTUPINITCOMPLETE=0xf0
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSTARTUPINITCOMPLETERETURN=0xf1
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSUBST=0x69
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSUBSTRETURN=0x6b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSUBST_EDIRNAME=0x6a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSUPPORTEDFILESYSTEMNAME=0x38
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSUPPORTEDFILESYSTEMNAMERETURN=0x3a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSWAPFILESYSTEM=0xfa
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSWAPFILESYSTEMRETURN=0xfd
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSWAPFILESYSTEM_ENEWNAME=0xfc
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSSWAPFILESYSTEM_EOLDNAME=0xfb
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSUNLOCKDRIVE=0xea
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSUNLOCKDRIVERETURN=0xeb
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSVERSION=0x15
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSVERSIONRETURN=0x16
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSVOLUME1=0x61
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSVOLUME1RETURNA=0x62
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSVOLUME1RETURNB=0x63
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSVOLUME2=0x64
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSVOLUME2RETURN=0x65
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSVOLUMEIOPARAM=0x117
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EFSVOLUMEIOPARAMRETURN=0x118
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINCLOSE=0x25f
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINCLOSERETURN=0x260
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINDOCANCEL=0x26d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINDOCANCELRETURN=0x26e
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINDOCONTROL1=0x267
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINDOCONTROL1RETURN=0x268
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINDOCONTROL2=0x269
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINDOCONTROL2RETURN=0x26a
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINDOCONTROL3=0x26b
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINDOCONTROL3RETURN=0x26c
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINDOREQUEST1=0x261
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINDOREQUEST1RETURN=0x262
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINDOREQUEST2=0x263
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINDOREQUEST2RETURN=0x264
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINDOREQUEST3=0x265
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINDOREQUEST3RETURN=0x266
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINOPEN=0x25d
+[TRACE]TRACE_BORDER[0x40]_EFSRV_EPLUGINOPENRETURN=0x25e
+[TRACE]TRACE_PANIC[0x41]_EFSRV_EPANIC=0x1
--- a/userlibandfileserver/fileserver/shostmassstorage/base_f32_shostmassstorage.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/base_f32_shostmassstorage.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "USB Host Mass Storage Server"
 
 component	base_f32_shostmassstorage
--- a/userlibandfileserver/fileserver/shostmassstorage/client/hostmsclient.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/client/hostmsclient.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -30,7 +30,7 @@
 
 LIBRARY		efsrv.lib euser.lib hal.lib usbdescriptors.lib usbdi_utils.lib
 
-CAPABILITY ALL
+CAPABILITY TCB  ProtServ DiskAdmin AllFiles PowerMgmt CommDD NetworkControl WriteDeviceData
 
 //MACRO _USBMS_DEBUG_PRINT_
 
--- a/userlibandfileserver/fileserver/shostmassstorage/msproxy/hostusbmsproxy.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/msproxy/hostusbmsproxy.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -596,12 +596,18 @@
             // do nothing
             }
 		}
-	else if (KErrNotReady)
+	else if (KErrNotReady == r)
         {
         __HOSTPRINT(_L("<<< HOST Caps Media Not Present"));
 		c.iType = EMediaNotPresent;		
 		r = KErrNone;
         }
+	else if (KErrGeneral == r)
+        {
+        RDebug::Print(_L("<<< HOST Caps Unable to communicate with media"));
+		c.iType = EMediaUnknown;		
+        }
+
     else
         {
         __HOSTPRINT(_L("<<< HOST Caps Unknown Error"));
--- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevice.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevice.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -166,14 +166,14 @@
     // interface suspension to the transport layer
 	for (TInt i = 0; i < iLuList.Count(); i++)
 		{
-		CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i);
+		CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i);
 	   	if (!lu.IsReadyToSuspend() && lu.IsConnected())
 	   		return;
 		}
 
 	for (TInt i = 0; i < iLuList.Count(); i++)
 		{
-		CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i);
+		CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i);
 		SetLunL(lu);
 		lu.SuspendL();
 		}
@@ -299,7 +299,7 @@
 	TInt err;
 	for (TInt i = 0; i < iLuList.Count(); i++)
 		{
-		CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i);
+		CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i);
 		SetLunL(lu);
 		TRAP(err, lu.DoLunReadyCheckL());
 		}
@@ -315,7 +315,7 @@
     // interface suspension to the transport layer
 	for (TInt i = 0; i < iLuList.Count(); i++)
 		{
-		CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i);
+		CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i);
 		// Has any of the logical units have got its state changed?
 	   	if ( (lu.IsReadyToSuspend() && !lu.IsConnected()) ||
 				(!lu.IsReadyToSuspend() && lu.IsConnected()) )
@@ -327,7 +327,7 @@
 
 	for (TInt i = 0; i < iLuList.Count(); i++)
 		{
-		CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i);
+		CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i);
 		SetLunL(lu);
 		lu.SuspendL();
 		}
@@ -341,7 +341,7 @@
     __MSFNLOG
 	for (TInt i = 0; i < iLuList.Count(); i++)
 		{
-		CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i);
+		CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i);
 		SetLunL(lu);
 		lu.ResumeL();
 		}
--- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevicethread.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevicethread.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -308,6 +308,9 @@
             }
 		return;
 	case EUsbHostMsUnRegisterInterface:
+		// Check whether all luns have got uninitialised. 
+		for(TInt i = 0, j = iUsbHostMsDevice->GetMaxLun(); i <= j; i++)
+			TRAP_IGNORE(iUsbHostMsDevice->RemoveLunL(i));
 		TRAP(ret, UnRegisterInterfaceL(aMessage));
 		break;
 	case EUsbHostMsRegisterLun:
--- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/include/tlogicalunitlist.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/include/tlogicalunitlist.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -29,9 +29,10 @@
     void RemoveLuL(TLun aLun);
     void RemoveAllLuL();
     CUsbHostMsLogicalUnit& GetLuL(TLun aLun) const;
-    TInt FindLu(TLun aLun) const;
+    CUsbHostMsLogicalUnit& GetLu(TInt aIndex) const;
 	TInt Count() const;
 private:
+    TInt FindLu(TLun aLun) const;
     RPointerArray<CUsbHostMsLogicalUnit> iLu;
     };
 
--- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/tlogicalunitlist.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/tlogicalunitlist.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -124,3 +124,10 @@
     User::LeaveIfError(index);
     return *iLu[index];
     }
+
+
+CUsbHostMsLogicalUnit& TLogicalUnitList::GetLu(TInt aIndex) const
+    {
+    __MSFNSLOG
+    return *iLu[aIndex];
+    }
--- a/userlibandfileserver/fileserver/shostmassstorage/server/hostmsserver.mmp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/hostmsserver.mmp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -62,7 +62,7 @@
 BASEADDRESS		0x61000000 
 END
 
-CAPABILITY ALL -Tcb
+CAPABILITY AllFiles CommDD
 
 UID		0 0x10286A83 
 
--- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/cscsiprotocol.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/cscsiprotocol.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -264,7 +264,8 @@
 	__MSFNLOG
     if (!IsConnected())
         {
-        DoScsiReadyCheckEventL();
+        if (!DoScsiReadyCheckEventL())
+            return;
         }
 
     if (!iSbcInterface)
@@ -800,7 +801,7 @@
 	}
 
 
-void CScsiProtocol::DoScsiReadyCheckEventL()
+TBool CScsiProtocol::DoScsiReadyCheckEventL()
 	{
     __MSFNLOG
 	TInt err = KErrNone;
@@ -833,6 +834,7 @@
             iMediaChangeNotifier.DoNotifyL();
 			}
         }
+    return err = KErrNone ? ETrue : EFalse;
 	}
 
 
--- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/cscsiprotocol.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/cscsiprotocol.h	Thu Jul 22 16:46:39 2010 +0100
@@ -85,7 +85,7 @@
     // unit testing
     void CreateSbcInterfaceL(TUint32 aBlockLen, TUint32 aLastLba);
 
-	void DoScsiReadyCheckEventL();
+	TBool DoScsiReadyCheckEventL();
 
 	void NotifyChange(const RMessage2& aMessage);
     void ForceCompleteNotifyChangeL();
--- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/mprotocol.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/mprotocol.h	Thu Jul 22 16:46:39 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -66,7 +66,7 @@
     /** unit testing */
     virtual void CreateSbcInterfaceL(TUint32 aBlockLen, TUint32 aLastLba) = 0;
 
-	virtual void DoScsiReadyCheckEventL() = 0;
+	virtual TBool DoScsiReadyCheckEventL() = 0;
 
     /**
     Media change notification
--- a/userlibandfileserver/fileserver/shostmassstorage/server/src/cusbhostmssession.cpp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/src/cusbhostmssession.cpp	Thu Jul 22 16:46:39 2010 +0100
@@ -114,9 +114,13 @@
 			return;
 			}
 		break;
+	case EUsbHostMsUnRegisterInterface:
+		iCleanupInProgress = ETrue;
+		break;
 	/* If it is a cleanup then we need to delete the iDeviceThread */
 	case EUsbHostMsFinalCleanup:	
 		delete iDeviceThread;
+		iDeviceThread = NULL;
 		iThread.Kill(KErrNone);
 		aMessage.Complete(KErrNone);
 		return;
@@ -124,7 +128,12 @@
 		break;
 		}
 
-	__ASSERT_DEBUG(iDeviceThread != NULL, User::Panic(KUsbMsHostPanicCat, EDeviceThreadDoesNotExist));
+	if (iDeviceThread == NULL || iCleanupInProgress ) 
+		{
+		aMessage.Complete(KErrBadHandle);
+		return;
+		}
+
 
 	r = iDeviceThread->QueueMsg(aMessage);
 	if (r != KErrNone)
--- a/userlibandfileserver/fileserver/shostmassstorage/server/src/include/cusbhostmssession.h	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/src/include/cusbhostmssession.h	Thu Jul 22 16:46:39 2010 +0100
@@ -63,6 +63,7 @@
 	CUsbHostMsDeviceThread* iDeviceThread;
 	RThread	iThread;
 
+	TBool iCleanupInProgress;
     TRequestStatus* iClientStatus;
 	};
 
--- a/userlibandfileserver/fileserver/smassstorage/base_f32_smassstorage.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/smassstorage/base_f32_smassstorage.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "USB Mass Storage File System"
 
 component	base_f32_smassstorage
--- a/userlibandfileserver/fileserver/srofs/base_f32_srofs.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/srofs/base_f32_srofs.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "ROFS File System"
 
 component	base_f32_srofs
--- a/userlibandfileserver/fileserver/srom/base_f32_srom.mrp	Wed Jul 21 14:46:58 2010 +0100
+++ b/userlibandfileserver/fileserver/srom/base_f32_srom.mrp	Thu Jul 22 16:46:39 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
 # component name "ROM File System"
 
 component	base_f32_srom