From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,LOTS_OF_MONEY autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,971aa11c293c3db1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-21 11:09:05 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.frii.net!easynews!sjc-peer.news.verio.net!news.verio.net!iad-read.news.verio.net.POSTED!kilgallen From: Kilgallen@eisner.decus.org.nospam (Larry Kilgallen) Newsgroups: comp.lang.ada Subject: Re: Device drivers in Ada (was Re: Ada The Best Language?) Message-ID: References: <5be89e2f.0107170838.c71ad61@posting.google.com> <0Bh57.24338$JN6.5004065@news1.rdc1.mi.home.com> Organization: LJK Software Date: 21 Jul 2001 14:09:01 -0500 NNTP-Posting-Host: 216.44.122.34 X-Complaints-To: abuse@verio.net X-Trace: iad-read.news.verio.net 995738944 216.44.122.34 (Sat, 21 Jul 2001 18:09:04 GMT) NNTP-Posting-Date: Sat, 21 Jul 2001 18:09:04 GMT Xref: archiver1.google.com comp.lang.ada:10405 Date: 2001-07-21T14:09:01-05:00 List-Id: In article , "Mark Lundquist" writes: > > "McDoobie" wrote in message > news:0Bh57.24338$JN6.5004065@news1.rdc1.mi.home.com... > >> I use Ada95 because for a lot of jobs it's the right tool for me. I write >> applications using Ada95, I do device drives with Assembler > > Just out of curiosity... have you ever tried writing a device driver in Ada? > > My experience is that Ada is really well-suited for device-level > programming, and I'm curious about the experiences of others. > > Why do you write device drivers in assembler instead of a higher-level > language? Just curious, I'm not being judgemental or anything... I don't recall what operating system (if any) was specified in the post from McDoobie, but on VAX VMS device drivers require special use of the registers. Even Bliss, with it's fine-grained control over register usage could only be used in the drivers for pseudo-devices because it lacked what I would call the wait-for-interrupt-and-keep-channel-linkage. In Macro one would do something like: BSBW .WORD 168 where the inline word was an offset to an alternate return address. Longword size for all instructions on Alpha eliminated that problem :-), but the register usage issues remained until Alpha VMS V6.2 when the ability to write drivers in C was supported, mainly by adding calls that made standard use of registers. At this point one could write Alpha VMS device drivers in Ada, given an Ada compiler that supports 64-bit addressing. I am not sure that GNAT does, and I recognize demand is low. I have had good luck using DEC Ada against the sorts of VMS data structures that drivers use, in particular because a representation clause allows one to specify where the discriminant goes, making it match the standard location specified by the operating system for determining the nature of a block of nonpaged pool. _think_ (but have not gotten far enough to know for sure) that I would prefer a mechanism in Ada to specify where the cell (dope vector?) goes that tells one tagged type from another. For most drivers tagged types should not be necessary to meet the requirements set by the operating system, but I would prefer some control in that regard. (I realize compiler vendors do not want to be constrained, and tagged types are certainly more useful within pure Ada code rather than for interfacing to already-established operating system conventions.