Skip to content

Commit

Permalink
io.h from linux-0.01
Browse files Browse the repository at this point in the history
  • Loading branch information
DamieFC authored May 10, 2021
1 parent 0541e1b commit 85c3152
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions kernel/include/asm/io.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#define outb(value,port) \
__asm__ ("outb %%al,%%dx"::"a" (value),"d" (port))


#define inb(port) ({ \
unsigned char _v; \
__asm__ volatile ("inb %%dx,%%al":"=a" (_v):"d" (port)); \
_v; \
})

#define outb_p(value,port) \
__asm__ ("outb %%al,%%dx\n" \
"\tjmp 1f\n" \
"1:\tjmp 1f\n" \
"1:"::"a" (value),"d" (port))

#define inb_p(port) ({ \
unsigned char _v; \
__asm__ volatile ("inb %%dx,%%al\n" \
"\tjmp 1f\n" \
"1:\tjmp 1f\n" \
"1:":"=a" (_v):"d" (port)); \
_v; \
})

0 comments on commit 85c3152

Please sign in to comment.