1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/euser/epoc/x86/uc_exec.cia Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,138 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32\euser\epoc\x86\uc_exec.cia
1.18 +//
1.19 +//
1.20 +
1.21 +#define __GEN_USER_EXEC_CODE__
1.22 +
1.23 +#include <e32svr.h>
1.24 +#include <u32exec.h>
1.25 +
1.26 +
1.27 +/******************************************************************************
1.28 +* Slow executive calls with preprocessing or extra arguments
1.29 +******************************************************************************/
1.30 +__NAKED__ TInt Exec::SessionSend(TInt /*aHandle*/, TInt /*aFunction*/, TAny* /*aPtr*/, TRequestStatus* /*aStatus*/)
1.31 +//
1.32 +// Send a blind message to the server.
1.33 +//
1.34 + {
1.35 + SLOW_EXEC4(EExecSessionSend);
1.36 + }
1.37 +
1.38 +__NAKED__ TInt Exec::SessionSendSync(TInt /*aHandle*/, TInt /*aFunction*/, TAny* /*aPtr*/, TRequestStatus* /*aStatus*/)
1.39 +//
1.40 +// Send a blind message to the server using thread's dedicated message slot.
1.41 +//
1.42 + {
1.43 + SLOW_EXEC4(EExecSessionSendSync);
1.44 + }
1.45 +
1.46 +__NAKED__ TInt Exec::MessageIpcCopy(TInt /*aHandle*/, TInt /*aParam*/, SIpcCopyInfo& /*aInfo*/, TInt /*anOffset*/)
1.47 +//
1.48 +// IPC transfer using message handle
1.49 +//
1.50 + {
1.51 + SLOW_EXEC4(EExecMessageIpcCopy);
1.52 + }
1.53 +
1.54 +__NAKED__ TInt Exec::BTraceOut(TUint32 /*a0*/, TUint32 /*a1*/, const BTrace::SExecExtension& /*aExtension*/, TInt /*aDataSize*/)
1.55 + {
1.56 + SLOW_EXEC4(EExecBTraceOut);
1.57 + }
1.58 +
1.59 +__NAKED__ TInt Exec::BTraceOutBig(TUint32 /*a0*/, TUint32 /*a1*/, const BTrace::SExecExtension& /*aExtension*/, TInt /*aDataSize*/)
1.60 + {
1.61 + SLOW_EXEC4(EExecBTraceOutBig);
1.62 + }
1.63 +
1.64 +__NAKED__ TInt Exec::UTraceOut(TUint32 /*a0*/, TUint32 /*a1*/, const BTrace::SExecExtension& /*aExtension*/, TInt /*aDataSize*/)
1.65 + {
1.66 + SLOW_EXEC4(EExecUTraceOut);
1.67 + }
1.68 +
1.69 +__NAKED__ void ExitCurrentThread(TExitType /*aType*/, TInt /*aReason*/, const TDesC8* /*aCategory*/)
1.70 + {
1.71 + asm("mov eax, %0": : "i"(EExecThreadKill));
1.72 + asm("push ebx"); // push these anyway for debug
1.73 + asm("push esi");
1.74 + asm("mov ecx, %0": : "i"(0xffff8001)); // gcc/gas doesnt like KCurrentThreadHandle
1.75 + asm("mov edx, [esp+12]");
1.76 + asm("mov ebx, [esp+16]");
1.77 + asm("mov esi, [esp+20]");
1.78 + asm("int 0x21");
1.79 + // doesn't return
1.80 + }
1.81 +
1.82 +EXPORT_C __NAKED__ void RThread::RequestComplete(TRequestStatus*& aStatus, TInt aReason) const
1.83 +/**
1.84 +Signals this thread that an asynchronous request originating from this thread,
1.85 +is complete.
1.86 +
1.87 +The request is associated with the specified request status object supplied
1.88 +by this thread.
1.89 +
1.90 +Typically, the caller of this function is the service provider responsible
1.91 +for satisfying the request made by this thread.
1.92 +
1.93 +The request is completed with the completion code passed in aReason. This
1.94 +value is copied into this thread's request status, *aStatus, before signalling
1.95 +this thread's request semaphore.
1.96 +
1.97 +The meaning of the completion code is a matter of convention to be decided
1.98 +between the service provider and this thread.
1.99 +
1.100 +In a client-server situation, completion of a request takes place in the context
1.101 +of the server thread, but the pointer is interpreted in the address space
1.102 +of the client.
1.103 +
1.104 +It is often the case in client-server situations that the client and the server
1.105 +are in the same address space (i.e. the same process).
1.106 +
1.107 +Setting the pointer to the request status to NULL is a convenience, not all
1.108 +servers need it.
1.109 +
1.110 +@param aStatus A reference to a pointer to the request status originally
1.111 +supplied by this thread. This is a pointer into this thread's
1.112 +address space, which may be different to the thread currently
1.113 +executing (this code). On return, the pointer to the request
1.114 +status is set to NULL.
1.115 +
1.116 +@param aReason The completion code of this request.
1.117 +*/
1.118 +//
1.119 +// Signal a request completion.
1.120 +// NOTE: __thiscall convention - we must remove parameters
1.121 +//
1.122 + {
1.123 + THISCALL_PROLOG2()
1.124 + asm("push ebx");
1.125 + asm("mov ecx, [ecx]");
1.126 + asm("mov eax, [esp+8]");
1.127 + asm("mov ebx, [esp+12]");
1.128 + asm("xor edx, edx");
1.129 + asm("lock xchg edx, [eax]");
1.130 + asm("cmp edx, 0");
1.131 + asm("je ExecRequestComplete_ret");
1.132 + asm("mov [edx], ebx"); // write to request status
1.133 + asm("mov eax, %0": : "i"(EExecThreadRequestSignal));
1.134 + asm("int 0x21");
1.135 + asm("ExecRequestComplete_ret:");
1.136 + asm("pop ebx");
1.137 + THISCALL_EPILOG2()
1.138 + }
1.139 +
1.140 +
1.141 +