slide 10 of 14


I/O Port Access Using Gnu C

extern inline unsigned int
_inb(unsigned short port)
{
  unsigned char _v;
__asm__ __volatile__ ("inb %w1,%b0"
                      :"=a" (_v)
                      :"d" (port), "0" (0));
  return _v;
}

extern inline void
_outb(unsigned char value, unsigned short port)
{
__asm__ __volatile__ ("outb %b0,%w1"
                      :/* no outputs */
                      :"a" (value), "d" (port));
}