From owner-freebsd-hardware@FreeBSD.ORG Mon Dec 1 13:07:39 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 1FBE91065677 for ; Mon, 1 Dec 2008 13:07:39 +0000 (UTC) (envelope-from won.derick@yahoo.com) Received: from n13b.bullet.mail.mud.yahoo.com (n13b.bullet.mail.mud.yahoo.com [68.142.207.222]) by mx1.freebsd.org (Postfix) with SMTP id CE6498FC0C for ; Mon, 1 Dec 2008 13:07:38 +0000 (UTC) (envelope-from won.derick@yahoo.com) Received: from [68.142.200.227] by n13.bullet.mail.mud.yahoo.com with NNFMP; 01 Dec 2008 13:07:38 -0000 Received: from [68.142.201.254] by t8.bullet.mud.yahoo.com with NNFMP; 01 Dec 2008 13:07:38 -0000 Received: from [127.0.0.1] by omp415.mail.mud.yahoo.com with NNFMP; 01 Dec 2008 13:07:38 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 327366.6780.bm@omp415.mail.mud.yahoo.com Received: (qmail 25032 invoked by uid 60001); 1 Dec 2008 13:07:37 -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=Ro7gstu12jL3stmqpmEalaOKX6tJSpy3aI2IQ4x7HOwAoaQe+bSidMqInJUYn+Nq/QJ1zY263dJVmOjWnjyq221c6dr7zZs7RG6jHhc3Oi6wUMhB3GfoPSht3dAi8b8lnpdYJPxDl74i2D7+dClIM+IMmPpMoBCeFLd0e0HKhos=; X-YMail-OSG: c5TDNu8VM1kS6iJI4fAgQUnbBZSvyMVeqdMfbEZKBpe7aLQ6fdyJlsQQaRtyWDBz3d9niZbsG9xbJYEedPpSynTDOy5JMogBH9BbXQO5IQfy9_nwEMNs.osRYWecULfsTB.bqOPb0WEKqrU9mIT0h0Y5Rplm9FZd7_g.A_rwCngevKHezEGw.shZPsKF Received: from [58.71.34.137] by web45816.mail.sp1.yahoo.com via HTTP; Mon, 01 Dec 2008 05:07:37 PST X-Mailer: YahooMailRC/1155.32 YahooMailWebService/0.7.260.1 Date: Mon, 1 Dec 2008 05:07:37 -0800 (PST) From: Won De Erick To: Christoph Mallon MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Message-ID: <839504.20277.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-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 13:07:39 -0000 >From: Won De Erick >>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); > aww.. i mean int sio = open("/dev/io", O_RDWR); > >> >>Regards >> Christoph