Mail Archives: djgpp/2001/09/08/12:15:13
> 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 -