aboutsummaryrefslogtreecommitdiff
path: root/src/include/asm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/asm.h')
-rw-r--r--src/include/asm.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/include/asm.h b/src/include/asm.h
new file mode 100644
index 0000000..97ea45a
--- /dev/null
+++ b/src/include/asm.h
@@ -0,0 +1,15 @@
+#pragma once
+#include <stdint.h>
+
+// IO
+static inline void outb(uint16_t port, uint8_t val) {
+ asm volatile("outb %0, %1" : : "a"(val), "Nd"(port) : "memory");
+}
+
+static inline uint8_t inb(uint16_t port) {
+ uint8_t ret;
+ asm volatile("inb %1, %0" : "=a"(ret) : "Nd"(port) : "memory");
+ return ret;
+}
+
+static inline void io_wait(void) { outb(0x80, 0); }