*BSD News Article 36259


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!yeshua.marcam.com!zip.eecs.umich.edu!panix!not-for-mail
From: wpaul@panix.com (Bill Paul)
Newsgroups: comp.os.386bsd.questions
Subject: Re: how to write a interrupt function in c?
Date: 28 Sep 1994 13:05:12 -0400
Organization: The M00se Illuminati (bl00p!)
Lines: 54
Message-ID: <36c7o8$6ag@panix3.panix.com>
References: <maruthan.780739386@marsh>
NNTP-Posting-Host: panix3.panix.com
X-Newsreader: TIN [version 1.2 PL2]

Daring to challenge the will of the almighty Leviam00se,
Chandrasekaran Maruthanayakam (maruthan@cs.curtin.edu.au)
had the courage to say:

: On DOS platform one can write interrupt functions in C using the standard
: C compilers. Does any one know how write a interrupt function in C
: on 386BSD platform?
: Thanks
: chandra

If by 'interrupt functions' you mean BIOS interrupts (INT 21,
INT 33, etc...), then the answer is: no, nobody knows.

And you know why they don't know? Because you can't do it. 386BSD, NetBSD,
FreeBSD, Linux and virtually all other PC UNIX operating systems run
in 386 (32-bit) protected mode -- the BIOS code only runs in real mode. If
you're the adventurous type, you could try to implement some sort of
virtual 8086 support, but this is widely regarded as being a non-trivial
task.

Or, if you have time, you can wait for the DOS emulator for FreeBSD to
be completed. Then you can call all the BIOS interrupts you want.

Now, if you mean 'interrupt functions' as in hardware interrupts (which I
don't think you do), then you can take a look at the BSD kernel source
code and see how the device drivers are written. If you have some new
or unusual device that isn't supported by BSD and you want to trap
interrupts from it, then you have to write a driver for it. For devices
that already have drivers (serial ports, mouses, disk drives) you
probably shouldn't be trying to trap interrupts in the first place since
the existing drivers are already handling them.

I would pick up a few good books on UNIX C programming. Trying to
implement DOS coding techniques in UNIX is really a waste of time.
If you can be specific about exactly what it is you want to do then
I might be able to provide a better comparisson, and maybe an example
or two.

(And readers please note that tossing a couple of supposedly highbrow
buzzwords into your postings and expecting them to help people instantly
divine the exact nature of your problem/question/situation is *NOT*
what is meant by being specific. Repeating the buzzwords doesnt do
any good either. You want exact answers, ask exact questions.)


-Bill

--
 _      /\      _            Join the
/ \_/\_/  \_/\_/ \  .----.   M00se Illuminati   Bill Paul 
\_____/ () \_____/ (bl00p!)  Face it: wouldn't  <Big City M00se>
     /      \       `----'   you feel much      wpaul@panix.com   -or-
    /  \__/  \    --'        safer?             ghod@drycas.club.cc.cmu.edu
   /__________\