Update contrib.
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 // e32\nkern\win32\vectors.cpp
20 inline TInt Invoke(TLinAddr aHandler,const TInt* aArgs)
21 {return (TExecHandler(aHandler))(aArgs[0],aArgs[1],aArgs[2],aArgs[3]);}
23 /** Executive dispatcher.
24 This is hooked by EUSER to handle executive dispatch into the kernel.
25 aArgs can be treated as an array of 1 to 4 arguments (depending on the exec call).
29 EXPORT_C TInt __fastcall Dispatch(TInt aFunction, TInt* aArgs)
31 NThread& me = *static_cast<NThread*>(TheScheduler.iCurrentThread);
32 //SL: If you panic here its probably because you forgot to Emulator::Lock() when doing system calls.
33 //@see: http://www.developer.nokia.com/Community/Wiki/Symbian_OS_Internals/03._Threads,_Processes_and_Libraries#Forced_exit_-_diverting_threads
34 __NK_ASSERT_ALWAYS(!me.iDiverted);
38 if (aFunction & 0x800000)
40 aFunction &= 0x7fffff;
42 const SFastExecTable* table = me.iFastExecTable;
45 // special case fast exec call
46 NKern::WaitForAnyRequest();
50 if (TUint(aFunction)<TUint(table->iFastExecCount))
53 TInt r = Invoke(table->iFunction[aFunction-1],aArgs);
58 // invalid exec number passed, so ensure we invoke the invalid exec
59 // handler by setting an illegal slow exec number
66 const SSlowExecTable* table = (const SSlowExecTable*)((const TUint8*)me.iSlowExecTable - _FOFF(SSlowExecTable,iEntries));
67 if (TUint(aFunction) >= TUint(table->iSlowExecCount))
68 return Invoke(table->iInvalidExecHandler,aArgs);
70 const SSlowExecEntry& e = table->iEntries[aFunction];
71 if (e.iFlags & KExecFlagClaim)
73 if (e.iFlags & KExecFlagPreprocess)
75 // replace the first argument with the result of preprocessing
76 TPreprocessHandler preprocesser = (TPreprocessHandler)table->iPreprocessHandler;
77 preprocesser(aArgs, e.iFlags);
79 TInt r = Invoke(e.iFunction,aArgs);
80 if (e.iFlags & KExecFlagRelease)
81 NKern::UnlockSystem();