kern
view src/asmops.h @ 80:4db99a52863e
fixed the "endianess" of the text messages in the ATA identify info block. this
is the first time I've seen wrong byteorder in ascii text, the ATA committee
should be commended.
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 06 Dec 2011 13:35:39 +0200 |
parents | 5f6c5751ae05 |
children |
line source
1 #ifndef ASMOPS_H_
2 #define ASMOPS_H_
4 #include <inttypes.h>
6 /* general purpose registers as they are pushed by pusha */
7 struct registers {
8 uint32_t edi, esi, ebp, esp;
9 uint32_t ebx, edx, ecx, eax;
10 } __attribute__ ((packed));
12 #define enable_intr() asm volatile("sti")
13 #define disable_intr() asm volatile("cli")
14 #define halt_cpu() asm volatile("hlt")
16 #define push_regs() asm volatile("pusha");
17 #define pop_regs() asm volatile("popa");
19 #define inb(dest, port) asm volatile( \
20 "inb %1, %0\n\t" \
21 : "=a" ((unsigned char)(dest)) \
22 : "dN" ((unsigned short)(port)))
24 #define inw(dest, port) asm volatile( \
25 "inw %1, %0\n\t" \
26 : "=a" ((unsigned short)(dest)) \
27 : "dN" ((unsigned short)(port)))
29 #define inl(dest, port) asm volatile( \
30 "inl %1, %0\n\t" \
31 : "=a" ((unsigned long)(dest)) \
32 : "dN" ((unsigned short)(port)))
34 #define outb(src, port) asm volatile( \
35 "outb %0, %1\n\t" \
36 :: "a" ((unsigned char)(src)), "dN" ((unsigned short)(port)))
38 #define outw(src, port) asm volatile( \
39 "outw %0, %1\n\t" \
40 :: "a" ((unsigned short)(src)), "dN" ((unsigned short)(port)))
42 #define outl(src, port) asm volatile( \
43 "outl %0, %1\n\t" \
44 :: "a" ((unsigned long)(src)), "dN" ((unsigned short)(port)))
46 #define iodelay() outb(0, 0x80)
49 #endif /* ASMOPS_H_ */