kernel/eka/euser/epoc/x86/uc_exec.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     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\euser\epoc\x86\uc_exec.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <e32svr.h>
       
    19 #include <u32exec.h>
       
    20 
       
    21 
       
    22 /******************************************************************************
       
    23  * Slow executive calls with preprocessing or extra arguments
       
    24  ******************************************************************************/
       
    25 EXPORT_C TBool BTrace::Out(TUint32 a0, TUint32 a1, TUint32 a2, TUint32 a3)
       
    26 	{
       
    27 	BTrace::SExecExtension ext;
       
    28 	ext.iA2 = a2;
       
    29 	ext.iA3 = a3;
       
    30 	ext.iPc = (&a0)[-1]; // return address on X86
       
    31 	return Exec::BTraceOut(a0,a1,ext,0);
       
    32 	}
       
    33 
       
    34 EXPORT_C TBool BTrace::OutX(TUint32 a0, TUint32 a1, TUint32 a2, TUint32 a3)
       
    35 	{
       
    36 	BTrace::SExecExtension ext;
       
    37 	ext.iA2 = a2;
       
    38 	ext.iA3 = a3;
       
    39 	ext.iPc = (&a0)[-1]; // return address on X86
       
    40 	return Exec::BTraceOut(a0,a1,ext,0);
       
    41 	}
       
    42 
       
    43 EXPORT_C TBool BTrace::OutN(TUint32 a0, TUint32 a1, TUint32 a2, const TAny* aData, TInt aDataSize)
       
    44 	{
       
    45 	BTrace::SExecExtension ext;
       
    46 	ext.iA2 = a2;
       
    47 	ext.iA3 = (TUint32)aData;
       
    48 	ext.iPc = (&a0)[-1]; // return address on X86
       
    49 	return Exec::BTraceOut(a0,a1,ext,aDataSize);
       
    50 	}
       
    51 
       
    52 EXPORT_C TBool BTrace::OutNX(TUint32 a0, TUint32 a1, TUint32 a2, const TAny* aData, TInt aDataSize)
       
    53 	{
       
    54 	BTrace::SExecExtension ext;
       
    55 	ext.iA2 = a2;
       
    56 	ext.iA3 = (TUint32)aData;
       
    57 	ext.iPc = (&a0)[-1]; // return address on X86
       
    58 	return Exec::BTraceOut(a0,a1,ext,aDataSize);
       
    59 	}
       
    60 
       
    61 EXPORT_C TBool BTrace::OutBig(TUint32 a0, TUint32 a1, const TAny* aData, TInt aDataSize)
       
    62 	{
       
    63 	BTrace::SExecExtension ext;
       
    64 	ext.iA2 = 0;
       
    65 	ext.iA3 = (TUint32)aData;
       
    66 	ext.iPc = (&a0)[-1]; // return address on X86
       
    67 
       
    68 	if((TUint)aDataSize>8u)
       
    69 		{
       
    70 		if((TUint)aDataSize>KMaxBTraceDataArray+4u)
       
    71 			return Exec::BTraceOutBig(a0,a1,ext,aDataSize);
       
    72 		a0 += 4;
       
    73 		aDataSize -= 4;
       
    74 		ext.iA2 = *((TUint32*&)aData)++;
       
    75 		ext.iA3 = (TUint32)aData;
       
    76 		return Exec::BTraceOut(a0,a1,ext,aDataSize);
       
    77 		}
       
    78 
       
    79 	if((TUint)aDataSize>4u)
       
    80 		ext.iA3 = ((TUint32*)aData)[1];
       
    81 	if(aDataSize)
       
    82 		ext.iA2 = ((TUint32*)aData)[0];
       
    83 	a0 += aDataSize;
       
    84 	aDataSize = 0;
       
    85 	return Exec::BTraceOut(a0,a1,ext,aDataSize);
       
    86 	}
       
    87 
       
    88 EXPORT_C TBool BTrace::OutFiltered(TUint32 a0, TUint32 a1, TUint32 a2, TUint32 a3)
       
    89 	{
       
    90 	BTrace::SExecExtension ext;
       
    91 	a0 |= EMissingRecord<<BTrace::EFlagsIndex*8; // overload meaning of this flag to indicate filtered trace
       
    92 	ext.iA2 = a2;
       
    93 	ext.iA3 = a3;
       
    94 	ext.iPc = (&a0)[-1]; // return address on X86
       
    95 	return Exec::BTraceOut(a0,a1,ext,0);
       
    96 	}
       
    97 
       
    98 EXPORT_C TBool BTrace::OutFilteredX(TUint32 a0, TUint32 a1, TUint32 a2, TUint32 a3)
       
    99 	{
       
   100 	BTrace::SExecExtension ext;
       
   101 	a0 |= EMissingRecord<<BTrace::EFlagsIndex*8; // overload meaning of this flag to indicate filtered trace
       
   102 	ext.iA2 = a2;
       
   103 	ext.iA3 = a3;
       
   104 	ext.iPc = (&a0)[-1]; // return address on X86
       
   105 	return Exec::BTraceOut(a0,a1,ext,0);
       
   106 	}
       
   107 
       
   108 EXPORT_C TBool BTrace::OutFilteredN(TUint32 a0, TUint32 a1, TUint32 a2, const TAny* aData, TInt aDataSize)
       
   109 	{
       
   110 	BTrace::SExecExtension ext;
       
   111 	a0 |= EMissingRecord<<BTrace::EFlagsIndex*8; // overload meaning of this flag to indicate filtered trace
       
   112 	ext.iA2 = a2;
       
   113 	ext.iA3 = (TUint32)aData;
       
   114 	ext.iPc = (&a0)[-1]; // return address on X86
       
   115 	return Exec::BTraceOut(a0,a1,ext,aDataSize);
       
   116 	}
       
   117 
       
   118 EXPORT_C TBool BTrace::OutFilteredNX(TUint32 a0, TUint32 a1, TUint32 a2, const TAny* aData, TInt aDataSize)
       
   119 	{
       
   120 	BTrace::SExecExtension ext;
       
   121 	a0 |= EMissingRecord<<BTrace::EFlagsIndex*8; // overload meaning of this flag to indicate filtered trace
       
   122 	ext.iA2 = a2;
       
   123 	ext.iA3 = (TUint32)aData;
       
   124 	ext.iPc = (&a0)[-1]; // return address on X86
       
   125 	return Exec::BTraceOut(a0,a1,ext,aDataSize);
       
   126 	}
       
   127 
       
   128 EXPORT_C TBool BTrace::OutFilteredBig(TUint32 a0, TUint32 a1, const TAny* aData, TInt aDataSize)
       
   129 	{
       
   130 	BTrace::SExecExtension ext;
       
   131 	a0 |= EMissingRecord<<BTrace::EFlagsIndex*8; // overload meaning of this flag to indicate filtered trace
       
   132 	ext.iA2 = 0;
       
   133 	ext.iA3 = (TUint32)aData;
       
   134 	ext.iPc = (&a0)[-1]; // return address on X86
       
   135 
       
   136 	if((TUint)aDataSize>8u)
       
   137 		{
       
   138 		if((TUint)aDataSize>KMaxBTraceDataArray+4u)
       
   139 			return Exec::BTraceOutBig(a0,a1,ext,aDataSize);
       
   140 		a0 += 4;
       
   141 		aDataSize -= 4;
       
   142 		ext.iA2 = *((TUint32*&)aData)++;
       
   143 		ext.iA3 = (TUint32)aData;
       
   144 		return Exec::BTraceOut(a0,a1,ext,aDataSize);
       
   145 		}
       
   146 
       
   147 	if((TUint)aDataSize>4u)
       
   148 		ext.iA3 = ((TUint32*)aData)[1];
       
   149 	if(aDataSize)
       
   150 		ext.iA2 = ((TUint32*)aData)[0];
       
   151 	a0 += aDataSize;
       
   152 	aDataSize = 0;
       
   153 	return Exec::BTraceOut(a0,a1,ext,aDataSize);
       
   154 	}
       
   155 
       
   156 EXPORT_C TBool BTrace::OutFilteredPcFormatBig(TUint32 aHeader, TUint32 aModuleUid, TUint32 aPc, TUint16 aFormatId, const TAny* aData, TInt aDataSize)
       
   157 	{
       
   158  	BTrace::SExecExtension ext;
       
   159 	aHeader |= EMissingRecord<<BTrace::EFlagsIndex*8; // overload meaning of this flag to indicate filtered trace
       
   160 	ext.iA2 = aFormatId;
       
   161 	ext.iA3 = (TUint32)aData;
       
   162 	ext.iPc = aPc;
       
   163 
       
   164 	if((TUint)aDataSize>KMaxBTraceDataArray)
       
   165 		return Exec::UTraceOut(aHeader,aModuleUid,ext,aDataSize);
       
   166 	aHeader += 4;
       
   167 	return Exec::BTraceOut(aHeader,aModuleUid,ext,aDataSize);
       
   168 	}
       
   169 
       
   170 /**
       
   171 Signal this threads request semaphore.
       
   172 
       
   173 This is similar to RThread::RequestComplete() except that no TRequestStatus object
       
   174 is modified.
       
   175 
       
   176 May only be used to signal a thread in the same process as the callers.
       
   177 
       
   178 @panic KERN-EXEC 46 if the thread is not in the same process as the callers
       
   179 */
       
   180 EXPORT_C void RThread::RequestSignal() const
       
   181 	{
       
   182 	Exec::ThreadRequestSignal(iHandle);
       
   183 	}
       
   184 
       
   185 
       
   186