[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: io ports reading/writing



>  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.]