Newer
Older
tree-os / src / kernel / lib / ports.c
@Lukas Lukas on 28 Mar 2021 270 bytes Initial commit after relocation
#include <lib/ports.h>
#include <stdint.h>

void outb(uint16_t port, uint8_t val) {
   asm volatile("outb %0, %1" : : "a"(val), "Nd"(port) );
}

uint8_t inb(uint16_t port) {
   uint8_t result;
   __asm__("in %%dx, %%al" : "=a" (result) : "d" (port));
   return result;
}