Bring in NDIS emulation support from FreeBSD-5. NDIS is a Windows device
authorMatthew Dillon <>
Thu, 29 Jul 2004 20:51:36 +0000 (20:51 +0000)
committerMatthew Dillon <>
Thu, 29 Jul 2004 20:51:36 +0000 (20:51 +0000)
Bring in NDIS emulation support from FreeBSD-5.  NDIS is a Windows device
driver API emulator.  The FreeBSD work was done by Bill Paul
<>, who has again proven himself to be a more insane
hacker then the rest of us.

Bring in IF_NDIS from FreeBSD-5.

Make a number of additional changes to the driver.  Windows API calls are not
compatible with standard gnu C.   The FreeBSD-5 NDIS code properly uses
__attribute__((__stdcall__)) to deal with the target-pops-argument-stack
issue but had terrible __asm hacks to deal with regargs.  Consolidate the
regargs support into a new header file, regcall.h, and use
__attribute__((__regparm__(3))) to formalize argument passing in registers.
Note that __regparm__(3) places three arguments in registers in the
following order: %eax, %edx, %ecx, but Windoz reg calls place registered
arguments in %ecx and %edx (and additional arguments go on the stack).
regcall.h provides macros to do the proper (I hope) translations.

DragonFly's kernel threads do not have proc structures.  Convert up all the
proc references to thread references.

Convert mutex ops into token ops.

Fix a number of prototypes, including one that was causing an internal
compiler error in gcc2.

Testing: Doesn't crash with Sony-TR3A Intel Centrino 2200 based wireless
chipset, is able to DHCP up the IP address, but cannot yet ping due
to an issue in the ARP code somewhere.
Taken from: FreeBSD-5 / Bill Paul
19 files changed:
sys/dev/netif/ndis/Makefile [new file with mode: 0644]
sys/dev/netif/ndis/if_ndis.c [new file with mode: 0644]
sys/dev/netif/ndis/if_ndis_pccard.c [new file with mode: 0644]
sys/dev/netif/ndis/if_ndis_pci.c [new file with mode: 0644]
sys/dev/netif/ndis/if_ndisvar.h [new file with mode: 0644]
sys/emulation/ndis/Makefile [new file with mode: 0644]
sys/emulation/ndis/cfg_var.h [new file with mode: 0644]
sys/emulation/ndis/hal_var.h [new file with mode: 0644]
sys/emulation/ndis/kern_ndis.c [new file with mode: 0644]
sys/emulation/ndis/ndis_var.h [new file with mode: 0644]
sys/emulation/ndis/ntoskrnl_var.h [new file with mode: 0644]
sys/emulation/ndis/pe_var.h [new file with mode: 0644]
sys/emulation/ndis/regcall.h [new file with mode: 0644]
sys/emulation/ndis/resource_var.h [new file with mode: 0644]
sys/emulation/ndis/subr_hal.c [new file with mode: 0644]
sys/emulation/ndis/subr_ndis.c [new file with mode: 0644]
sys/emulation/ndis/subr_ntoskrnl.c [new file with mode: 0644]
sys/emulation/ndis/subr_pe.c [new file with mode: 0644]