crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianInstructionLib/Arm/Instructions/Thumb/DataProcessing/Thumb_AddOrSubtract_SP.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     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.Thumb.DataProcessing
       
    26 {
       
    27     [ArmRef( "A7.1.9 ADD (7)",  "ADD SP, #<immed_7> * 4" )]
       
    28     [ArmRef( "A7.1.68 SUB (4)", "SUB SP, #<immed_7> * 4" )]
       
    29     public class Thumb_AddOrSubtract_SP : Thumb_AddOrSubtract
       
    30     {
       
    31         #region Constructors
       
    32         public Thumb_AddOrSubtract_SP()
       
    33         {
       
    34             //                         Type   immed_7
       
    35             base.SetMask( "10110000" + "#" + "#######" );
       
    36         }
       
    37         #endregion
       
    38 
       
    39         #region From ArmBaseInstruction
       
    40         protected override bool DoQueryInvolvementAsSource( TArmRegisterType aRegister )
       
    41         {
       
    42             // SP acts as source & destination
       
    43             return ( aRegister == TArmRegisterType.EArmReg_SP );
       
    44         }
       
    45         #endregion
       
    46 
       
    47         #region From Thumb_AddOrSubtract
       
    48         public override TArmDataProcessingType OperationType
       
    49         {
       
    50             get
       
    51             {
       
    52                 TArmDataProcessingType ret = TArmDataProcessingType.ADD;
       
    53                 //
       
    54                 if ( base.AIRawValue[ 7 ] == SymBit.ESet )
       
    55                 {
       
    56                     ret = TArmDataProcessingType.SUB;
       
    57                 }
       
    58                 //
       
    59                 return ret;
       
    60             }
       
    61         }
       
    62         #endregion
       
    63 
       
    64         #region Properties
       
    65         public override uint Immediate
       
    66         {
       
    67             get
       
    68             {
       
    69                 uint rawValue = ( base.AIRawValue & 0x7F );
       
    70                 uint ret = rawValue * 4;
       
    71                 return ret;
       
    72             }
       
    73         }
       
    74 
       
    75         public override bool SuppliesImmediate
       
    76         {
       
    77             get { return true; }
       
    78         }
       
    79 
       
    80         public override TArmRegisterType Rd
       
    81         {
       
    82             get { return TArmRegisterType.EArmReg_SP; }
       
    83         }
       
    84         #endregion
       
    85 
       
    86         #region Internal methods
       
    87         #endregion
       
    88 
       
    89         #region Data members
       
    90         private static readonly SymMask KMaskRn = new SymMask( 0x38, SymMask.TShiftDirection.ERight, 3 );
       
    91         private static readonly SymMask KMaskRd = new SymMask( 0x7 );
       
    92         #endregion
       
    93     }
       
    94 }
       
    95