@@ -55,11 +55,43 @@ public class EspExceptionDecoder implements Tool, DocumentListener {
5555 File tool ;
5656 File elf ;
5757
58+ private static String [] exceptions = {
59+ "Illegal instruction" ,
60+ "SYSCALL instruction" ,
61+ "InstructionFetchError: Processor internal physical address or data error during instruction fetch" ,
62+ "LoadStoreError: Processor internal physical address or data error during load or store" ,
63+ "Level1Interrupt: Level-1 interrupt as indicated by set level-1 bits in the INTERRUPT register" ,
64+ "Alloca: MOVSP instruction, if caller's registers are not in the register file" ,
65+ "IntegerDivideByZero: QUOS, QUOU, REMS, or REMU divisor operand is zero" ,
66+ "reserved" ,
67+ "Privileged: Attempt to execute a privileged operation when CRING ? 0" ,
68+ "LoadStoreAlignmentCause: Load or store to an unaligned address" ,
69+ "reserved" ,
70+ "reserved" ,
71+ "InstrPIFDataError: PIF data error during instruction fetch" ,
72+ "LoadStorePIFDataError: Synchronous PIF data error during LoadStore access" ,
73+ "InstrPIFAddrError: PIF address error during instruction fetch" ,
74+ "LoadStorePIFAddrError: Synchronous PIF address error during LoadStore access" ,
75+ "InstTLBMiss: Error during Instruction TLB refill" ,
76+ "InstTLBMultiHit: Multiple instruction TLB entries matched" ,
77+ "InstFetchPrivilege: An instruction fetch referenced a virtual address at a ring level less than CRING" ,
78+ "reserved" ,
79+ "InstFetchProhibited: An instruction fetch referenced a page mapped with an attribute that does not permit instruction fetch" ,
80+ "reserved" ,
81+ "reserved" ,
82+ "reserved" ,
83+ "LoadStoreTLBMiss: Error during TLB refill for a load or store" ,
84+ "LoadStoreTLBMultiHit: Multiple TLB entries matched for a load or store" ,
85+ "LoadStorePrivilege: A load or store referenced a virtual address at a ring level less than CRING" ,
86+ "reserved" ,
87+ "LoadProhibited: A load referenced a page mapped with an attribute that does not permit loads" ,
88+ "StoreProhibited: A store referenced a page mapped with an attribute that does not permit stores"
89+ };
90+
5891 public void init (Editor editor ) {
5992 this .editor = editor ;
6093 }
6194
62-
6395 public String getMenuTitle () {
6496 return "ESP Exception Decoder" ;
6597 }
@@ -312,6 +344,19 @@ public void run() {
312344 createAndUpload ();
313345 }
314346
347+ private void parseException (){
348+ String content = inputArea .getText ();
349+ Pattern p = Pattern .compile ("Exception \\ (([0-9]*)\\ ):" );
350+ Matcher m = p .matcher (content );
351+ if (m .find ()){
352+ int exception = Integer .parseInt (m .group (1 ));
353+ if (exception < 0 || exception > 29 ){
354+ return ;
355+ }
356+ outputText += "<b><font color=red>Exception " +exception +": " +exceptions [exception ]+"</font></b>\n " ;
357+ }
358+ }
359+
315360 private void parseText (){
316361 String content = inputArea .getText ();
317362 Pattern p = Pattern .compile ("40[0-2](\\ d|[a-f]){5}\\ b" );
@@ -333,25 +378,29 @@ private void parseText(){
333378 while (m .find ()) {
334379 command [i ++] = content .substring (m .start (), m .end ());
335380 }
336- outputText = "<html><pre> <i>Decoding " +count +" results</i>\n " ;
381+ outputText + = "<i>Decoding " +count +" results</i>\n " ;
337382 sysExec (command );
338383 }
339384
385+ private void runParser (){
386+ outputText = "<html><pre>\n " ;
387+ parseException ();
388+ parseText ();
389+ }
390+
340391 private class CommitAction extends AbstractAction {
341- public void actionPerformed (ActionEvent ev ) {
342- parseText ();
343- }
392+ public void actionPerformed (ActionEvent ev ) {
393+ runParser ();
394+ }
344395 }
345396
346397 public void changedUpdate (DocumentEvent ev ) {
347- //parseText();
348398 }
349399
350400 public void removeUpdate (DocumentEvent ev ) {
351- //parseText();
352401 }
353402
354403 public void insertUpdate (DocumentEvent ev ) {
355- parseText ();
404+ runParser ();
356405 }
357406}
0 commit comments