seb15753

kern/io.h

Jun 24th, 2014
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. //a.michelizza.free.fr
  2. #include "types.h"
  3.  
  4. #define cli asm("cli"::)
  5.  
  6. #define sti asm("sti"::)
  7.  
  8. #define outb(port,value) \
  9.     asm volatile ("outb %%al, %%dx" :: "d" (port), "a" (value));
  10.  
  11. #define outbp(port,value) \
  12.     asm volatile ("outb %%al, %%dx; jmp 1f; 1:" :: "d" (port), "a" (value));
  13.  
  14. #define inb(port) ({    \
  15.     unsigned char _v;       \
  16.     asm volatile ("inb %%dx, %%al" : "=a" (_v) : "d" (port)); \
  17.         _v;     \
  18. })
  19.  
  20. #define outw(port,value) \
  21.     asm volatile ("outw %%ax, %%dx" :: "d" (port), "a" (value));
  22.  
  23. #define inw(port) ({        \
  24.     u16 _v;         \
  25.     asm volatile ("inw %%dx, %%ax" : "=a" (_v) : "d" (port));   \
  26.         _v;         \
  27. })
Advertisement
Add Comment
Please, Sign In to add comment