summaryrefslogtreecommitdiff
path: root/include/asm/io.h
blob: 3d151a5c966b95398b805cf0870b4c37cb1cd7e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * asm/io.h
 *
 * Provides access to x86 I/O functions
 */

#define inb(port) ({ \
  unsigned char _val; \
  __asm__ volatile ("inb %%dx, %%al" : "=a" (_val) : "d" (port)); \
  _val; \
  })

#define inw(port) ({ \
  unsigned short _val; \
  __asm__ volatile ("inw %%dx, %%ax" : "=a" (_val) : "d" (port)); \
  _val; \
  })

#define outb(port, val) \
  __asm__ volatile ("outb %%al, %%dx" :: "d" (port), "a" (val));

#define outw(port, val) \
  __asm__ volatile ("outw %%ax, %%dx" :: "d" (port), "a" (val));