From owner-freebsd-hackers@FreeBSD.ORG Thu May 31 04:44:40 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7513416A400 for ; Thu, 31 May 2007 04:44:40 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from pobox.codelabs.ru (pobox.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id 2A8EA13C4BC for ; Thu, 31 May 2007 04:44:39 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) DomainKey-Signature: a=rsa-sha1; q=dns; c=simple; s=one; d=codelabs.ru; h=Received:Date:From:To:Cc:Message-ID:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:Sender:X-Spam-Status:Subject; b=ZIr9fjajMr013xCUeBdrwsRwPMtUYDY66PKcMSnmCJXiBeRRcCFI2YL2G0UphkklYhjSn0NSY2J+coKd3Dd+j96vEyztpjDszYD5UuhrBLMg3r3yVncnSgkB1Z22/7sWIW9dv1oIPP565pymTGP4tQQXIAZ+tK8IhevoeHS3a1M=; Received: from void.codelabs.ru (void.codelabs.ru [144.206.177.25]) by pobox.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1HtcWb-000Etq-JN; Thu, 31 May 2007 08:44:37 +0400 Date: Thu, 31 May 2007 08:44:33 +0400 From: Eygene Ryabinkin To: Mike Meyer Message-ID: <20070531044432.GC35160@void.codelabs.ru> References: <20070529181027.65AD5700009C@mwinf2454.orange.fr> <18013.7419.355416.25585@bhuda.mired.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <18013.7419.355416.25585@bhuda.mired.org> Sender: rea-fbsd@codelabs.ru X-Spam-Status: No, score=-2.9 required=4.0 tests=ALL_TRUSTED,AWL,BAYES_00 Cc: rmgls@wanadoo.fr, freebsd-hackers@freebsd.org Subject: Re: direct I/O access X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2007 04:44:40 -0000 Mike, good day. Wed, May 30, 2007 at 02:43:07AM -0400, Mike Meyer wrote: > I believe this should be $0x4, as you want to *set* the values, not > get them. Right. > You also need to open the file "/dev/io". I believe that leaving this > file open for anything more than a handful of instructions would be a > bad thing, but I'm not going to verify it. I feel that the i386_set_ioperm directly manipulates the task's I/O bitmap referenced by the task state segment (TSS), so you don't need to mangle with /dev/io. /dev/io itself is the higher-level semi machine-indenepdent abstraction. Opening /dev/io grants the global access to all ports, while using i386_set_ioperm gives the fine-grained access. When you closing /dev/io, the port I/O access is revoked. To summarise: either you open /dev/io and do all your port I/O as in the good old days of the real-mode programs, or you're using i386_set_ioperm to obtain the access permissions to the I/O port range and again, do all port I/O as usual. -- Eygene