d8f2dda739
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.
213 lines
8.4 KiB
Plaintext
213 lines
8.4 KiB
Plaintext
# 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.
|
|
#
|
|
#
|
|
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"
|
|
#
|
|
ia32_genassym.o standard \
|
|
dependency "$S/compat/ia32/ia32_genassym.c" \
|
|
compile-with "${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}" \
|
|
no-obj no-implicit-rule \
|
|
clean "ia32_genassym.o"
|
|
#
|
|
ia32_assym.h standard \
|
|
dependency "$S/kern/genassym.sh ia32_genassym.o" \
|
|
compile-with "env NM='${NM}' sh $S/kern/genassym.sh ia32_genassym.o > ${.TARGET}" \
|
|
no-obj no-implicit-rule before-depend \
|
|
clean "ia32_assym.h"
|
|
#
|
|
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"
|
|
#
|
|
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"
|
|
#
|
|
amd64/acpica/OsdEnvironment.c optional acpi
|
|
amd64/acpica/acpi_machdep.c optional acpi
|
|
amd64/acpica/acpi_wakeup.c optional acpi
|
|
amd64/acpica/madt.c optional acpi
|
|
amd64/amd64/amd64_mem.c optional mem
|
|
#amd64/amd64/apic_vector.S standard
|
|
amd64/amd64/atomic.c standard
|
|
amd64/amd64/autoconf.c standard
|
|
amd64/amd64/bios.c standard
|
|
amd64/amd64/busdma_machdep.c standard
|
|
amd64/amd64/cpu_switch.S standard
|
|
amd64/amd64/critical.c standard
|
|
amd64/amd64/db_disasm.c optional ddb
|
|
amd64/amd64/db_interface.c optional ddb
|
|
amd64/amd64/db_trace.c optional ddb
|
|
amd64/amd64/dump_machdep.c standard
|
|
amd64/amd64/elf_machdep.c standard
|
|
amd64/amd64/exception.S standard
|
|
amd64/amd64/fpu.c standard
|
|
amd64/amd64/gdb_machdep.c optional gdb
|
|
amd64/amd64/identcpu.c standard
|
|
amd64/amd64/in_cksum.c optional inet
|
|
amd64/amd64/initcpu.c standard
|
|
amd64/amd64/intr_machdep.c standard
|
|
amd64/amd64/io.c optional io
|
|
amd64/amd64/io_apic.c standard
|
|
amd64/amd64/legacy.c standard
|
|
amd64/amd64/local_apic.c standard
|
|
amd64/amd64/locore.S standard no-obj
|
|
amd64/amd64/machdep.c standard
|
|
amd64/amd64/mem.c optional mem
|
|
amd64/amd64/mp_machdep.c optional smp
|
|
amd64/amd64/mp_watchdog.c optional mp_watchdog smp
|
|
amd64/amd64/mpboot.S optional smp
|
|
amd64/amd64/mptable.c optional mptable
|
|
amd64/amd64/mptable_pci.c optional mptable pci
|
|
amd64/amd64/nexus.c standard
|
|
amd64/amd64/pmap.c standard
|
|
amd64/amd64/prof_machdep.c optional profiling-routine
|
|
amd64/amd64/sigtramp.S standard
|
|
amd64/amd64/support.S standard
|
|
amd64/amd64/sys_machdep.c standard
|
|
amd64/amd64/trap.c standard
|
|
amd64/amd64/tsc.c standard
|
|
amd64/amd64/uio_machdep.c standard
|
|
amd64/amd64/uma_machdep.c standard
|
|
amd64/amd64/vm_machdep.c standard
|
|
amd64/isa/atpic.c optional atpic isa
|
|
#amd64/isa/atpic_vector.S optional atpic isa
|
|
amd64/isa/clock.c standard
|
|
amd64/isa/elcr.c standard
|
|
amd64/isa/isa.c standard
|
|
amd64/isa/isa_dma.c standard
|
|
amd64/isa/nmi.c standard
|
|
amd64/pci/pci_bus.c optional pci
|
|
amd64/pci/pci_cfgreg.c optional pci
|
|
crypto/blowfish/bf_enc.c optional crypto
|
|
crypto/blowfish/bf_enc.c optional ipsec ipsec_esp
|
|
crypto/des/des_ecb.c optional netsmbcrypto
|
|
crypto/des/des_enc.c optional crypto
|
|
crypto/des/des_enc.c optional ipsec ipsec_esp
|
|
crypto/des/des_enc.c optional netsmbcrypto
|
|
crypto/des/des_setkey.c optional netsmbcrypto
|
|
dev/acpica/acpi_if.m standard
|
|
dev/fb/fb.c optional fb
|
|
dev/fb/fb.c optional vga
|
|
dev/fb/splash.c optional splash
|
|
dev/fb/vga.c optional vga
|
|
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
|
|
dev/io/iodev.c optional io
|
|
dev/fdc/fdc.c optional fdc
|
|
dev/fdc/fdc_acpi.c optional fdc
|
|
dev/fdc/fdc_isa.c optional fdc isa
|
|
dev/fdc/fdc_pccard.c optional fdc pccard
|
|
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
|
|
dev/mem/memutil.c optional mem
|
|
dev/ppc/ppc.c optional ppc
|
|
dev/sio/sio.c optional sio
|
|
dev/sio/sio_isa.c optional sio isa
|
|
dev/syscons/apm/apm_saver.c optional apm_saver apm
|
|
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
|
|
dev/syscons/scterm.c optional sc
|
|
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
|
|
dev/uart/uart_cpu_amd64.c optional uart
|
|
geom/geom_bsd.c standard
|
|
geom/geom_bsd_enc.c standard
|
|
geom/geom_mbr.c standard
|
|
geom/geom_mbr_enc.c standard
|
|
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
|
|
kern/link_elf_obj.c standard
|
|
pci/agp_amd64.c optional agp
|
|
pci/agp_intel.c optional agp
|
|
#
|
|
# IA32 binary support
|
|
#
|
|
#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
|
|
#
|
|
# 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
|
|
#
|
|
# 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
|
|
compat/ndis/winx64_wrap.S optional ndisapi pci
|