delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/06/01/02:47:15

Date: Tue, 1 Jun 1999 09:44:50 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp-workers AT delorie DOT com
cc: Charles Sandmann <sandmann AT clio DOT rice DOT edu>
Subject: __dpmi_simulate_real_mode_procedure_retf_stack
Message-ID: <Pine.SUN.3.91.990601094401.19912N-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

The source code of __dpmi_simulate_real_mode_procedure_retf_stack is
attached below.  Unless I'm missing something, it passes the number of
*bytes* on the stack in ECX, whereas the DPMI Spec says we need to
pass the number of 16-bit *words* (see the excerpt below).

Is this a bug or some hidden feature?

-----------------------------------------------------------------------
From the DPMI Spec:

            To Call

                 AX = 0301h
                 BH = Flags
                      Bit 0  = 1 resets the interrupt controller and A20
                      line
                      Other flags reserved and must be 0
                 CX =  Number of  words to  copy from  protected mode to
                      real mode stack
                 ES:(E)DI = Selector:Offset of real mode call structure

-----------------------------------------------------------------------
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#define USE_EBX
#define USE_ESI
#define USE_EDI
#include "dpmidefs.h"

	.text

	FUNC(___dpmi_simulate_real_mode_procedure_retf_stack)
	ENTER

	pushl	%es

	movl	ARG2, %ecx
	testl	%ecx, %ecx
	jz	L_do_call

	/* Set up %esi, %edi to copy data to the PM stack. */
	subl	%ecx, %esp
	movl	%esp, %edi
	movl	ARG3, %esi

	/* Copy the data. */
	cld
	rep
	movsb

	/* Reload %ecx with the number of bytes to transfer to RM stack. */
	movl	ARG2, %ecx

L_do_call:
	movw	___djgpp_ds_alias, %es
	xorl	%ebx, %ebx
	movl	ARG1, %edi
	DPMI(0x0301)

	xorl	%eax, %eax

#define RESTORE_ESP	addl ARG2, %esp	 /* comma confuses LEAVEP macro. */
	LEAVEP(RESTORE_ESP ; popl %es)

- Raw text -


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