os/kernelhwsrv/kernel/eka/drivers/debug/smdebug/d_sm_staticinfo.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 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 // Responsible for dealing with static info in the Stop Mode framework
    15 //
    16 
    17 /**
    18  * @file
    19  * @internalComponent
    20  * @prototype
    21  */
    22 
    23 #ifdef __LAUNCH_AS_EXTENSION__
    24 
    25 #include <rm_debug_api.h>
    26 #include <sm_debug_api.h>
    27 #include <e32rom.h>
    28 #include "d_rmd_breakpoints.h"
    29 
    30 using namespace Debug;
    31 
    32 const TInt KBUFSIZE = 128;
    33 
    34 /**
    35  * Stop Mode routine to retrieve the static info and place it in the response buffer
    36  * @param aItem List item describing the list
    37  * @return One of the system wide error codes
    38  */
    39 TInt StopModeDebug::GetStaticInfo(const TListItem* aItem, bool aCheckConsistent)
    40 	{
    41 	__KTRACE_OPT(KDEBUGGER,Kern::Printf("\nDumping the static information"));
    42 
    43 	if(aItem->iListScope != EScopeGlobal)
    44 		{
    45 		return KErrArgument; //No other scope makes sense for static info
    46 		}
    47 
    48 	TUint8* buffer = (TUint8*)aItem->iBufferAddress;
    49 	TUint8* bufferPos = Align4(buffer + sizeof(TListReturn));
    50 	TUint8* bufferEnd = buffer + aItem->iBufferSize;
    51 
    52 	TListReturn* listResp = (TListReturn*)buffer;
    53 	listResp->iReqNo = EStaticInfo;
    54 	listResp->iNumberItems = 1; //there in only one structure of TStaticListEntry
    55 	listResp->iDataSize = sizeof(TStaticListEntry);
    56 	
    57 	if (bufferPos < bufferEnd)
    58 		{
    59 		// making sure we have enough space to write the static info
    60 		TStaticListEntry& entry = *(TStaticListEntry*)(bufferPos);
    61 
    62 		// build version and rom build time 
    63 		TRomHeader rHdr = Epoc::RomHeader();
    64 		entry.iTime = rHdr.iTime; 
    65 		entry.iBuildNumber = rHdr.iVersion.iBuild;
    66 		entry.iMajorVersion = rHdr.iVersion.iMajor;
    67 		entry.iMinorVersion = rHdr.iVersion.iMinor;
    68 
    69 		//Number of CPUs
    70 		entry.iCpuNumbers = NKern::NumberOfCpus();
    71 
    72 		TBuf<KBUFSIZE> bufTime64; 
    73 		bufTime64.Num(rHdr.iTime); 
    74 
    75 		__KTRACE_OPT(KDEBUGGER,Kern::Printf("Version%d.%02d(%03d) %d", rHdr.iVersion.iMajor, rHdr.iVersion.iMinor, rHdr.iVersion.iBuild));
    76 		__KTRACE_OPT(KDEBUGGER,Kern::Printf("Build Time %S ms", &bufTime64));
    77 		__KTRACE_OPT(KDEBUGGER,Kern::Printf("Number of CPUs in the system: %d", entry.iCpuNumbers));
    78 		}
    79 
    80 	return KErrNone;
    81 	}
    82 
    83 #endif
    84