Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Assure that unhandled MSR reads get back zeros
[palacios.git] / geekos / include / geekos / io_defs.h
1 #ifndef __IO_DEFS_H__
2 #define __IO_DEFS_H__
3
4
5 #define __SLOW_DOWN_IO "\noutb %%al,$0x80"
6
7 #ifdef REALLY_SLOW_IO
8 #define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO
9 #else
10 #define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO
11 #endif
12
13
14
15 #define __OUT1(s,x) \
16 static inline void out##s(unsigned x value, unsigned short port) {
17
18 #define __OUT2(s,s1,s2) \
19 __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1"
20
21 #define __OUT(s,s1,x) \
22 __OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "Nd" (port)); } \
23 __OUT1(s##_p,x) __OUT2(s,s1,"w") __FULL_SLOW_DOWN_IO : : "a" (value), "Nd" (port));} \
24
25
26 #define __IN1(s) \
27 static inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v;
28
29 #define __IN2(s,s1,s2) \
30 __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0"
31
32 #define __IN(s,s1,i...) \
33 __IN1(s) __IN2(s,s1,"w") : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \
34 __IN1(s##_p) __IN2(s,s1,"w") __FULL_SLOW_DOWN_IO : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \
35
36
37 #define RETURN_TYPE unsigned char
38 __IN(b,"")
39 #undef RETURN_TYPE
40 #define RETURN_TYPE unsigned short
41 __IN(w,"")
42 #undef RETURN_TYPE
43 #define RETURN_TYPE unsigned int
44 __IN(l,"")
45 #undef RETURN_TYPE
46
47
48
49 __OUT(b,"b",char)
50 __OUT(w,"w",short)
51
52
53
54 #endif