x86_64 port IO

Added byte port IO with outb() and inb()
This commit is contained in:
Matheus
2022-07-22 17:58:26 -03:00
parent 9e3ac64248
commit f6f6f650da
+14
View File
@@ -0,0 +1,14 @@
#ifndef _IO_H_INCLUDE
#define _IO_H_INCLUDE
static inline void outb(uint16_t port, uint8_t data){
asm("out %%al, %%dx" : : "a"(data), "d"(port));
}
static inline uint8_t inb(uint16_t port){
uint8_t ret;
asm("in %%dx, %%al" : "=a"(ret) : "d"(port));
return ret;
}
#endif