crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianInstructionLib/Arm/Instructions/Arm/DataTransfer/Arm_STM.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.Arm.DataTransfer
       
    26 {
       
    27     [ArmRefAttribute( "A4.1.98 STM (1)", "STM{<cond>}<addressing_mode> <Rn>{!}, <registers>" )]
       
    28     public class Arm_STM : Arm_LoadOrStoreMultiple_GP
       
    29     {
       
    30         #region Enumerations
       
    31         public enum TType
       
    32         {
       
    33             ETypeNotSupported = -1,
       
    34             ETypeNonEmptyGP = 0,
       
    35             ETypeNonEmptyUserMode
       
    36         }
       
    37         #endregion
       
    38 
       
    39         #region Constructors
       
    40         public Arm_STM()
       
    41         {
       
    42             // STM (1) (Store Multiple) stores a non-empty subset (or possibly all) of the general-purpose registers to
       
    43             // sequential memory locations.
       
    44             //
       
    45             //  4    3                  4               16 bits
       
    46             // ---------------------------------------------------
       
    47             // cond 100 P U S W L       Rn          register list
       
    48             // 1110 100 1 0 0 1 0      1101       0100000000010000
       
    49             //
       
    50             // 1110 => Condition = "Always"
       
    51             //  100 => STM (1) instruction signature
       
    52             //    1 => P = addressing mode
       
    53             //    0 => U = addressing mode
       
    54             //    0 => S = indicates that when the processor is in a privileged mode
       
    55             //    1 => W = write a modified value back to its base register Rn
       
    56             //    0 => L = distinguishes between a Load (L==1) and a Store (L==0) instruction.
       
    57             // 1101 => Rn = Specifies the base register used by <addressing_mode>. => SP
       
    58             // 
       
    59             base.SetMask( "####" + "100" + "##" + "##0" + "####" + "######## ########" );
       
    60         }
       
    61         #endregion
       
    62 
       
    63         #region From Arm_LoadOrStore
       
    64         public override TArmDataTransferType DataTransferType
       
    65         {
       
    66             get { return TArmDataTransferType.EStore; }
       
    67         }
       
    68         #endregion
       
    69 
       
    70         #region From ArmInstruction
       
    71         public override bool Matches( uint aOpCode )
       
    72         {
       
    73             bool match = base.Matches( aOpCode );
       
    74             if ( match )
       
    75             {
       
    76                 TType type = StaticInternalType( aOpCode );
       
    77                 match = ( type != TType.ETypeNotSupported );
       
    78             }
       
    79             return match;
       
    80         }
       
    81         #endregion
       
    82 
       
    83         #region Properties
       
    84         public TType Type
       
    85         {
       
    86             get { return iType; }
       
    87         }
       
    88         #endregion
       
    89 
       
    90         #region Internal methods
       
    91         private new SymBit SBit // Hide
       
    92         {
       
    93             get { return SymBit.EClear; }
       
    94         }
       
    95 
       
    96         private TType InternalType
       
    97         {
       
    98             get
       
    99             {
       
   100                 uint raw = base.AIRawValue;
       
   101                 TType ret = StaticInternalType( raw );
       
   102                 return ret;
       
   103             }
       
   104         }
       
   105 
       
   106         private static TType StaticInternalType( uint aRaw )
       
   107         {
       
   108             TType ret = TType.ETypeNotSupported;
       
   109             //
       
   110             if ( KSTM1.IsMatch( aRaw ) )
       
   111             {
       
   112                 ret = TType.ETypeNonEmptyGP;
       
   113             }
       
   114             else if ( KSTM2.IsMatch( aRaw ) )
       
   115             {
       
   116                 ret = TType.ETypeNonEmptyUserMode;
       
   117             }
       
   118             //
       
   119             return ret;
       
   120         }
       
   121         #endregion
       
   122 
       
   123         #region Data members
       
   124         private TType iType = TType.ETypeNotSupported;
       
   125         private static readonly SymMask KSTM1 = new SymMask( "####" + "100" + "##" + "0#0" + "####" + "######## ########" );
       
   126         private static readonly SymMask KSTM2 = new SymMask( "####" + "100" + "##" + "101" + "####" + "0####### ########" );
       
   127         #endregion
       
   128     }
       
   129 }
       
   130