Mail Archives: djgpp-workers/1999/06/01/02:47:15
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 -