From owner-freebsd-hardware@FreeBSD.ORG Mon Dec 1 09:35:36 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 238A31065678 for ; Mon, 1 Dec 2008 09:35:36 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id E317C8FC17 for ; Mon, 1 Dec 2008 09:35:34 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: (qmail invoked by alias); 01 Dec 2008 09:35:17 -0000 Received: from p54A3F341.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.243.65] by mail.gmx.net (mp008) with SMTP; 01 Dec 2008 10:35:17 +0100 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX1+wfCJleOWwuIvfP2GVCbeELFTY0c8dvfNtfyg8uq xUdGkj+DKHg64E Message-ID: <4933AFD4.3070501@gmx.de> Date: Mon, 01 Dec 2008 10:35:16 +0100 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.18 (X11/20081124) MIME-Version: 1.0 To: Won De Erick References: <547602.79284.qm@web45809.mail.sp1.yahoo.com> <4933A29B.8060907@gmx.de> <20081201090421.GA99082@rink.nu> <611173.7111.qm@web45805.mail.sp1.yahoo.com> In-Reply-To: <611173.7111.qm@web45805.mail.sp1.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.51 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 09:35:36 -0000 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). Regards Christoph