Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef CatOS_x86_H
- #define CatOS_x86_H
- #include "types.h"
- static inline void outb(u8,u16);
- static inline u8 inb(u16);
- static inline void outw(u16,u16);
- static inline u16 inw(u16);
- static inline void
- outb(u8 v,u16 port)
- {
- asm volatile ("outb %0,%1"::"a"(v),"d" (port));
- }
- static inline u8
- inb(u16 port)
- {
- u8 v;
- asm volatile("inb %1,%0" : "=a" (v) : "d" (port));
- return v;
- }
- static inline void
- outw(u16 v,u16 port)
- {
- asm volatile("outw %0,%1" : : "a"(v),"d" (port));
- }
- static inline u16
- inw(u16 port)
- {
- u16 v;
- asm volatile("inw %0,%1" : "=a"(v) :"d" (port));
- return v;
- }
- #endif
Add Comment
Please, Sign In to add comment