Newer
Older
tree-os / src / kernel / util / ports.c
@lukas lukas on 3 Aug 2021 336 bytes wip: add exceptions
#include <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;
}

void ioWait() {
   asm volatile ( "outb %%al, $0x80" : : "a"(0) );
}