delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/24/09:51:32

Date: Sun, 24 Oct 1999 09:55:49 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Francisco Pastor <Francisco DOT Pastor AT uv DOT es>
cc: djgpp AT delorie DOT com
Subject: Re: Dos services and interrupts
In-Reply-To: <38109F41.365614DE@uv.es>
Message-ID: <Pine.SUN.3.91.991024095355.29385h-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Fri, 22 Oct 1999, Francisco Pastor wrote:

> I use a handler interrupt with gcc in djgpp for control a serial port
> comuncation and when I write a large buffer of data to the disk in a
> file it apear overun erros in the receiver of the serial port. It seems
> that when a program call a dos service switching to real mode  the
> interrupts are disabled.

Interrupts are NOT disabled when you call a real-mode service, but:

  - DOS itself (and sometimes BIOS) disable interrupts when they wait
    for I/O to complete in some tight loops;

  - When a hardware interrupt happens in the middle of a DOS call, it
    needs to be ``reflected'' to the protected-mode handler.  This
    reflection requires a costly mode switch to protected mode and
    back, which incurs an overhead, and thus you could lose interrupts
    if they come in at a hight rate.

> Somebody know if is posible to avoid this problem.

The usual way to avoid this is to drop the CS bit while you call DOS,
or use some other mechanism, like software flow-control, to tell the
other side of the link not to send data while you are in a DOS call.

You can also try to avoid calling DOS to write large chunks of data, 
write it in smaller chunks, and make sure your system is set up for 
efficient disk operations.  But this isn't 100% safe.

- Raw text -


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