Mail Archives: djgpp-workers/1999/05/02/10:33:48
> Can somebody please tell what was the reason for this change in
> __dpmi_int? (I cannot find anything pertaining to it in the v2.02
> changes' description inside wc202.txi.)
From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <9712300251 DOT AA14537 AT clio DOT rice DOT edu>
Subject: Re: Win95 problem solved! (again! ;) )
To: 44699 AT ef DOT gc DOT maricopa DOT edu (Joshua James Turpen)
Date: Mon, 29 Dec 1997 20:51:44 -0600 (CST)
Cc: eliz AT is DOT elta DOT co DOT il, dj AT delorie DOT com (DJ at Home)
Thanks for your effort in looking into this. On a first review your fix
below sounds like a very good idea. As you've probably noticed, I've been
on vacation and don't have much time in the next few days to look at it
much harder. I would like to see a bit of testing with this fix - probably
putting it into the next alpha release would be a good idea to see if it
breaks anything. It certainly fixes something, and your explaination
is very likely. You get an A+ for investigation on this!
I'm including DJ on this too...
> Regarding ___djgpp_hw_exception and Win95:
>
> Eureka! :) It turns out that Win95 is using your pmode SS for some of
> it's code when building the stack frame on a change from pmode->V86 mode.
> Below is a very simple, hopefully safe solution to the problem. Charles,
> please correct my code if it's wrong.
>
> I haven't checked, but a similar fix may be needed for other functions
> that change from pmode->V86 mode, functions like
> call_real_mode_procedure_with_far_ret_frame, and
> call_real_mode_procedure_with_iret_frame.
>
>
> I've tested the code below and it seems to work great, even with the more
> complex test programs.
>
>
> -----------file D0300_Z.S----------------------------------------
> /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
> #define USE_EBX
> #define USE_EDI
> #include "dpmidefs.h"
>
> .comm ___dpmi_int_ss, 2
> .comm ___dpmi_int_sp, 2
> .comm ___dpmi_int_flags, 2
> .lcomm dpmi_busy, 1
>
> .text
>
> FUNC(___dpmi_int)
> ENTER
>
> pushl %es
> /* Win95 problem: Add this next line */
> pushl %ss
> movw ___djgpp_ds_alias, %ax
> movw %ax, %es
> /* Win95 Problem: Add this next line */
> /* This should be ok since the app's SS and ___djgpp_ds_alias */
> /* have the same linear address space */
> movw %ax, %ss
> movl ARG1, %ebx
> movl $0, %ecx
> movl ARG2, %edi
> incb dpmi_busy
>
> cmpb $1, dpmi_busy
> jne L_is_busy
>
> movw ___dpmi_int_flags, %ax
> movw %ax, 0x20(%edi) /* r.x.flags */
> movw ___dpmi_int_sp, %ax
> movw %ax, 0x2e(%edi) /* r.x.sp */
> movw ___dpmi_int_ss, %ax
> movw %ax, 0x30(%edi) /* r.x.ss */
> jmp L_not_busy
>
> L_is_busy:
> movw $0, 0x20(%edi) /* r.x.flags */
> movw $0, 0x2e(%edi) /* r.x.sp */
> movw $0, 0x30(%edi) /* r.x.ss */
>
> L_not_busy:
> DPMI(0x0300)
> xorl %eax,%eax
>
> /* win95 problem: Change this next line to pop %ss */
> LEAVEP(decb dpmi_busy; popl %ss; popl %es)
>
>
>
- Raw text -