kern

view 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
line source
1 #ifndef ASMOPS_H_
2 #define ASMOPS_H_
4 #define enable_intr() asm volatile("sti")
5 #define disable_intr() asm volatile("cli")
6 #define halt_cpu() asm volatile("hlt")
8 #define inb(dest, port) asm volatile( \
9 "inb %1, %0\n\t" \
10 : "=a" ((unsigned char)(dest)) \
11 : "dN" ((unsigned short)(port)))
13 #define inw(dest, port) asm volatile( \
14 "inw %1, %0\n\t" \
15 : "=a" ((unsigned short)(dest)) \
16 : "dN" ((unsigned short)(port)))
18 #define inl(dest, port) asm volatile( \
19 "inl %1, %0\n\t" \
20 : "=a" ((unsigned long)(dest)) \
21 : "dN" ((unsigned short)(port)))
23 #define outb(src, port) asm volatile( \
24 "outb %0, %1\n\t" \
25 :: "a" ((unsigned char)(src)), "dN" ((unsigned short)(port)))
27 #define outw(src, port) asm volatile( \
28 "outw %0, %1\n\t" \
29 :: "a" ((unsigned short)(src)), "dN" ((unsigned short)(port)))
31 #define outl(src, port) asm volatile( \
32 "outl %0, %1\n\t" \
33 :: "a" ((unsigned long)(src)), "dN" ((unsigned short)(port)))
35 #endif /* ASMOPS_H_ */