freebsd-dev/sys
Bill Paul d8f2dda739 Add support for Windows/x86-64 binaries to Project Evil.
Ville-Pertti Keinonen (will at exomi dot comohmygodnospampleasekthx)
deserves a big thanks for submitting initial patches to make it
work. I have mangled his contributions appropriately.

The main gotcha with Windows/x86-64 is that Microsoft uses a different
calling convention than everyone else. The standard ABI requires using
6 registers for argument passing, with other arguments on the stack.
Microsoft uses only 4 registers, and requires the caller to leave room
on the stack for the register arguments incase the callee needs to
spill them. Unlike x86, where Microsoft uses a mix of _cdecl, _stdcall
and _fastcall, all routines on Windows/x86-64 uses the same convention.
This unfortunately means that all the functions we export to the
driver require an intermediate translation wrapper. Similarly, we have
to wrap all calls back into the driver binary itself.

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. The subr_pe module has been modified to patch in the
wrapped function instead of the original. (On x86, the wrapping
routine is a no-op.)

There are some minor API differences that had to be accounted for:

- KeAcquireSpinLock() is a real function on amd64, not a macro wrapper
  around KfAcquireSpinLock()
- NdisFreeBuffer() is actually IoFreeMdl(). I had to change the whole
  NDIS_BUFFER API a bit to accomodate this.

Bugs fixed along the way:
- IoAllocateMdl() always returned NULL
- kern_windrv.c:windrv_unload() wasn't releasing private driver object
  extensions correctly (found thanks to memguard)

This has only been tested with the driver for the Broadcom 802.11g
chipset, which was the only Windows/x86-64 driver I could find.
2005-02-16 05:41:18 +00:00
..
alpha Backout previous change (disabling of security checks for signals delivered 2005-02-13 17:37:20 +00:00
amd64 MFi386 rev 1.61: Fix a few bugs in the legacy cpu attachment ivars. 2005-02-15 07:26:28 +00:00
arm Define NIRQ to 64 for CPU_ARM9, because Cirrus Logic EP93XX cores provides 2005-02-13 18:26:31 +00:00
boot Expand *n't contractions. 2005-02-13 22:25:33 +00:00
bsm Add a stub audit_kevents.h, which defines exactly one audit event: 2005-02-02 14:27:36 +00:00
cam Remove a shadow declaration of 'error' that caused certain tests to be 2005-02-12 04:51:19 +00:00
coda Remove vop_destroyvobject() initialization. 2005-02-07 08:04:24 +00:00
compat Add support for Windows/x86-64 binaries to Project Evil. 2005-02-16 05:41:18 +00:00
conf Add support for Windows/x86-64 binaries to Project Evil. 2005-02-16 05:41:18 +00:00
contrib Access softc embedded struct ifnet via function macro to make it easier to 2005-02-09 19:29:13 +00:00
crypto Start the dreaded NOFOO -> NO_FOO conversion. 2004-12-21 08:47:35 +00:00
ddb Start each of the license/copyright comments with /*- 2005-01-06 01:34:41 +00:00
dev Add support for Windows/x86-64 binaries to Project Evil. 2005-02-16 05:41:18 +00:00
doc
fs Make a SYSCTL_NODE static 2005-02-10 12:23:29 +00:00
gdb /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 18:27:30 +00:00
geom Fix typo. We want to unlock mutex here. 2005-02-12 16:19:03 +00:00
gnu Make a SYSCTL_NODE static 2005-02-10 12:23:29 +00:00
i4b /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 22:18:23 +00:00
i386 Correct a few bugs in the legacy cpu attachment. Get the unit from the 2005-02-15 07:21:20 +00:00
ia64 s/descr/oid_descr/ 2005-02-09 04:48:23 +00:00
isa Use the local APIC timer to drive the various kernel clocks on SMP machines 2005-02-08 20:25:07 +00:00
isofs/cd9660 Unbreak a few filesystems for which vnode_create_vobject() wasn't being 2005-01-29 16:23:39 +00:00
kern When dealing with systems with no absolute drivers attached, only calibrate 2005-02-15 07:43:48 +00:00
libkern Add strspn() to libkern. 2005-02-10 20:39:39 +00:00
modules Add support for Windows/x86-64 binaries to Project Evil. 2005-02-16 05:41:18 +00:00
net Check for non-NULL ac_netgraph field in interface arpcom, instead of 2005-02-14 11:58:54 +00:00
net80211 rev 1.19 fixed wpa supplicant but broke wpa authenticator; when operating 2005-02-10 17:00:48 +00:00
netatalk /* -> /*- for license, minor formatting changes, insert COPYRIGHT into files 2005-01-07 02:35:34 +00:00
netatm /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
netgraph Make WITNESS happier: 2005-02-14 13:47:06 +00:00
netinet Fix for a SACK (receiver) bug where incorrect SACK blocks are 2005-02-16 01:46:17 +00:00
netinet6 Add missed merge of ripcbinfo extern. Given how widely used 2005-02-09 01:12:43 +00:00
netipsec /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
netipx Mark the IPX netisr as MPSAFE so that inbound IPX traffic is processed 2005-01-09 07:34:55 +00:00
netkey fixed an unexpected addr/port matching failure in IPv6 SA management 2005-01-10 13:06:42 +00:00
netnatm /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
netncp /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
netsmb /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
nfs /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
nfs4client Remove unused cred arg from nfs_vinvalbuf() and many bogus arguments 2005-01-24 12:31:06 +00:00
nfsclient Drop Giant before calling kthread_exit(). 2005-02-07 18:21:50 +00:00
nfsserver Don't try to create vnode_pager objects on other filesystems vnodes, 2005-01-24 22:09:13 +00:00
opencrypto /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
pc98 Merged from sys/dev/sio/sio.c revision 1.458. 2005-02-11 03:41:34 +00:00
pccard Remove more deadwood that never got implemented in NEWCARD, since NEWCARD 2005-02-15 02:54:53 +00:00
pci Correct the SiS 755 PCI ID. Confirmed against Linux code. 2005-02-14 07:30:04 +00:00
posix4 /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
powerpc Finish the job of sorting all includes and fix the build by including 2005-02-06 01:55:08 +00:00
rpc /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
security Synchronize HEAD copyright/license with RELENG_5 copyright/license: 2005-02-13 13:59:34 +00:00
sparc64 - Re-write OF_decode_addr() with a bus-neutral approach, adding support 2005-02-12 19:13:51 +00:00
sys Bump __FreeBSD_version for increased size for default thread stacks. 2005-02-15 06:33:28 +00:00
tools Add VOP_FOO_APV() which takes a pointer to the vop_vector. 2005-02-08 12:54:32 +00:00
ufs - Remove the unused and unsafe ufs_ihashlookup. This function returned a 2005-02-14 20:51:39 +00:00
vm Rather than overloading the page->object field like UMA does, use instead 2005-02-15 22:17:07 +00:00
Makefile