author | Stephane Lenclud <tortoisehg@lenclud.com> |
Tue, 27 Apr 2010 20:22:55 +0200 | |
branch | anywhere |
changeset 95 | f561f9ae805b |
parent 94 | f36eb4948686 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1995-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\include\u32exec.h |
|
15 |
// |
|
16 |
// WARNING: This file contains some APIs which are internal and are subject |
|
17 |
// to change without notice. Such APIs should therefore not be used |
|
18 |
// outside the Kernel and Hardware Services package. |
|
19 |
// |
|
20 |
||
21 |
/** |
|
22 |
@file |
|
23 |
@internalComponent |
|
24 |
*/ |
|
25 |
||
26 |
#ifndef __U32EXEC_H__ |
|
27 |
#define __U32EXEC_H__ |
|
28 |
#include <u32std.h> |
|
29 |
#include <cpudefs.h> |
|
30 |
||
31 |
#ifdef __KERNEL_MODE__ |
|
32 |
#define EXEC_INT64 Int64 |
|
33 |
#define EXEC_TIME TTimeK |
|
34 |
#else |
|
35 |
#define EXEC_INT64 TInt64 |
|
36 |
#define EXEC_TIME TInt64 |
|
37 |
#endif |
|
38 |
||
94
f36eb4948686
Basic process initialisation and shutdown working. Using small fixed heap for now. Fixing missing global Symbian C++ new operators. Panics on Win32 now display error message.
Stephane Lenclud <tortoisehg@lenclud.com>
parents:
0
diff
changeset
|
39 |
#ifdef __SYMC__ |
f36eb4948686
Basic process initialisation and shutdown working. Using small fixed heap for now. Fixing missing global Symbian C++ new operators. Panics on Win32 now display error message.
Stephane Lenclud <tortoisehg@lenclud.com>
parents:
0
diff
changeset
|
40 |
#define __EXECDECL__ |
f36eb4948686
Basic process initialisation and shutdown working. Using small fixed heap for now. Fixing missing global Symbian C++ new operators. Panics on Win32 now display error message.
Stephane Lenclud <tortoisehg@lenclud.com>
parents:
0
diff
changeset
|
41 |
#else |
0 | 42 |
#define __EXECDECL__ __NAKED__ |
94
f36eb4948686
Basic process initialisation and shutdown working. Using small fixed heap for now. Fixing missing global Symbian C++ new operators. Panics on Win32 now display error message.
Stephane Lenclud <tortoisehg@lenclud.com>
parents:
0
diff
changeset
|
43 |
#endif |
0 | 44 |
|
45 |
#if defined(__WINS__) |
|
46 |
||
47 |
// Executive call macros for WINS |
|
48 |
||
49 |
#define EXECUTIVE_FAST 0x00800000 |
|
50 |
#define EXECUTIVE_SLOW 0x00000000 |
|
51 |
||
52 |
#define __DISPATCH(func) \ |
|
53 |
__asm lea edx, [esp + 0x4] \ |
|
54 |
__asm mov ecx, (func) \ |
|
55 |
__asm jmp [TheDispatcher] |
|
56 |
||
57 |
#define FAST_EXEC0(n) __DISPATCH((n)|EXECUTIVE_FAST) |
|
58 |
#define FAST_EXEC1(n) __DISPATCH((n)|EXECUTIVE_FAST) |
|
59 |
#define SLOW_EXEC0(n) __DISPATCH((n)|EXECUTIVE_SLOW) |
|
60 |
#define SLOW_EXEC1(n) __DISPATCH((n)|EXECUTIVE_SLOW) |
|
61 |
#define SLOW_EXEC2(n) __DISPATCH((n)|EXECUTIVE_SLOW) |
|
62 |
#define SLOW_EXEC3(n) __DISPATCH((n)|EXECUTIVE_SLOW) |
|
63 |
#define SLOW_EXEC4(n) __DISPATCH((n)|EXECUTIVE_SLOW) |
|
64 |
||
65 |
#define KFAST_EXEC0(n) __DISPATCH((n)|EXECUTIVE_FAST) |
|
66 |
#define KFAST_EXEC1(n) __DISPATCH((n)|EXECUTIVE_FAST) |
|
67 |
#define KSLOW_EXEC0(n) __DISPATCH((n)|EXECUTIVE_SLOW) |
|
68 |
#define KSLOW_EXEC1(n) __DISPATCH((n)|EXECUTIVE_SLOW) |
|
69 |
#define KSLOW_EXEC2(n) __DISPATCH((n)|EXECUTIVE_SLOW) |
|
70 |
#define KSLOW_EXEC3(n) __DISPATCH((n)|EXECUTIVE_SLOW) |
|
71 |
#define KSLOW_EXEC4(n) __DISPATCH((n)|EXECUTIVE_SLOW) |
|
72 |
||
73 |
#elif defined(__CPU_X86) |
|
74 |
||
75 |
// Executive call macros for X86 |
|
76 |
#ifdef __GCC32__ |
|
77 |
#define FAST_EXEC0(n) asm("mov eax, %0": :"i"(n)); \ |
|
78 |
asm("int 0x20 \n ret") |
|
79 |
#define FAST_EXEC1(n) asm("mov eax, %0": :"i"(n)); \ |
|
80 |
asm("mov ecx, [esp+4] \n int 0x20 \n ret") |
|
81 |
#define SLOW_EXEC0(n) asm("mov eax, %0": :"i"(n)); \ |
|
82 |
asm("int 0x21 \n ret") |
|
83 |
#define SLOW_EXEC1(n) asm("mov eax, %0": :"i"(n)); \ |
|
84 |
asm("mov ecx, [esp+4] \n int 0x21 \n ret") |
|
85 |
#define SLOW_EXEC2(n) asm("mov eax, %0": :"i"(n)); \ |
|
86 |
asm("mov ecx, [esp+4] \n mov edx, [esp+8] \n int 0x21 \n ret") |
|
87 |
#define SLOW_EXEC3(n) asm("mov eax, %0": :"i"(n)); \ |
|
88 |
asm("push ebx \n" \ |
|
89 |
"mov ecx, [esp+8] \n" \ |
|
90 |
"mov edx, [esp+12]\n" \ |
|
91 |
"mov ebx, [esp+16]\n" \ |
|
92 |
"int 0x21 \n" \ |
|
93 |
"pop ebx \n" \ |
|
94 |
"ret") |
|
95 |
||
96 |
#define SLOW_EXEC4(n) asm("mov eax, %0": :"i"(n)); \ |
|
97 |
asm("push ebx \n" \ |
|
98 |
"push esi \n" \ |
|
99 |
"mov ecx, [esp+12]\n" \ |
|
100 |
"mov edx, [esp+16]\n" \ |
|
101 |
"mov ebx, [esp+20]\n" \ |
|
102 |
"mov esi, [esp+24]\n" \ |
|
103 |
"int 0x21 \n" \ |
|
104 |
"pop esi \n" \ |
|
105 |
"pop ebx \n" \ |
|
106 |
"ret") |
|
107 |
#else |
|
108 |
#define FAST_EXEC0(n) _asm mov eax, n _asm int 20h _asm ret |
|
109 |
#define FAST_EXEC1(n) _asm mov eax, n _asm mov ecx, [esp+4] _asm int 20h _asm ret |
|
110 |
||
111 |
#define SLOW_EXEC0(n) _asm mov eax, n _asm int 21h _asm ret |
|
112 |
#define SLOW_EXEC1(n) _asm mov eax, n _asm mov ecx, [esp+4] _asm int 21h _asm ret |
|
113 |
#define SLOW_EXEC2(n) _asm mov eax, n _asm mov ecx, [esp+4] _asm mov edx, [esp+8] _asm int 21h _asm ret |
|
114 |
||
115 |
#define SLOW_EXEC3(n) _asm mov eax, n \ |
|
116 |
_asm push ebx \ |
|
117 |
_asm mov ecx, [esp+8] \ |
|
118 |
_asm mov edx, [esp+12] \ |
|
119 |
_asm mov ebx, [esp+16] \ |
|
120 |
_asm int 21h \ |
|
121 |
_asm pop ebx \ |
|
122 |
_asm ret |
|
123 |
||
124 |
#define SLOW_EXEC4(n) _asm mov eax, n \ |
|
125 |
_asm push ebx \ |
|
126 |
_asm push esi \ |
|
127 |
_asm mov ecx, [esp+12] \ |
|
128 |
_asm mov edx, [esp+16] \ |
|
129 |
_asm mov ebx, [esp+20] \ |
|
130 |
_asm mov esi, [esp+24] \ |
|
131 |
_asm int 21h \ |
|
132 |
_asm pop esi \ |
|
133 |
_asm pop ebx \ |
|
134 |
_asm ret |
|
135 |
#endif |
|
136 |
||
137 |
#define KFAST_EXEC0(n) FAST_EXEC0(n) |
|
138 |
#define KFAST_EXEC1(n) FAST_EXEC1(n) |
|
139 |
#define KSLOW_EXEC0(n) SLOW_EXEC0(n) |
|
140 |
#define KSLOW_EXEC1(n) SLOW_EXEC1(n) |
|
141 |
#define KSLOW_EXEC2(n) SLOW_EXEC2(n) |
|
142 |
#define KSLOW_EXEC3(n) SLOW_EXEC3(n) |
|
143 |
#define KSLOW_EXEC4(n) SLOW_EXEC4(n) |
|
144 |
||
145 |
#elif defined(__CPU_ARM) |
|
146 |
||
147 |
// Executive call macros for ARM |
|
148 |
||
149 |
#define EXECUTIVE_FAST 0x00800000 |
|
150 |
#define EXECUTIVE_SLOW 0x00000000 |
|
151 |
||
152 |
#define __DISPATCH(n) \ |
|
153 |
asm("swi %a0" : : "i" (n)); \ |
|
154 |
__JUMP(,lr); |
|
155 |
||
156 |
#define FAST_EXEC0(n) __DISPATCH((n)|EXECUTIVE_FAST) |
|
157 |
#define FAST_EXEC1(n) __DISPATCH((n)|EXECUTIVE_FAST) |
|
158 |
#define SLOW_EXEC0(n) __DISPATCH((n)|EXECUTIVE_SLOW) |
|
159 |
#define SLOW_EXEC1(n) __DISPATCH((n)|EXECUTIVE_SLOW) |
|
160 |
#define SLOW_EXEC2(n) __DISPATCH((n)|EXECUTIVE_SLOW) |
|
161 |
#define SLOW_EXEC3(n) __DISPATCH((n)|EXECUTIVE_SLOW) |
|
162 |
#define SLOW_EXEC4(n) __DISPATCH((n)|EXECUTIVE_SLOW) |
|
163 |
||
164 |
#define __KDISPATCH(n) \ |
|
165 |
asm("stmfd sp!, {ip,lr} "); \ |
|
166 |
asm("swi %a0" : : "i" (n)); \ |
|
167 |
__POPRET("ip,"); |
|
168 |
||
169 |
#define KFAST_EXEC0(n) __KDISPATCH((n)|EXECUTIVE_FAST) |
|
170 |
#define KFAST_EXEC1(n) __KDISPATCH((n)|EXECUTIVE_FAST) |
|
171 |
#define KSLOW_EXEC0(n) __KDISPATCH((n)|EXECUTIVE_SLOW) |
|
172 |
#define KSLOW_EXEC1(n) __KDISPATCH((n)|EXECUTIVE_SLOW) |
|
173 |
#define KSLOW_EXEC2(n) __KDISPATCH((n)|EXECUTIVE_SLOW) |
|
174 |
#define KSLOW_EXEC3(n) __KDISPATCH((n)|EXECUTIVE_SLOW) |
|
175 |
#define KSLOW_EXEC4(n) __KDISPATCH((n)|EXECUTIVE_SLOW) |
|
176 |
||
177 |
#define __DISPATCH_NR(n) \ |
|
178 |
asm("swi %a0" : : "i" (n)); |
|
179 |
||
180 |
#define FAST_EXEC0_NR(n) __DISPATCH_NR((n)|EXECUTIVE_FAST) |
|
181 |
#define FAST_EXEC1_NR(n) __DISPATCH_NR((n)|EXECUTIVE_FAST) |
|
182 |
#define SLOW_EXEC0_NR(n) __DISPATCH_NR((n)|EXECUTIVE_SLOW) |
|
183 |
#define SLOW_EXEC1_NR(n) __DISPATCH_NR((n)|EXECUTIVE_SLOW) |
|
184 |
#define SLOW_EXEC2_NR(n) __DISPATCH_NR((n)|EXECUTIVE_SLOW) |
|
185 |
#define SLOW_EXEC3_NR(n) __DISPATCH_NR((n)|EXECUTIVE_SLOW) |
|
186 |
#define SLOW_EXEC4_NR(n) __DISPATCH_NR((n)|EXECUTIVE_SLOW) |
|
187 |
||
188 |
#define __KDISPATCH_NR(n) \ |
|
189 |
asm("swi %a0" : : "i" (n)); |
|
190 |
||
191 |
#define KFAST_EXEC0_NR(n) __KDISPATCH_NR((n)|EXECUTIVE_FAST) |
|
192 |
#define KFAST_EXEC1_NR(n) __KDISPATCH_NR((n)|EXECUTIVE_FAST) |
|
193 |
#define KSLOW_EXEC0_NR(n) __KDISPATCH_NR((n)|EXECUTIVE_SLOW) |
|
194 |
#define KSLOW_EXEC1_NR(n) __KDISPATCH_NR((n)|EXECUTIVE_SLOW) |
|
195 |
#define KSLOW_EXEC2_NR(n) __KDISPATCH_NR((n)|EXECUTIVE_SLOW) |
|
196 |
#define KSLOW_EXEC3_NR(n) __KDISPATCH_NR((n)|EXECUTIVE_SLOW) |
|
197 |
#define KSLOW_EXEC4_NR(n) __KDISPATCH_NR((n)|EXECUTIVE_SLOW) |
|
198 |
||
199 |
#else |
|
200 |
#error Unknown CPU |
|
201 |
#endif |
|
202 |
||
203 |
#ifdef __LEAVE_EQUALS_THROW__ |
|
204 |
// Hide TTrap to catch unwary uses of the old cleanup |
|
205 |
// mechanism at compile time |
|
206 |
class TTrap; |
|
207 |
#endif //__LEAVE_EQUALS_THROW__ |
|
208 |
||
209 |
#include <exec_enum.h> |
|
210 |
#include <e32btrace.h> |
|
211 |
#include <exec_user.h> |
|
212 |
||
213 |
#endif |