kerneltest/e32test/misc/int_svr_calls.cia
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 17 Dec 2009 09:24:54 +0200
changeset 9 96e5fb8b040d
permissions -rw-r--r--
Revision: 200951 Kit: 200951

// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// e32test\misc\int_svr_calls.cia
// 
//

#include <e32def.h>
#undef IMPORT_C
#define IMPORT_C
#undef EXPORT_C
#define EXPORT_C

#define __GEN_USER_EXEC_CODE__
#include <e32svr.h>
#include <u32exec.h>

#undef EXPORT_C
#define EXPORT_C __declspec(dllexport)


#ifdef __MARM__
// ripped from e32\euser\epoc\arm\uc_exec.cia

__NAKED__ TInt Exec::SessionSend(TInt /*aHandle*/, TInt /*aFunction*/, TAny* /*aPtr*/, TRequestStatus* /*aStatus*/)
//
// Send a blind message to the server.
//
	{
	asm("stmfd sp!, {r4-r8,lr} ");
	asm("movs r8, r2 ");				// test for aPtr==NULL, set iArgFlags=0 if so
	asm("ldmneia r2, {r4-r8} ");		// else get args into r4-r8
	asm("mov ip, pc ");
	asm("swi	%a0" : : "i" (EExecSessionSend|EXECUTIVE_SLOW));
	__POPRET("r4-r8,");
	}

__NAKED__ TInt Exec::SessionSendSync(TInt /*aHandle*/, TInt /*aFunction*/, TAny* /*aPtr*/, TRequestStatus* /*aStatus*/)
//
// Send a blind message to the server using thread's dedicated message slot.
//
	{
	asm("stmfd sp!, {r4-r8,lr} ");
	asm("movs r8, r2 ");				// test for aPtr==NULL, set iArgFlags=0 if so
	asm("ldmneia r2, {r4-r8} ");		// else get args into r4-r8
	asm("mov ip, pc ");
	asm("swi	%a0" : : "i" (EExecSessionSendSync|EXECUTIVE_SLOW));
	__POPRET("r4-r8,");
	}

EXPORT_C TInt SessionCreate(const TDesC8& aName, TInt aMsgSlots, const TSecurityPolicy* aPolicy, TInt aType)
	{
	return Exec::SessionCreate(aName, aMsgSlots, aPolicy, aType);
	}

EXPORT_C TInt SessionSend(TInt aHandle, TInt aFunction, TAny* aArgs, TRequestStatus* aStatus)
	{
	return Exec::SessionSend(aHandle, aFunction, aArgs, aStatus);
	}

EXPORT_C TInt SessionSendSync(TInt aHandle, TInt aFunction, TAny* aArgs, TRequestStatus* aStatus)
	{
	return Exec::SessionSendSync(aHandle, aFunction, aArgs, aStatus);
	}

EXPORT_C void SetSessionPtr(TInt aHandle, const TAny* aPtr)
	{
	Exec::SetSessionPtr(aHandle, aPtr);
	}
#endif //__MARM__

#ifdef __X86__
// ripped from e32\euser\epoc\x86\uc_exec.cpp

__NAKED__ TInt Exec::SessionSend(TInt /*aHandle*/, TInt /*aFunction*/, TAny* /*aPtr*/, TRequestStatus* /*aStatus*/)
//
// Send a blind message to the server.
//
	{
	SLOW_EXEC4(EExecSessionSend);
	}

__NAKED__ TInt Exec::SessionSendSync(TInt /*aHandle*/, TInt /*aFunction*/, TAny* /*aPtr*/, TRequestStatus* /*aStatus*/)
//
// Send a blind message to the server using thread's dedicated message slot.
//
	{
	SLOW_EXEC4(EExecSessionSendSync);
	}

EXPORT_C TInt SessionCreate(const TDesC8& aName, TInt aMsgSlots, const TSecurityPolicy* aPolicy, TInt aType)
	{
	RDebug::Printf("Exec: %08x %08x %08x %08x", &aName, aMsgSlots, aPolicy, aType);
	return Exec::SessionCreate(aName, aMsgSlots, aPolicy, aType);
	}

EXPORT_C TInt SessionSend(TInt aHandle, TInt aFunction, TAny* aArgs, TRequestStatus* aStatus)
	{
	return Exec::SessionSend(aHandle, aFunction, aArgs, aStatus);
	}

EXPORT_C TInt SessionSendSync(TInt aHandle, TInt aFunction, TAny* aArgs, TRequestStatus* aStatus)
	{
	return Exec::SessionSendSync(aHandle, aFunction, aArgs, aStatus);
	}

EXPORT_C void SetSessionPtr(TInt aHandle, const TAny* aPtr)
	{
	Exec::SetSessionPtr(aHandle, aPtr);
	}
#endif //__X86__