blob: 52e5d047eee6c24c60cfa6d6a6010fe50bd983cf [file] [log] [blame]
#include "io.h"
void outb(ushort port, uchar val)
{
asm volatile("outb %1, %0" : : "dN"(port), "a"(val));
}
uchar inb(ushort port)
{
uchar ret;
asm volatile("inb %1, %0" : "=a"(ret) : "dN"(port));
return ret;
}
ushort inw(ushort port)
{
ushort ret;
asm volatile("inw %1, %0" : "=a"(ret) : "dN"(port));
return ret;
}
void *memset(void *s, int c, size_t n)
{
for (size_t i = 0; i < n; i++)
{
((uchar *)s)[i] = c;
}
return s;
}
void *memcpy(void *dest, const void *src, size_t n)
{
for (size_t i = 0; i < n; i++)
{
((uchar *)dest)[i] = ((uchar *)src)[i];
}
return dest;
}
void io_wait()
{
asm volatile("outb %0, $0x80" ::"a"(0));
}