On Sat, 15 Apr 2000, Bart Oldeman wrote:
> On Sat, 15 Apr 2000, Josef Drexler wrote:
>
> > On Sat, 15 Apr 2000, Bart Oldeman wrote:
> > > The following patch fixes this for me: (but move the line containing
> > > "esi,edi,ecx" behind "should use ")
> > >
> > > I hope I haven't looked over something in this quick patch.
> >
> > No, you haven't, it works perfectly. Thanks a lot!
>
> Nice. I produced a new one which is a bit more elegant: it treats all int
> variations and basically lets dosemu return to vm86 mode after a 0x66 in
> this case, where upon the dos app invokes the int instruction which might
> get trapped by dosemu in turn.
>
> So it was eg (GP=general protection fault):
> 0x66 0xcd 0x10 -> GP -> do_int(0x10) -> next instruction
>
> and now:
>
> 0x66 0xcd 0x10 -> GP -> 0xcd 0x10 -> GP -> do_int(0x10)
I like it even better this way, because now I can use dosdebug's bpint
for my weird interrupts. That didn't work before, but it didn't bother me
too much.
Although there may be one thing that might need to be improved. The iret
instruction (0xcf) has two different forms, depending on the operand size.
So it should executed differently depending on the 0x67 prefix.
However, if for example, the instruction was coded as
0x67 0x66 0xcf IRETD
(where the 0x66 is again ignored), it would be executed as a simple IRET
because the prefixes are ignored, if I understand your code correctly.
In the case
0x66 0x67 0xcf IRETD
it would be executed correctly, but the order of prefixes should not
matter.
I'm afraid I'll have to leave it up to you to actually fix it though, I'm
not familiar enough with dosemu yet. Anyway, that code will not happen
too often, I certainly don't need it for my program, so it may be best if
you just leave out the 0xcf from the case list.
> I'll have to let the DOSEMU team decide whether or which version of the
> patch they would like to have.
>
> BTW, (0xf1) int 1 is an "undocumented" instruction, but we know how
> nicely behaved dos application are ;-)
Heh...
Thanks again for your support!
> Bart
>
> diff -u dosemu-1.0.0-orig/src/emu-i386/do_vm86.c
> dosemu-1.0.0/src/emu-i386/do_vm86.c
> --- dosemu-1.0.0-orig/src/emu-i386/do_vm86.c Sun Mar 5 19:41:09 2000
> +++ dosemu-1.0.0/src/emu-i386/do_vm86.c Sat Apr 15 23:33:25 2000
> @@ -193,6 +193,13 @@
> LWORD(eip) += (csp-lina);
>
> switch (*csp) {
> +
> + case 0xcc: /* int 3 */
> + case 0xcd: /* int */
> + case 0xce: /* into */
> + case 0xcf: /* iret */
^^^^^^^^^^^
This probably needs to be fixed...
> + case 0xf1: /* int 1 */
> + break;
>
> case 0x6c: /* insb */
> /* NOTE: ES can't be overwritten; prefixes 66,67 should use
> esi,edi,ecx
>
--
Josef Drexler