diff options
| author | Michal Idziorek <m.i@gmx.at> | 2014-08-20 10:45:40 +0200 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2014-08-20 10:45:40 +0200 |
| commit | 46063e75f3f81dfb532fa5772c88e9027a0faebd (patch) | |
| tree | ea264dd6d2eb323df0fb3efbc5899db41208f21e /kernel/x86.h | |
| parent | 444a88dddf2411f5502413f3f02725a5968eaa9b (diff) | |
added x86.h and removed some test-bugs.
Diffstat (limited to 'kernel/x86.h')
| -rw-r--r-- | kernel/x86.h | 42 |
1 files changed, 42 insertions, 0 deletions
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 |
