annotate src/asmops.h @ 49:50730d42d2d3
fuck yeah, now do priviledge levels and TSS
author |
John Tsiombikas <nuclear@member.fsf.org> |
date |
Sat, 30 Jul 2011 07:21:54 +0300 |
parents |
e6de3c6015cb |
children |
4eaecb14fe31 |
rev |
line source |
nuclear@1
|
1 #ifndef ASMOPS_H_
|
nuclear@1
|
2 #define ASMOPS_H_
|
nuclear@1
|
3
|
nuclear@43
|
4 #include <inttypes.h>
|
nuclear@43
|
5
|
nuclear@42
|
6 /* general purpose registers as they are pushed by pusha */
|
nuclear@42
|
7 struct registers {
|
nuclear@42
|
8 uint32_t edi, esi, ebp, esp;
|
nuclear@42
|
9 uint32_t ebx, edx, ecx, eax;
|
nuclear@42
|
10 } __attribute__ ((packed));
|
nuclear@42
|
11
|
nuclear@10
|
12 #define enable_intr() asm volatile("sti")
|
nuclear@10
|
13 #define disable_intr() asm volatile("cli")
|
nuclear@10
|
14 #define halt_cpu() asm volatile("hlt")
|
nuclear@10
|
15
|
nuclear@1
|
16 #define inb(dest, port) asm volatile( \
|
nuclear@1
|
17 "inb %1, %0\n\t" \
|
nuclear@2
|
18 : "=a" ((unsigned char)(dest)) \
|
nuclear@2
|
19 : "dN" ((unsigned short)(port)))
|
nuclear@1
|
20
|
nuclear@10
|
21 #define inw(dest, port) asm volatile( \
|
nuclear@10
|
22 "inw %1, %0\n\t" \
|
nuclear@2
|
23 : "=a" ((unsigned short)(dest)) \
|
nuclear@2
|
24 : "dN" ((unsigned short)(port)))
|
nuclear@1
|
25
|
nuclear@1
|
26 #define inl(dest, port) asm volatile( \
|
nuclear@1
|
27 "inl %1, %0\n\t" \
|
nuclear@2
|
28 : "=a" ((unsigned long)(dest)) \
|
nuclear@2
|
29 : "dN" ((unsigned short)(port)))
|
nuclear@1
|
30
|
nuclear@1
|
31 #define outb(src, port) asm volatile( \
|
nuclear@1
|
32 "outb %0, %1\n\t" \
|
nuclear@2
|
33 :: "a" ((unsigned char)(src)), "dN" ((unsigned short)(port)))
|
nuclear@1
|
34
|
nuclear@10
|
35 #define outw(src, port) asm volatile( \
|
nuclear@10
|
36 "outw %0, %1\n\t" \
|
nuclear@2
|
37 :: "a" ((unsigned short)(src)), "dN" ((unsigned short)(port)))
|
nuclear@1
|
38
|
nuclear@1
|
39 #define outl(src, port) asm volatile( \
|
nuclear@1
|
40 "outl %0, %1\n\t" \
|
nuclear@2
|
41 :: "a" ((unsigned long)(src)), "dN" ((unsigned short)(port)))
|
nuclear@1
|
42
|
nuclear@36
|
43 #define iodelay() outb(0, 0x80)
|
nuclear@36
|
44
|
nuclear@1
|
45 #endif /* ASMOPS_H_ */
|