First public contribution.
1 // Copyright (c) 1998-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\system\t_xprot.cpp
22 const TInt KSupervisorAddress=0x80000000;
23 const TInt KGarbageAddress=0xeeddbbcc;
25 TInt Handles[MAX_HANDLE];
29 TPtrC8 PtrC8(Buf8.Ptr(),10);
30 TPtrC8 PtrC(Buf.Ptr(),10);
31 TPtrC8 Ptr8(Buf8.Ptr(),10,1024);
32 TPtrC8 Ptr(Buf.Ptr(),10,1024);
33 TPtrC8 Ptr8N(NULL,10,1024);
34 TPtrC8 PtrN(NULL,10,1024);
35 TPtrC8 Ptr8I((TUint8*)KGarbageAddress,10,1024);
36 TPtrC8 PtrI((TText*)KGarbageAddress,10,1024);
37 TPtrC8 Ptr8S((TUint8*)KSupervisorAddress,10,1024);
38 TPtrC8 PtrS((TText*)KSupervisorAddress,10,1024);
43 TInt GetHandle(TInt& aState, TInt aHandleType)
46 TInt t=aHandleType?aHandleType-1:ELibrary;
50 case 1: r=0xdeaddead; break;
51 case 2: r=Handles[EThread]; break;
52 case 3: r=Handles[t]; break;
53 case 4: aState=0; return 0;
59 TInt GetAnyInt(TInt& aState)
68 case 4: r=299792458; break;
69 case 5: aState=0; return 0;
75 TInt GetAnyPtr(TInt& aState)
81 case 1: r=KGarbageAddress; break;
82 case 2: r=KSupervisorAddress; break;
83 case 3: r=(TInt)DataArea; break;
84 case 4: aState=0; return 0;
90 TInt GetIntPtr(TInt& aState)
96 case 1: r=KGarbageAddress; break;
97 case 2: r=((TInt)DataArea)+1; break;
98 case 3: r=KSupervisorAddress; break;
99 case 4: r=(TInt)DataArea; break;
100 case 5: aState=0; return 0;
106 TInt GetDes8(TInt& aState)
112 case 1: r=KGarbageAddress; break;
113 case 2: r=KSupervisorAddress; break;
114 case 3: r=(TInt)&Ptr8N; break;
115 case 4: r=(TInt)&Ptr8I; break;
116 case 5: r=(TInt)&Ptr8S; break;
117 case 6: r=(TInt)&Ptr8; break;
118 case 7: aState=0; return 0;
124 TInt GetWDes8(TInt& aState)
130 case 1: r=KGarbageAddress; break;
131 case 2: r=KSupervisorAddress; break;
132 case 3: r=(TInt)&Ptr8N; break;
133 case 4: r=(TInt)&Ptr8I; break;
134 case 5: r=(TInt)&Ptr8S; break;
135 case 6: r=(TInt)&PtrC8; break;
136 case 7: r=(TInt)&Ptr8; break;
137 case 8: aState=0; return 0;
143 TInt GetDes(TInt& aState)
149 case 1: r=KGarbageAddress; break;
150 case 2: r=KSupervisorAddress; break;
151 case 3: r=(TInt)&PtrN; break;
152 case 4: r=(TInt)&PtrI; break;
153 case 5: r=(TInt)&PtrS; break;
154 case 6: r=(TInt)&Ptr; break;
155 case 7: aState=0; return 0;
161 TInt GetWDes(TInt& aState)
167 case 1: r=KGarbageAddress; break;
168 case 2: r=KSupervisorAddress; break;
169 case 3: r=(TInt)&PtrN; break;
170 case 4: r=(TInt)&PtrI; break;
171 case 5: r=(TInt)&PtrS; break;
172 case 6: r=(TInt)&PtrC; break;
173 case 7: r=(TInt)&Ptr; break;
174 case 8: aState=0; return 0;
180 TInt GetBool(TInt& aState)
187 case 2: r=299792458; break;
188 case 3: aState=0; return 0;
194 TInt GetObjectType(TInt& aState)
199 case 0: r=EThread; break;
200 case 1: r=ELibrary; break;
201 case 2: r=ENumObjectType; break;
202 case 3: r=20000; break;
203 case 4: aState=0; return 0;
209 TInt GetDevUnit(TInt& aState)
216 case 2: r=20000; break;
217 case 3: aState=0; return 0;
223 TInt GetMsgHandle(TInt& aState)
229 case 1: r=KGarbageAddress; break;
230 case 2: r=(TInt)DataArea; break;
231 case 3: r=KSupervisorAddress; break;
232 case 4: r=MessageHandle; break;
233 case 5: aState=0; return 0;
239 TInt GetModuleHandle(TInt& aState)
245 case 1: r=KGarbageAddress; break;
246 case 2: r=ModuleHandle; break;
247 case 3: aState=0; return 0;
253 TInt GetSessionHandlePtr(TInt& aState)
259 case 1: r=KGarbageAddress; break;
260 case 2: r=KSupervisorAddress; break;
261 case 3: r=(TInt)&Handles[ESession]; break;
262 case 4: aState=0; return 0;
268 TInt GetArgument(TInt& aState, TInt aArgType)
270 if (aArgType==NO_PAR)
272 if (aArgType<MAX_HANDLE)
273 return GetHandle(aState,aArgType);
276 case ANY_INT: return GetAnyInt(aState);
277 case ANY_PTR: return GetAnyPtr(aState);
278 case INT_PTR: return GetIntPtr(aState);
279 case DES8: return GetDes8(aState);
280 case WDES8: return GetWDes8(aState);
281 case DES: return GetDes(aState);
282 case WDES: return GetWDes(aState);
283 case BOOL: return GetBool(aState);
284 case OBJECT_TYPE: return GetObjectType(aState);
285 case DEV_UNIT: return GetDevUnit(aState);
286 case MSG_HANDLE: return GetMsgHandle(aState);
287 case MODULE_HANDLE: return GetModuleHandle(aState);
288 case SESSION_HANDLE_PTR: return GetSessionHandlePtr(aState);
290 User::Panic(_L("UNKNOWN ARG TYPE"),aArgType);
293 #define FAST_EXEC(n) asm("swi %a0" : : "i" (n|EXECUTIVE_FAST))
294 __NAKED__ void DoFastExecCall(TInt /*aExecNum*/)
296 asm("ldr r1, __Args ");
298 asm("ldmfd r1, {r0-r3} ");
299 asm("add pc, pc, r0, lsl #2 ");
302 FAST_EXEC(EFastExecWaitForAnyRequest);
303 FAST_EXEC(EFastExecLanguage);
304 FAST_EXEC(EFastExecHeap);
305 FAST_EXEC(EFastExecHeapSwitch);
306 FAST_EXEC(EFastExecPushTrapFrame);
307 FAST_EXEC(EFastExecPopTrapFrame);
308 FAST_EXEC(EFastExecActiveScheduler);
309 FAST_EXEC(EFastExecSetActiveScheduler);
310 FAST_EXEC(EFastExecLockPeriod);
311 FAST_EXEC(EFastExecTrapHandler);
312 FAST_EXEC(EFastExecSetTrapHandler);
313 FAST_EXEC(EFastExecLockedInc);
314 FAST_EXEC(EFastExecLockedDec);
315 FAST_EXEC(EFastExecDebugMask);
316 FAST_EXEC(EFastExecSetDebugMask);
317 FAST_EXEC(EFastExecFastCounter);
318 FAST_EXEC(EFastExecGetLocaleCharSet);
319 FAST_EXEC(EFastExecLockRamDrive);
320 FAST_EXEC(EFastExecUnlockRamDrive);
321 FAST_EXEC(EFastExecRomHeaderAddress);
322 FAST_EXEC(EFastExecRomRootDirAddress);
323 FAST_EXEC(EFastExecJustInTime);
324 FAST_EXEC(EFastExecSetJustInTime);
325 FAST_EXEC(EFastExecBlockThreads);
326 FAST_EXEC(EFastExecKernelStartup);
327 FAST_EXEC(EFastExecFatUtilityFunctions);
328 FAST_EXEC(EFastExecSafeInc);
329 FAST_EXEC(EFastExecSafeDec);
335 #define SLOW_EXEC(n) asm("swi %a0" : : "i" (n))
336 __NAKED__ void DoSlowExecCall(TInt /*aExecNum*/)
338 asm("ldr r1, __Args ");
340 asm("ldmfd r1, {r0-r3} ");
341 asm("add pc, pc, r0, lsl #2 ");
344 SLOW_EXEC(EExecObjectNext);
345 SLOW_EXEC(EExecChunkBase);
346 SLOW_EXEC(EExecChunkSize);
347 SLOW_EXEC(EExecChunkMaxSize);
348 SLOW_EXEC(EExecHandleAttributes);
349 SLOW_EXEC(EExecTickCount);
350 SLOW_EXEC(EExecLogicalDeviceGetCaps);
351 SLOW_EXEC(EExecLogicalDeviceQueryVersionSupported);
352 SLOW_EXEC(EExecLogicalDeviceIsAvailable);
353 SLOW_EXEC(EExecDllGlobalAlloc);
354 SLOW_EXEC(EExecChangeLocale);
355 SLOW_EXEC(EExecChannelRequest);
356 SLOW_EXEC(EExecMathRandom);
357 SLOW_EXEC(EExecChannelControl);
358 SLOW_EXEC(EExecResetMachine);
359 SLOW_EXEC(EExecLibraryLookup);
360 SLOW_EXEC(EExecLibraryEntryPoint);
361 SLOW_EXEC(EExecLibraryDllRefTable);
362 SLOW_EXEC(EExecStaticCallList);
363 SLOW_EXEC(EExecDynamicCallList);
364 SLOW_EXEC(EExecLibraryCallList);
365 SLOW_EXEC(EExecLibraryFileName);
366 SLOW_EXEC(EExecExecuteInSupervisorMode);
367 SLOW_EXEC(EExecMutexCount);
368 SLOW_EXEC(EExecMutexWait);
369 SLOW_EXEC(EExecMutexSignal);
370 SLOW_EXEC(EExecProcessId);
371 SLOW_EXEC(EExecDllFileName);
372 SLOW_EXEC(EExecProcessResume);
373 SLOW_EXEC(EExecProcessFileName);
374 SLOW_EXEC(EExecProcessCommandLine);
375 SLOW_EXEC(EExecProcessExitType);
376 SLOW_EXEC(EExecProcessExitReason);
377 SLOW_EXEC(EExecProcessExitCategory);
378 SLOW_EXEC(EExecProcessPriority);
379 SLOW_EXEC(EExecProcessSetPriority);
380 SLOW_EXEC(EExecProcessFlags);
381 SLOW_EXEC(EExecProcessSetFlags);
382 SLOW_EXEC(EExecProcessSetOwner);
383 SLOW_EXEC(EExecDllInitialiseData);
384 SLOW_EXEC(EExecSemaphoreCount);
385 SLOW_EXEC(EExecSemaphoreWait);
386 SLOW_EXEC(EExecSemaphoreSignal1);
387 SLOW_EXEC(EExecSemaphoreSignalN);
388 SLOW_EXEC(EExecDllFreeData);
389 SLOW_EXEC(EExecServerReceive);
390 SLOW_EXEC(EExecServerCancel);
391 SLOW_EXEC(EExecSetSessionPtr);
392 SLOW_EXEC(EExecSessionSend);
393 SLOW_EXEC(EExecThreadId);
394 SLOW_EXEC(EExecSessionShare);
395 SLOW_EXEC(EExecThreadResume);
396 SLOW_EXEC(EExecThreadSuspend);
397 SLOW_EXEC(EExecThreadPriority);
398 SLOW_EXEC(EExecThreadSetPriority);
399 SLOW_EXEC(EExecThreadProcessPriority);
400 SLOW_EXEC(EExecThreadSetProcessPriority);
401 SLOW_EXEC(EExecThreadFlags);
402 SLOW_EXEC(EExecThreadSetFlags);
403 SLOW_EXEC(EExecThreadRequestCount);
404 SLOW_EXEC(EExecThreadExitType);
405 SLOW_EXEC(EExecThreadExitReason);
406 SLOW_EXEC(EExecThreadExitCategory);
407 SLOW_EXEC(EExecThreadGetDesLength);
408 SLOW_EXEC(EExecThreadGetDesMaxLength);
409 SLOW_EXEC(EExecThreadRead8);
410 SLOW_EXEC(EExecThreadRead16);
411 SLOW_EXEC(EExecThreadWrite8);
412 SLOW_EXEC(EExecThreadWrite16);
413 SLOW_EXEC(EExecTimerCancel);
414 SLOW_EXEC(EExecTimerAfter);
415 SLOW_EXEC(EExecTimerAt);
416 SLOW_EXEC(EExecTimerLock);
417 SLOW_EXEC(EExecChangeNotifierLogon);
418 SLOW_EXEC(EExecChangeNotifierLogoff);
419 SLOW_EXEC(EExecRequestSignal);
420 SLOW_EXEC(EExecMatch8);
421 SLOW_EXEC(EExecMatch16);
422 SLOW_EXEC(EExecFind8);
423 SLOW_EXEC(EExecFind16);
424 SLOW_EXEC(EExecLocateF8);
425 SLOW_EXEC(EExecLocateF16);
426 SLOW_EXEC(EExecHandleName);
427 SLOW_EXEC(EExecHandleFullName);
428 SLOW_EXEC(EExecHandleInfo);
429 SLOW_EXEC(EExecHandleCount);
430 SLOW_EXEC(EExecAfter);
432 SLOW_EXEC(EExecDayName);
433 SLOW_EXEC(EExecDayNameAbb);
434 SLOW_EXEC(EExecMonthName);
435 SLOW_EXEC(EExecMonthNameAbb);
436 SLOW_EXEC(EExecSuffix);
437 SLOW_EXEC(EExecAmPmName);
438 SLOW_EXEC(EExecCurrencySymbol);
439 SLOW_EXEC(EExecLocale);
440 SLOW_EXEC(EExecLocaleSet);
441 SLOW_EXEC(EExecLocaleMessageText);
442 SLOW_EXEC(EExecMessageComplete);
443 SLOW_EXEC(EExecTimeNow);
444 SLOW_EXEC(EExecSetHomeTime);
445 SLOW_EXEC(EExecSetMachineConfiguration);
446 SLOW_EXEC(EExecCaptureEventHook);
447 SLOW_EXEC(EExecReleaseEventHook);
448 SLOW_EXEC(EExecRequestEvent);
449 SLOW_EXEC(EExecRequestEventCancel);
450 SLOW_EXEC(EExecAddEvent);
451 SLOW_EXEC(EExecSessionSendSync);
452 SLOW_EXEC(EExecDllGlobalAllocated);
453 SLOW_EXEC(EExecDllGlobalRead);
454 SLOW_EXEC(EExecDllGlobalWrite);
455 SLOW_EXEC(EExecDllTls);
456 SLOW_EXEC(EExecHalFunction);
457 SLOW_EXEC(EExecSessionAttach);
458 SLOW_EXEC(EExecWsRegisterThread);
459 SLOW_EXEC(EExecFsRegisterThread);
460 SLOW_EXEC(EExecProcessCommandLineLength);
461 SLOW_EXEC(EExecTimerInactivity);
462 SLOW_EXEC(EExecUserInactivityTime);
463 SLOW_EXEC(EExecShortDateFormatSpec);
464 SLOW_EXEC(EExecLongDateFormatSpec);
465 SLOW_EXEC(EExecTimeFormatSpec);
466 SLOW_EXEC(EExecResetInactivityTime);
467 SLOW_EXEC(EExecDebugFunction);
468 SLOW_EXEC(EExecBreakPoint);
469 SLOW_EXEC(EExecProfileStart);
470 SLOW_EXEC(EExecProfileEnd);
471 SLOW_EXEC(EExecPasswordIsEnabled);
472 SLOW_EXEC(EExecPasswordIsValid);
473 SLOW_EXEC(EExecExceptionHandler);
474 SLOW_EXEC(EExecSetExceptionHandler);
475 SLOW_EXEC(EExecModifyExceptionMask);
476 SLOW_EXEC(EExecRaiseException);
477 SLOW_EXEC(EExecIsExceptionHandled);
478 SLOW_EXEC(EExecThreadGetRamSizes);
479 SLOW_EXEC(EExecProcessGetRamSizes);
480 SLOW_EXEC(EExecLibraryGetRamSizes);
481 SLOW_EXEC(EExecMachineConfiguration);
482 SLOW_EXEC(EExecWasChunkSetHeapInfo);
483 SLOW_EXEC(EExecLibraryType);
484 SLOW_EXEC(EExecProcessType);
485 SLOW_EXEC(EExecPasswordSetEnabled);
486 SLOW_EXEC(EExecPasswordSet);
487 SLOW_EXEC(EExecSetCurrencySymbol);
488 SLOW_EXEC(EExecProcessSetType);
489 SLOW_EXEC(EExecChunkBottom);
490 SLOW_EXEC(EExecChunkTop);
491 SLOW_EXEC(EExecThreadContext);
492 SLOW_EXEC(EExecDllDataInfo);
493 SLOW_EXEC(EExecThreadCreate);
494 SLOW_EXEC(EExecProcessCreate);
495 SLOW_EXEC(EExecProcessLoaded);
496 SLOW_EXEC(EExecFindHandleOpen);
497 SLOW_EXEC(EExecHandleClose);
498 SLOW_EXEC(EExecChunkCreate);
499 SLOW_EXEC(EExecChunkAdjust);
500 SLOW_EXEC(EExecOpenNamedObject);
501 SLOW_EXEC(EExecHandleDuplicate);
502 SLOW_EXEC(EExecMutexCreate);
503 SLOW_EXEC(EExecSemaphoreCreate);
504 SLOW_EXEC(EExecThreadOpenById);
505 SLOW_EXEC(EExecProcessOpenById);
506 SLOW_EXEC(EExecThreadKill);
507 SLOW_EXEC(EExecThreadLogon);
508 SLOW_EXEC(EExecThreadLogonCancel);
509 SLOW_EXEC(EExecDllSetTls);
510 SLOW_EXEC(EExecDllFreeTls);
511 SLOW_EXEC(EExecThreadRename);
512 SLOW_EXEC(EExecProcessRename);
513 SLOW_EXEC(EExecProcessKill);
514 SLOW_EXEC(EExecProcessOwner);
515 SLOW_EXEC(EExecProcessLogon);
516 SLOW_EXEC(EExecProcessLogonCancel);
517 SLOW_EXEC(EExecThreadSetInitialParameter);
518 SLOW_EXEC(EExecThreadProcess);
519 SLOW_EXEC(EExecThreadGetHeap);
520 SLOW_EXEC(EExecServerCreate);
521 SLOW_EXEC(EExecSessionCreate);
522 SLOW_EXEC(EExecLibraryLoadExact);
523 SLOW_EXEC(EExecLibraryLoaded);
524 SLOW_EXEC(EExecDeviceLoad);
525 SLOW_EXEC(EExecDeviceFree);
526 SLOW_EXEC(EExecChannelCreate);
527 SLOW_EXEC(EExecTimerCreate);
528 SLOW_EXEC(EExecDllAddDependency);
529 SLOW_EXEC(EExecTimerHighRes);
530 SLOW_EXEC(EExecAfterHighRes);
531 SLOW_EXEC(EExecChangeNotifierCreate);
532 SLOW_EXEC(EExecUndertakerCreate);
533 SLOW_EXEC(EExecUndertakerLogon);
534 SLOW_EXEC(EExecUndertakerLogonCancel);
535 SLOW_EXEC(EExecKernelHeapDebug);
536 SLOW_EXEC(EExecThreadGetCpuTime);
540 void TestExec(const SExecInfo& aInfo, TBool aFast)
542 TInt xn=aInfo.iExecNum;
543 TInt np=aInfo.iNumParams;
545 return; // no parameters
548 // don't do some slow execs
551 // loader group (could be restricted to F32)
552 case EExecProcessCreate:
553 case EExecProcessLoaded:
554 case EExecLibraryLoadExact:
555 case EExecLibraryLoaded:
556 case EExecDllAddDependency:
558 // descriptor processing (could be moved user side)
567 // we don't want to do this
568 case EExecResetMachine:
574 Mem::FillZ(state,sizeof(state));