os/kernelhwsrv/kernel/eka/drivers/debug/smdebug/d_sm_staticinfo.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/drivers/debug/smdebug/d_sm_staticinfo.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,84 @@
     1.4 +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Responsible for dealing with static info in the Stop Mode framework
    1.18 +//
    1.19 +
    1.20 +/**
    1.21 + * @file
    1.22 + * @internalComponent
    1.23 + * @prototype
    1.24 + */
    1.25 +
    1.26 +#ifdef __LAUNCH_AS_EXTENSION__
    1.27 +
    1.28 +#include <rm_debug_api.h>
    1.29 +#include <sm_debug_api.h>
    1.30 +#include <e32rom.h>
    1.31 +#include "d_rmd_breakpoints.h"
    1.32 +
    1.33 +using namespace Debug;
    1.34 +
    1.35 +const TInt KBUFSIZE = 128;
    1.36 +
    1.37 +/**
    1.38 + * Stop Mode routine to retrieve the static info and place it in the response buffer
    1.39 + * @param aItem List item describing the list
    1.40 + * @return One of the system wide error codes
    1.41 + */
    1.42 +TInt StopModeDebug::GetStaticInfo(const TListItem* aItem, bool aCheckConsistent)
    1.43 +	{
    1.44 +	__KTRACE_OPT(KDEBUGGER,Kern::Printf("\nDumping the static information"));
    1.45 +
    1.46 +	if(aItem->iListScope != EScopeGlobal)
    1.47 +		{
    1.48 +		return KErrArgument; //No other scope makes sense for static info
    1.49 +		}
    1.50 +
    1.51 +	TUint8* buffer = (TUint8*)aItem->iBufferAddress;
    1.52 +	TUint8* bufferPos = Align4(buffer + sizeof(TListReturn));
    1.53 +	TUint8* bufferEnd = buffer + aItem->iBufferSize;
    1.54 +
    1.55 +	TListReturn* listResp = (TListReturn*)buffer;
    1.56 +	listResp->iReqNo = EStaticInfo;
    1.57 +	listResp->iNumberItems = 1; //there in only one structure of TStaticListEntry
    1.58 +	listResp->iDataSize = sizeof(TStaticListEntry);
    1.59 +	
    1.60 +	if (bufferPos < bufferEnd)
    1.61 +		{
    1.62 +		// making sure we have enough space to write the static info
    1.63 +		TStaticListEntry& entry = *(TStaticListEntry*)(bufferPos);
    1.64 +
    1.65 +		// build version and rom build time 
    1.66 +		TRomHeader rHdr = Epoc::RomHeader();
    1.67 +		entry.iTime = rHdr.iTime; 
    1.68 +		entry.iBuildNumber = rHdr.iVersion.iBuild;
    1.69 +		entry.iMajorVersion = rHdr.iVersion.iMajor;
    1.70 +		entry.iMinorVersion = rHdr.iVersion.iMinor;
    1.71 +
    1.72 +		//Number of CPUs
    1.73 +		entry.iCpuNumbers = NKern::NumberOfCpus();
    1.74 +
    1.75 +		TBuf<KBUFSIZE> bufTime64; 
    1.76 +		bufTime64.Num(rHdr.iTime); 
    1.77 +
    1.78 +		__KTRACE_OPT(KDEBUGGER,Kern::Printf("Version%d.%02d(%03d) %d", rHdr.iVersion.iMajor, rHdr.iVersion.iMinor, rHdr.iVersion.iBuild));
    1.79 +		__KTRACE_OPT(KDEBUGGER,Kern::Printf("Build Time %S ms", &bufTime64));
    1.80 +		__KTRACE_OPT(KDEBUGGER,Kern::Printf("Number of CPUs in the system: %d", entry.iCpuNumbers));
    1.81 +		}
    1.82 +
    1.83 +	return KErrNone;
    1.84 +	}
    1.85 +
    1.86 +#endif
    1.87 +