Commit 26e9794e authored by Lucas Meneghel Rodrigues's avatar Lucas Meneghel Rodrigues Committed by Avi Kivity
Browse files

Add x86 port io accessors


Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 4329bb00
#ifndef IO_H
#define IO_H
static inline unsigned char inb(unsigned short port)
{
unsigned char value;
asm volatile("inb %w1, %0" : "=a" (value) : "Nd" (port));
return value;
}
static inline unsigned short inw(unsigned short port)
{
unsigned short value;
asm volatile("inw %w1, %0" : "=a" (value) : "Nd" (port));
return value;
}
static inline unsigned int inl(unsigned short port)
{
unsigned int value;
asm volatile("inl %w1, %0" : "=a" (value) : "Nd" (port));
return value;
}
static inline void outb(unsigned char value, unsigned short port)
{
asm volatile("outb %b0, %w1" : : "a"(value), "Nd"(port));
}
static inline void outw(unsigned short value, unsigned short port)
{
asm volatile("outw %w0, %w1" : : "a"(value), "Nd"(port));
}
static inline void outl(unsigned int value, unsigned short port)
{
asm volatile("outl %0, %w1" : : "a"(value), "Nd"(port));
}
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment