kern

annotate src/asmops.h @ 29:8ea6debe4265

starting on the task switching implementation
author John Tsiombikas <nuclear@siggraph.org>
date Sat, 23 Apr 2011 00:51:18 +0300
parents 86781ef20689
children e70b1ab9613e
rev   line source
nuclear@1 1 #ifndef ASMOPS_H_
nuclear@1 2 #define ASMOPS_H_
nuclear@1 3
nuclear@10 4 #define enable_intr() asm volatile("sti")
nuclear@10 5 #define disable_intr() asm volatile("cli")
nuclear@10 6 #define halt_cpu() asm volatile("hlt")
nuclear@10 7
nuclear@1 8 #define inb(dest, port) asm volatile( \
nuclear@1 9 "inb %1, %0\n\t" \
nuclear@2 10 : "=a" ((unsigned char)(dest)) \
nuclear@2 11 : "dN" ((unsigned short)(port)))
nuclear@1 12
nuclear@10 13 #define inw(dest, port) asm volatile( \
nuclear@10 14 "inw %1, %0\n\t" \
nuclear@2 15 : "=a" ((unsigned short)(dest)) \
nuclear@2 16 : "dN" ((unsigned short)(port)))
nuclear@1 17
nuclear@1 18 #define inl(dest, port) asm volatile( \
nuclear@1 19 "inl %1, %0\n\t" \
nuclear@2 20 : "=a" ((unsigned long)(dest)) \
nuclear@2 21 : "dN" ((unsigned short)(port)))
nuclear@1 22
nuclear@1 23 #define outb(src, port) asm volatile( \
nuclear@1 24 "outb %0, %1\n\t" \
nuclear@2 25 :: "a" ((unsigned char)(src)), "dN" ((unsigned short)(port)))
nuclear@1 26
nuclear@10 27 #define outw(src, port) asm volatile( \
nuclear@10 28 "outw %0, %1\n\t" \
nuclear@2 29 :: "a" ((unsigned short)(src)), "dN" ((unsigned short)(port)))
nuclear@1 30
nuclear@1 31 #define outl(src, port) asm volatile( \
nuclear@1 32 "outl %0, %1\n\t" \
nuclear@2 33 :: "a" ((unsigned long)(src)), "dN" ((unsigned short)(port)))
nuclear@1 34
nuclear@1 35 #endif /* ASMOPS_H_ */