summaryrefslogtreecommitdiffstats
path: root/kernel/io_ports.asm
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/io_ports.asm')
-rw-r--r--kernel/io_ports.asm28
1 files changed, 28 insertions, 0 deletions
diff --git a/kernel/io_ports.asm b/kernel/io_ports.asm
new file mode 100644
index 0000000..9ab47d9
--- /dev/null
+++ b/kernel/io_ports.asm
@@ -0,0 +1,28 @@
+SECTION .text
+global outw
+global inw
+
+outw:
+ push ebp;
+ mov ebp,esp
+
+ mov dx, [ebp+8] ; port
+ mov ax, [ebp+12] ; data
+ out dx, ax
+
+ mov esp,ebp
+ pop ebp
+ ret
+
+
+inw:
+ push ebp;
+ mov ebp,esp
+
+ mov dx, [ebp+8] ; port
+ in eax, dx
+
+ mov esp,ebp
+ pop ebp
+ ret
+