crashanalysercmd/Libraries/Engine/CrashDebuggerLib/Structures/DebugMask/DebugMaskInfo.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2004-2008 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 
       
    18 using System;
       
    19 using System.Collections.Generic;
       
    20 using System.Text;
       
    21 using CrashDebuggerLib.Structures.KernelObjects;
       
    22 using CrashDebuggerLib.Structures.Register;
       
    23 using CrashDebuggerLib.Structures.Common;
       
    24 
       
    25 namespace CrashDebuggerLib.Structures.DebugMask
       
    26 {
       
    27     public class DebugMaskInfo : CrashDebuggerAware
       
    28     {
       
    29         #region Enumerations
       
    30         public enum TDebugMaskArea : byte
       
    31         {
       
    32             EAreaKernelDebug = 63,       // Bits   0 -> 63
       
    33             EAreaKernelConfig = 127,     // Bits  64 -> 127
       
    34             EAreaFileSystem = 191,       // Bits 128 -> 191
       
    35             EAreaLicensee = 255,         // Bits 192 -> 255
       
    36         }
       
    37 
       
    38         [Flags]
       
    39         public enum TDebugMaskKernel : ulong
       
    40         {
       
    41             KHARDWARE = 0x00000001,
       
    42             KBOOT = 0x00000002,
       
    43             KSERVER = 0x00000004,
       
    44             KMMU = 0x00000008,
       
    45             KSEMAPHORE = 0x00000010,
       
    46             KSCHED = 0x00000020,
       
    47             KPROC = 0x00000040,
       
    48             KEXEC = 0x00000080,
       
    49             KDEBUGGER = 0x00000100,
       
    50             KTHREAD = 0x00000200,
       
    51             KDLL = 0x00000400,
       
    52             KIPC = 0x00000800,
       
    53             KPBUS1 = 0x00001000,
       
    54             KPBUS2 = 0x00002000,
       
    55             KPBUSDRV = 0x00004000,
       
    56             KPOWER = 0x00008000,
       
    57             KTIMING = 0x00010000,
       
    58             KEVENT = 0x00020000,
       
    59             KOBJECT = 0x00040000,
       
    60             KDFC = 0x00080000,
       
    61             KEXTENSION = 0x00100000,
       
    62             KSCHED2 = 0x00200000,
       
    63             KLOCDRV = 0x00400000,
       
    64             KFAIL = 0x00800000,
       
    65             KTHREAD2 = 0x01000000,
       
    66             KDEVICE = 0x02000000,
       
    67             KMEMTRACE = 0x04000000,
       
    68             KDMA = 0x08000000,
       
    69             KMMU2 = 0x10000000,
       
    70             KNKERN = 0x20000000,
       
    71             KSCRATCH = 0x40000000,
       
    72             KPANIC = 0x80000000,
       
    73             KUSB = 1u << 32,
       
    74             KUSBPSL = 1u << 33,
       
    75             KNETWORK1 = 1u << 34,
       
    76             KNETWORK2 = 1u << 35,
       
    77             KSOUND1 = 1u << 36,
       
    78             KREALTIME = 1u << 63,
       
    79             KPAGING = 1u << 62,
       
    80             KLOCDPAGING = 1u << 61
       
    81         }
       
    82 
       
    83         [Flags]
       
    84         public enum TDebugMaskKernelConfig : ulong
       
    85         {
       
    86             KALLTHREADSSYSTEM = 0x00000001,
       
    87             KTESTFAST = 0x00000002,
       
    88             KTESTLATENCY = 0x00000004
       
    89         }
       
    90         #endregion
       
    91 
       
    92         #region Constructors
       
    93         public DebugMaskInfo( CrashDebuggerInfo aCrashDebugger )
       
    94             : base( aCrashDebugger )
       
    95         {
       
    96         }
       
    97         #endregion
       
    98 
       
    99         #region API
       
   100         public void Clear()
       
   101         {
       
   102             iDebugMaskFileSystem = 0;
       
   103             iDebugMaskKernel = TDebugMaskKernel.KPANIC;
       
   104             iDebugMaskKernelConfig = 0;
       
   105             iDebugMaskReservedForLicensees = 0;
       
   106         }
       
   107 
       
   108         public void SetValueByWordIndex( ulong aValue, int aWord )
       
   109         {
       
   110             uint areaByte = ( (byte) aWord ) * 32u;
       
   111             TDebugMaskArea area = TDebugMaskArea.EAreaKernelDebug;
       
   112             if ( areaByte < (byte) TDebugMaskArea.EAreaKernelDebug )
       
   113             {
       
   114                 area = TDebugMaskArea.EAreaKernelDebug;
       
   115             }
       
   116             else if ( areaByte < (byte) TDebugMaskArea.EAreaKernelConfig )
       
   117             {
       
   118                 area = TDebugMaskArea.EAreaKernelConfig;
       
   119             }
       
   120             else if ( areaByte < (byte) TDebugMaskArea.EAreaFileSystem )
       
   121             {
       
   122                 area = TDebugMaskArea.EAreaFileSystem;
       
   123             }
       
   124             else if ( areaByte < (byte) TDebugMaskArea.EAreaLicensee )
       
   125             {
       
   126                 area = TDebugMaskArea.EAreaLicensee;
       
   127             }
       
   128             SetValueByArea( aValue, area );
       
   129         }
       
   130 
       
   131         public void SetValueByArea( ulong aValue, TDebugMaskArea aArea )
       
   132         {
       
   133             switch ( aArea )
       
   134             {
       
   135                 default:
       
   136                 case TDebugMaskArea.EAreaKernelDebug:
       
   137                     DebugMaskKernel = (TDebugMaskKernel) aValue;
       
   138                     break;
       
   139                 case TDebugMaskArea.EAreaKernelConfig:
       
   140                     DebugMaskKernelConfig = (TDebugMaskKernelConfig) aValue;
       
   141                     break;
       
   142                 case TDebugMaskArea.EAreaFileSystem:
       
   143                     iDebugMaskFileSystem = aValue;
       
   144                     break;
       
   145                 case TDebugMaskArea.EAreaLicensee:
       
   146                     iDebugMaskReservedForLicensees = aValue;
       
   147                     break;
       
   148             }
       
   149         }
       
   150         #endregion
       
   151 
       
   152         #region Properties
       
   153         public TDebugMaskKernel DebugMaskKernel
       
   154         {
       
   155             get { return iDebugMaskKernel; }
       
   156             set { iDebugMaskKernel = value; }
       
   157         }
       
   158 
       
   159         public TDebugMaskKernelConfig DebugMaskKernelConfig
       
   160         {
       
   161             get { return iDebugMaskKernelConfig; }
       
   162             set { iDebugMaskKernelConfig = value; }
       
   163         }
       
   164         #endregion
       
   165 
       
   166         #region Internal methods
       
   167         #endregion
       
   168 
       
   169         #region Internal constants
       
   170         #endregion
       
   171 
       
   172         #region From System.Object
       
   173         public override string ToString()
       
   174         {
       
   175             return base.ToString();
       
   176         }
       
   177         #endregion
       
   178 
       
   179         #region Data members
       
   180         private TDebugMaskKernel iDebugMaskKernel = TDebugMaskKernel.KPANIC;
       
   181         private TDebugMaskKernelConfig iDebugMaskKernelConfig = 0;
       
   182         private ulong iDebugMaskFileSystem = 0;
       
   183         private ulong iDebugMaskReservedForLicensees = 0;
       
   184         #endregion
       
   185     }
       
   186 }