os/kernelhwsrv/kerneltest/e32test/misc/int_svr_calls.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2005-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
// e32test\misc\int_svr_calls.cpp
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#include <e32def.h>
sl@0
    19
#include <e32def_private.h>
sl@0
    20
#include <e32cmn.h>
sl@0
    21
#include <e32cmn_private.h>
sl@0
    22
#undef EXPORT_C
sl@0
    23
#define EXPORT_C
sl@0
    24
#undef IMPORT_C
sl@0
    25
#define IMPORT_C
sl@0
    26
#include <e32std.h>
sl@0
    27
#include <e32std_private.h>
sl@0
    28
sl@0
    29
#ifdef __WINS__
sl@0
    30
// NB: The following is a straight rip from the win32 uc_exec.cpp
sl@0
    31
#include <emulator.h>
sl@0
    32
sl@0
    33
typedef TInt (__fastcall *TDispatcher)(TInt, TInt*);
sl@0
    34
TInt __fastcall LazyDispatch(TInt aFunction, TInt* aArgs);
sl@0
    35
sl@0
    36
#pragma data_seg(".data2")
sl@0
    37
#ifdef __VC32__
sl@0
    38
#pragma bss_seg(".data2")
sl@0
    39
#endif
sl@0
    40
static TDispatcher TheDispatcher = &LazyDispatch;
sl@0
    41
#pragma data_seg()
sl@0
    42
#ifdef __VC32__
sl@0
    43
#pragma bss_seg()
sl@0
    44
#endif
sl@0
    45
sl@0
    46
TInt __fastcall LazyDispatch(TInt aFunction, TInt* aArgs)
sl@0
    47
	{
sl@0
    48
	HINSTANCE kernel = GetModuleHandleA("ekern.exe");
sl@0
    49
	if (kernel)
sl@0
    50
		{
sl@0
    51
		TDispatcher dispatcher = (TDispatcher)Emulator::GetProcAddress(kernel, (LPCSTR)1);
sl@0
    52
		if (dispatcher)
sl@0
    53
			{
sl@0
    54
			TheDispatcher = dispatcher;
sl@0
    55
			return dispatcher(aFunction, aArgs);
sl@0
    56
			}
sl@0
    57
		}
sl@0
    58
	return 0;
sl@0
    59
	}
sl@0
    60
sl@0
    61
// Do the exec stuff in a cpp file for WINS
sl@0
    62
#define __GEN_USER_EXEC_CODE__
sl@0
    63
#include <e32svr.h>
sl@0
    64
#include <u32exec.h>
sl@0
    65
sl@0
    66
#undef EXPORT_C
sl@0
    67
#define EXPORT_C __declspec(dllexport)
sl@0
    68
sl@0
    69
// ripped from e32\euser\epoc\x86\uc_exec.cpp
sl@0
    70
sl@0
    71
__NAKED__ TInt Exec::SessionSend(TInt /*aHandle*/, TInt /*aFunction*/, TAny* /*aPtr*/, TRequestStatus* /*aStatus*/)
sl@0
    72
//
sl@0
    73
// Send a blind message to the server.
sl@0
    74
//
sl@0
    75
	{
sl@0
    76
	SLOW_EXEC4(EExecSessionSend);
sl@0
    77
	}
sl@0
    78
sl@0
    79
__NAKED__ TInt Exec::SessionSendSync(TInt /*aHandle*/, TInt /*aFunction*/, TAny* /*aPtr*/, TRequestStatus* /*aStatus*/)
sl@0
    80
//
sl@0
    81
// Send a blind message to the server using thread's dedicated message slot.
sl@0
    82
//
sl@0
    83
	{
sl@0
    84
	SLOW_EXEC4(EExecSessionSendSync);
sl@0
    85
	}
sl@0
    86
sl@0
    87
EXPORT_C TInt SessionCreate(const TDesC8& aName, TInt aMsgSlots, const TSecurityPolicy* aPolicy, TInt aType)
sl@0
    88
	{
sl@0
    89
	return Exec::SessionCreate(aName, aMsgSlots, aPolicy, aType);
sl@0
    90
	}
sl@0
    91
sl@0
    92
EXPORT_C TInt SessionSend(TInt aHandle, TInt aFunction, TAny* aArgs, TRequestStatus* aStatus)
sl@0
    93
	{
sl@0
    94
	return Exec::SessionSend(aHandle, aFunction, aArgs, aStatus);
sl@0
    95
	}
sl@0
    96
sl@0
    97
EXPORT_C TInt SessionSendSync(TInt aHandle, TInt aFunction, TAny* aArgs, TRequestStatus* aStatus)
sl@0
    98
	{
sl@0
    99
	return Exec::SessionSendSync(aHandle, aFunction, aArgs, aStatus);
sl@0
   100
	}
sl@0
   101
sl@0
   102
EXPORT_C void SetSessionPtr(TInt aHandle, const TAny* aPtr)
sl@0
   103
	{
sl@0
   104
	Exec::SetSessionPtr(aHandle, aPtr);
sl@0
   105
	}
sl@0
   106
#endif //__WINS__