🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #1201

Re: Writing Device Drivers for OS/2 2.0

#1201
From: hamish
Date: Sat, 22 Aug 1992 10:55
53 lines
3427 bytes
In article <1992Aug21.151852.8673@natinst.com>, ramdas@natinst.com (Malathi Ramdas) writes:
> 
>     I am in the process of writing an instrument control character based devcie
> driver for OS/2 2.0. The device driver architecture under OS/2 2.0 is still

Keep muttering to yourself. Device Drivers are Fun! You'll need it :)

> 16-bit. Does that mean that I need to generate 16-bit device driver code. (ie:
> generate code using a 16-bit compiler and 16-bit linker). Also, what would

Yes. BUT!! Only the interface to the device driver is 16-bit. You can have 32
bit code in the driver if you wish. (I do).

> be the address format of the data address in an IOCTL request packet passed by
> the kernel on behalf of an application making a DosDevIOCtl API call to my
> device driver? Would it be in a 16:16 (selector:offset) form or a 0:32 
> address form (flat address)? Would it depend on whether the application is 

When the strategy routine of the diver gets called the request is pointed to by
the ES:SI registers. (Or is that ES:[BX]? My PC is at work, and I'm at home). 

> 16-bit or 32-bit? From what I read all 16-bit processes  get tiled
> into a flat virtual address space. I hope to hear that all virtual addresses
> that gets passed to my driver is in a 0:32 bit form.
>    Is there a 32-bit assembler that goes out with OS/2 2.0. I still have the
> masm assembler that is 16-bit. I have not received anything along with toolkit
>

5.1 will generate 386 32-bit instructions. 6.0 will do it properly so I hear.
(I have one on order). The best way to learn is to grab the hrtimer.zip archive
fromhobbes in os2/all/programming, it has a device driver for a hi-res timer in
it. I used that to write an ndis and odi protocol stack device drivers. It has
one bug though, quite serious. When initialising it gets the size of the data
segment wrong. It just so happens to work thopugh, unless you add a lot of
data, then it dies as the data you want to use gets thrown away at init time.

Also grab the OS/2 tech library. The device drivber reference is invaluable
here. Oh and one thing. This got me a good one. Device Drivers are linked as
DLL's, not Device Drivers. Strange huh?
 
> 
> 
-- 
==============================================================================
|  Hamish Marson   <h.marson@waikato.ac.nz>                             OS/2 |
|  Programmer (n/5), School of Computing and Mathematical Sciences           | 
|  University of Waikato,                                                    |
|  Hamilton, New Zealand.                                                    |
|Disclaimer:  Anything said in this message is the personal opinion of the   |
|             finger hitting the keyboard & doesn't represent my employers   |
|             opinion in any way. (ie we probably don't agree)               |
==============================================================================
  Q. If Nuclear Tests are so safe, why don't the French do them under Paris?
Technical Details
Message-ID: <1992Aug22.225508.10297@waikato.ac.nz>
Path: arc1-ca.pugleaf.net!sparky!uunet!decwrl!waikato.ac.nz!hamish
References: <1992Aug21.151852.8673@natinst.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!decwrl!waikato.ac.nz!hamish
From: hamish@waikato.ac.nz
Newsgroups: comp.os.os2.programmer,comp.os.os2.apps
Subject: Re: Writing Device Drivers for OS/2 2.0
Message-ID: <1992Aug22.225508.10297@waikato.ac.nz>
Date: 22 Aug 92 22:55:08 +1200
References: <1992Aug21.151852.8673@natinst.com>
Organization: University of Waikato, Hamilton, New Zealand
Lines: 53