freebsd-dev/sys/dev
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
..
aac Remove the messy locking dance around xpt_done() 2005-02-09 11:50:16 +00:00
acpi_support Unify ACPI_DEBUG support for all OEM drivers under ACPI_OEM. Since more than 2004-12-13 23:31:46 +00:00
acpica Allow users to manually override quirks with the tunable "debug.acpi.quirks". 2005-02-13 20:10:28 +00:00
adlink Commit the new version of the adlink driver which can do non-cyclic 2004-09-19 21:52:15 +00:00
advansys Fix a missing /*- 2005-02-14 01:10:50 +00:00
agp Correct the SiS 755 PCI ID. Confirmed against Linux code. 2005-02-14 07:30:04 +00:00
aha Simplify aha resource management, and fix a few bugs in unwinding 2005-01-19 06:54:10 +00:00
ahb Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
aic Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
aic7xxx Make this compile from the last commit 2005-01-06 05:30:44 +00:00
amd Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
amr Remove some unused variables. 2005-02-09 17:19:12 +00:00
an Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ar Initialize Netgraph type at a correct time, before device probing. 2005-02-15 18:41:21 +00:00
arl Since if_arl doesn't contain locking or run with INTR_MPSAFE, mark 2004-08-13 22:54:19 +00:00
asr Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ata Avoid using tsleep() in the resume path as it may result in the 2005-02-07 17:14:42 +00:00
ath Fixup radiotap handling of FCS and QoS frames per discussion with David Young: 2005-01-24 20:31:24 +00:00
atkbdc Make life for owners of Synaptics Touchpads more pleasant :-) 2005-01-10 13:05:58 +00:00
auxio Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
awi Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
bfe correct direction for bus_dma sync of rx buffer 2005-01-09 19:57:55 +00:00
bge Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
bktr Remove lots of tab/space errors introduced by massive cut-n-paste action. 2005-02-10 22:38:51 +00:00
buslogic Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
cardbus Move resource allocation routines from cardbus_cis.c to cardbus.c. 2005-02-06 21:03:13 +00:00
ciss Remove 6422, V100 and add the P600. 2005-01-20 22:51:38 +00:00
cm Since if_cm doesn't contain locking or run with INTR_MPSAFE, mark 2004-08-13 22:57:44 +00:00
cnw Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
cp Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
cpufreq Use intr_disable/restore() instead of disable_intr() since the latter is 2005-02-05 16:31:58 +00:00
cs Fix the worst offenders of style(9) with a small style sweep. 2005-01-28 06:50:59 +00:00
ct Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ctau Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
cx Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
cy Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
dc /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
dcons Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
de Hide link up/down/media printfs behind bootverbose 2004-11-08 19:21:57 +00:00
dec Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
digi Add new function ttyinitmode() which sets our systemwide default 2004-10-18 21:51:27 +00:00
dpt Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
drm Fix typo from previous commit. 2005-01-07 07:08:33 +00:00
ed Move the harvesting of the MAC address out of the generic novell probe 2005-02-14 23:00:41 +00:00
eisa Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
em Call if_link_state_change() when link status changes. 2005-02-04 18:36:04 +00:00
en Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ep Don't print 'unknown id' in the ep_pccard_identify routine. It is 2005-01-20 20:36:59 +00:00
esp Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ex Include necessary declarations 2005-01-20 20:06:44 +00:00
exca Properly calculate the offset in mapping the memory of pccards. This 2005-01-11 00:32:43 +00:00
fatm Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
fb Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
fdc Mask off the upper bits of the resource before using it as an index 2005-01-20 17:27:37 +00:00
fe we don't need the offset in the attr memory to get the ethernet 2005-01-21 19:51:23 +00:00
firewire Clear PCIM_CMD_SERRESPEN and PCIM_CMD_PERRESPEN for broken hardware. 2005-01-06 07:40:34 +00:00
fxp Remove an outdated comment about ifnet not being locked. 2005-02-15 17:47:57 +00:00
gem Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
gfb Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
harp Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
hatm Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
hfa Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
hifn Update support for 795x parts: 2005-01-19 17:03:35 +00:00
hme Fix "Duplicate mbuf free panic". 2005-02-02 08:35:11 +00:00
hptmv Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ic Since we are quite unlikely to ever face another platform which 2005-02-06 13:46:39 +00:00
ichsmb Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ichwd Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ida Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
idt Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ie Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ieee488 Check handle types. 2005-02-12 23:52:44 +00:00
if_ndis Add support for Windows/x86-64 binaries to Project Evil. 2005-02-16 05:41:18 +00:00
iicbus Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
iir Remove a dead vtophys() reference. 2005-01-31 01:26:22 +00:00
io Add module versions. 2004-08-02 20:42:28 +00:00
ips Add crashdump support to the ips driver. It only works for the more modern 2005-01-30 17:45:45 +00:00
isp Provide a needed argument to AT_MAKE_TAGID. 2005-01-23 22:33:59 +00:00
ispfw Roll firmware to the latest version. There are a bunch of features 2005-01-29 01:12:37 +00:00
ixgb Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
joy Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
kbd #include fcntl.h not vnode.h. Check O_NONBLOCK not IO_NDELAY. 2004-12-22 17:29:02 +00:00
led Make a bunch of malloc types static. 2005-02-10 12:02:37 +00:00
lge Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
lnc Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
mc146818 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
mca
mcd o Fix a typo. 2005-01-30 16:42:23 +00:00
md Request a CPU private mapping from sf_buf_alloc(). If the swap-backed 2005-02-13 21:51:50 +00:00
mem Fix module builds for i386 and amd64. 2004-08-04 18:30:31 +00:00
mii Add location and PNP info to the mii bus 2005-02-16 01:08:43 +00:00
mk48txx o Sync with the NetBSD mk48txx driver (the result simplyfies some changes 2004-11-17 12:54:12 +00:00
mlx Don't use PAGE_SIZE to calculate controller-specific attributes. 2004-11-25 12:15:49 +00:00
mly Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
mpt Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
mse Use the standard FreeBSD license 2005-01-11 06:24:40 +00:00
musycc Add -1 to this non-existent use of m_print in the source tree so LINT 2004-09-28 20:14:51 +00:00
my Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ncv takawata tells me that KXLC0003 also works with this driver, so add it 2005-02-03 23:39:29 +00:00
nge Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
nmdm If CDSR_OFLOW (stty dsrflow) is enabled on one or both sides of a 2005-01-26 23:42:18 +00:00
nsp Minor style nits 2005-02-04 02:32:43 +00:00
null Go back to the historical minor numbers. Add a module version while 2004-08-02 19:59:41 +00:00
ofw Merge revision 1.5 from NetBSD: Fix a typo in a comment. 2005-02-12 19:12:17 +00:00
owi MF dev/wi: merge the pccard lists. 2005-02-03 00:40:35 +00:00
patm Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
pbio Skip PNP probes. If there are isapnp or pnpbios instances of this driver, 2005-02-11 03:56:13 +00:00
pccard Add an XXX comment about string quoting. 2005-02-16 01:03:30 +00:00
pccbb Use the standard FreeBSD license for these files. 2005-01-13 19:05:25 +00:00
pcf - Introduce an ofw_bus kobj-interface for retrieving the OFW node and a 2004-08-12 17:41:33 +00:00
pci Enable interrupt routing as first choice on alpha. 2005-02-07 00:43:14 +00:00
pdq Prefer C99's __func__ over GCC's __FUNCTION__. 2004-09-22 17:16:04 +00:00
ppbus Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ppc Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
pst Use the correct type for iop_attach(). 2004-10-03 16:06:46 +00:00
puc add support for NetMos NM9805 1284 Printer port 2005-02-09 18:38:28 +00:00
random Check that we have at least a 586-class CPU before calling do_cpuid(). 2005-02-06 16:55:52 +00:00
ray Make a bunch of malloc types static. 2005-02-10 12:02:37 +00:00
rc Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
re Bring in support for SUGOI LAN GIGA NIC made by System TALKS, Inc from 2005-01-22 22:40:53 +00:00
rndtest Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
rp Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
sab Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
safe Add missing <sys/module.h> includes 2004-05-30 20:08:47 +00:00
sbni Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
sbsh Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
scd Boot away another stackgap (one of the lest ones in linuxlator/i386) by 2005-01-30 08:12:37 +00:00
sf /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
si Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
sio Simplify the "and if we're in the debugger, don't use locks" logic, 2005-02-08 17:56:04 +00:00
sk Cleanup debugging code and put it under bootverbose 2005-01-29 19:26:53 +00:00
smbus Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
sn Only attach to network functions. I'm not aware of any multifunction 2005-01-20 19:59:31 +00:00
snc Remove now-stale comment 2005-01-20 20:32:56 +00:00
snp Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
sound BUS_SPACE_UNRESTRICTED shouldn't be used with the bus_alloc_resource 2005-02-01 07:43:34 +00:00
speaker /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 22:18:23 +00:00
sr Initialize Netgraph type at a correct time, before device probing. 2005-02-15 18:41:21 +00:00
stg Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
streams Use kern_open() directly rather than a stackgap detour via open(). 2005-02-07 18:22:20 +00:00
sx Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
sym Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
syscons Remove the last vestiges of the userconfig option. None of this actually 2004-12-01 04:59:33 +00:00
tdfx Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
tga Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ti /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
trm Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
twa Bumped up the driver version, following recent changes. 2005-02-12 01:16:28 +00:00
twe Fix crashdumps on twe. The twe_immediate_request() path was not only 2005-02-08 03:43:02 +00:00
tx Since if_tx doesn't contain locking or run with INTR_MPSAFE, mark 2004-08-13 23:52:33 +00:00
txp Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
uart - Re-write OF_decode_addr() with a bus-neutral approach, adding support 2005-02-12 19:13:51 +00:00
ubsec Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
usb Abort any active transfers when the device detaches. This fixes a 2005-02-14 02:17:53 +00:00
utopia Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
vge Use if_link_state_change() instead of rt_ifmsg(). Remove include net/route.h. 2005-02-07 19:39:29 +00:00
vkbd Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
vr /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
vx Fix up assignment of negative number to char. Char's are unsigned by 2005-02-03 02:35:28 +00:00
watchdog Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
wds Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
wi The two PLANEX cards listed in pccarddevs, identified only by their 2005-02-01 18:28:09 +00:00
wl Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
xe u_intXX_t -> uintXX_t 2005-01-20 19:32:37 +00:00
zs Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00