home *** CD-ROM | disk | FTP | other *** search
- /* FAS Final Async Solution driver for 386 versions of system V UNIX */
-
- /* Originally written by
- Jim Murray encore!cloud9!jjmhome!jjm
- 2 Mohawk Circle harvard!m2c!jjmhome!jjm
- Westboro Mass 01581 jjm%jjmhome@m2c.m2c.org
- USA voice (508) 366-2813
- */
-
- /* Current author:
- Uwe Doering Domain : gemini@geminix.in-berlin.de
- Billstedter Pfad 17 b Bangpath : ...!unido!fub!tmpmbx!geminix!gemini
- 1000 Berlin 20
- Germany
- */
-
- #ident "@(#)fas.c 2.07"
-
- /* Note: This source code was quite heavily optimized for speed. You
- may wonder that register variables aren't used everywhere.
- This is because there is an overhead in memory accesses
- when using register variables. As you may know data accesses
- usually need much more wait states on the memory bus than
- code accesses (because of page or cache misses). Therefore
- saving some data accesses has higher priority than saving
- code accesses.
-
- You may also note some not very elegant constructions that
- may be intentional because they are faster. If you want to
- make style improvements you should check the assembler output
- whether this wouldn't slow things down.
-
- Decisions for speed optimization were based on assembler
- listings produced by the standard UNIX V 3.X/386 C compiler.
- */
-
- #if defined (XENIX)
- #include "fas.h"
- #else
- #include <sys/fas.h>
- #include <sys/inline.h>
- #endif
-
- #if defined (SCO) || defined (XENIX)
- #define asyputchar sioputchar
- #define asygetchar siogetchar
- #endif
-
- #if defined (XENIX)
- #define intr_disable() old_level = SPLINT ()
- #define intr_restore() (void) splx (old_level)
- #define REGVAR
-
- /*
- ** Union for use by all device handler ioctl routines.
- */
- union ioctl_arg {
- struct termio *stparg; /* ptr to termio struct */
- char *cparg; /* ptr to character */
- char carg; /* character */
- int *iparg; /* ptr to integer */
- int iarg; /* integer */
- long *lparg; /* ptr to long */
- long larg; /* long */
- };
- #else
- /* This is a terrible ugly kludge to speed up the `inb' and `outb'
- functions. I.e., originally, the `outb' inline function had an
- overhead of four data memory accesses for parameter passing. This
- parameter passing actually consumed more clock cycles than the
- assembler `outb' command itself. Although this solution can't
- prevent unnessessary register moves it limits them at least to
- register to register moves that are much faster. You need a
- line like the following in the declaration part of every
- function that uses `inb' or `outb' calls:
-
- REGVAR;
-
- This hack should work with every compiler that knows about the
- UNIX V 3.X/386 standard compiler's inline assembler directives.
- */
-
- asm void loadal (val)
-