Update contrib.
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\mmu\d_asid.cpp
18 #include <kernel/kern_priv.h>
25 class DAsidFactory : public DLogicalDevice
29 virtual TInt Install();
30 virtual void GetCaps(TDes8& aDes) const;
31 virtual TInt Create(DLogicalChannelBase*& aChannel);
34 class DAsidChannel : public DLogicalChannelBase
39 virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
40 virtual TInt Request(TInt aFunction, TAny* a1, TAny* a2);
42 DAsidFactory* iFactory;
51 TInt DAsidFactory::Install()
53 return SetName(&KMemoryTestLddName);
56 DAsidFactory::~DAsidFactory()
60 void DAsidFactory::GetCaps(TDes8& /*aDes*/) const
62 // Not used but required as DLogicalDevice::GetCaps is pure virtual
65 TInt DAsidFactory::Create(DLogicalChannelBase*& aChannel)
68 DAsidChannel* channel=new DAsidChannel;
71 channel->iFactory = this;
76 DECLARE_STANDARD_LDD()
78 return new DAsidFactory;
85 TInt DAsidChannel::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& /*aVer*/)
90 DAsidChannel::DAsidChannel() : iThread(NULL)
94 DAsidChannel::~DAsidChannel()
101 TInt DAsidChannel::Request(TInt aFunction, TAny* a1, TAny* a2)
103 TInt r=KErrNotSupported;
107 case RAsidLdd::EGetCurrentThread:
109 DThread* thread = &Kern::CurrentThread();
110 kumemput32(a1, (TAny*)&thread, sizeof(DThread*));
115 case RAsidLdd::EOpenThread:
122 iThread = (DThread*) a1;
128 case RAsidLdd::ECloseThread:
135 NKern::ThreadEnterCS();
136 iThread->Close(NULL);
139 NKern::ThreadLeaveCS();
143 case RAsidLdd::EReadDesHeader:
147 kumemget32((TAny*)&hdr, a2, sizeof(SDesHeader));
148 r = Kern::ThreadGetDesInfo((DThread*)a1, hdr.iDes, hdr.iLength, hdr.iMaxLength, ptr, ETrue);
150 {// copy the data back to user side struct.
151 kumemput32(a2, &hdr, sizeof(SDesHeader));