Mail Archives: djgpp/1996/05/16/01:05:37
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 -