Skip to content

Commit 85c3152

Browse files
authored
io.h from linux-0.01
https://github.com/zavg/linux-0.01/ I got the URL finally.
1 parent 0541e1b commit 85c3152

File tree

1 file changed

+24
-0
lines changed
  • kernel/include/asm

1 file changed

+24
-0
lines changed

kernel/include/asm/io.h

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#define outb(value,port) \
2+
__asm__ ("outb %%al,%%dx"::"a" (value),"d" (port))
3+
4+
5+
#define inb(port) ({ \
6+
unsigned char _v; \
7+
__asm__ volatile ("inb %%dx,%%al":"=a" (_v):"d" (port)); \
8+
_v; \
9+
})
10+
11+
#define outb_p(value,port) \
12+
__asm__ ("outb %%al,%%dx\n" \
13+
"\tjmp 1f\n" \
14+
"1:\tjmp 1f\n" \
15+
"1:"::"a" (value),"d" (port))
16+
17+
#define inb_p(port) ({ \
18+
unsigned char _v; \
19+
__asm__ volatile ("inb %%dx,%%al\n" \
20+
"\tjmp 1f\n" \
21+
"1:\tjmp 1f\n" \
22+
"1:":"=a" (_v):"d" (port)); \
23+
_v; \
24+
})

0 commit comments

Comments
 (0)