os/kernelhwsrv/kernel/eka/drivers/debug/rmdebug/d_rmd_stepping.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2004-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 //
    15 
    16 #ifndef D_RMD_STEPPING_H
    17 #define D_RMD_STEPPING_H
    18 
    19 // fwd declaration of DRM_DebugChannel
    20 class DRM_DebugChannel;
    21 
    22 // extracted from rm_debug_kerneldriver.h
    23 // Register definitions
    24 #define SP_REGISTER			13
    25 #define LINK_REGISTER		14
    26 #define PC_REGISTER			15
    27 #define STATUS_REGISTER		16
    28 
    29 class DRMDStepping : public DBase
    30 {
    31 public:
    32 	// ctor
    33 	DRMDStepping(DRM_DebugChannel* aChannel);
    34 
    35 	// dtor
    36 	~DRMDStepping();
    37 
    38 	// extracted from rm_debug_kerneldriver.cpp
    39 	TBool IsExecuted(TUint8 aCondition, TUint32 aStatusRegister);
    40 	TBool IsPreviousInstructionMovePCToLR(DThread *aThread);
    41 	void DecodeDataProcessingInstruction(TUint8 aOpcode, TUint32 aOp1, TUint32 aOp2, TUint32 aStatusRegister, TUint32 &aBreakAddress);
    42 	TUint32 PCAfterInstructionExecutes(DThread *aThread, TUint32 aCurrentPC, TUint32 aStatusRegister, TInt aInstSize, TUint32 &aNewRangeEnd, TBool &aChangingModes);
    43 	TUint32 ShiftedRegValue(DThread *aThread, TUint32 aInstruction, TUint32 aCurrentPC, TUint32 aStatusRegister);
    44 	TInt ModifyBreaksForStep(DThread *aThread, TUint32 aRangeStart, TUint32 aRangeEnd,TBool aResumeOnceOutOfRange, TBool aCheckForStubs, const TUint32 aNumSteps);
    45 
    46 private:
    47 
    48 	// Needed to access private data until re-structuring work is complete.
    49 	friend class DRM_DebugChannel;
    50 
    51 	DRM_DebugChannel* iChannel;	// temporary reference back to DRM_DebugChannel to help with refactoring
    52 
    53 	// Set of inline functions for decoding instructions. Formerly these were all macros
    54 
    55 	// ARM instruction bitmasks
    56 	inline TUint32 arm_opcode(const TUint32 aInst);
    57 
    58 	// Generic instruction defines
    59 	inline TUint32 arm_rm(const TUint32 aInst);
    60 	inline TUint32 arm_rs(const TUint32 aInst);
    61 	inline TUint32 arm_rd(const TUint32 aInst);
    62 	inline TUint32 arm_rn(const TUint32 aInst);
    63 	inline TUint32 arm_load(const TUint32 aInst);
    64 
    65 	// Data processing instruction defines
    66 	inline TUint32 arm_data_shift(const TUint32 aInst);
    67 	inline TUint32 arm_data_c(const TUint32 aInst);
    68 	inline TUint32 arm_data_imm(const TUint32 aInst);
    69 	inline TUint32 arm_data_rot(const TUint32 aInst);
    70 
    71 	// Single date transfer instruction defines
    72 	inline TUint32 arm_single_imm(const TUint32 aInst);
    73 	inline TUint32 arm_single_byte(const TUint32 aInst);
    74 	inline TUint32 arm_single_u(const TUint32 aInst);
    75 	inline TUint32 arm_single_pre(const TUint32 aInst);
    76 
    77 	// Block data transfer instruction defines
    78 	inline TUint32 arm_block_reglist(const TUint32 aInst);
    79 	inline TUint32 arm_block_u(const TUint32 aInst);
    80 	inline TUint32 arm_block_pre(const TUint32 aInst);
    81 
    82 	// Branch instruction defines
    83 	inline TUint32 arm_b_addr(const TUint32 aInst);
    84 	inline TUint32 arm_instr_b_dest(const TUint32 aInst, TUint32& aAddr);
    85 	inline TUint32 thumb_b_addr(const TUint32 aInst);
    86 	inline TUint32 thumb_instr_b_dest(const TUint32 aInst, TUint32& aAddr);
    87 	inline TUint32 arm_carry_bit(void);
    88 	
    89 
    90 	// Thumb instruction bitmasks
    91 	inline TUint16 thumb_opcode(const TUint16 aInst);
    92 	inline TUint16 thumb_inst_7_15(const TUint16 aInst);
    93 	inline TUint16 thumb_inst_8_15(const TUint16 aInst);
    94 
    95 	// Thumb2 decode support functions
    96 	inline TUint16 t2opcode16(const TUint16 aInst);
    97 
    98 	inline TUint16 t2opcode16special(const TUint16 aInst);
    99 
   100 	// Helper functions
   101 	TInt CurrentPC(DThread* aThread, TUint32& aPC);
   102 
   103 	TInt CurrentCPSR(DThread* aThread, TUint32& aCPSR);	
   104 
   105 	TInt CurrentInstruction(DThread* aThread, TUint32& aInstruction);
   106 
   107 	TInt CurrentArchMode(const TUint32 cpsr, Debug::TArchitectureMode& mode);
   108 
   109 	TInt RegisterValue(DThread *aThread, const TUint32 aKernelRegisterId, TUint32 &aValue);
   110 
   111 	TInt ReadMem32(DThread* aThread, const TUint32 aAddress, TUint32& aValue);
   112 
   113 	TInt ReadMem16(DThread* aThread, const TUint32 aAddress, TUint16& aValue);
   114 
   115 	TInt ReadMem8(DThread* aThread, const TUint32 aAddress, TUint8& aValue);
   116 
   117 	inline TUint32 BitCount(const TUint32 aVal);
   118 
   119 	inline TUint32 IsBitSet(const TUint32 aBitset, const TUint8 aBitNum);
   120 };
   121 
   122 #include "d_rmd_stepping.inl"
   123 
   124 #endif	// D_RMD_STEPPPING_H
   125 
   126 // End of file - d-rmd-stepping.h