| 1 |
/* |
| 2 |
This file is based on: |
| 3 |
$XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 2001/11/16 21:13:34 tsi Exp $ |
| 4 |
Modified for readability by Nick Kurshev |
| 5 |
*/ |
| 6 |
|
| 7 |
#ifndef __ASM_MACROS_X86_H |
| 8 |
#define __ASM_MACROS_X86_H |
| 9 |
|
| 10 |
#if defined (WINNT) |
| 11 |
#include "sysdep/AsmMacros_generic.h" |
| 12 |
#else |
| 13 |
|
| 14 |
#include "config.h" |
| 15 |
|
| 16 |
static __inline__ void outb(short port,char val) |
| 17 |
{ |
| 18 |
__asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port)); |
| 19 |
return; |
| 20 |
} |
| 21 |
|
| 22 |
static __inline__ void outw(short port,short val) |
| 23 |
{ |
| 24 |
__asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port)); |
| 25 |
return; |
| 26 |
} |
| 27 |
|
| 28 |
static __inline__ void outl(short port,unsigned int val) |
| 29 |
{ |
| 30 |
__asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port)); |
| 31 |
return; |
| 32 |
} |
| 33 |
|
| 34 |
static __inline__ unsigned int inb(short port) |
| 35 |
{ |
| 36 |
unsigned char ret; |
| 37 |
__asm__ __volatile__("inb %1,%0" : |
| 38 |
"=a" (ret) : |
| 39 |
"d" (port)); |
| 40 |
return ret; |
| 41 |
} |
| 42 |
|
| 43 |
static __inline__ unsigned int inw(short port) |
| 44 |
{ |
| 45 |
unsigned short ret; |
| 46 |
__asm__ __volatile__("inw %1,%0" : |
| 47 |
"=a" (ret) : |
| 48 |
"d" (port)); |
| 49 |
return ret; |
| 50 |
} |
| 51 |
|
| 52 |
static __inline__ unsigned int inl(short port) |
| 53 |
{ |
| 54 |
unsigned int ret; |
| 55 |
__asm__ __volatile__("inl %1,%0" : |
| 56 |
"=a" (ret) : |
| 57 |
"d" (port)); |
| 58 |
return ret; |
| 59 |
} |
| 60 |
|
| 61 |
static __inline__ void intr_disable() |
| 62 |
{ |
| 63 |
__asm__ __volatile__("cli"); |
| 64 |
} |
| 65 |
|
| 66 |
static __inline__ void intr_enable() |
| 67 |
{ |
| 68 |
__asm__ __volatile__("sti"); |
| 69 |
} |
| 70 |
|
| 71 |
#endif |
| 72 |
#endif |