Guest User

Untitled

a guest
Dec 11th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #ifndef CatOS_x86_H
  2. #define CatOS_x86_H
  3.  
  4. #include "types.h"
  5. static inline void outb(u8,u16);
  6. static inline u8 inb(u16);
  7. static inline void outw(u16,u16);
  8. static inline u16 inw(u16);
  9.  
  10. static inline void
  11. outb(u8 v,u16 port)
  12. {
  13. asm volatile ("outb %0,%1"::"a"(v),"d" (port));
  14. }
  15. static inline u8
  16. inb(u16 port)
  17. {
  18. u8 v;
  19. asm volatile("inb %1,%0" : "=a" (v) : "d" (port));
  20. return v;
  21. }
  22. static inline void
  23. outw(u16 v,u16 port)
  24. {
  25. asm volatile("outw %0,%1" : : "a"(v),"d" (port));
  26. }
  27. static inline u16
  28. inw(u16 port)
  29. {
  30. u16 v;
  31. asm volatile("inw %0,%1" : "=a"(v) :"d" (port));
  32. return v;
  33. }
  34. #endif
Add Comment
Please, Sign In to add comment