delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/11/16:15:30

Date: Tue, 11 Apr 2000 13:24:34 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: OiSyN <oisyn AT afmp DOT nl>
cc: djgpp AT delorie DOT com
Subject: Re: Processor Exceptions
In-Reply-To: <955386420.5260.0.pluto.d4ee0fa5@news.demon.nl>
Message-ID: <Pine.SUN.3.91.1000411132415.4929H-100000@is>
MIME-Version: 1.0
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

On Mon, 10 Apr 2000, OiSyN wrote:

> I was writing a thread-library for DJGPP to make it multi-threading.
> I first used setitimer () to generate a SIGREAL, and I used a signal handler
> to switch between threads. It worked fine, but a bit unstable

In what version of DJGPP did you try this?  If it was not the latest
v2.03, I suggest to upgrade: I think setitimer is much better there.
You might have no need to reinvent the wheel.

> So I decided to write my own timer and exception handler.

It's probably better to improve the existing one, instead of starting
from scratch.  The machinery in exceptn.S and dpmiexcp.c is proven
during several releases and by many users.  Even if you have found a
bug, it's probably easier to fix it than to rewrite the whole thing.

> The timer sets the length of __djgpp_app_DS to zero (the normal data
> selector),
> which will generate an exception as soon as you read/write a variable.
> The exception handler (exception 0x0D) checks if the exception was generated
> because of the timer interrupt, if it wasn't, it calls the old exception
> handler.
> If it was, it saves the registers to a buffer, sets the length of
> __djgpp_app_DS to
> whatever it was, changes the address of the instruction that generated the
> exception
> into my thread_switch_handler and returns with a retf.

But this is almost exactly what the DJGPP code already does!  So why
do you think this would work better than the existing code?

I really suggest to explain what is wrong with the library
implementation of setitimer.  I think that will bring you to your goal
faster and more reliably.  Why ignore the experience and know-how of
so many people who labored on that?

> Just a detailed document about processor exceptions would be great to!

You want the Intel manuals, they are available from the Intel Web
site.

- Raw text -


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