diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2023-12-05 21:21:34 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2023-12-05 21:21:34 +0100 |
| commit | bdf2922f5d5e4f98731833dc727048a32b514902 (patch) | |
| tree | 8469ef332ab98cb4f26b056143ed686dd2761022 /src/emu | |
| parent | f52d13f86adee09506b74efa679dc1cd2e4548e2 (diff) | |
| download | box64-bdf2922f5d5e4f98731833dc727048a32b514902.tar.gz box64-bdf2922f5d5e4f98731833dc727048a32b514902.zip | |
[INTERPRETER] Added addling to divide by 0 exception
Diffstat (limited to 'src/emu')
| -rw-r--r-- | src/emu/x64run.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/emu/x64run.c b/src/emu/x64run.c index 7209aa28..b9b6ddf7 100644 --- a/src/emu/x64run.c +++ b/src/emu/x64run.c @@ -1744,9 +1744,13 @@ x64emurun: imul8(emu, EB->byte[0]); break; case 6: /* DIV Eb */ + if(!EB->byte[0]) + emit_div0(emu, (void*)R_RIP, 0); div8(emu, EB->byte[0]); break; case 7: /* IDIV Eb */ + if(!EB->byte[0]) + emit_div0(emu, (void*)R_RIP, 0); idiv8(emu, EB->byte[0]); break; } @@ -1775,9 +1779,13 @@ x64emurun: imul64_rax(emu, ED->q[0]); break; case 6: /* DIV Ed */ + if(!ED->q[0]) + emit_div0(emu, (void*)R_RIP, 0); div64(emu, ED->q[0]); break; case 7: /* IDIV Ed */ + if(!ED->q[0]) + emit_div0(emu, (void*)R_RIP, 0); idiv64(emu, ED->q[0]); break; } @@ -1811,11 +1819,15 @@ x64emurun: emu->regs[_DX].dword[1] = 0; break; case 6: /* DIV Ed */ + if(!ED->dword[0]) + emit_div0(emu, (void*)R_RIP, 0); div32(emu, ED->dword[0]); //emu->regs[_AX].dword[1] = 0; // already put high regs to 0 //emu->regs[_DX].dword[1] = 0; break; case 7: /* IDIV Ed */ + if(!ED->dword[0]) + emit_div0(emu, (void*)R_RIP, 0); idiv32(emu, ED->dword[0]); //emu->regs[_AX].dword[1] = 0; //emu->regs[_DX].dword[1] = 0; |