From fb7fe73d491f30d4e36c937eb78746b988468ffb Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sat, 4 Feb 2023 23:37:34 +0200 Subject: [PATCH] Kernel: Add inw and outw to IO --- kernel/include/kernel/IO.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kernel/include/kernel/IO.h b/kernel/include/kernel/IO.h index f81eaca2b2..711953e4de 100644 --- a/kernel/include/kernel/IO.h +++ b/kernel/include/kernel/IO.h @@ -17,6 +17,18 @@ namespace IO return ret; } + static inline void outw(uint16_t port, uint16_t val) + { + asm volatile("outw %0, %1" : : "a"(val), "Nd"(port)); + } + + static inline uint16_t inw(uint16_t port) + { + uint16_t ret; + asm volatile("inw %1, %0" : "=a"(ret) : "Nd"(port)); + return ret; + } + static inline void io_wait() { outb(0x80, 0);