www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/09/08/12:15:13

Date: Sat, 08 Sep 2001 17:55:00 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: leif AT dtcs DOT de
Message-Id: <1438-Sat08Sep2001175457+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <3B99F4BA.D0753BF0@dtcs.de> (message from Leif Leonhardy on Sat,
08 Sep 2001 12:36:42 +0200)
Subject: Re: __dpmi_simulate_real_mode_procedure_retf[stack](): Links to bug fixes? FAQ?
References: <3B9993B7 DOT 7673E4B7 AT dtcs DOT de> <3405-Sat08Sep2001095723+0300-eliz AT is DOT elta DOT co DOT il> <3B99F4BA DOT D0753BF0 AT dtcs DOT de>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: Leif Leonhardy <leif AT dtcs DOT de>
> Newsgroups: comp.os.msdos.djgpp
> Date: Sat, 08 Sep 2001 12:36:42 +0200
> 
> [Believe me, I try to check all sources and to fix the bug myself before 
> I post a 'all bad-nothing works'.]
> 
> Since __dpmi_simulate_real_mode_function_retf() clears %ecx, nothing
> is copied in that case. None of the two djgpp functions deals with
> the stack specified in the regs structure (zero or not), this is
> solely handled by the DPMI host.

There's no need to explain how these functions work: I already know
that.

> > If this still doesn't help, please post the fragment of your code
> > which invokes __dpmi_simulate_real_mode_procedure_retf_stack to call
> > the ASPI manager.
> Ok, but I will abstract from ASPI manager, since my problem can be
> shown (much?) simpler:

Thanks.  Your code has a bug:

>   /* Modify function code such that first parameter on stack will be */
>   /* returned in AX (second in BX if specified): */
>   _farpokeb(conv_mem_sel,0,0x5B);       /* 5B = pop bx ; return address */
>   _farpokeb(conv_mem_sel,1,0x58);       /* 58 = pop ax ; first parameter */
>   _farpokeb(conv_mem_sel,2,0x50);       /* 50 = push ax ; first parameter */

Your real-mode code is called as a far procedure, so the return
address takes up 2 words (32 bits) on the stack, not one word.
Therefore, the values you pop into AX and BX are the far pointer of
the return address.  I.e. you didn't pop enough to see your 2
parameters: they are the next 2 words on the stack.

- Raw text -


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