sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\memmodel\epoc\direct\arm\xsched.cia sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: sl@0: #define iMState iWaitLink.iSpare1 sl@0: sl@0: #ifdef __SCHEDULER_MACHINE_CODED__ sl@0: sl@0: #if defined(_DEBUG) sl@0: extern "C" void __DebugMsgRequestComplete(TInt a0, TInt a1, TInt a2); sl@0: extern "C" void __DebugMsgReqCompleteWrite(TInt a0, TInt a1, TInt a2); sl@0: #endif sl@0: sl@0: __NAKED__ void DThread::RequestComplete(TRequestStatus*& /*aStatus*/, TInt /*aReason*/) sl@0: // sl@0: // Signal this threads request semaphore. sl@0: // sl@0: { sl@0: ASM_DEBUG2(DThreadRequestComplete,r0,lr); sl@0: sl@0: asm("ldr r3, [r1] "); // r3 points to TRequestStatus sl@0: asm("mov r12, #0 "); sl@0: asm("str r12, [r1] "); // aStatus=NULL sl@0: sl@0: asm(".global _asm_RequestComplete "); sl@0: asm("_asm_RequestComplete: "); sl@0: sl@0: #ifdef BTRACE_REQUESTS sl@0: asm("stmdb sp!,{r0-r3,lr}"); sl@0: asm("mov r1,r3"); sl@0: asm("mov r3,r2"); // arg3 = aReason sl@0: asm("mov r2,r1"); // arg2 = aStatus sl@0: asm("add r1,r0,#%a0" : : "i" _FOFF(DThread,iNThread)); // arg1 = &this->iNThread sl@0: asm("ldr r0,_threadReqequestCompleteTraceHeader"); // arg0 = header sl@0: asm("bl " CSM_ZN6BTrace4OutXEmmmm); sl@0: asm("ldmia sp!,{r0-r3,lr}"); sl@0: #endif sl@0: sl@0: ASM_DEBUG3(RequestComplete,r0,r3,r2); sl@0: asm("ldrb r12, [r0, #%a0]" : : "i" _FOFF(DThread,iMState)); sl@0: asm("add r0, r0, #%a0" : : "i" _FOFF(DThread,iNThread)); sl@0: asm("cmp r12, #%a0" : : "i" (DThread::EDead)); // test if iMState=EDead sl@0: asm("beq " CSM_ZN5NKern12UnlockSystemEv ); // if it is, finish sl@0: asm("tst r3, #3 "); // check address aligned sl@0: asm("streq r2, [r3] "); // if so, write completion code sl@0: asm("moveq r1, #0 "); // and signal thread sl@0: asm("beq " CSM_ZN5NKern19ThreadRequestSignalEP7NThreadP10NFastMutex ); sl@0: asm("b " CSM_ZN5NKern12UnlockSystemEv ); // bad address, just finish. sl@0: #ifdef BTRACE_REQUESTS sl@0: asm("_threadReqequestCompleteTraceHeader:"); sl@0: asm(".word %a0" : : "i" (BTRACE_HEADER_C(16,BTrace::ERequests,BTrace::ERequestComplete))); sl@0: #endif sl@0: } sl@0: sl@0: #endif sl@0: