[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: io ports reading/writing
- To: tech_(_at_)_openbsd_(_dot_)_org
- Subject: Re: io ports reading/writing
- From: KAMO Hiroyasu <wd_(_at_)_ics_(_dot_)_nara-wu_(_dot_)_ac_(_dot_)_jp>
- Date: Thu, 06 May 1999 16:45:32 +0900
> oops.. I actually wasn't able to find inb/outb routines in standard-linked
> library at all. Should I link any external routines? (as for now I just made
> them of my own, using inline asm directives).
No.
In /usr/include/i386/pio.h ,
#define inb(port) \
(__use_immediate_port(port) ? __inbc(port) : __inb(port))
static __inline u_int8_t
__inbc(int port)
{
u_int8_t data;
__asm __volatile("inb %1,%0" : "=a" (data) : "id" (port));
return data;
}
static __inline u_int8_t
__inb(int port)
{
u_int8_t data;
__asm __volatile("inb %w1,%0" : "=a" (data) : "d" (port));
return data;
}
and so on.
Kamo Hiroyasu
[Kamo is my family name and Hiroyasu my given name.]
Visit your host, monkey.org