sl@0: // Copyright (c) 2007-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\euser\epoc\x86\uc_exec.cia sl@0: // sl@0: // sl@0: sl@0: #define __GEN_USER_EXEC_CODE__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: sl@0: /****************************************************************************** sl@0: * Slow executive calls with preprocessing or extra arguments sl@0: ******************************************************************************/ sl@0: __NAKED__ TInt Exec::SessionSend(TInt /*aHandle*/, TInt /*aFunction*/, TAny* /*aPtr*/, TRequestStatus* /*aStatus*/) sl@0: // sl@0: // Send a blind message to the server. sl@0: // sl@0: { sl@0: SLOW_EXEC4(EExecSessionSend); sl@0: } sl@0: sl@0: __NAKED__ TInt Exec::SessionSendSync(TInt /*aHandle*/, TInt /*aFunction*/, TAny* /*aPtr*/, TRequestStatus* /*aStatus*/) sl@0: // sl@0: // Send a blind message to the server using thread's dedicated message slot. sl@0: // sl@0: { sl@0: SLOW_EXEC4(EExecSessionSendSync); sl@0: } sl@0: sl@0: __NAKED__ TInt Exec::MessageIpcCopy(TInt /*aHandle*/, TInt /*aParam*/, SIpcCopyInfo& /*aInfo*/, TInt /*anOffset*/) sl@0: // sl@0: // IPC transfer using message handle sl@0: // sl@0: { sl@0: SLOW_EXEC4(EExecMessageIpcCopy); sl@0: } sl@0: sl@0: __NAKED__ TInt Exec::BTraceOut(TUint32 /*a0*/, TUint32 /*a1*/, const BTrace::SExecExtension& /*aExtension*/, TInt /*aDataSize*/) sl@0: { sl@0: SLOW_EXEC4(EExecBTraceOut); sl@0: } sl@0: sl@0: __NAKED__ TInt Exec::BTraceOutBig(TUint32 /*a0*/, TUint32 /*a1*/, const BTrace::SExecExtension& /*aExtension*/, TInt /*aDataSize*/) sl@0: { sl@0: SLOW_EXEC4(EExecBTraceOutBig); sl@0: } sl@0: sl@0: __NAKED__ TInt Exec::UTraceOut(TUint32 /*a0*/, TUint32 /*a1*/, const BTrace::SExecExtension& /*aExtension*/, TInt /*aDataSize*/) sl@0: { sl@0: SLOW_EXEC4(EExecUTraceOut); sl@0: } sl@0: sl@0: __NAKED__ void ExitCurrentThread(TExitType /*aType*/, TInt /*aReason*/, const TDesC8* /*aCategory*/) sl@0: { sl@0: asm("mov eax, %0": : "i"(EExecThreadKill)); sl@0: asm("push ebx"); // push these anyway for debug sl@0: asm("push esi"); sl@0: asm("mov ecx, %0": : "i"(0xffff8001)); // gcc/gas doesnt like KCurrentThreadHandle sl@0: asm("mov edx, [esp+12]"); sl@0: asm("mov ebx, [esp+16]"); sl@0: asm("mov esi, [esp+20]"); sl@0: asm("int 0x21"); sl@0: // doesn't return sl@0: } sl@0: sl@0: EXPORT_C __NAKED__ void RThread::RequestComplete(TRequestStatus*& aStatus, TInt aReason) const sl@0: /** sl@0: Signals this thread that an asynchronous request originating from this thread, sl@0: is complete. sl@0: sl@0: The request is associated with the specified request status object supplied sl@0: by this thread. sl@0: sl@0: Typically, the caller of this function is the service provider responsible sl@0: for satisfying the request made by this thread. sl@0: sl@0: The request is completed with the completion code passed in aReason. This sl@0: value is copied into this thread's request status, *aStatus, before signalling sl@0: this thread's request semaphore. sl@0: sl@0: The meaning of the completion code is a matter of convention to be decided sl@0: between the service provider and this thread. sl@0: sl@0: In a client-server situation, completion of a request takes place in the context sl@0: of the server thread, but the pointer is interpreted in the address space sl@0: of the client. sl@0: sl@0: It is often the case in client-server situations that the client and the server sl@0: are in the same address space (i.e. the same process). sl@0: sl@0: Setting the pointer to the request status to NULL is a convenience, not all sl@0: servers need it. sl@0: sl@0: @param aStatus A reference to a pointer to the request status originally sl@0: supplied by this thread. This is a pointer into this thread's sl@0: address space, which may be different to the thread currently sl@0: executing (this code). On return, the pointer to the request sl@0: status is set to NULL. sl@0: sl@0: @param aReason The completion code of this request. sl@0: */ sl@0: // sl@0: // Signal a request completion. sl@0: // NOTE: __thiscall convention - we must remove parameters sl@0: // sl@0: { sl@0: THISCALL_PROLOG2() sl@0: asm("push ebx"); sl@0: asm("mov ecx, [ecx]"); sl@0: asm("mov eax, [esp+8]"); sl@0: asm("mov ebx, [esp+12]"); sl@0: asm("xor edx, edx"); sl@0: asm("lock xchg edx, [eax]"); sl@0: asm("cmp edx, 0"); sl@0: asm("je ExecRequestComplete_ret"); sl@0: asm("mov [edx], ebx"); // write to request status sl@0: asm("mov eax, %0": : "i"(EExecThreadRequestSignal)); sl@0: asm("int 0x21"); sl@0: asm("ExecRequestComplete_ret:"); sl@0: asm("pop ebx"); sl@0: THISCALL_EPILOG2() sl@0: } sl@0: sl@0: sl@0: