os/kernelhwsrv/kernel/eka/euser/epoc/x86/uc_exec.cia
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32\euser\epoc\x86\uc_exec.cia
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#define __GEN_USER_EXEC_CODE__
sl@0
    19
sl@0
    20
#include <e32svr.h>
sl@0
    21
#include <u32exec.h>
sl@0
    22
sl@0
    23
sl@0
    24
/******************************************************************************
sl@0
    25
* Slow executive calls with preprocessing or extra arguments
sl@0
    26
******************************************************************************/
sl@0
    27
__NAKED__ TInt Exec::SessionSend(TInt /*aHandle*/, TInt /*aFunction*/, TAny* /*aPtr*/, TRequestStatus* /*aStatus*/)
sl@0
    28
//
sl@0
    29
// Send a blind message to the server.
sl@0
    30
//
sl@0
    31
	{
sl@0
    32
	SLOW_EXEC4(EExecSessionSend);
sl@0
    33
	}
sl@0
    34
sl@0
    35
__NAKED__ TInt Exec::SessionSendSync(TInt /*aHandle*/, TInt /*aFunction*/, TAny* /*aPtr*/, TRequestStatus* /*aStatus*/)
sl@0
    36
//
sl@0
    37
// Send a blind message to the server using thread's dedicated message slot.
sl@0
    38
//
sl@0
    39
	{
sl@0
    40
	SLOW_EXEC4(EExecSessionSendSync);
sl@0
    41
	}
sl@0
    42
sl@0
    43
__NAKED__ TInt Exec::MessageIpcCopy(TInt /*aHandle*/, TInt /*aParam*/, SIpcCopyInfo& /*aInfo*/, TInt /*anOffset*/)
sl@0
    44
//
sl@0
    45
// IPC transfer using message handle
sl@0
    46
//
sl@0
    47
	{
sl@0
    48
	SLOW_EXEC4(EExecMessageIpcCopy);
sl@0
    49
	}
sl@0
    50
sl@0
    51
__NAKED__ TInt Exec::BTraceOut(TUint32 /*a0*/, TUint32 /*a1*/, const BTrace::SExecExtension& /*aExtension*/, TInt /*aDataSize*/)
sl@0
    52
	{
sl@0
    53
	SLOW_EXEC4(EExecBTraceOut);
sl@0
    54
	}
sl@0
    55
sl@0
    56
__NAKED__ TInt Exec::BTraceOutBig(TUint32 /*a0*/, TUint32 /*a1*/, const BTrace::SExecExtension& /*aExtension*/, TInt /*aDataSize*/)
sl@0
    57
	{
sl@0
    58
	SLOW_EXEC4(EExecBTraceOutBig);
sl@0
    59
	}
sl@0
    60
sl@0
    61
__NAKED__ TInt Exec::UTraceOut(TUint32 /*a0*/, TUint32 /*a1*/, const BTrace::SExecExtension& /*aExtension*/, TInt /*aDataSize*/)
sl@0
    62
	{
sl@0
    63
	SLOW_EXEC4(EExecUTraceOut);
sl@0
    64
	}
sl@0
    65
sl@0
    66
__NAKED__ void ExitCurrentThread(TExitType /*aType*/, TInt /*aReason*/, const TDesC8* /*aCategory*/)
sl@0
    67
	{
sl@0
    68
	asm("mov eax, %0": : "i"(EExecThreadKill));
sl@0
    69
	asm("push ebx");		// push these anyway for debug
sl@0
    70
	asm("push esi");
sl@0
    71
	asm("mov ecx, %0": : "i"(0xffff8001)); // gcc/gas doesnt like KCurrentThreadHandle
sl@0
    72
	asm("mov edx, [esp+12]");
sl@0
    73
	asm("mov ebx, [esp+16]");
sl@0
    74
	asm("mov esi, [esp+20]");
sl@0
    75
	asm("int 0x21");
sl@0
    76
	// doesn't return
sl@0
    77
	}
sl@0
    78
sl@0
    79
EXPORT_C __NAKED__ void RThread::RequestComplete(TRequestStatus*& aStatus, TInt aReason) const
sl@0
    80
/**
sl@0
    81
Signals this thread that an asynchronous request originating from this thread,
sl@0
    82
is complete.
sl@0
    83
sl@0
    84
The request is associated with the specified request status object supplied
sl@0
    85
by this thread.
sl@0
    86
sl@0
    87
Typically, the caller of this function is the service provider responsible
sl@0
    88
for satisfying the request made by this thread.
sl@0
    89
sl@0
    90
The request is completed with the completion code passed in aReason. This
sl@0
    91
value is copied into this thread's request status, *aStatus, before signalling
sl@0
    92
this thread's request semaphore.
sl@0
    93
sl@0
    94
The meaning of the completion code is a matter of convention to be decided
sl@0
    95
between the service provider and this thread.
sl@0
    96
sl@0
    97
In a client-server situation, completion of a request takes place in the context
sl@0
    98
of the server thread, but the pointer is interpreted in the address space
sl@0
    99
of the client.
sl@0
   100
sl@0
   101
It is often the case in client-server situations that the client and the server
sl@0
   102
are in the same address space (i.e. the same process).
sl@0
   103
sl@0
   104
Setting the pointer to the request status to NULL is a convenience, not all
sl@0
   105
servers need it.
sl@0
   106
sl@0
   107
@param aStatus A reference to a pointer to the request status originally
sl@0
   108
supplied by this thread. This is a pointer into this thread's
sl@0
   109
address space, which may be different to the thread currently
sl@0
   110
executing (this code). On return, the pointer to the request
sl@0
   111
status is set to NULL.
sl@0
   112
sl@0
   113
@param aReason The completion code of this request.
sl@0
   114
*/
sl@0
   115
//
sl@0
   116
// Signal a request completion.
sl@0
   117
// NOTE: __thiscall convention - we must remove parameters
sl@0
   118
//
sl@0
   119
	{
sl@0
   120
	THISCALL_PROLOG2()
sl@0
   121
	asm("push ebx");
sl@0
   122
	asm("mov ecx, [ecx]");
sl@0
   123
	asm("mov eax, [esp+8]");
sl@0
   124
	asm("mov ebx, [esp+12]");
sl@0
   125
	asm("xor edx, edx");
sl@0
   126
	asm("lock xchg edx, [eax]");
sl@0
   127
	asm("cmp edx, 0");
sl@0
   128
	asm("je ExecRequestComplete_ret");
sl@0
   129
	asm("mov [edx], ebx");   // write to request status
sl@0
   130
	asm("mov eax, %0": : "i"(EExecThreadRequestSignal));
sl@0
   131
	asm("int 0x21");
sl@0
   132
	asm("ExecRequestComplete_ret:");
sl@0
   133
	asm("pop ebx");
sl@0
   134
	THISCALL_EPILOG2()
sl@0
   135
	}
sl@0
   136
sl@0
   137
sl@0
   138