|
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.Text; |
|
19 using System.Collections.Generic; |
|
20 using CrashItemLib.Crash; |
|
21 using CrashItemLib.Crash.Base; |
|
22 using CrashItemLib.Crash.Messages; |
|
23 using CrashItemLib.Crash.Container; |
|
24 using CrashItemLib.Crash.Threads; |
|
25 using SymbianStructuresLib.Arm.Registers; |
|
26 |
|
27 namespace CrashItemLib.Crash.Registers.Special |
|
28 { |
|
29 public class CIRegisterFSR : CIRegister |
|
30 { |
|
31 #region Enumerations |
|
32 public enum TFaultType |
|
33 { |
|
34 EFaultTypeUnknown = -1, |
|
35 EFaultTypeVectorException = 00, |
|
36 EFaultTypeAlignmentFault = 01, |
|
37 EFaultTypeTerminalException = 02, |
|
38 EFaultTypeAlignmentFault2 = 03, |
|
39 EFaultTypeExternalAbortOnLinefetchForSectionTranslation = 04, |
|
40 EFaultTypeSectionTranslationFault = 05, |
|
41 EFaultTypeExternalAbortOnLineFetchForPageTranslation = 06, |
|
42 EFaultTypePageTranslationFault = 07, |
|
43 EFaultTypeExternalAbortOnNonLinefetchForSectionTranslation = 08, |
|
44 EFaultTypeDomainFaultOnSectionTranslation = 09, |
|
45 EFaultTypeExternalAbortOnNonLinefetchForPageTranslation = 10, |
|
46 EFaultTypeDomainFaultOnPageTranslation = 11, |
|
47 EFaultTypeExternalAbortOnFirstLevelTranslation = 12, |
|
48 EFaultTypePermissionFaultOnSection = 13, |
|
49 EFaultTypeExternalAbortOnSecondLevelTranslation = 14, |
|
50 EFaultTypePermissionFaultOnPage = 15 |
|
51 } |
|
52 #endregion |
|
53 |
|
54 #region Constructors |
|
55 public CIRegisterFSR( CIRegisterList aCollection, uint aValue ) |
|
56 : base( aCollection, TArmRegisterType.EArmReg_FSR, aValue ) |
|
57 { |
|
58 PrepareMessage(); |
|
59 } |
|
60 #endregion |
|
61 |
|
62 #region API |
|
63 #endregion |
|
64 |
|
65 #region Properties |
|
66 public TFaultType FaultType |
|
67 { |
|
68 get |
|
69 { |
|
70 uint fsr = System.Convert.ToUInt32( base.Value ); |
|
71 uint fsrMask = 0xF; // Look at first 4 bits |
|
72 fsr = fsr & fsrMask; |
|
73 // |
|
74 TFaultType type = TFaultType.EFaultTypeUnknown; |
|
75 if ( fsr >= 0 && fsr < (uint) TFaultType.EFaultTypePermissionFaultOnPage ) |
|
76 { |
|
77 type = (TFaultType) fsr; |
|
78 } |
|
79 // |
|
80 return type; |
|
81 } |
|
82 } |
|
83 |
|
84 public string FaultDescription |
|
85 { |
|
86 get |
|
87 { |
|
88 string ret = "Unknown"; |
|
89 // |
|
90 switch ( FaultType ) |
|
91 { |
|
92 default: |
|
93 case TFaultType.EFaultTypeUnknown: |
|
94 break; |
|
95 case TFaultType.EFaultTypeVectorException: |
|
96 ret = "Vector exception"; |
|
97 break; |
|
98 case TFaultType.EFaultTypeAlignmentFault: |
|
99 ret = "Alignment fault"; |
|
100 break; |
|
101 case TFaultType.EFaultTypeTerminalException: |
|
102 ret = "Terminal exception"; |
|
103 break; |
|
104 case TFaultType.EFaultTypeAlignmentFault2: |
|
105 ret = "Alignment fault"; |
|
106 break; |
|
107 case TFaultType.EFaultTypeExternalAbortOnLinefetchForSectionTranslation: |
|
108 ret = "External abort on linefetch for section translation"; |
|
109 break; |
|
110 case TFaultType.EFaultTypeSectionTranslationFault: |
|
111 ret = "Section translation fault (unmapped virtual address)"; |
|
112 break; |
|
113 case TFaultType.EFaultTypeExternalAbortOnLineFetchForPageTranslation: |
|
114 ret = "External abort on linefetch for page translation"; |
|
115 break; |
|
116 case TFaultType.EFaultTypePageTranslationFault: |
|
117 ret = "Page translation fault (unmapped virtual address)"; |
|
118 break; |
|
119 case TFaultType.EFaultTypeExternalAbortOnNonLinefetchForSectionTranslation: |
|
120 ret = "External abort on non-linefetch for section translation"; |
|
121 break; |
|
122 case TFaultType.EFaultTypeDomainFaultOnSectionTranslation: |
|
123 ret = "Domain fault on section translation (access to invalid domain)"; |
|
124 break; |
|
125 case TFaultType.EFaultTypeExternalAbortOnNonLinefetchForPageTranslation: |
|
126 ret = "External abort on non-linefetch for page translation"; |
|
127 break; |
|
128 case TFaultType.EFaultTypeDomainFaultOnPageTranslation: |
|
129 ret = "Domain fault on page translation (access to invalid domain)"; |
|
130 break; |
|
131 case TFaultType.EFaultTypeExternalAbortOnFirstLevelTranslation: |
|
132 ret = "External abort on first level translation"; |
|
133 break; |
|
134 case TFaultType.EFaultTypePermissionFaultOnSection: |
|
135 ret = "Permission fault on section (no permission to access virtual address)"; |
|
136 break; |
|
137 case TFaultType.EFaultTypeExternalAbortOnSecondLevelTranslation: |
|
138 ret = "External abort on second level translation"; |
|
139 break; |
|
140 case TFaultType.EFaultTypePermissionFaultOnPage: |
|
141 ret = "Permission fault on page (no permission to access virtual address)"; |
|
142 break; |
|
143 } |
|
144 // |
|
145 return ret; |
|
146 } |
|
147 } |
|
148 #endregion |
|
149 |
|
150 #region Operators |
|
151 public static implicit operator TFaultType( CIRegisterFSR aReg ) |
|
152 { |
|
153 return aReg.FaultType; |
|
154 } |
|
155 #endregion |
|
156 |
|
157 #region Internal methods |
|
158 private void PrepareMessage() |
|
159 { |
|
160 CIMessage message = CIMessage.NewMessage( Container ); |
|
161 // |
|
162 message.Title = "Fault Status"; |
|
163 message.AddLineFormatted( "The FSR (Fault Status Register) indicates that the processor encountered an fault of type [{0}].", FaultDescription ); |
|
164 // |
|
165 base.AddChild( message ); |
|
166 } |
|
167 #endregion |
|
168 |
|
169 #region Data members |
|
170 #endregion |
|
171 } |
|
172 } |