aboutsummaryrefslogtreecommitdiff
path: root/src/include/asm.h
diff options
context:
space:
mode:
authorNic Gaffney <gaffney_nic@protonmail.com>2023-12-21 03:32:06 -0600
committerNic Gaffney <gaffney_nic@protonmail.com>2023-12-21 03:32:06 -0600
commit138424b31d9c2af158e8ae619248b035b5a280d9 (patch)
tree0da4f6661d68737b5957029242bea43fad77d7a8 /src/include/asm.h
parent9dbc5231dd738d97eea13f8ecf9005e5b78ea0d3 (diff)
downloadgftos-138424b31d9c2af158e8ae619248b035b5a280d9.tar.gz
set up bochs for debugging and started working on interrupts.
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); }