forked from CHatingPython/towos
feat: add interrupts handling, PIC and PIT
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user