www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/16/01:05:37

Date: Thu, 16 May 1996 08:02:14 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Ralf Suessbrich <ralf DOT suessbrich AT nuernberg DOT netsurf DOT de>
Cc: DJGPP Mailing List <djgpp AT delorie DOT com>
Subject: Re: Realmode interrupts
In-Reply-To: <319A1F93.37C6@nuernberg.netsurf.de>
Message-Id: <Pine.SUN.3.91.960516074435.4526C-100000@is>
Mime-Version: 1.0

On Wed, 15 May 1996, Ralf Suessbrich wrote:

> handler () {
> 
> 	nosound ();
> 	sound (500);
> 	sleep (1);
> 	nosound ();
> }

What?  You sleep for 1 SECOND in the interrupt handler??  Are you aware 
of the fact that during all that time interrupts are disabled on your 
machine?  (That means, for example, that the PC clock stops ticking for 
the entire second.)

> 	dosmemput (funcptr, len, real_address); /* now i moved my handler to first 1 MB memory */
> 	
>  	handler_adr.segment = ra_adr >> 4;  /* FAQ section 18.9: lower 4 bits to offset16 */
>     	handler_adr.offset16 = ra_adr & 15; /* the rest to segment, did i do this right ? */
> 	
> 
> 	__dpmi_set_real_mode_interrupt_vector (9, &handler_adr);

That's very wrong.  First, you cannot register a protected-mode function 
as a real-mode handler, you must to wrap it with a special code by 
calling `__dpmi_allocate_real_mode_callback' first.  And second, you 
don't have to hook the real-mode Int 9 at all, because it will be 
reflected to protected mode if you hook it in protected mode, as the FAQ 
explains.

You should also lock all the memory that is used by the hardware interrupt
handler, so your handler won't be paged out of RAM.  For starters, just 
lock all the memory of your program using a bit in `_crt0_startup_flags' 
(it is described in the libc Info reference).

- Raw text -


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