Skip to content
Snippets Groups Projects
Commit b6306ab6 authored by Dor Laor's avatar Dor Laor
Browse files

Add in|out*{b|w|l} functions for port IO

parent c2db135b
No related branches found
No related tags found
No related merge requests found
......@@ -155,6 +155,46 @@ namespace processor {
asm volatile ("cli; hlt");
}
inline u8 inb (u16 port)
{
u8 r;
asm volatile ("inb %1, %0":"=a" (r):"dN" (port));
return r;
}
inline u16 inw (u16 port)
{
u16 r;
asm volatile ("inw %1, %0":"=a" (r):"dN" (port));
return r;
}
inline u32 inl (u16 port)
{
u32 r;
asm volatile ("inl %1, %0":"=a" (r):"dN" (port));
return r;
}
inline void outb (u8 val, u16 port)
{
asm volatile ("outb %0, %1"::"a" (val), "dN" (port));
}
inline void outw (u16 val, u16 port)
{
asm volatile ("outw %0, %1"::"a" (val), "dN" (port));
}
inline void outl (u32 val, u16 port)
{
asm volatile ("outl %0, %1"::"a" (val), "dN" (port));
}
};
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment