crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianInstructionLib/Arm/Instructions/Thumb/DataTransfer/Thumb_PushOrPop.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.DataTransfer
       
    26 {
       
    27     [ArmRef( "A7.1.50 PUSH", "PUSH <registers>" )]
       
    28     [ArmRef( "A7.1.49 POP",  "POP  <registers>" )]
       
    29     public class Thumb_PushOrPop : Thumb_LoadOrStoreMultiple
       
    30     {
       
    31         #region Constructors
       
    32         public Thumb_PushOrPop()
       
    33         {
       
    34             //                     Type          R     register_list
       
    35             base.SetMask( "1011" + "#" + "10" + "#"    + "########" );
       
    36             base.AIGroup = SymbianStructuresLib.Arm.Instructions.TArmInstructionGroup.EGroupDataTransfer;
       
    37         }
       
    38         #endregion
       
    39 
       
    40         #region From Thumb_LoadOrStore
       
    41         public override TArmRegisterType Rd
       
    42         {
       
    43             get { return TArmRegisterType.EArmReg_SP; }
       
    44         }
       
    45         #endregion
       
    46 
       
    47         #region Properties
       
    48         public override TArmDataTransferType DataTransferType
       
    49         {
       
    50             get
       
    51             {
       
    52                 TArmDataTransferType ret = (TArmDataTransferType) base.AIRawValue[ 11 ];
       
    53                 return ret;
       
    54             }
       
    55         }
       
    56 
       
    57         protected override List<TArmRegisterType> RegistersAsList
       
    58         {
       
    59             get
       
    60             {
       
    61                 List<TArmRegisterType> regs = new List<TArmRegisterType>();
       
    62 
       
    63                 // Bit 8 represents LR or PC, depending on whether it's a PUSH or POP.
       
    64                 //
       
    65                 // PUSH = R bit is set if LR is to be included
       
    66                 // POP  = R bit is set if PC is to be included
       
    67                 SymBit rBit = base.AIRawValue[ 8 ];
       
    68                 if ( rBit == SymBit.ESet )
       
    69                 {
       
    70                     if ( DataTransferType == TArmDataTransferType.ELoad )
       
    71                     {
       
    72                         regs.Add( TArmRegisterType.EArmReg_PC );
       
    73                     }
       
    74                     else if ( DataTransferType == TArmDataTransferType.EStore )
       
    75                     {
       
    76                         regs.Add( TArmRegisterType.EArmReg_LR );
       
    77                     }
       
    78                 }
       
    79 
       
    80                 // Bits 7-0 represent R7 -> R0.
       
    81                 uint value = base.AIRawValue & 0xFF;
       
    82                 for ( int i = 7; i >= 0; i-- )
       
    83                 {
       
    84                     uint mask = (uint) ( 1 << i );
       
    85                     if ( ( mask & value ) == mask )
       
    86                     {
       
    87                         TArmRegisterType reg = (TArmRegisterType) i;
       
    88                         regs.Add( reg );
       
    89                     }
       
    90                 }
       
    91                 //
       
    92                 return regs;
       
    93             }
       
    94         }
       
    95         #endregion
       
    96 
       
    97         #region Internal methods
       
    98         #endregion
       
    99 
       
   100         #region Data members
       
   101         #endregion
       
   102     }
       
   103 }
       
   104