]> rtime.felk.cvut.cz Git - jailhouse.git/blob - hypervisor/arch/x86/include/asm/io.h
7bb07657cb79e5324cbd78e2899d96541921aa78
[jailhouse.git] / hypervisor / arch / x86 / include / asm / io.h
1 /*
2  * Jailhouse, a Linux-based partitioning hypervisor
3  *
4  * Copyright (c) Siemens AG, 2013
5  *
6  * Authors:
7  *  Jan Kiszka <jan.kiszka@siemens.com>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2.  See
10  * the COPYING file in the top-level directory.
11  */
12
13 #include <jailhouse/types.h>
14
15 static inline void outb(u8 v, u16 port)
16 {
17         asm volatile("outb %0,%1" : : "a" (v), "dN" (port));
18 }
19
20 static inline u8 inb(u16 port)
21 {
22         u8 v;
23
24         asm volatile("inb %1,%0" : "=a" (v) : "dN" (port));
25         return v;
26 }
27
28 static inline void outw(u16 value, u16 port)
29 {
30         asm volatile("outw %w0,%w1" : : "a" (value), "Nd" (port));
31 }
32
33 static inline u16 inw(u16 port)
34 {
35         u16 v;
36
37         asm volatile("inw %w1,%0" : "=a" (v) : "Nd" (port));
38         return v;
39 }
40
41 static inline void outl(u32 value, u16 port)
42 {
43         asm volatile("outl %0,%1" : : "a" (value), "Nd" (port));
44 }
45
46 static inline u32 inl(u16 port)
47 {
48         u32 v;
49
50         asm volatile("inl %1,%0" : "=a" (v) : "dN" (port));
51         return v;
52 }