21 lines
408 B
C++
21 lines
408 B
C++
#ifndef ARCH_X86_64_IO_HPP
|
|
#define ARCH_X86_64_IO_HPP
|
|
|
|
#include "types.hpp"
|
|
|
|
namespace x86_64 {
|
|
|
|
struct io {
|
|
static u8 inb(u16 port) {
|
|
u8 value{};
|
|
asm volatile("inb %1, %0" : "=a"(value) : "Nd"(port));
|
|
return value;
|
|
}
|
|
|
|
static void outb(u16 port, u8 value) { asm volatile("outb %0, %1" : : "a"(value), "Nd"(port)); }
|
|
};
|
|
|
|
} // namespace x86_64
|
|
|
|
#endif // ARCH_X86_64_IO_HPP
|