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