@@ -55,11 +55,43 @@ public class EspExceptionDecoder implements Tool, DocumentListener {
55
55
File tool ;
56
56
File elf ;
57
57
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
+
58
91
public void init (Editor editor ) {
59
92
this .editor = editor ;
60
93
}
61
94
62
-
63
95
public String getMenuTitle () {
64
96
return "ESP Exception Decoder" ;
65
97
}
@@ -312,6 +344,19 @@ public void run() {
312
344
createAndUpload ();
313
345
}
314
346
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
+
315
360
private void parseText (){
316
361
String content = inputArea .getText ();
317
362
Pattern p = Pattern .compile ("40[0-2](\\ d|[a-f]){5}\\ b" );
@@ -333,25 +378,29 @@ private void parseText(){
333
378
while (m .find ()) {
334
379
command [i ++] = content .substring (m .start (), m .end ());
335
380
}
336
- outputText = "<html><pre> <i>Decoding " +count +" results</i>\n " ;
381
+ outputText + = "<i>Decoding " +count +" results</i>\n " ;
337
382
sysExec (command );
338
383
}
339
384
385
+ private void runParser (){
386
+ outputText = "<html><pre>\n " ;
387
+ parseException ();
388
+ parseText ();
389
+ }
390
+
340
391
private class CommitAction extends AbstractAction {
341
- public void actionPerformed (ActionEvent ev ) {
342
- parseText ();
343
- }
392
+ public void actionPerformed (ActionEvent ev ) {
393
+ runParser ();
394
+ }
344
395
}
345
396
346
397
public void changedUpdate (DocumentEvent ev ) {
347
- //parseText();
348
398
}
349
399
350
400
public void removeUpdate (DocumentEvent ev ) {
351
- //parseText();
352
401
}
353
402
354
403
public void insertUpdate (DocumentEvent ev ) {
355
- parseText ();
404
+ runParser ();
356
405
}
357
406
}
0 commit comments