delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/06/08/12:08:08

Date: Mon, 8 Jun 1998 19:07:11 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT gov DOT ar>
cc: djgpp-workers AT delorie DOT com
Subject: Re: __dpmi_yield considered harmful (sometimes)
In-Reply-To: <m0yhwhE-000S2iC@inti.gov.ar>
Message-ID: <Pine.SUN.3.91.980608190641.11424B-100000@is>
MIME-Version: 1.0

I think I know how to solve this.  Please try this small variant on
Salvador's original program and see if it works.  I tested it on DOS,
Windows 3.1 and Windows 95 and it seems to work on all of them,
including the one which had problems with the original program.

If this works, then we need to replace __dpmi_yield in the library and
rebuild the affected binaries.

I'm still clueless as to why issuing the INT instruction directly
wedges the DOS box, and why only on certain systems.  Probably some
screwup in the way Windows' built-in DOS extender thunks the interrupt
to VMM.

Thanks to all of you who provided useful input.

#include <dpmi.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

void
__dpmi_yield(void)
{
  __dpmi_regs r;

  r.x.ax = 0x1680;
  __dpmi_int(0x2f, &r);
  if (r.h.al != 0)
    errno = ENOSYS;
}

int main(int argc, char *argv[])
{
 while (!kbhit ())
   __dpmi_yield ();
 printf("Hello!!\nRun some programs, then type \"exit RET\"\n");
 system("");
 printf("Now I call it\n");
 while (!kbhit ())
   __dpmi_yield ();
 printf("All ok\n");
 return 0;
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019