feat: ajout de fonctions I/O sur 4 octets

This commit is contained in:
Nicolas Hordé 2007-04-02 13:11:17 +00:00
parent 8a0719e2b1
commit 4cddabc4f2
1 changed files with 22 additions and 1 deletions

View File

@ -3,6 +3,10 @@
#define cli() __asm__ ("cli"::) #define cli() __asm__ ("cli"::)
#define nop() __asm__ ("nop"::) #define nop() __asm__ ("nop"::)
#define iret() __asm__ ("iret"::) #define iret() __asm__ ("iret"::)
#define pause() __asm__ ("iret"::)
#define outbp(port,value) \
asm volatile ("outb %%al,%%dx; jmp 1f; 1:"::"d" (port), "a" (value));
#define outb(port,value) \ #define outb(port,value) \
asm volatile ("outb %%al,%%dx"::"d" (port), "a" (value)); asm volatile ("outb %%al,%%dx"::"d" (port), "a" (value));
@ -10,6 +14,9 @@
#define outw(port,value) \ #define outw(port,value) \
asm volatile ("outw %%ax,%%dx"::"d" (port), "a" (value)); asm volatile ("outw %%ax,%%dx"::"d" (port), "a" (value));
#define outd(port,value) \
asm volatile ("outd %%eax,%%dx"::"d" (port), "a" (value));
#define inb(port) ({ \ #define inb(port) ({ \
u8 _v; \ u8 _v; \
asm volatile ("inb %%dx,%%al" : "=a" (_v) : "d" (port)); \ asm volatile ("inb %%dx,%%al" : "=a" (_v) : "d" (port)); \
@ -20,4 +27,18 @@
u16 _v; \ u16 _v; \
asm volatile ("inw %%dx,%%ax" : "=a" (_v) : "d"(port)); \ asm volatile ("inw %%dx,%%ax" : "=a" (_v) : "d"(port)); \
_v; \ _v; \
}) }
#define ind(port) ({ \
u32 _v; \
asm volatile ("ind %%dx,%%eax" : "=a" (_v) : "d"(port)); \
_v; \
}
#define rolb(input,rotate) ({ \
u32 _v; \
asm volatile ("roll %1,%0" : "=g" (_v) : "cI" (rotate), "0" (input)); \
_v; \
}