Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Feb 2005 17:49:53 +0000 (GMT)
From:      wpaul@FreeBSD.ORG (Bill Paul)
To:        doconnor@gsoft.com.au (Daniel O'Connor)
Cc:        des@des.no
Subject:   Re: cvs commit: src/sys/compat/ndis hal_var.h kern_ndis.c kern_windrv.c ndis_var.h ntoskrnl_var.h pe_var.h resource_var.h subr_h
Message-ID:  <20050216174953.3A50C16A4CF@hub.freebsd.org>
In-Reply-To: <200502162127.56278.doconnor@gsoft.com.au> from "Daniel O'Connor" at "Feb 16, 2005 09:27:55 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
> On Wed, 16 Feb 2005 21:14, Dag-Erling Sm_rgrav wrote:
> > Bill Paul <wpaul@FreeBSD.org> writes:
> > >   Log:
> > >   Add support for Windows/x86-64 binaries to Project Evil.
> > >   [...]
> > >   The original patches provided macros to wrap every single routine at
> > >   compile time, providing a secondary jump table with a customized
> > >   wrapper for each exported routine. I decided to use a different
> > > approach: the call wrapper for each function is created from a template
> > > at runtime, and the routine to jump to is patched into the wrapper as it
> > > is created.  [...]
> >
> > I think this qualifies as "Project Eviler".  I can't wait to find out
> > what you'll come up with next...
> 
> "Pure Evil" (like in Time Bandits)

That's "Pure, _Concentrated_ Evil" to you, mister.
 
Note that the runtime wrapper construction is only for the cases
where the Windows binary has to call Project Evil routines. There is
only one wrapper template, which can handle up to 16 arguments.
This is kind of gross because it always translates 16 arguments,
even if the function requires less than that. It was the best
compromise I could come up with, especially given that I need to
handle some varadic functions too.

For the other direction, where Project Evil invokes a function
in the Windows binary (MiniportInitialize(), etc...), the wrapping
is done at compile time with macros. There are 6 small assembly wrappers
that can handle from 1 to 6 arguments (MSCALL1() to MSCALL6()). It
happens none of the functions we need to call take more than 6
args.

I'm hoping to get IRP support and, as a consequence, USB devices
working next. Last on the hit list is WPA support. Note: the
document at http://www.freebsd.org/~wpaul/80211.ps is a copy of
Microsoft's 802.11 adapter design guide for Windows XP, which describes
the API for using WPA with NDIS 5.1 drivers. If some enterprising
individual wants to step in and do the WPA support, I wouldn't say
no. :)

-Bill

--
=============================================================================
-Bill Paul            (510) 749-2329 | Senior Engineer, Master of Unix-Fu
                 wpaul@windriver.com | Wind River Systems
=============================================================================
              <adamw> you're just BEGGING to face the moose
=============================================================================



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050216174953.3A50C16A4CF>