From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stas Sergeev Subject: Re: Redirecting a DOS interrupt call out to Linux Date: Thu, 18 Jul 2013 23:49:41 +0400 Message-ID: <51E846D5.1000200@list.ru> References: <1379967.GstMATdtWo@polly.spheresystems.co.uk> Mime-Version: 1.0 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=list.ru; s=mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID; bh=JPDz7qa22INbuPFexofD2370ispabgzWzGo9JXiVsWU=; b=cUenUJ3i6qAk4z/sSCPHvgn0GFYON5vLBBMd3gBSFisMLK/5MMlq9TXaWXKlhFyxPEiLhJ0xgBelbyQuCHhMneqQDjVGRH9UvRdeChOdcRYm/it7pPCx30swoNhoriPInDYRR61EczVauF9GoIq9vHI0uOMBgnmBxop8pfjkP+E=; In-Reply-To: <1379967.GstMATdtWo@polly.spheresystems.co.uk> Sender: linux-msdos-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="utf-8"; format="flowed" To: "Andrew Bird (Sphere Systems)" Cc: linux-msdos@vger.kernel.org 18.07.2013 20:35, Andrew Bird (Sphere Systems) =D0=BF=D0=B8=D1=88=D0=B5= =D1=82: > Hi all, > I've been playing with the Dosemu source code with the hope of repla= cing > an old TSR with a native Linux daemon. Currently a DOS app I have no = source > for makes an interrupt call to a TSR with data, the TSR works with it= and the > result is returned. > > I had in mind to replace it with something like this: > 1/ Old DOS app makes call to interrupt > 2/ New Dosemu interrupt handler that collects the data given to it by= the DOS > app and pushes it into a message queue on the host. > 3/ A Linux daemon that reads the incoming message, does the processin= g and > returns the result via a second message queue. > 4/ The new Dosemu interrupt handler then reads the result from the se= cond > message queue, places it in memory and returns. > 5/ The DOS app sees the result and is unaware of any difference. > > My first step was to hook in a new skeleton Dosemu interrupt handler,= but it > doesn't seem to be being called and the DOS app thinks the TSR is not > installed. I'm using Dosemu 1.2.2 for historical reasons, but I expec= t the > problem is similar on 1.4.0 etc. > > I figured all I'd need to do would be to add a new function to > src/base/async/int.c and reference it. > > /* this is the handler for INT 76 calls from DOS to the test interfac= e */ > int test_int (void) { > ds_printf("INT76: we have been called\n"); > return 1; > } > > /* add reference to it in setup_interrupts() */ > interrupt_function[0x76] =3D test_int; > > Can anybody tell me what I'm missing? How does the interrupt vector t= able get > built? =46irstly, the interrupt handling is much different in 1.2 and 1.4. Secondly, you need to make sure the interrupt vector points to BIOSSEG:INT_OFF(i) (see bios_setup() in setup.c) and that no one have hooked it from DOS (or, at least, chains it back to the original address). Alternatively you can make dosemu to try and intercept the int0xNN instruction. In this case you won't need to worry if someone have hooked that vector under DOS. For that you will need to modify the can_revector() function. Note that this all applies to 1.4. I have no idea how 1.2 worked, this was too long ago. Additionally, curent git allows you to sleep inside the interrupt handler of dosemu, while the DOS is still running. This will likely allow you to do the thing within one interrupt call, instead of 2. -- To unsubscribe from this list: send the line "unsubscribe linux-msdos" = in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html