From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 11 04:52:50 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78F5E1065672 for ; Thu, 11 Dec 2008 04:52:50 +0000 (UTC) (envelope-from won.derick@yahoo.com) Received: from n30.bullet.mail.mud.yahoo.com (n30.bullet.mail.mud.yahoo.com [68.142.207.49]) by mx1.freebsd.org (Postfix) with SMTP id 33E918FC22 for ; Thu, 11 Dec 2008 04:52:49 +0000 (UTC) (envelope-from won.derick@yahoo.com) Received: from [68.142.200.227] by n30.bullet.mail.mud.yahoo.com with NNFMP; 11 Dec 2008 04:52:49 -0000 Received: from [68.142.201.247] by t8.bullet.mud.yahoo.com with NNFMP; 11 Dec 2008 04:52:49 -0000 Received: from [127.0.0.1] by omp408.mail.mud.yahoo.com with NNFMP; 11 Dec 2008 04:52:49 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 436556.11565.bm@omp408.mail.mud.yahoo.com Received: (qmail 76419 invoked by uid 60001); 11 Dec 2008 04:52:48 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Message-ID; b=5R7L5Q4L5vAkDUMPfFkxGsAaaYx9kqg7h69o5P4QCFURrYGd/lQnh+YqFYCuKWfMR8UrSzA1lKiSeJs9mKkIye+B9R5gr6k19VdjAPMyDK6sbxRsF7+17BmURFWs37uVleMPzY3AFiddvE7maW01SIXT/ir6LtPz5/11D4DNNO0=; X-YMail-OSG: t9X3icoVM1mhCfBWo2il8PIL.3u5.tG5S54VEa7thQ5KOhm64JEftDLleHS9aG5Oguaw3ZjCYSs5_3EwfTqO0UHgvUQHUUucfNzLs4TN.FUFYn3V_yMzN2gaPMagU88i_kQe2uFPRCWPoXiXFdgsmG90XfNePI2S5y16Rm5NevI3qI_4qP432Y_FlngEKy299FnZpDxQMl.NWNUgQ1YV.zk6CB_YQDDj Received: from [58.71.34.137] by web45816.mail.sp1.yahoo.com via HTTP; Wed, 10 Dec 2008 20:52:48 PST X-Mailer: YahooMailRC/1155.32 YahooMailWebService/0.7.260.1 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> <4933AFD4.3070501@gmx.de> Date: Wed, 10 Dec 2008 20:52:48 -0800 (PST) From: Won De Erick To: Christoph Mallon MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Message-ID: <832968.75350.qm@web45816.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-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, 11 Dec 2008 04:52:50 -0000 Christoph Mallon wrote: > > 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). > > OK thanks for all the tips. I have now a working watchdog. :)