[comp.os.os2.programmer] DOS driver under OS/2

steves@truevision.com (Steve Spicklemire) (10/22/90)

Help!

I wrote a DOS installable device driver and would like to make
it usable under OS/2. (I don't know anything about OS/2 expect that
there is some DOS capability, DOS in a window?) Someone told me
that OS/2 doesn't support IOCTL read and write! Is this true?
What happens when a DOS program in an OS/2 window generates an
int 21 for IOCTL read or write? Is there a good reference for
writing device drivers for OS/2 that can run, or at least be 
compatable with drivers for DOS?

Thanks in Advance!

Steve Spicklemire		(steves@truevision.com	internet)
				(sspickle@INSTEPS.bitnet bitnet)

dez@cbnewsk.att.com (daniel.e.zuccarelli) (11/16/90)

In article <478@epicb.com>, steves@truevision.com (Steve Spicklemire) writes:
> Help!
> 
> I wrote a DOS installable device driver and would like to make
> it usable under OS/2. (I don't know anything about OS/2 expect that
> there is some DOS capability, DOS in a window?) Someone told me
> that OS/2 doesn't support IOCTL read and write! Is this true?
> What happens when a DOS program in an OS/2 window generates an
> int 21 for IOCTL read or write? Is there a good reference for
> writing device drivers for OS/2 that can run, or at least be 
> compatable with drivers for DOS?
> 
> Steve Spicklemire		(steves@truevision.com	internet)
> 				(sspickle@INSTEPS.bitnet bitnet)

Can't do it. A DOS program that runs in the compatibility box will run
correctly if it makes int 21 calls.  Whether IOCTL is supported depends
on your driver.  However you must rewrite your drvier for OS/2, and it
must be a bi-modal (both real and protected mode) driver if you plan
on calling it from the DOS box (which runs in real mode).  Basically,
the bimodal requirement means switching the processor to/from real
mode when necessary, ie. processing interrupts.
-- 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"Well, there's not much to see really. We're inside a Chinese dragon."
Dan Zuccarelli - AT&T Bell Labs CB/RV, INTERACTIVE Systems Corp.
(614) 860-7023

ballard@cheddar.ucs.ubc.ca (Alan Ballard) (11/16/90)

In article <1990Nov15.160926.5036@cbnewsk.att.com> dez@cbnewsk.att.com (daniel.e.zuccarelli) writes:
>However you must rewrite your drvier for OS/2, and it
>must be a bi-modal (both real and protected mode) driver if you plan
>on calling it from the DOS box (which runs in real mode). 
 
Supposedly, some DOS drivers can run unchanged, as long as you *only* call 
them from the DOS box.  However, the constraints are such that few drivers
are likely to make it... character mode only, no interrupt handler,
(hardware) device cannot also be accessed in any way from prot mode.



Alan Ballard                   | Internet: ballard@ucs.ubc.ca
University Computing Services  |   Bitnet: USERAB1@UBCMTSG
University of British Columbia |    Phone: 604-228-3074
Vancouver B.C. Canada V6R 1W5  |      Fax: 604-228-5116

dez@cbnewsk.att.com (daniel.e.zuccarelli) (11/16/90)

In article <10480@ubc-cs.UUCP>, ballard@cheddar.ucs.ubc.ca (Alan Ballard) writes:
> In article <1990Nov15.160926.5036@cbnewsk.att.com> dez@cbnewsk.att.com (daniel.e.zuccarelli) writes:
> >However you must rewrite your drvier for OS/2, and it
> >must be a bi-modal (both real and protected mode) driver if you plan
> >on calling it from the DOS box (which runs in real mode). 
>  
> Supposedly, some DOS drivers can run unchanged, as long as you *only* call 
> them from the DOS box.  However, the constraints are such that few drivers
> are likely to make it... character mode only, no interrupt handler,
> (hardware) device cannot also be accessed in any way from prot mode.
> 
> Alan Ballard                   | Internet: ballard@ucs.ubc.ca

How would it be possible for OS/2 to install such a driver?
-- 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"Well, there's not much to see actually; we're inside a Chinese dragon."
					- Dr. Howard Bannister
Dan Zuccarelli - AT&T Bell Labs CB/RV, INTERACTIVE Systems Corp.

ballard@cheddar.ucs.ubc.ca (Alan Ballard) (11/17/90)

In article <1990Nov16.133628.6975@cbnewsk.att.com> dez@cbnewsk.att.com (daniel.e.zuccarelli) writes:
>
>How would it be possible for OS/2 to install such a driver?
 
The initial part of the device driver header for OS/2 is compatible with 
a DOS driver header.  It contains a flag bit that is 0 for DOS and 1 
for OS/2.  Presumably this is checked.  The documentation says such
drviers are initialized in real mode rather than prot mode. 



Alan Ballard                   | Internet: ballard@ucs.ubc.ca
University Computing Services  |   Bitnet: USERAB1@UBCMTSG
University of British Columbia |    Phone: 604-228-3074
Vancouver B.C. Canada V6R 1W5  |      Fax: 604-228-5116

cowan@marob.masa.com (John Cowan) (11/17/90)

In article <1990Nov15.160926.5036@cbnewsk.att.com>,
	dez@cbnewsk.att.com (daniel.e.zuccarelli) writes:
>[An OS/2 device driver]
>must be a bi-modal (both real and protected mode) driver if you plan
>on calling it from the DOS box (which runs in real mode).

This statement is too weak.  An OS/2 driver must be bi-modal whether it
is called from the compatibility box or not, because it will have to 
service real-mode interrupts that come in when the >user< is running the
compatibility box.

The only thing that can be omitted from an OS/2 driver not used from the
compatibility box is the real-mode (DOS-compatible) calling sequence,
which is usually trivial to provide.
-- 
cowan@marob.masa.com			(aka ...!hombre!marob!cowan)
			e'osai ko sarji la lojban

bmarsh@cod.NOSC.MIL (William C. Marsh) (11/21/90)

In article <1990Nov16.133628.6975@cbnewsk.att.com> dez@cbnewsk.att.com (daniel.e.zuccarelli) writes:
>In article <10480@ubc-cs.UUCP>, ballard@cheddar.ucs.ubc.ca (Alan Ballard) writes:
>> Supposedly, some DOS drivers can run unchanged, as long as you *only* call 
>How would it be possible for OS/2 to install such a driver?

I load nansi.sys to run in the DOS box in my OS/2 1.1 system.  I just include
the line:

device = c:\etc\nansi.sys

in the config.sys...

Bill
-- 
Bill Marsh, Naval Ocean Systems Center, San Diego, CA
{arpa,mil}net: bmarsh@cod.nosc.mil
uucp: {ihnp4,akgua,decvax,dcdwest,ucbvax}!sdcsvax!nosc!bmarsh
"If you are not part of the solution, you're part of the problem..."