internal TArmExceptionVector MapToExceptionVector(uint aAddress) { System.Diagnostics.Debug.Assert(IsExceptionVector(aAddress)); // TArmExceptionVector ret = TArmExceptionVector.EUndefinedInstruction; // uint baseAddress = (uint)ExceptionVectorLocation; uint delta = aAddress - baseAddress; switch (delta) { case (uint)TArmExceptionVector.EReset: case (uint)TArmExceptionVector.EUndefinedInstruction: case (uint)TArmExceptionVector.ESVC: case (uint)TArmExceptionVector.EPrefetchAbort: case (uint)TArmExceptionVector.EDataAbort: case (uint)TArmExceptionVector.EIRQ: case (uint)TArmExceptionVector.EFIQ: ret = (TArmExceptionVector)delta; break; default: throw new ETMException("ERROR - specified address is an unsupported vector location"); } // return(ret); }
private void ExtractXmlExceptionVectors(XmlNode aNode) { foreach (XmlNode node in aNode.ChildNodes) { string nodeName = node.Name.Trim().ToUpper(); if (nodeName == "REGISTER" && node.Attributes.Count == 2) { XmlAttributeCollection attributes = node.Attributes; // XmlAttribute attribName = attributes["name"]; XmlAttribute attribValue = attributes["value"]; // if (attribName != null && !string.IsNullOrEmpty(attribName.Value.Trim()) && attribValue != null && !string.IsNullOrEmpty(attribValue.Value.Trim()) ) { string name = attribName.Value.Trim().ToUpper(); uint value = uint.Parse(attribValue.Value, System.Globalization.NumberStyles.HexNumber); // TArmExceptionVector exceptionVectorType = ETMTextToEnumConverter.ToExceptionVector(name); SetExceptionVector(exceptionVectorType, value); } } } }
internal ETMInstruction FetchInstruction(uint aAddress) { ETMInstruction ret = new ETMInstruction(aAddress); // bool gotCode = false; if (this.LastBranch.IsKnown && Engine.DebugEngineView != null) { DbgViewCode codeView = Engine.DebugEngineView.Code; // In the case where we've been asked to fetch the code from the exception // vector, then bypass the rom/rofs code entirely. bool isExceptionVector = Config.IsExceptionVector(aAddress); if (isExceptionVector) { System.Diagnostics.Debug.Assert(this.CurrentInstructionSet == TArmInstructionSet.EARM); TArmExceptionVector vector = Config.MapToExceptionVector(aAddress); uint rawInstruction = Config.GetExceptionVector(vector); ret.Instruction = codeView.ConvertToInstruction(aAddress, TArmInstructionSet.EARM, rawInstruction); } else { IArmInstruction[] instructions = null; gotCode = codeView.GetInstructions(aAddress, CurrentInstructionSet, 1, out instructions); // if (gotCode) { System.Diagnostics.Debug.Assert(instructions != null && instructions.Length == 1); ret.Instruction = instructions[0]; } } } // return(ret); }
public void SetExceptionVector(TArmExceptionVector aVector, uint aInstruction) { if (!iExceptionVectors.ContainsKey(aVector)) { iExceptionVectors.Add(aVector, aInstruction); } else { iExceptionVectors[aVector] = aInstruction; } }
public static TArmExceptionVector ToExceptionVector(string aText) { TArmExceptionVector ret = TArmExceptionVector.EUndefinedInstruction; // string text = aText.ToUpper(); if (text == "RST") { ret = TArmExceptionVector.EReset; } else if (text == "UND") { ret = TArmExceptionVector.EUndefinedInstruction; } else if (text == "SWI") { ret = TArmExceptionVector.ESVC; } else if (text == "ETB11_STATUS") { ret = TArmExceptionVector.EPrefetchAbort; } else if (text == "PRE") { ret = TArmExceptionVector.EPrefetchAbort; } else if (text == "DAT") { ret = TArmExceptionVector.EDataAbort; } else if (text == "IRQ") { ret = TArmExceptionVector.EIRQ; } else if (text == "FIQ") { ret = TArmExceptionVector.EFIQ; } // return(ret); }
private void DecodeInlineException(SymByte aByte) { // b1CEEExxx Exception executed in ARM state. // // The C bit is set to 1 if the exception cancels the last traced instruction. // The EEE bits, bits [5:3], indicate the type of exception as shown in Table 7-9. // Use of this format is deprecated in favor of using an Exception information byte. // Inline exception packets always indicate ARM mode base.InstructionSet = TArmInstructionSet.EARM; // Was it a cancelling branch? base.IsLastInstructionCancelled = aByte[6]; // Set back to no exception unless changed explicitly below. base.ExceptionType = TArmExceptionType.ENone; // Get exception type SymMask mask = new SymMask("## 111 ###", SymMask.TShiftDirection.ERight, 3); SymByte exceptionInfo = (byte)mask.Apply(aByte); if (exceptionInfo == 0) { // Have to work this out from the branch address TArmExceptionVector vector = base.Config.MapToExceptionVector(base.BranchAddress.Address); switch (vector) { case TArmExceptionVector.EReset: base.ExceptionType = TArmExceptionType.EProcessorReset; break; case TArmExceptionVector.EUndefinedInstruction: base.ExceptionType = TArmExceptionType.EUndefinedInstruction; break; case TArmExceptionVector.ESVC: base.ExceptionType = TArmExceptionType.ESVC; break; case TArmExceptionVector.EPrefetchAbort: base.ExceptionType = TArmExceptionType.EPrefetchAbortOrSWBreakpoint; break; case TArmExceptionVector.EDataAbort: base.ExceptionType = TArmExceptionType.ESyncDataAbortOrSWWatchpoint; break; default: throw new ETMException("ERROR - unable to extract exception type from branch address: 0x" + base.BranchAddress); } } else { switch (exceptionInfo) { case 1: base.ExceptionType = TArmExceptionType.EIRQ; break; default: case 2: case 3: throw new NotSupportedException("Reserved exception type"); case 4: base.ExceptionType = TArmExceptionType.EJazelle; break; case 5: base.ExceptionType = TArmExceptionType.EFIQ; break; case 6: base.ExceptionType = TArmExceptionType.EAsyncDataAbort; break; case 7: base.ExceptionType = TArmExceptionType.EHaltingDebug; break; } } }
internal uint GetExceptionVector(TArmExceptionVector aVector) { uint ret = iExceptionVectors[aVector]; return(ret); }