ladybird/Kernel/IO.h
Andreas Kling 731fc5a7c8 Kernel: Much improved BochsVGA (BXVGA) support.
Instead of cowboy-calling the VESA BIOS in the bootloader, find the emulator
VGA adapter by scanning the PCI bus. Then set up the desired video mode by
sending device commands.
2019-02-06 10:17:26 +01:00

43 lines
727 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(word 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));
}
}