From owner-freebsd-current@FreeBSD.ORG Thu Nov 10 03:52:53 2005 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0793816A41F for ; Thu, 10 Nov 2005 03:52:53 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from pi.codefab.com (pi.codefab.com [199.103.21.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8FE0543D48 for ; Thu, 10 Nov 2005 03:52:52 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from localhost (localhost [127.0.0.1]) by pi.codefab.com (Postfix) with ESMTP id C34BD5F7C; Wed, 9 Nov 2005 22:52:51 -0500 (EST) Received: from pi.codefab.com ([127.0.0.1]) by localhost (pi.codefab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 47190-01; Wed, 9 Nov 2005 22:52:50 -0500 (EST) Received: from [192.168.1.3] (pool-68-161-122-227.ny325.east.verizon.net [68.161.122.227]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pi.codefab.com (Postfix) with ESMTP id 214F55C67; Wed, 9 Nov 2005 22:52:50 -0500 (EST) Message-ID: <4372C410.5060707@mac.com> Date: Wed, 09 Nov 2005 22:52:48 -0500 From: Chuck Swiger Organization: The Courts of Chaos User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Scott Long References: <1566.1131574723@critter.freebsd.dk> <916E69BA-AE58-4BB4-AB8A-01BDFBA5FF49@mac.com> <43729ED9.9050204@samsco.org> <4372AED7.9000403@elischer.org> <4372B360.50203@samsco.org> In-Reply-To: <4372B360.50203@samsco.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at codefab.com Cc: Poul-Henning Kamp , Julian Elischer , current@freebsd.org Subject: Re: Generic Kernel API X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2005 03:52:53 -0000 Scott Long wrote: > Julian Elischer wrote: [ ... ] >> but if we could implement it we could run apple drivers.... >> (when they move to x86) > > No, we can't, unless we emulate the rest of the kernel API in OSX. > IOKit doesn't describe the entire kernel API. Think of it as 'newbus > done right' and nothing more. The rest of the kernel interfaces are > up for grabs. Some look and act like their BSD counterparts, some do > not. Scott's right that the IOKit is not a complete set of calls. The primary thing [1] that would be missing for Apple's drivers would be Mach messaging and Mach memory calls, which provide some of the underlying serialization capabilites of events, or clearly pertain to DMA (respectively). Apple has a portability layer written for Solaris, HP/UX, and even Windows which has a nmserver daemon which handles Mach messaging, and a shim for Mach memory calls using the SysV shared-memory interface. This has been included with PDO/EOF, WebObjects, and the FoundationKit packages with slight name variantions over time. The code is probably used by the ports of lookupd and netinfod...? -- -Chuck [1]: The complete KPI list for compliant drivers ought to be: com.apple.kernel.iokit, com.apple.kernel.libkern ...which would be enough for open source drivers, but a complete emulation layer would probably involve much of: com.apple.kernel, com.apple.kernel.mach, com.apple.kernel.bsd, com.apple.kernel.libkern, com.apple.kernel.iokit Fortunately, the upstream BSD layer is reasonably close to what FreeBSD has, except for Mach exception handling versus traditional BSD signals. MachO is not that different from ELF, and GCC already supports the BFD for it. There is some difference in dynamic linking semantics and namespaces, and someone would have to figure out the C++ name mangling, too. If this part was done, you might obtain reasonable compatibility with closed drivers available as binaries only, similar to what Project Evil/NDIS does now.