2002-06-30 08:05:21 +00:00
|
|
|
# This file tells config what files go into building a kernel,
|
|
|
|
# files marked standard are always included.
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
# The long compile-with and dependency lines are required because of
|
|
|
|
# limitations in config: backslash-newline doesn't work in strings, and
|
|
|
|
# dependency lines other than the first are silently ignored.
|
|
|
|
#
|
2004-08-16 07:55:06 +00:00
|
|
|
#
|
|
|
|
linux32_genassym.o optional compat_linux32 \
|
|
|
|
dependency "$S/amd64/linux32/linux32_genassym.c" \
|
|
|
|
compile-with "${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}" \
|
|
|
|
no-obj no-implicit-rule \
|
|
|
|
clean "linux32_genassym.o"
|
|
|
|
#
|
|
|
|
linux32_assym.h optional compat_linux32 \
|
|
|
|
dependency "$S/kern/genassym.sh linux32_genassym.o" \
|
|
|
|
compile-with "sh $S/kern/genassym.sh linux32_genassym.o > ${.TARGET}" \
|
|
|
|
no-obj no-implicit-rule before-depend \
|
|
|
|
clean "linux32_assym.h"
|
|
|
|
#
|
2003-11-17 08:58:16 +00:00
|
|
|
ia32_genassym.o standard \
|
2003-08-23 00:58:33 +00:00
|
|
|
dependency "$S/compat/ia32/ia32_genassym.c" \
|
2003-05-14 04:10:49 +00:00
|
|
|
compile-with "${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}" \
|
|
|
|
no-obj no-implicit-rule \
|
|
|
|
clean "ia32_genassym.o"
|
|
|
|
#
|
2003-11-17 08:58:16 +00:00
|
|
|
ia32_assym.h standard \
|
2003-05-14 04:10:49 +00:00
|
|
|
dependency "$S/kern/genassym.sh ia32_genassym.o" \
|
2004-12-21 02:08:14 +00:00
|
|
|
compile-with "env NM='${NM}' sh $S/kern/genassym.sh ia32_genassym.o > ${.TARGET}" \
|
2003-05-14 04:10:49 +00:00
|
|
|
no-obj no-implicit-rule before-depend \
|
|
|
|
clean "ia32_assym.h"
|
|
|
|
#
|
2004-03-03 09:37:44 +00:00
|
|
|
font.h optional sc_dflt_font \
|
|
|
|
compile-with "uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'static u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'static u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'static u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h" \
|
|
|
|
no-obj no-implicit-rule before-depend \
|
|
|
|
clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
|
|
|
|
#
|
|
|
|
atkbdmap.h optional atkbd_dflt_keymap \
|
|
|
|
compile-with "/usr/sbin/kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \
|
|
|
|
no-obj no-implicit-rule before-depend \
|
|
|
|
clean "atkbdmap.h"
|
|
|
|
#
|
|
|
|
ukbdmap.h optional ukbd_dflt_keymap \
|
|
|
|
compile-with "/usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \
|
|
|
|
no-obj no-implicit-rule before-depend \
|
|
|
|
clean "ukbdmap.h"
|
|
|
|
#
|
2004-12-15 02:21:23 +00:00
|
|
|
hal.o optional ath_hal \
|
|
|
|
dependency "$S/contrib/dev/ath/public/x86_64-elf.hal.o.uu" \
|
|
|
|
compile-with "uudecode < $S/contrib/dev/ath/public/x86_64-elf.hal.o.uu" \
|
|
|
|
no-implicit-rule
|
|
|
|
opt_ah.h optional ath_hal \
|
|
|
|
dependency "$S/contrib/dev/ath/public/x86_64-elf.opt_ah.h" \
|
|
|
|
compile-with "cp $S/contrib/dev/ath/public/x86_64-elf.opt_ah.h opt_ah.h" \
|
|
|
|
no-obj no-implicit-rule before-depend \
|
|
|
|
clean "opt_ah.h"
|
|
|
|
#
|
2005-03-12 00:29:30 +00:00
|
|
|
nvenetlib.o optional nve pci \
|
|
|
|
dependency "$S/contrib/dev/nve/amd64/nvenetlib.o.bz2.uu" \
|
|
|
|
compile-with "uudecode $S/contrib/dev/nve/amd64/nvenetlib.o.bz2.uu ; bzip2 -df nvenetlib.o.bz2" \
|
|
|
|
no-implicit-rule
|
|
|
|
#
|
|
|
|
os+%DIKED-nve.h optional nve pci \
|
|
|
|
dependency "$S/contrib/dev/nve/os.h" \
|
|
|
|
compile-with "sed -e 's/^.*#include.*phy\.h.*$$//' $S/contrib/dev/nve/os.h > os+%DIKED-nve.h" \
|
2005-04-22 19:55:52 +00:00
|
|
|
no-implicit-rule no-obj before-depend \
|
|
|
|
clean "os+%DIKED-nve.h"
|
2005-03-12 00:29:30 +00:00
|
|
|
#
|
2003-05-31 06:47:05 +00:00
|
|
|
amd64/acpica/OsdEnvironment.c optional acpi
|
|
|
|
amd64/acpica/acpi_machdep.c optional acpi
|
|
|
|
amd64/acpica/acpi_wakeup.c optional acpi
|
2003-11-17 08:58:16 +00:00
|
|
|
amd64/acpica/madt.c optional acpi
|
2004-09-28 07:29:54 +00:00
|
|
|
amd64/amd64/amd64_mem.c optional mem
|
2004-05-24 12:08:56 +00:00
|
|
|
#amd64/amd64/apic_vector.S standard
|
2003-11-17 08:58:16 +00:00
|
|
|
amd64/amd64/atomic.c standard
|
2003-05-01 02:59:24 +00:00
|
|
|
amd64/amd64/autoconf.c standard
|
2004-09-24 01:08:34 +00:00
|
|
|
amd64/amd64/bios.c standard
|
2003-05-01 02:59:24 +00:00
|
|
|
amd64/amd64/busdma_machdep.c standard
|
2003-05-03 03:30:29 +00:00
|
|
|
amd64/amd64/cpu_switch.S standard
|
2003-05-30 01:03:43 +00:00
|
|
|
amd64/amd64/db_disasm.c optional ddb
|
|
|
|
amd64/amd64/db_interface.c optional ddb
|
|
|
|
amd64/amd64/db_trace.c optional ddb
|
2003-05-01 02:59:24 +00:00
|
|
|
amd64/amd64/dump_machdep.c standard
|
|
|
|
amd64/amd64/elf_machdep.c standard
|
2003-05-03 00:19:42 +00:00
|
|
|
amd64/amd64/exception.S standard
|
2003-11-17 08:58:16 +00:00
|
|
|
amd64/amd64/fpu.c standard
|
2004-07-10 23:31:17 +00:00
|
|
|
amd64/amd64/gdb_machdep.c optional gdb
|
2003-05-01 02:59:24 +00:00
|
|
|
amd64/amd64/identcpu.c standard
|
2003-11-17 08:58:16 +00:00
|
|
|
amd64/amd64/in_cksum.c optional inet
|
2003-05-01 02:59:24 +00:00
|
|
|
amd64/amd64/initcpu.c standard
|
2003-11-17 08:58:16 +00:00
|
|
|
amd64/amd64/intr_machdep.c standard
|
2004-08-01 11:40:54 +00:00
|
|
|
amd64/amd64/io.c optional io
|
2003-11-17 08:58:16 +00:00
|
|
|
amd64/amd64/io_apic.c standard
|
2003-05-01 02:59:24 +00:00
|
|
|
amd64/amd64/legacy.c standard
|
2003-11-17 08:58:16 +00:00
|
|
|
amd64/amd64/local_apic.c standard
|
2003-05-03 00:19:42 +00:00
|
|
|
amd64/amd64/locore.S standard no-obj
|
2003-05-01 02:59:24 +00:00
|
|
|
amd64/amd64/machdep.c standard
|
2004-08-01 11:40:54 +00:00
|
|
|
amd64/amd64/mem.c optional mem
|
2003-11-17 08:58:16 +00:00
|
|
|
amd64/amd64/mp_machdep.c optional smp
|
2004-08-30 23:33:33 +00:00
|
|
|
amd64/amd64/mp_watchdog.c optional mp_watchdog smp
|
2003-11-17 08:58:16 +00:00
|
|
|
amd64/amd64/mpboot.S optional smp
|
|
|
|
amd64/amd64/mptable.c optional mptable
|
|
|
|
amd64/amd64/mptable_pci.c optional mptable pci
|
2003-05-01 02:59:24 +00:00
|
|
|
amd64/amd64/nexus.c standard
|
|
|
|
amd64/amd64/pmap.c standard
|
2004-05-24 09:55:02 +00:00
|
|
|
amd64/amd64/prof_machdep.c optional profiling-routine
|
2003-05-03 00:19:42 +00:00
|
|
|
amd64/amd64/sigtramp.S standard
|
|
|
|
amd64/amd64/support.S standard
|
2003-05-01 02:59:24 +00:00
|
|
|
amd64/amd64/sys_machdep.c standard
|
|
|
|
amd64/amd64/trap.c standard
|
|
|
|
amd64/amd64/tsc.c standard
|
2004-03-20 19:36:29 +00:00
|
|
|
amd64/amd64/uio_machdep.c standard
|
2003-10-14 05:51:31 +00:00
|
|
|
amd64/amd64/uma_machdep.c standard
|
2003-05-01 02:59:24 +00:00
|
|
|
amd64/amd64/vm_machdep.c standard
|
2003-11-17 08:58:16 +00:00
|
|
|
amd64/isa/atpic.c optional atpic isa
|
2004-05-24 12:08:56 +00:00
|
|
|
#amd64/isa/atpic_vector.S optional atpic isa
|
2003-05-01 02:59:24 +00:00
|
|
|
amd64/isa/clock.c standard
|
2004-05-16 20:30:47 +00:00
|
|
|
amd64/isa/elcr.c standard
|
2003-05-01 02:59:24 +00:00
|
|
|
amd64/isa/isa.c standard
|
|
|
|
amd64/isa/isa_dma.c standard
|
2003-11-17 08:58:16 +00:00
|
|
|
amd64/isa/nmi.c standard
|
2003-05-01 02:59:24 +00:00
|
|
|
amd64/pci/pci_bus.c optional pci
|
2003-11-17 08:58:16 +00:00
|
|
|
amd64/pci/pci_cfgreg.c optional pci
|
2004-02-05 01:09:29 +00:00
|
|
|
crypto/blowfish/bf_enc.c optional crypto
|
2004-05-24 09:55:02 +00:00
|
|
|
crypto/blowfish/bf_enc.c optional ipsec ipsec_esp
|
2004-04-23 14:41:23 +00:00
|
|
|
crypto/des/des_ecb.c optional netsmbcrypto
|
2004-05-24 09:55:02 +00:00
|
|
|
crypto/des/des_enc.c optional crypto
|
|
|
|
crypto/des/des_enc.c optional ipsec ipsec_esp
|
2004-04-23 14:41:23 +00:00
|
|
|
crypto/des/des_enc.c optional netsmbcrypto
|
|
|
|
crypto/des/des_setkey.c optional netsmbcrypto
|
2004-12-21 02:07:38 +00:00
|
|
|
dev/acpica/acpi_if.m standard
|
2005-04-01 19:32:12 +00:00
|
|
|
dev/arcmsr/arcmsr.c optional arcmsr pci
|
2003-05-01 02:59:24 +00:00
|
|
|
dev/fb/fb.c optional fb
|
|
|
|
dev/fb/fb.c optional vga
|
|
|
|
dev/fb/splash.c optional splash
|
|
|
|
dev/fb/vga.c optional vga
|
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
|
|
|
dev/if_ndis/if_ndis.c optional ndis
|
|
|
|
dev/if_ndis/if_ndis_pccard.c optional ndis pccard
|
|
|
|
dev/if_ndis/if_ndis_pci.c optional ndis cardbus
|
|
|
|
dev/if_ndis/if_ndis_pci.c optional ndis pci
|
Throw the switch on the new driver generation/loading mechanism. From
here on in, if_ndis.ko will be pre-built as a module, and can be built
into a static kernel (though it's not part of GENERIC). Drivers are
created using the new ndisgen(8) script, which uses ndiscvt(8) under
the covers, along with a few other tools. The result is a driver module
that can be kldloaded into the kernel.
A driver with foo.inf and foo.sys files will be converted into
foo_sys.ko (and foo_sys.o, for those who want/need to make static
kernels). This module contains all of the necessary info from the
.INF file and the driver binary image, converted into an ELF module.
You can kldload this module (or add it to /boot/loader.conf) to have
it loaded automatically. Any required firmware files can be bundled
into the module as well (or converted/loaded separately).
Also, add a workaround for a problem in NdisMSleep(). During system
bootstrap (cold == 1), msleep() always returns 0 without actually
sleeping. The Intel 2200BG driver uses NdisMSleep() to wait for
the NIC's firmware to come to life, and fails to load if NdisMSleep()
doesn't actually delay. As a workaround, if msleep() (and hence
ndis_thsuspend()) returns 0, use a hard DELAY() to sleep instead).
This is not really the right thing to do, but we can't really do much
else. At the very least, this makes the Intel driver happy.
There are probably other drivers that fail in this way during bootstrap.
Unfortunately, the only workaround for those is to avoid pre-loading
them and kldload them once the system is running instead.
2005-04-24 20:21:22 +00:00
|
|
|
dev/if_ndis/if_ndis_usb.c optional ndis usb
|
2004-08-01 11:40:54 +00:00
|
|
|
dev/io/iodev.c optional io
|
2004-07-09 05:05:13 +00:00
|
|
|
dev/fdc/fdc.c optional fdc
|
2004-07-15 16:43:52 +00:00
|
|
|
dev/fdc/fdc_acpi.c optional fdc
|
2004-07-07 22:29:33 +00:00
|
|
|
dev/fdc/fdc_isa.c optional fdc isa
|
|
|
|
dev/fdc/fdc_pccard.c optional fdc pccard
|
2003-05-01 02:59:24 +00:00
|
|
|
dev/kbd/atkbd.c optional atkbd
|
|
|
|
dev/kbd/atkbdc.c optional atkbdc
|
|
|
|
dev/kbd/kbd.c optional atkbd
|
|
|
|
dev/kbd/kbd.c optional sc
|
|
|
|
dev/kbd/kbd.c optional ukbd
|
2004-08-04 20:49:43 +00:00
|
|
|
dev/mem/memutil.c optional mem
|
2005-03-12 00:29:30 +00:00
|
|
|
dev/nve/if_nve.c optional nve pci
|
2003-08-04 02:39:14 +00:00
|
|
|
dev/ppc/ppc.c optional ppc
|
2003-11-17 08:58:16 +00:00
|
|
|
dev/sio/sio.c optional sio
|
|
|
|
dev/sio/sio_isa.c optional sio isa
|
|
|
|
dev/syscons/apm/apm_saver.c optional apm_saver apm
|
2003-05-01 02:59:24 +00:00
|
|
|
dev/syscons/schistory.c optional sc
|
|
|
|
dev/syscons/scmouse.c optional sc
|
|
|
|
dev/syscons/scterm-dumb.c optional sc
|
|
|
|
dev/syscons/scterm-sc.c optional sc
|
2003-11-17 08:58:16 +00:00
|
|
|
dev/syscons/scterm.c optional sc
|
2003-05-01 02:59:24 +00:00
|
|
|
dev/syscons/scvgarndr.c optional sc vga
|
|
|
|
dev/syscons/scvidctl.c optional sc
|
|
|
|
dev/syscons/scvtb.c optional sc
|
|
|
|
dev/syscons/syscons.c optional sc
|
|
|
|
dev/syscons/sysmouse.c optional sc
|
2003-11-17 08:58:16 +00:00
|
|
|
dev/uart/uart_cpu_amd64.c optional uart
|
2003-05-01 02:59:24 +00:00
|
|
|
geom/geom_bsd.c standard
|
|
|
|
geom/geom_bsd_enc.c standard
|
|
|
|
geom/geom_mbr.c standard
|
|
|
|
geom/geom_mbr_enc.c standard
|
2005-04-19 04:01:25 +00:00
|
|
|
hwpmc/hwpmc_amd.c optional hwpmc
|
2003-05-01 02:59:24 +00:00
|
|
|
isa/atkbd_isa.c optional atkbd
|
|
|
|
isa/atkbdc_isa.c optional atkbdc
|
|
|
|
isa/psm.c optional psm
|
|
|
|
isa/syscons_isa.c optional sc
|
|
|
|
isa/vga_isa.c optional vga
|
2004-05-16 20:11:38 +00:00
|
|
|
kern/link_elf_obj.c standard
|
2004-08-16 12:25:48 +00:00
|
|
|
pci/agp_amd64.c optional agp
|
2003-11-17 08:58:16 +00:00
|
|
|
pci/agp_intel.c optional agp
|
|
|
|
#
|
|
|
|
# IA32 binary support
|
|
|
|
#
|
2004-08-16 12:51:33 +00:00
|
|
|
#amd64/ia32/ia32_exception.S optional compat_ia32
|
|
|
|
amd64/ia32/ia32_signal.c optional compat_ia32
|
|
|
|
amd64/ia32/ia32_sigtramp.S optional compat_ia32
|
|
|
|
amd64/ia32/ia32_syscall.c optional compat_ia32
|
|
|
|
compat/freebsd32/freebsd32_misc.c optional compat_ia32
|
|
|
|
compat/freebsd32/freebsd32_syscalls.c optional compat_ia32
|
|
|
|
compat/freebsd32/freebsd32_sysent.c optional compat_ia32
|
|
|
|
compat/ia32/ia32_sysvec.c optional compat_ia32
|
|
|
|
kern/imgact_elf32.c optional compat_ia32
|
2004-08-16 07:55:06 +00:00
|
|
|
#
|
|
|
|
# Linux/i386 binary support
|
|
|
|
#
|
|
|
|
amd64/linux32/linux32_dummy.c optional compat_linux32
|
|
|
|
amd64/linux32/linux32_locore.s optional compat_linux32 \
|
|
|
|
dependency "linux32_assym.h"
|
|
|
|
amd64/linux32/linux32_machdep.c optional compat_linux32
|
|
|
|
amd64/linux32/linux32_sysent.c optional compat_linux32
|
|
|
|
amd64/linux32/linux32_sysvec.c optional compat_linux32
|
|
|
|
compat/linux/linux_file.c optional compat_linux32
|
|
|
|
compat/linux/linux_getcwd.c optional compat_linux32
|
|
|
|
compat/linux/linux_ioctl.c optional compat_linux32
|
|
|
|
compat/linux/linux_ipc.c optional compat_linux32
|
|
|
|
compat/linux/linux_mib.c optional compat_linux32
|
|
|
|
compat/linux/linux_misc.c optional compat_linux32
|
|
|
|
compat/linux/linux_signal.c optional compat_linux32
|
|
|
|
compat/linux/linux_socket.c optional compat_linux32
|
|
|
|
compat/linux/linux_stats.c optional compat_linux32
|
|
|
|
compat/linux/linux_sysctl.c optional compat_linux32
|
|
|
|
compat/linux/linux_uid16.c optional compat_linux32
|
|
|
|
compat/linux/linux_util.c optional compat_linux32
|
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
|
|
|
#
|
|
|
|
# Windows NDIS driver support
|
|
|
|
#
|
|
|
|
compat/ndis/kern_ndis.c optional ndisapi pci
|
|
|
|
compat/ndis/kern_windrv.c optional ndisapi pci
|
|
|
|
compat/ndis/subr_hal.c optional ndisapi pci
|
|
|
|
compat/ndis/subr_ndis.c optional ndisapi pci
|
|
|
|
compat/ndis/subr_ntoskrnl.c optional ndisapi pci
|
|
|
|
compat/ndis/subr_pe.c optional ndisapi pci
|
- Correct one aspect of the driver_object/device_object/IRP framework:
when we create a PDO, the driver_object associated with it is that
of the parent driver, not the driver we're trying to attach. For
example, if we attach a PCI device, the PDO we pass to the NdisAddDevice()
function should contain a pointer to fake_pci_driver, not to the NDIS
driver itself. For PCI or PCMCIA devices this doesn't matter because
the child never needs to talk to the parent bus driver, but for USB,
the child needs to be able to send IRPs to the parent USB bus driver, and
for that to work the parent USB bus driver has to be hung off the PDO.
This involves modifying windrv_lookup() so that we can search for
bus drivers by name, if necessary. Our fake bus drivers attach themselves
as "PCI Bus," "PCCARD Bus" and "USB Bus," so we can search for them
using those names.
The individual attachment stubs now create and attach PDOs to the
parent bus drivers instead of hanging them off the NDIS driver's
object, and in if_ndis.c, we now search for the correct driver
object depending on the bus type, and use that to find the correct PDO.
With this fix, I can get my sample USB ethernet driver to deliver
an IRP to my fake parent USB bus driver's dispatch routines.
- Add stub modules for USB support: subr_usbd.c, usbd_var.h and
if_ndis_usb.c. The subr_usbd.c module is hooked up the build
but currently doesn't do very much. It provides the stub USB
parent driver object and a dispatch routine for
IRM_MJ_INTERNAL_DEVICE_CONTROL. The only exported function at
the moment is USBD_GetUSBDIVersion(). The if_ndis_usb.c stub
compiles, but is not hooked up to the build yet. I'm putting
these here so I can keep them under source code control as I
flesh them out.
2005-02-24 21:49:14 +00:00
|
|
|
compat/ndis/subr_usbd.c optional ndisapi pci
|
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
|
|
|
compat/ndis/winx64_wrap.S optional ndisapi pci
|
2005-03-27 21:50:30 +00:00
|
|
|
i386/cpufreq/powernow.c optional cpufreq
|