Kernel IO
This commit is contained in:
13
kernel/kernio.cpp
Normal file
13
kernel/kernio.cpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include "kernio.h"
|
||||||
|
|
||||||
|
inline void outb(uint16_t port, uint8_t b) {
|
||||||
|
asm("outb %0, %1" : : "a"(b), "Nd"(port));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline uint8_t inb(uint16_t port) {
|
||||||
|
uint8_t ret;
|
||||||
|
asm volatile ( "inb %1, %0"
|
||||||
|
: "=a"(ret) // Output
|
||||||
|
: "Nd"(port)); // Input
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
4
kernel/kernio.h
Normal file
4
kernel/kernio.h
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#include <lib/stdint.h>
|
||||||
|
|
||||||
|
inline void outb(uint16_t port, uint8_t b);
|
||||||
|
inline uint8_t inb(uint16_t port);
|
||||||
Reference in New Issue
Block a user