Article View: comp.os.msdos.programmer
Article #3435DEVICE DRIVER programming question
From: Fraser Street
Date: Tue, 29 Sep 1992 20:49
Date: Tue, 29 Sep 1992 20:49
48 lines
2516 bytes
2516 bytes
I AM HAVING TROUBLE DETERMINING WHERE MY DEVICE DRIVER ENDS IN MEMORY WHEN IT IS INITIALIZING - I.E. FINDING THE BREAKPOINT TO RETURN TO DOS. I need to determine the last paragraph occupied by my drivers code and data. Here's my situation: I have written a block mode device (a special purpose RAM disk) using Robert Lai's book as a guide. In particular I have written the frontend in TASM large model and I link it to Turbo C large model code for the driver commands (again using Lai's book as a guide). I plan to link in a bunch more large model code in the future as this driver is one day going to implement some network services using our implementation of the XTP Transfer Protocol. All the example code in Lai's book uses Tiny model and he uses a TASM GROUP command to order the segments, putting the CODE segment last in the executable. He then calculates the break point for the end of the driver relative to the last instructions in his CODE segment - this works well for him since his CODE segment is the last thing in his executable. My problem is that I'm working in large model and the linker is putting CODE first and _BSS last (according to the .map file). So, how can I find the segment:offset address of the bottom of the _BSS at init time so that I can use this address to calculate the break point for my driver to return to DOS? My first thought was to look in the PSP, but I come to find that DOS does not build a PSP for drivers. At the present time I just add 1000 paragraphs to the bottom of my code segment and use that as a break address. It works but it obviously wastes memory and only works because I know I have far less than 16K of data below my code - a very poor hack to get me around the problem. Any suggestions would be appreciated. I'd appreciate e-mail responses. I'll summarize the solutions I get and post them to the net. Thank you for your time! -- Fraser Street fraser@Virginia.EDU University of Virginia Department of Computer Science
Technical Details
Message-ID:
<1992Sep29.204910.14231@murdoch.acc.Virginia.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!darwin.sura.net!uvaarpa!murdoch!uvacs.cs.Virginia.EDU!fs8jShow Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!darwin.sura.net!uvaarpa!murdoch!uvacs.cs.Virginia.EDU!fs8j From: fs8j@uvacs.cs.Virginia.EDU (Fraser Street) Subject: DEVICE DRIVER programming question Message-ID: <1992Sep29.204910.14231@murdoch.acc.Virginia.EDU> Sender: usenet@murdoch.acc.Virginia.EDU Organization: University of Virginia Computer Science Department Date: Tue, 29 Sep 1992 20:49:10 GMT Lines: 48