On Sat, 15 Apr 2000, Josef Drexler wrote:
> On Sat, 15 Apr 2000, Bart Oldeman wrote:
> > On Sat, 15 Apr 2000, Josef Drexler wrote:
> > > On Sat, 15 Apr 2000, Bart Oldeman wrote:
> > 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.
Nice.
> 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.
Yes, of course. I suspect the IRETD instruction to be _highly_ unusual for
any DOS application, even DPMI ones, so I've enabled the old behaviour
(DOSEMU quits with a general protection fault) for this particular case
again.
> > BTW, (0xf1) int 1 is an "undocumented" instruction, but we know how
> > nicely behaved dos application are ;-)
> Heh...
This one didn't work under DOSEMU as it did in real mode (DOSEMU gave a
GP for any form, but real mode did an int 1), so I've made the behaviour
similar by emulation.
A new patch is below.
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 Sun Apr 16 14:43:56 2000
@@ -193,6 +193,18 @@
LWORD(eip) += (csp-lina);
switch (*csp) {
+ /* interrupt calls after prefix: we go back to vm86 */
+ case 0xcc: /* int 3 and let it generate an */
+ case 0xcd: /* int interrupt (don't advance eip) */
+ case 0xce: /* into */
+ break;
+ case 0xcf: /* iret */
+ if (prefix67) goto op0ferr; /* iretd */
+ break;
+ case 0xf1: /* int 1 */
+ LWORD(eip)++; /* emulated "undocumented" instruction */
+ do_int(1);
+ break;
case 0x6c: /* insb */
/* NOTE: ES can't be overwritten; prefixes 66,67 should use
esi,edi,ecx