summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kernel/pci.c30
-rw-r--r--kernel/vmem.c3
-rw-r--r--kernel/x86.h42
3 files changed, 44 insertions, 31 deletions
diff --git a/kernel/pci.c b/kernel/pci.c
index 292bf1b..8aa5eb9 100644
--- a/kernel/pci.c
+++ b/kernel/pci.c
@@ -1,37 +1,9 @@
#include "kernel.h"
+#include "x86.h"
#define PCI_CONFIG_DATA 0xCFC
#define PCI_CONFIG_ADDRESS 0xCF8
-void OutPort(unsigned short int IO_port,char Value)
-{
- asm("outb %%al,%%dx;"
- : //no output data
- :"d"(IO_port),"a"(Value) //input data (EDX<-IO_port; AL<-Value)
- );
-}
-char InPort(unsigned short int IO_port)
-{
- asm("inb %%dx,%%al;"
- : //output data is in al register
- :"d"(IO_port) //input data (EDX<-IO_port AL<-Value)
- );
-}
-
-x86_outl(int port, uint32_t data)
-{
- __asm __volatile("outl %0,%w1" : : "a" (data), "d" (port));
-}
-
-
-
-x86_inl(int port)
-{
- uint32_t data;
- __asm __volatile("inl %w1,%0" : "=a" (data) : "d" (port));
- return data;
-}
-
void pciConfigSet (uint8_t bus, uint8_t slot,
uint8_t func, uint8_t offset, uint32_t data)
{
diff --git a/kernel/vmem.c b/kernel/vmem.c
index ecdf9cd..98eab08 100644
--- a/kernel/vmem.c
+++ b/kernel/vmem.c
@@ -150,7 +150,6 @@ uint8_t vmmngr_alloc_page (pt_entry* e)
void vmem_init()
{
- scr_put_string_nl("vmem: Init paging\nxxx");
- int x=10/0;
+ scr_put_string_nl("vmem: Init paging");
}
diff --git a/kernel/x86.h b/kernel/x86.h
new file mode 100644
index 0000000..1f2179d
--- /dev/null
+++ b/kernel/x86.h
@@ -0,0 +1,42 @@
+#ifndef FOOLOS_X86_H
+#define FOOLOS_X86_H
+
+#include "kernel.h"
+
+void x86_outb(int port, uint8_t data)
+{
+ __asm __volatile("outb %0,%w1" : : "a" (data), "d" (port));
+}
+
+uint8_t x86_inb(int port)
+{
+ uint8_t data;
+ __asm __volatile("inb %w1,%0" : "=a" (data) : "d" (port));
+ return data;
+}
+
+void x86_outw(int port, uint16_t data)
+{
+ __asm __volatile("outw %0,%w1" : : "a" (data), "d" (port));
+}
+
+uint16_t x86_inw(int port)
+{
+ uint16_t data;
+ __asm __volatile("inw %w1,%0" : "=a" (data) : "d" (port));
+ return data;
+}
+
+void x86_outl(int port, uint32_t data)
+{
+ __asm __volatile("outl %0,%w1" : : "a" (data), "d" (port));
+}
+
+uint32_t x86_inl(int port)
+{
+ uint32_t data;
+ __asm __volatile("inl %w1,%0" : "=a" (data) : "d" (port));
+ return data;
+}
+
+#endif