2 * Jailhouse, a Linux-based partitioning hypervisor
4 * Copyright (c) Siemens AG, 2013
7 * Jan Kiszka <jan.kiszka@siemens.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
13 #include <jailhouse/types.h>
17 * @defgroup PIO x86 I/O Accessors
22 * Read 8 (b), 16(w) or 32-bit (l) value from a port.
23 * @param port Port number.
28 static inline u8 inb(u16 port)
32 asm volatile("inb %1,%0" : "=a" (v) : "dN" (port));
36 static inline u16 inw(u16 port)
40 asm volatile("inw %w1,%0" : "=a" (v) : "Nd" (port));
44 static inline u32 inl(u16 port)
48 asm volatile("inl %1,%0" : "=a" (v) : "dN" (port));
54 * Write 8 (b), 16(w) or 32-bit (l) value to a port.
55 * @param value Value to write
56 * @param port Port number.
59 static inline void outb(u8 value, u16 port)
61 asm volatile("outb %0,%1" : : "a" (value), "dN" (port));
64 static inline void outw(u16 value, u16 port)
66 asm volatile("outw %w0,%w1" : : "a" (value), "Nd" (port));
69 static inline void outl(u32 value, u16 port)
71 asm volatile("outl %0,%1" : : "a" (value), "Nd" (port));