kern

diff src/asmops.h @ 1:ebe5e0e44a9d

pretty much finished the code for article 1, might do minor adjustments though
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 02 Dec 2010 08:45:41 +0200
parents
children 86781ef20689
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/asmops.h	Thu Dec 02 08:45:41 2010 +0200
     1.3 @@ -0,0 +1,31 @@
     1.4 +#ifndef ASMOPS_H_
     1.5 +#define ASMOPS_H_
     1.6 +
     1.7 +#define inb(dest, port) asm volatile( \
     1.8 +	"inb %1, %0\n\t" \
     1.9 +	: "=a" (unsigned char)(dest) \
    1.10 +	: "dN" (unsigned short)(port))
    1.11 +
    1.12 +#define ins(dest, port) asm volatile( \
    1.13 +	"ins %1, %0\n\t" \
    1.14 +	: "=a" (unsigned short)(dest) \
    1.15 +	: "dN" (unsigned short)(port))
    1.16 +
    1.17 +#define inl(dest, port) asm volatile( \
    1.18 +	"inl %1, %0\n\t" \
    1.19 +	: "=a" (unsigned long)(dest) \
    1.20 +	: "dN" (unsigned short)(port))
    1.21 +
    1.22 +#define outb(src, port) asm volatile( \
    1.23 +	"outb %0, %1\n\t" \
    1.24 +	:: "a" (unsigned char)(src), "dN" (unsigned short)(port))
    1.25 +
    1.26 +#define outs(src, port) asm volatile( \
    1.27 +	"outs %0, %1\n\t" \
    1.28 +	:: "a" (unsigned short)(src), "dN" (unsigned short)(port))
    1.29 +
    1.30 +#define outl(src, port) asm volatile( \
    1.31 +	"outl %0, %1\n\t" \
    1.32 +	:: "a" (unsigned long)(src), "dN" (unsigned short)(port))
    1.33 +
    1.34 +#endif	/* ASMOPS_H_ */