about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYour Name <you@example.com>2020-06-24 03:33:16 +0200
committerYour Name <you@example.com>2020-06-24 03:33:16 +0200
commitcafc92c531f0e6342e46508b4583d26e2dbd776c (patch)
tree4a2e6463f5502c14a973d02db24a2eb749290b0b
parentTODO: added to the todo (diff)
downloadpOS-cafc92c531f0e6342e46508b4583d26e2dbd776c.tar.gz
pOS-cafc92c531f0e6342e46508b4583d26e2dbd776c.tar.bz2
pOS-cafc92c531f0e6342e46508b4583d26e2dbd776c.zip
Base: added outw, outl, inw and inl to the system interface
-rw-r--r--src/pOS/arch/x86/kernel/system.cpp24
-rw-r--r--src/pOS/include/kernel/system.h5
2 files changed, 29 insertions, 0 deletions
diff --git a/src/pOS/arch/x86/kernel/system.cpp b/src/pOS/arch/x86/kernel/system.cpp
index ade04f8..0ff405a 100644
--- a/src/pOS/arch/x86/kernel/system.cpp
+++ b/src/pOS/arch/x86/kernel/system.cpp
@@ -7,11 +7,35 @@ uint8_t System::inb(uint16_t port)
         return result;
 }
 
+uint16_t System::inw(uint16_t port)
+{
+    uint16_t result;
+    asm volatile( "inw %1, %0" : "=a"(result) : "Nd"(port));
+        return result;
+}
+
+uint32_t System::inl(uint16_t port)
+{
+    uint32_t result;
+    asm volatile( "inl %1, %0" : "=a"(result) : "Nd"(port));
+        return result;
+}
+
 void System::outb(uint16_t port, uint8_t data)
 {
    asm volatile( "outb %0, %1" : : "a"(data), "Nd"(port));
 }
 
+void System::outw(uint16_t port, uint16_t data)
+{
+    asm volatile ("outw %0, %1" : : "a" (data), "Nd" (port));
+}
+
+void System::outl(uint16_t port, uint32_t data)
+{
+    asm volatile ("outl %0, %1" : : "a" (data), "Nd" (port));
+}
+
 int System::idle_loop(void)
 {
     while(1)
diff --git a/src/pOS/include/kernel/system.h b/src/pOS/include/kernel/system.h
index 146ceed..22628c3 100644
--- a/src/pOS/include/kernel/system.h
+++ b/src/pOS/include/kernel/system.h
@@ -7,7 +7,12 @@ class System
 {
 public:
     static uint8_t inb(uint16_t port);
+    static uint16_t inw(uint16_t port);
+    static uint32_t inl(uint16_t port);
+
     static void outb(uint16_t port, uint8_t data);
+    static void outw(uint16_t port, uint16_t data);
+    static void outl(uint16_t port, uint32_t data);
 
     static int idle_loop(void);
 };