Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5b3d290

Browse files
Add synthetic IntegerDivideByZero exception (#7496)
The ROM routine __divsi3 is called by code whenever a division is needed,because there is no divide unit on the ESP8266 core. When the divideroutine in ROM hits a div-by-zero case, it jumpt to an ILL(egal instruction)at a fixed address which causes a HW exception 0 (IllegalInsnException).In the postmortem dump, when an ILL exception is detected at this addressin ROM, convert it to a DivByZeroException for printout (6).Divde by zero errors now print as follows:````--------------- CUT HERE FOR EXCEPTION DECODER ---------------Exception (6):epc1=0x4000dce5 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000>>>stack>>>...<<<stack<<<--------------- CUT HERE FOR EXCEPTION DECODER ---------------````And will decode as follows:````Exception 6: IntegerDivideByZero: QUOS, QUOU, REMS, or REMU divisor operand is zeroPC: 0x4000dce5EXCVADDR: 0x00000000Decoding stack results...````
1 parentf42327d commit5b3d290

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎cores/esp8266/core_esp8266_postmortem.cpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,11 @@ void __wrap_system_restart_local() {
144144
ets_printf_P(PSTR("\nAbort called\n"));
145145
}
146146
elseif (rst_info.reason == REASON_EXCEPTION_RST) {
147+
// The GCC divide routine in ROM jumps to the address below and executes ILL (00 00 00) on div-by-zero
148+
// In that case, print the exception as (6) which is IntegerDivZero
149+
bool div_zero = (rst_info.exccause ==0) && (rst_info.epc1 ==0x4000dce5);
147150
ets_printf_P(PSTR("\nException (%d):\nepc1=0x%08x epc2=0x%08x epc3=0x%08x excvaddr=0x%08x depc=0x%08x\n"),
148-
rst_info.exccause, rst_info.epc1, rst_info.epc2, rst_info.epc3, rst_info.excvaddr, rst_info.depc);
151+
div_zero ?6 :rst_info.exccause, rst_info.epc1, rst_info.epc2, rst_info.epc3, rst_info.excvaddr, rst_info.depc);
149152
}
150153
elseif (rst_info.reason == REASON_SOFT_WDT_RST) {
151154
ets_printf_P(PSTR("\nSoft WDT reset\n"));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp