From owner-freebsd-hackers@FreeBSD.ORG Wed May 30 05:05:33 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 C568516A469 for ; Wed, 30 May 2007 05:05:33 +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 7186F13C4BF for ; Wed, 30 May 2007 05:05:33 +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=DnqvnLI9BrRjy5b/NPTBkYmFCpHTXT+Aqy9/53cX+T/GFpX3NyHOnV2vJT+UU4TCKkr4fZCAy7z4yE49BHrDG53emDr0r+TjBRzxluaeobNSN043Zc1Xp4MS84vDw18j50nWxBtunEIXZzM6w41nZdbnG/VXoEhr83xlJtALulA=; Received: from void.codelabs.ru (void.codelabs.ru [144.206.177.25]) by pobox.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1HtG4g-000DTD-Rb; Wed, 30 May 2007 08:46:18 +0400 Date: Wed, 30 May 2007 08:46:14 +0400 From: Eygene Ryabinkin To: rmgls@wanadoo.fr Message-ID: <20070530044614.GX35160@void.codelabs.ru> References: <20070529181027.65AD5700009C@mwinf2454.orange.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20070529181027.65AD5700009C@mwinf2454.orange.fr> Sender: rea-fbsd@codelabs.ru X-Spam-Status: No, score=-2.9 required=4.0 tests=ALL_TRUSTED,AWL,BAYES_00 Cc: 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: Wed, 30 May 2007 05:05:33 -0000 Raoul, good day. Tue, May 29, 2007 at 08:10:26PM +0200, rmgls@wanadoo.fr wrote: > i am trying to port my old assembler soft for Dos to FreeBSD. > i need to write and read directly to the midi and scsi device. > when i try something like this i receive a sigbus error Seems like that the following fragment >params: .word 0x330,2,1 # midi port => enabling IO ??? >[...] > pushl params > pushl $0x3 > movl $0Xa5,%eax > int $0x80 > addl $0x08,%esp translates to the call i386_get_ioperm(0x330, 2, 1). But you should use the i386_set_ioperm(0x330, 2, 1), aren't you? You're trying to grant the IO permissions for your process? Then use i386_set_ioperm that will be equivalent to the first parameter to the 'int 0x80' to 0x04 instead 0x03. With 0x03 you're just trying to make the system to write the _current_ IO permissions starting with port 0x330 to the _addresses_ 0x02 and 0x01. And this is obviously wrong, but it should provoke the segfault error instead of sigbus. I am not sure about the 'pushl params' statement: will it push all three arguments to the stack? My GNU assembler knowledge is rather rusty and incomplete, sorry. But maybe it is the reason why you're getting the sigbus instead of 'correct' sigsegv. -- Eygene