Date: Wed, 10 Dec 2008 20:52:48 -0800 (PST) From: Won De Erick <won.derick@yahoo.com> To: Christoph Mallon <christoph.mallon@gmx.de> Cc: freebsd-hackers@freebsd.org, Rink Springer <rink@FreeBSD.org>, freebsd-hardware@freebsd.org Subject: Re: Watchdog for Boser (HS-7001) Message-ID: <832968.75350.qm@web45816.mail.sp1.yahoo.com> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
Christoph Mallon wrote:
>
>
Won De Erick schrieb:
>>> ----- Original Message ----
>>
>>> From: Rink Springer <rink@FreeBSD.org>
>>>
>>>
>> 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. :)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?832968.75350.qm>
