|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 using System; |
|
18 using System.Collections.Generic; |
|
19 using System.Text; |
|
20 using SymbianUtils.BasicTypes; |
|
21 using SymbianStructuresLib.Arm.Registers; |
|
22 using SymbianStructuresLib.Arm.Instructions; |
|
23 using SymbianInstructionLib.Arm.Instructions.Common; |
|
24 |
|
25 namespace SymbianInstructionLib.Arm.Instructions.Arm.DataTransfer |
|
26 { |
|
27 public abstract class Arm_LoadOrStoreMultiple_GP : Arm_LoadOrStoreMultiple |
|
28 { |
|
29 #region Constructors |
|
30 protected Arm_LoadOrStoreMultiple_GP() |
|
31 { |
|
32 } |
|
33 #endregion |
|
34 |
|
35 #region From ArmBaseInstruction |
|
36 protected override bool DoQueryInvolvementAsSource( TArmRegisterType aRegister ) |
|
37 { |
|
38 TArmDataTransferType type = this.DataTransferType; |
|
39 // |
|
40 bool ret = base.DoQueryInvolvementAsSource( aRegister ); |
|
41 if ( ret == false && type == TArmDataTransferType.EStore ) |
|
42 { |
|
43 // STMFD R13!, {R0 - R12, LR} |
|
44 // r13 = dest, r0->r12, r14 are source registers |
|
45 List<TArmRegisterType> regs = this.RegistersAsList; |
|
46 ret = regs.Contains( aRegister ); |
|
47 } |
|
48 // |
|
49 return ret; |
|
50 } |
|
51 |
|
52 protected override bool DoQueryInvolvementAsDestination( TArmRegisterType aRegister ) |
|
53 { |
|
54 TArmDataTransferType type = this.DataTransferType; |
|
55 // |
|
56 bool ret = base.DoQueryInvolvementAsDestination( aRegister ); |
|
57 if ( ret == false && type == TArmDataTransferType.ELoad ) |
|
58 { |
|
59 // LDMFD R13!, {R0 - R12, PC} |
|
60 // r13 = source, r0->r12, r15 are destination registers |
|
61 List<TArmRegisterType> regs = this.RegistersAsList; |
|
62 ret = regs.Contains( aRegister ); |
|
63 } |
|
64 // |
|
65 return ret; |
|
66 } |
|
67 #endregion |
|
68 |
|
69 #region API |
|
70 #endregion |
|
71 |
|
72 #region Properties |
|
73 public bool AffectsPC |
|
74 { |
|
75 get |
|
76 { |
|
77 SymBit pcBit = SymBitUtils.GetBit( base.AIRawValue, 15 ); |
|
78 return ( pcBit == SymBit.ESet ); |
|
79 } |
|
80 } |
|
81 |
|
82 public override TArmRegisterType BaseRegister |
|
83 { |
|
84 get |
|
85 { |
|
86 SymMask mask = new SymMask( 0xF << 16, SymMask.TShiftDirection.ERight, 16 ); |
|
87 TArmRegisterType ret = (TArmRegisterType) mask.Apply( base.AIRawValue ); |
|
88 return ret; |
|
89 } |
|
90 } |
|
91 |
|
92 public TArmRegisterType[] Registers |
|
93 { |
|
94 get |
|
95 { |
|
96 TArmRegisterType[] list = RegistersAsList.ToArray(); |
|
97 return list; |
|
98 } |
|
99 } |
|
100 |
|
101 public TArmInstructionAddressingMode AddressingMode |
|
102 { |
|
103 get |
|
104 { |
|
105 SymMask mask = new SymMask( 3u << 23, SymMask.TShiftDirection.ERight, 23 ); |
|
106 TArmInstructionAddressingMode mode = (TArmInstructionAddressingMode) mask.Apply( base.AIRawValue ); |
|
107 return mode; |
|
108 } |
|
109 } |
|
110 #endregion |
|
111 |
|
112 #region Internal methods |
|
113 private List<TArmRegisterType> RegistersAsList |
|
114 { |
|
115 get |
|
116 { |
|
117 List<TArmRegisterType> list = ArmInstructionUtils.ExtractGPRegisterList( base.AIRawValue & 0x0000FFFF ); |
|
118 return list; |
|
119 } |
|
120 } |
|
121 #endregion |
|
122 |
|
123 #region Data members |
|
124 #endregion |
|
125 } |
|
126 } |
|
127 |