* better
[mascara-docs.git] / i386 / linux-2.3.21 / arch / alpha / kernel / fpreg.c
blob0bd8b9f67dfca6c87d326a8c7824c3b1f0f83bc8
1 /*
2 * arch/alpha/kernel/fpreg.c
4 * (C) Copyright 1998 Linus Torvalds
5 */
7 #if defined(__alpha_cix__) || defined(__alpha_fix__)
8 #define STT(reg,val) asm volatile ("ftoit $f"#reg",%0" : "=r"(val));
9 #else
10 #define STT(reg,val) asm volatile ("stt $f"#reg",%0" : "=m"(val));
11 #endif
13 unsigned long
14 alpha_read_fp_reg (unsigned long reg)
16 unsigned long val;
18 switch (reg) {
19 case 0: STT( 0, val); break;
20 case 1: STT( 1, val); break;
21 case 2: STT( 2, val); break;
22 case 3: STT( 3, val); break;
23 case 4: STT( 4, val); break;
24 case 5: STT( 5, val); break;
25 case 6: STT( 6, val); break;
26 case 7: STT( 7, val); break;
27 case 8: STT( 8, val); break;
28 case 9: STT( 9, val); break;
29 case 10: STT(10, val); break;
30 case 11: STT(11, val); break;
31 case 12: STT(12, val); break;
32 case 13: STT(13, val); break;
33 case 14: STT(14, val); break;
34 case 15: STT(15, val); break;
35 case 16: STT(16, val); break;
36 case 17: STT(17, val); break;
37 case 18: STT(18, val); break;
38 case 19: STT(19, val); break;
39 case 20: STT(20, val); break;
40 case 21: STT(21, val); break;
41 case 22: STT(22, val); break;
42 case 23: STT(23, val); break;
43 case 24: STT(24, val); break;
44 case 25: STT(25, val); break;
45 case 26: STT(26, val); break;
46 case 27: STT(27, val); break;
47 case 28: STT(28, val); break;
48 case 29: STT(29, val); break;
49 case 30: STT(30, val); break;
50 case 31: STT(31, val); break;
52 return val;
55 #if defined(__alpha_cix__) || defined(__alpha_fix__)
56 #define LDT(reg,val) asm volatile ("itoft %0,$f"#reg : : "r"(val));
57 #else
58 #define LDT(reg,val) asm volatile ("ldt $f"#reg",%0" : : "m"(val));
59 #endif
61 void
62 alpha_write_fp_reg (unsigned long reg, unsigned long val)
64 switch (reg) {
65 case 0: LDT( 0, val); break;
66 case 1: LDT( 1, val); break;
67 case 2: LDT( 2, val); break;
68 case 3: LDT( 3, val); break;
69 case 4: LDT( 4, val); break;
70 case 5: LDT( 5, val); break;
71 case 6: LDT( 6, val); break;
72 case 7: LDT( 7, val); break;
73 case 8: LDT( 8, val); break;
74 case 9: LDT( 9, val); break;
75 case 10: LDT(10, val); break;
76 case 11: LDT(11, val); break;
77 case 12: LDT(12, val); break;
78 case 13: LDT(13, val); break;
79 case 14: LDT(14, val); break;
80 case 15: LDT(15, val); break;
81 case 16: LDT(16, val); break;
82 case 17: LDT(17, val); break;
83 case 18: LDT(18, val); break;
84 case 19: LDT(19, val); break;
85 case 20: LDT(20, val); break;
86 case 21: LDT(21, val); break;
87 case 22: LDT(22, val); break;
88 case 23: LDT(23, val); break;
89 case 24: LDT(24, val); break;
90 case 25: LDT(25, val); break;
91 case 26: LDT(26, val); break;
92 case 27: LDT(27, val); break;
93 case 28: LDT(28, val); break;
94 case 29: LDT(29, val); break;
95 case 30: LDT(30, val); break;
96 case 31: LDT(31, val); break;