mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
42 lines
728 B
C++
42 lines
728 B
C++
#pragma once
|
|
|
|
#include "types.h"
|
|
|
|
namespace IO {
|
|
|
|
inline byte in8(word port)
|
|
{
|
|
byte value;
|
|
asm volatile("inb %1, %0":"=a"(value):"Nd"(port));
|
|
return value;
|
|
}
|
|
|
|
inline word in16(word port)
|
|
{
|
|
word value;
|
|
asm volatile("inw %1, %0":"=a"(value):"Nd"(port));
|
|
return value;
|
|
}
|
|
|
|
inline dword in32(dword port)
|
|
{
|
|
dword value;
|
|
asm volatile("inl %1, %0":"=a"(value):"Nd"(port));
|
|
return value;
|
|
}
|
|
|
|
inline void out8(word port, byte value)
|
|
{
|
|
asm volatile("outb %0, %1"::"a"(value), "Nd"(port));
|
|
}
|
|
|
|
inline void out16(word port, word value)
|
|
{
|
|
asm volatile("outw %0, %1"::"a"(value), "Nd"(port));
|
|
}
|
|
|
|
inline void out32(word port, dword value)
|
|
{
|
|
asm volatile("outl %0, %1"::"a"(value), "Nd"(port));
|
|
}
|
|
}
|