]> git.corax.cc Git - corax/commitdiff
Add io_inb and io_outb methods for IO-port access on Intel-based platforms
authorMatthias Kruk <m@m10k.eu>
Mon, 23 Dec 2019 07:29:46 +0000 (16:29 +0900)
committerMatthias Kruk <m@m10k.eu>
Mon, 23 Dec 2019 07:29:46 +0000 (16:29 +0900)
kernel/arch/Makefile
kernel/arch/io.S [new file with mode: 0644]
kernel/include/arch.h

index e7e4cceed87b98fc69b0ce7310ec5dafb317dda7..b63e608fe4944eadf82e72c5052794ccebaa944c 100644 (file)
@@ -1,5 +1,5 @@
 OBJECTS = boot.o debug.o init.o cpu.o cpu32.o entry.o interrupt.o paging.o apic.o i8259.o task.o \
-                 heap.o
+                 heap.o io.o
 OUTPUT = arch.o
 LDFLAGS += -r
 INCLUDES = -I../../include -I../include -I../..
diff --git a/kernel/arch/io.S b/kernel/arch/io.S
new file mode 100644 (file)
index 0000000..ceca967
--- /dev/null
@@ -0,0 +1,22 @@
+#define __ASSEMBLY_SOURCE
+
+#include <config.h>
+#include <arch.h>
+#include "defs.h"
+
+       .global io_inb
+       .global io_outb
+
+       .section .text
+
+io_inb:
+       movl    4(%esp), %edx
+       xorl    %eax, %eax
+       inb             %dx, %al
+       ret
+
+io_outb:
+       movl    4(%esp), %edx
+       movl    8(%esp), %eax
+       outb    %al, %dx
+       ret
index cc8830895188eff7068c181926fb962f3c92b22b..29c8804b4f91673a1b136280e144c7cae610df07 100644 (file)
@@ -189,6 +189,9 @@ int     pg_dir_memcpy(pg_dir_t*, void*, pg_dir_t*, void*, u32_t);
 int     pg_dir_mmap(pg_dir_t*, void*, u32_t, int, int, void**);
 int     pg_dir_munmap(pg_dir_t*, void*, u32_t);
 
+u8_t    io_inb(const u16_t);
+void    io_outb(const u16_t, const u8_t);
+
 #endif /* !__ASSEMBLY_SOURCE */
 
 #endif /* __ARCH_H */