summaryrefslogtreecommitdiff
path: root/src/kernel/arch/i386/port_io.h
diff options
context:
space:
mode:
authordzwdz2021-08-09 22:48:19 +0200
committerdzwdz2021-08-09 22:48:19 +0200
commit294b8b1ac82352e23a83ce9cad7af9d3b98365ef (patch)
tree651791fa9c8132d91527f7b34922e0b3ca5664cb /src/kernel/arch/i386/port_io.h
parenta8b89d2536a660e0216fb54e7681e35f6ac67483 (diff)
move the x86 port io code to a separate file
Diffstat (limited to 'src/kernel/arch/i386/port_io.h')
-rw-r--r--src/kernel/arch/i386/port_io.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/kernel/arch/i386/port_io.h b/src/kernel/arch/i386/port_io.h
new file mode 100644
index 0000000..db755b4
--- /dev/null
+++ b/src/kernel/arch/i386/port_io.h
@@ -0,0 +1,12 @@
+#include <stdint.h>
+
+inline void port_outb(uint16_t port, uint8_t val) {
+ asm volatile("outb %0, %1" : : "a" (val), "Nd" (port));
+}
+
+inline uint8_t port_inb(uint16_t port) {
+ uint8_t val;
+ asm volatile("inb %1, %0" : "=a" (val) : "Nd" (port));
+ return val;
+}
+