delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/05/21/01:04:07

Date: Tue, 21 May 2002 07:58:55 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: sandmann AT clio DOT rice DOT edu
cc: djgpp-workers AT delorie DOT com, lauras AT softhome DOT net
Subject: Re: emacs under w2k
In-Reply-To: <10205210418.AA15653@clio.rice.edu>
Message-ID: <Pine.SUN.3.91.1020521074720.4513A-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 20 May 2002 sandmann AT clio DOT rice DOT edu wrote:

> Tried adding __djgpp_exception_toggle() before the sbrk() calls and it
> no longer aborts under Win2K(), even with very large memory arena moves.

That's encouraging, but toggling exceptions on each sbrk is probably 
going to make memory-intensive programs significantly slower.  There are 
quite a few DPMI calls in __djgpp_exception_toggle.

> It appears that when the arena is moved (20Mb of it) 
> on the second sbrk takes a significant amount of time, and some 
> event (interrupt?) happens in that time.  It then gets serviced after 
> the move - or in the middle of it (ignoring the disable interrupt
> call?) and boom.

Perhaps the virtualization of interrupt disabling causes the disable 
interrupt call to be ignored?

> I believe it is the key up event for the keyboard - 
> if I hold the key down a little longer after the keypress (but not so
> long that it autorepeats) I seem to be able to avoid the crash sometimes.
> Luck? Not sure, but seems fairly reproducible.
> 
> There's no real easy way to restore just the keyboard handler that I
> see without some dpmiexcp edits I didn't have time for.

How about simply blocking the interrupt in the PIC?  It might not work 
due to virtualization of the PIC, but it's so simple that I think it's 
worth trying.

The main issue that worries me is the interrupts besides the keyboard 
that could cause the same crashes.  While we can do lots of things with 
the keyboard (isn't there a keyboard controller command to tell the 
keyboard to stop sending keys, btw?), other sources, such as the timer, 
are harder.

It's true that the keyboard interrupt is by far the most important one, 
since we always hook it, but it would be nice if timers could work as 
well (e.g., profiling needs them).

So if the PIC method works, it might be a better solution, because we can 
block all the potential trouble-making IRQ lines, and we don't lose 
events as the result, if the time we keep them blocked is short.  By 
contrast, toggling the timer interrupt handler with 
__djgpp_exception_toggle will lose the timer ticks and other interrupts 
until we toggle again.  Losing interrupts is much better than crashing, 
but is not very nice (e.g., imagine a communications program that loses 
bytes as a result).

> I don't know if a CLI would work better under Win2K either to prevent
> this.  

It probably won't, but perhaps it's worth trying.

> I thought I would fill you in on what I found - no time for another day
> or so.

Thanks.

- Raw text -


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