Modestus Moon OS  R4
CS 450 project
io.h
Go to the documentation of this file.
1 #ifndef _IO_H
2 #define _IO_H
3 
4 /*
5  Procedure..: outb
6  Description..: Write a byte of data to a port.
7 */
8 #define outb(port, data) \
9  asm volatile ("outb %%al,%%dx" : : "a" (data), "d" (port))
10 
11 /*
12  Procedure..: inb
13  Description..: Read a byte of data from a port.
14 */
15 #define inb(port) ({ \
16  unsigned char r; \
17  asm volatile ("inb %%dx,%%al": "=a" (r): "d" (port)); \
18  r; \
19  })
20 
21 #endif