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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef D_RMD_STEPPING_H
17 #define D_RMD_STEPPING_H
19 // fwd declaration of DRM_DebugChannel
20 class DRM_DebugChannel;
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
29 class DRMDStepping : public DBase
33 DRMDStepping(DRM_DebugChannel* aChannel);
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);
48 // Needed to access private data until re-structuring work is complete.
49 friend class DRM_DebugChannel;
51 DRM_DebugChannel* iChannel; // temporary reference back to DRM_DebugChannel to help with refactoring
53 // Set of inline functions for decoding instructions. Formerly these were all macros
55 // ARM instruction bitmasks
56 inline TUint32 arm_opcode(const TUint32 aInst);
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);
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);
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);
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);
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);
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);
95 // Thumb2 decode support functions
96 inline TUint16 t2opcode16(const TUint16 aInst);
98 inline TUint16 t2opcode16special(const TUint16 aInst);
101 TInt CurrentPC(DThread* aThread, TUint32& aPC);
103 TInt CurrentCPSR(DThread* aThread, TUint32& aCPSR);
105 TInt CurrentInstruction(DThread* aThread, TUint32& aInstruction);
107 TInt CurrentArchMode(const TUint32 cpsr, Debug::TArchitectureMode& mode);
109 TInt RegisterValue(DThread *aThread, const TUint32 aKernelRegisterId, TUint32 &aValue);
111 TInt ReadMem32(DThread* aThread, const TUint32 aAddress, TUint32& aValue);
113 TInt ReadMem16(DThread* aThread, const TUint32 aAddress, TUint16& aValue);
115 TInt ReadMem8(DThread* aThread, const TUint32 aAddress, TUint8& aValue);
117 inline TUint32 BitCount(const TUint32 aVal);
119 inline TUint32 IsBitSet(const TUint32 aBitset, const TUint8 aBitNum);
122 #include "d_rmd_stepping.inl"
124 #endif // D_RMD_STEPPPING_H
126 // End of file - d-rmd-stepping.h