8 void outb(Uint16 Port, Uint8 Data)
10 __asm__ __volatile__ ("outb %%al, %%dx"::"d"(Port),"a"(Data));
12 void outw(Uint16 Port, Uint16 Data)
14 __asm__ __volatile__ ("outw %%ax, %%dx"::"d"(Port),"a"(Data));
16 void outd(Uint16 Port, Uint32 Data)
18 __asm__ __volatile__ ("outl %%eax, %%dx"::"d"(Port),"a"(Data));
20 Uint8 inb(Uint16 Port)
23 __asm__ __volatile__ ("inb %%dx, %%al":"=a"(ret):"d"(Port));
26 Uint16 inw(Uint16 Port)
29 __asm__ __volatile__ ("inw %%dx, %%ax":"=a"(ret):"d"(Port));
32 Uint32 ind(Uint16 Port)
35 __asm__ __volatile__ ("inl %%dx, %%eax":"=a"(ret):"d"(Port));
40 Uint32 BigEndian32(Uint32 Value)
44 ret |= ((Value >> 16) & 0xFF) << 8;
45 ret |= ((Value >> 8) & 0xFF) << 16;
46 ret |= ((Value >> 0) & 0xFF) << 24;
50 Uint16 BigEndian16(Uint16 Value)
52 return (Value>>8)|(Value<<8);
55 // === Memory Manipulation ===
56 void *memcpy(void *__dest, const void *__src, size_t __count)
58 if( ((tVAddr)__dest & 7) != ((tVAddr)__src & 7) )
59 __asm__ __volatile__ ("rep movsb" : : "D"(__dest),"S"(__src),"c"(__count));
61 const Uint8 *src = __src;
63 while( (tVAddr)src & 7 && __count ) {
68 __asm__ __volatile__ ("rep movsq" : : "D"(dst),"S"(src),"c"(__count/8));
71 __count = __count & 7;
78 void *memset(void *__dest, int __val, size_t __count)
80 if( __val != 0 || ((tVAddr)__dest & 7) != 0 )
81 __asm__ __volatile__ ("rep stosb" : : "D"(__dest),"a"(__val),"c"(__count));
85 __asm__ __volatile__ ("rep stosq" : : "D"(dst),"a"(0),"c"(__count/8));
87 __count = __count & 7;