From f71f131dcc5f2be5a7da508128e432be78f0376f Mon Sep 17 00:00:00 2001 From: Godzil Date: Fri, 20 Sep 2019 16:26:07 +0100 Subject: [PATCH] Add proper report if something is trying to call a non initialized interrupt aka CS=0000h, IP=0000h which is more than likely to crash the whole thing. --- oswan/source/nec/nec.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/oswan/source/nec/nec.cpp b/oswan/source/nec/nec.cpp index 5a18808..0bdc20f 100644 --- a/oswan/source/nec/nec.cpp +++ b/oswan/source/nec/nec.cpp @@ -128,6 +128,14 @@ void nec_int(uint16_t vector) I.TF = I.IF = 0; dest_off = ReadWord(vector); dest_seg = ReadWord(vector+2); + + if ((dest_off == 0) && (dest_seg == 0)) + { + printf("Something wrong with the interrupt, exiting...\n"); + //dump_memory(); + return; + } + PUSH(I.sregs[CS]); PUSH(I.ip); I.ip = (WORD)dest_off; @@ -151,6 +159,14 @@ static void nec_interrupt(uint32_t int_num, /*BOOLEAN*/ int md_flag) dest_off = ReadWord((int_num)*4); dest_seg = ReadWord((int_num)*4+2); + if ((dest_off == 0) && (dest_seg == 0)) + { + printf("Something wrong with the interrupt, exiting...\n"); + //dump_memory(); + return; + } + + PUSH(I.sregs[CS]); PUSH(I.ip); I.ip = (WORD)dest_off;