www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/09/09/14:03:23

From: Leif Leonhardy <leif AT dtcs DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: __dpmi_simulate_real_mode_procedure_retf[stack](): Links to bug fixes? FAQ?
Date: Sun, 09 Sep 2001 19:58:32 +0200
Organization: delta t Computerservice
Lines: 56
Message-ID: <3B9BADC8.61AE3883@dtcs.de>
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> <1438-Sat08Sep2001175457+0300-eliz AT is DOT elta DOT co DOT il>
NNTP-Posting-Host: pd9e0e278.dip0.t-ipconnect.de
Mime-Version: 1.0
X-Trace: news.online.de 1000058320 27533 217.224.226.120 (9 Sep 2001 17:58:40 GMT)
X-Complaints-To: abuse AT online DOT de
NNTP-Posting-Date: 9 Sep 2001 17:58:40 GMT
X-Mailer: Mozilla 4.01 [de] (Win95; I)
X-Priority: 3 (Normal)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii schrieb:
> There's no need to explain how these functions work: I already know
> that.
That's actually a description of the source code and citations from the
docs;
I'm sure you are familiar with it, but to make things clear I repeated
it,
so other readers can follow the text without looking at them. 

> 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.
Ok, you're right.
Modifying the code to pop the return address into cx and dx and then the
stack
parameters into bx and ax (then pushing all back in the reverse order)
brings 
the expected results.
---------
   /* Modify function code such that first parameter on stack will be */
   /* returned in AX (second in BX if specified): */
   _farpokeb(conv_mem_sel,0,0x59);       /* 59 = pop cx ; return address
*/
   _farpokeb(conv_mem_sel,1,0x5A);       /* 5A = pop dx ; return address
*/
   _farpokeb(conv_mem_sel,2,0x58);       /* 58 = pop ax ; first
parameter */
   _farpokeb(conv_mem_sel,3,0x5B);       /* 5B = pop bx ; second
parameter */
   _farpokeb(conv_mem_sel,4,0x53);       /* 53 = push bx ; second
parameter */
   _farpokeb(conv_mem_sel,5,0x50);       /* 50 = push ax ; first
parameter */
   _farpokeb(conv_mem_sel,6,0x52);       /* 52 = push dx ; return
address */
   _farpokeb(conv_mem_sel,7,0x51);       /* 51 = push cx ; return
address */
   _farpokeb(conv_mem_sel,8,0xCB);       /* CB = retf */
---------

I'm sorry here, I should have seen this.
So now I can continue where I started (calling the ASPI manager), I
still don't
know what's going wrong there.

Thanks, Leif

- Raw text -


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