This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: building device drivers


> From: Jason Pyeron
> Sent: Friday, August 19, 2005 12:00 PM
> To: cygwin@cygwin.com
> Subject: Re: building device drivers
> 
> On Fri, 19 Aug 2005, Brian Dessent wrote:
> 
> >
> > I don't think that's really going to work.  Cygwin cannot be linked 
> > statically and even if it could, it was not designed to run 
> in kernel 
> > space at all.  Cygwin does not try to emulate the linux 
> kernel, just a 
> > POSIX api.  So low level things like device drivers are not 
> going to 
> > just port over.  What you need to do is get the Windows DDK 
> and write 
> > a true windows driver for your device.  Then you can port 
> the userland 
> > tools using Cygwin and interface with the windows driver.
> 
> 
> I am using the DDK. But that being said, inside I would like 
> to use some POSIX code.
> 

Abandon that idea.  Windows device drivers barely resemble C code.  They are
about as far away from POSIX as it is possible to get.  I am not
exaggerating.

> The problem I am running into, is what Linux considers user 
> space, windows does not.
> 
> So to port the code, with minimal changes, I have to move it 
> into kernel space on windows. IGNORING RED FLAGS THERE.
> 

You are in for a world of hurt the magnitude of which you can not possibly
imagine.

The short form is that it is nonsensical to talk of "moving code into kernal
space" on Windows.  From the very start, you have to design the code to
cleave to Windows' notions of how a device driver must operate.  And large
chunks of that notion are undocumented.  Still larger chunks are erroneously
documented.  The rare portion that is clearly and correctly documented is
certain to change with the release of the next service pack.

Do one of the following:

- Contract the job out to an experienced shop that does drivers and drivers
only.
- Look into one of these "Write your drivers in C++ in 10 minutes!" packages
that are around.  I have no experience with them, and frankly would expect
them to cause more problems than they solved, but who knows, you might get
lucky.

> So that being said, why can't the cygwin libraries be linked 
> statically?
> 

An entirely separate issue, and completely unrelated to writing Windows
drivers.  It would do you no good even if it could be statically linked.

-- 
Gary R. Van Sickle
 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]