From owner-freebsd-amd64@FreeBSD.ORG Wed Jan 12 22:37:25 2005 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2561916A4CF for ; Wed, 12 Jan 2005 22:37:25 +0000 (GMT) Received: from will.iki.fi (will.iki.fi [217.169.64.20]) by mx1.FreeBSD.org (Postfix) with ESMTP id A00FA43D2F for ; Wed, 12 Jan 2005 22:37:24 +0000 (GMT) (envelope-from will@exomi.com) Received: from [192.168.1.29] (ZMCXLI.dsl.saunalahti.fi [85.76.70.242]) by will.iki.fi (Postfix) with ESMTP id 1D343138; Thu, 13 Jan 2005 00:37:23 +0200 (EET) From: Ville-Pertti Keinonen To: freebsd-amd64@freebsd.org Content-Type: text/plain Date: Thu, 13 Jan 2005 00:37:17 +0200 Message-Id: <1105569437.670.45.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.0.3 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit cc: wpaul@windriver.com Subject: RFC: if_ndis on amd64 X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jan 2005 22:37:25 -0000 Now that 64-bit Windows WLAN drivers are actually available, I decided to see if it would be relatively simple to get a 64-bit driver to work on FreeBSD/amd64. It turns out Microsoft doesn't even use the same calling conventions as everybody else, so it ended up requiring some fairly intrusive changes, such as making everything in the HAL, NDIS and ntoskrnl tables point to assembly language wrappers, and making the symbols for the actual functions visible for linking. To get it to work, I used the very ugly trick of #defining away the static keyword for code where those functions were being defined... Before I start cleaning things up I'd like some comments on what kind of solution to this would be preferred and have a chance of actually being committed (e.g. having an ndis_static that is empty on amd64). A patch against a recent -current is available at http://will.iki.fi/patches/ndis-amd64-20050112.diff It seems reasonably functional; I'm writing this on my Ferrari 3200 running FreeBSD/amd64, and my main route to the outside world is through: ndis0: mem 0xd0014000-0xd0015fff irq 19 at device 9.0 on pci0 ndis0: NDIS API version: 5.1 ndis0: Ethernet address: 00:0b:6b:4a:7e:76 I found the 64-bit Windows driver I'm using through a link on http://www.linuxant.com/driverloader/drivers.php The .inf file needed some editing for ndiscvt to do anything useful with it (asciification and getting rid of the NTamd64 strings). Although ndis.ko builds on amd64, for some reason if_ndis.ko can't find symbols that it defines, so currently "option NDISAPI" needs to be in the kernel.