www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/16/09:30:17

Xref: news2.mv.net comp.lang.ada:24352 comp.os.msdos.djgpp:7367
Newsgroups: comp.lang.ada,comp.os.msdos.djgpp
From: jerry AT jvdsys DOT nextjk DOT stuyts DOT nl (Jerry van Dijk)
Subject: Re: GNAT and interrupts with DJGPP and CWSPR0
Followup-To: comp.lang.ada,comp.os.msdos.djgpp
Organization: * JerryWare HQ *
Message-ID: <Dw78v1.6L@jvdsys.nextjk.stuyts.nl>
References: <32110129 DOT 3C6E AT ee DOT ubc DOT ca>
Date: Thu, 15 Aug 1996 21:54:36 GMT
Lines: 47
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm not sure whether this will go out...

Greg Bond (bond AT ee DOT ubc DOT ca) wrote:

: Since I'm using CWSPR0 (a ring 0, no frills DPMI server that disables 
: virtual memory)

This solves the problem of not being able to lock all memory used by
the interrupt handler, but still leaves the problem of real mode interrupt
defection by DPMI, if you access the first megabyte.

> I believe I still might be able to access memory 
: locations directly (anyone know enough to disagree?).

Accessing memory locations directly will work anyway by using the djgpp
library. 

: So my thought was 
: that I could install a (mostly) Ada interrupt handler in Ada using the 
: 'for', 'use' keywords to assign an address to the interrupt handler. 

Yep, in theory this should work, if you tell GNAT that this is a callback
function (so its C-style callable). However, you run into problems if you
try to use arguments. And don't forget using the right stack :-)

: Since I've got to include some assembly language in the handler itself, 
: I could use the Ada handler as a wrapper to call a C/assembly handler 
: via Ada's foreign language interface.

If that's the case, why not write the whole handler in C ?

: The design I have in mind is to have an Ada interrupt task wait on a 
: guarded entry of a protected object for interrupt events (the 
: recommended way of handling interrupts in GNAT).

Oops, that changes things a bit. I'm not sure how interrupt safe the DOS
port of pthreads really is....

: If it won't work, what 
: are my alternatives? The only alternative I can think of is polling the 
: hardware directly from the interrupt task

This depends on what you are trying to archive. And the interrupt frequency
you are looking at.

Jerry.

- Raw text -


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