Date: Sun, 14 Jun 1998 14:32:54 +0300 (IDT) From: Eli Zaretskii To: DJ Delorie cc: djgpp-workers AT delorie DOT com Subject: __dpmi_yield: a replacement Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk Here's a replacement for the __dpmi_yield function which should work around the bug in some versions of Windows 95: *** src/libc/dpmi/api/2f_1680.S Sun Mar 12 03:08:58 1995 --- /dev/null Sat Jun 13 20:25:35 1998 *************** *** 1,9 **** - /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ - #include - - FUNC(___dpmi_yield) - - movw $0x1680, %ax - int $0x2f - - ret --- 0 ---- *** /dev/nul Sat Jun 13 20:26:01 1998 --- src/libc/dpmi/api/2f_1680.c Mon Jun 8 07:54:12 1998 *************** *** 0 **** --- 1,14 ---- + #include + #include + + void + __dpmi_yield(void) + { + __dpmi_regs r; + + r.x.ax = 0x1680; + r.x.ss = r.x.sp = r.x.flags = 0; + __dpmi_simulate_real_mode_interrupt (0x2f, &r); + if (r.h.al == 0x80) + errno = ENOSYS; + } *** src/libc/dpmi/api/makefile.~0 Sun Dec 24 03:45:36 1995 --- src/libc/dpmi/api/makefile Sat Jun 13 20:11:56 1998 *************** *** 1,7 **** # Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details TOP=../.. ! SRC += 2f_1680.S SRC += d0000.S SRC += d0001.S SRC += d0002.S --- 1,7 ---- # Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details TOP=../.. ! SRC += 2f_1680.c SRC += d0000.S SRC += d0001.S SRC += d0002.S *** src/libc/dpmi/api/2f_1680.t~0 Mon Jul 10 05:40:42 1995 --- src/libc/dpmi/api/2f_1680.txh Sat Jun 13 20:22:34 1998 *************** *** 9,23 **** @subheading Description ! Please refer to @ref{DPMI Specification} for details on DPMI ! function call operation. Also see @ref{DPMI Overview} for general ! information. ! INT 0x2f, AX = 0x1680 ! ! This function yields the CPU to the next process. This should be ! called in busy-wait loops. @subheading Return Value ! None. --- 9,25 ---- @subheading Description ! @code{__dpmi_yield} calls function 1680h of the interrupt 2Fh, which ! tells the task manager in a multitasking environment that the calling ! program doesn't need the rest of its time slice. The task manager will ! then preempt the calling program and switch to another task that is ! ready to run. ! This function should be called in busy-wait loops, like when a program ! waits for user input via keyboard, after it finds the keyboard buffer ! empty, to enhance overall performance in a multitasking environment. @subheading Return Value ! None. If the call isn't supported by the environment, like when running ! on plain DOS, @code{errno} is set to @code{ENOSYS}. *** src/docs/kb/wc202.~13 Fri May 29 19:30:26 1998 --- src/docs/kb/wc202.txi Sat Jun 13 20:24:42 1998 *************** *** 395,397 **** --- 395,401 ---- @code{fflush} now conforms to ANSI C standard when called with a @code{NULL} argument. @findex fflush + + @code{__dpmi_yield} doesn't wedge the DOS box on some versions of + Windows 9X anymore. + @findex __dpmi_yield