From owner-freebsd-hardware@FreeBSD.ORG Mon Dec 1 12:52:44 2008 Return-Path: Delivered-To: freebsd-hardware@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90CC8106567C for ; Mon, 1 Dec 2008 12:52:44 +0000 (UTC) (envelope-from won.derick@yahoo.com) Received: from n69.bullet.mail.sp1.yahoo.com (n69.bullet.mail.sp1.yahoo.com [98.136.44.41]) by mx1.freebsd.org (Postfix) with SMTP id 5C3518FC1D for ; Mon, 1 Dec 2008 12:52:44 +0000 (UTC) (envelope-from won.derick@yahoo.com) Received: from [69.147.65.174] by n69.bullet.mail.sp1.yahoo.com with NNFMP; 01 Dec 2008 12:52:44 -0000 Received: from [69.147.65.152] by t12.bullet.mail.sp1.yahoo.com with NNFMP; 01 Dec 2008 12:52:44 -0000 Received: from [127.0.0.1] by omp400.mail.sp1.yahoo.com with NNFMP; 01 Dec 2008 12:52:43 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 982965.16608.bm@omp400.mail.sp1.yahoo.com Received: (qmail 65780 invoked by uid 60001); 1 Dec 2008 12:52:43 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Message-ID; b=V8JSOJZb2YkCFCPsGUQI5K1ajK8Pa/rxpg/kyC95VcjUtlhFJDYULzotqgR9qfTc7R+NMY0J+ubFE43DjF1pt1ViCBjkP44PAMYXuNvSbpqExbpOky1gJl9JhqpkwD+v3QcASXB382kDs/KIxHL4tpgCtSoGZnxLpGaX8zoyo0k=; X-YMail-OSG: 82GVhzIVM1lsMCLKSac1mMSGmPNdZ96EPEwt0G7RhyvAdcS0CMWT3HA6EZ.41YScESAHSgm87QjZlG7wOaNo.hupE7q4RRyqHJ_O5at6m7hNYkG.pJCPdyIvbEr19XzzpP6WSNZH4m8SYepv2phs5TwyJ1Ob6DwM2uqauaBgUxP5VIW0m1kAytCszaVi Received: from [58.71.34.137] by web45808.mail.sp1.yahoo.com via HTTP; Mon, 01 Dec 2008 04:52:43 PST X-Mailer: YahooMailRC/1155.32 YahooMailWebService/0.7.260.1 Date: Mon, 1 Dec 2008 04:52:43 -0800 (PST) From: Won De Erick To: Christoph Mallon MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Message-ID: <838497.65099.qm@web45808.mail.sp1.yahoo.com> Cc: freebsd-hackers@freebsd.org, Rink Springer , freebsd-hardware@freebsd.org Subject: Re: Watchdog for Boser (HS-7001) X-BeenThere: freebsd-hardware@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General discussion of FreeBSD hardware List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 12:52:44 -0000 >----- Original Message ---- >From: Christoph Mallon > > Won De Erick schrieb: >>> ----- Original Message ---- >> >>> From: Rink Springer >>> >>> >> On Mon, Dec 01, 2008 at 09:38:51AM +0100, Christoph Mallon wrote: >>>> Userland is not allowed to write to ports. That's the bus error you see. Also without a call to the exit syscall at the end, it will segfault. >>> Note that you can write to ports from userland by opening /dev/io - if >>> you have it opened, you can write to the ports. >>> >> >> I've added the following at the end >> >> mov eax, 1 ; SYS_exit >> call doint >> >> doint: >> int 0x80 >> ret >> >> Besides, I can see the following at /dev >> crw------- 1 root wheel 0, 16 Nov 27 01:53 io >> >> How should I make this open? do i need to %include this? > >You're probably better of writing this in C. Here is a wrapper for the out instruction: > >static inline outb(unsigned short port, unsigned char data) >{ > asm("outb %0, %1" : : "a" (data), "dN" (port)); >} > >As Rink mentioned, you have to open /dev/io. The process must have super-user privileges, see io(4). will this be ok? int fd = open("/dev/fido", O_RDWR); > >Regards > Christoph