Rev 2071 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2071 | Rev 2082 | ||
|---|---|---|---|
| Line 37... | Line 37... | ||
| 37 | #include <arch/register.h> |
37 | #include <arch/register.h> |
| 38 | #include <arch/asm.h> |
38 | #include <arch/asm.h> |
| 39 | 39 | ||
| 40 | void fpu_context_save(fpu_context_t *fctx) |
40 | void fpu_context_save(fpu_context_t *fctx) |
| 41 | { |
41 | { |
| 42 | __asm__ volatile ( |
42 | asm volatile ( |
| 43 | "std %%f0, %0\n" |
43 | "std %%f0, %0\n" |
| 44 | "std %%f2, %1\n" |
44 | "std %%f2, %1\n" |
| 45 | "std %%f4, %2\n" |
45 | "std %%f4, %2\n" |
| 46 | "std %%f6, %3\n" |
46 | "std %%f6, %3\n" |
| 47 | "std %%f8, %4\n" |
47 | "std %%f8, %4\n" |
| Line 65... | Line 65... | ||
| 65 | /* |
65 | /* |
| 66 | * We need to split loading of the floating-point registers because |
66 | * We need to split loading of the floating-point registers because |
| 67 | * GCC (4.1.1) can't handle more than 30 operands in one asm statement. |
67 | * GCC (4.1.1) can't handle more than 30 operands in one asm statement. |
| 68 | */ |
68 | */ |
| 69 | 69 | ||
| 70 | __asm__ volatile ( |
70 | asm volatile ( |
| 71 | "std %%f32, %0\n" |
71 | "std %%f32, %0\n" |
| 72 | "std %%f34, %1\n" |
72 | "std %%f34, %1\n" |
| 73 | "std %%f36, %2\n" |
73 | "std %%f36, %2\n" |
| 74 | "std %%f38, %3\n" |
74 | "std %%f38, %3\n" |
| 75 | "std %%f40, %4\n" |
75 | "std %%f40, %4\n" |
| Line 88... | Line 88... | ||
| 88 | "=m" (fctx->d[20]), "=m" (fctx->d[21]), "=m" (fctx->d[22]), "=m" (fctx->d[23]), |
88 | "=m" (fctx->d[20]), "=m" (fctx->d[21]), "=m" (fctx->d[22]), "=m" (fctx->d[23]), |
| 89 | "=m" (fctx->d[24]), "=m" (fctx->d[25]), "=m" (fctx->d[26]), "=m" (fctx->d[27]), |
89 | "=m" (fctx->d[24]), "=m" (fctx->d[25]), "=m" (fctx->d[26]), "=m" (fctx->d[27]), |
| 90 | "=m" (fctx->d[28]), "=m" (fctx->d[29]), "=m" (fctx->d[30]), "=m" (fctx->d[31]) |
90 | "=m" (fctx->d[28]), "=m" (fctx->d[29]), "=m" (fctx->d[30]), "=m" (fctx->d[31]) |
| 91 | ); |
91 | ); |
| 92 | 92 | ||
| 93 | __asm__ volatile ("stx %%fsr, %0\n" : "=m" (fctx->fsr)); |
93 | asm volatile ("stx %%fsr, %0\n" : "=m" (fctx->fsr)); |
| 94 | } |
94 | } |
| 95 | 95 | ||
| 96 | void fpu_context_restore(fpu_context_t *fctx) |
96 | void fpu_context_restore(fpu_context_t *fctx) |
| 97 | { |
97 | { |
| 98 | __asm__ volatile ( |
98 | asm volatile ( |
| 99 | "ldd %0, %%f0\n" |
99 | "ldd %0, %%f0\n" |
| 100 | "ldd %1, %%f2\n" |
100 | "ldd %1, %%f2\n" |
| 101 | "ldd %2, %%f4\n" |
101 | "ldd %2, %%f4\n" |
| 102 | "ldd %3, %%f6\n" |
102 | "ldd %3, %%f6\n" |
| 103 | "ldd %4, %%f8\n" |
103 | "ldd %4, %%f8\n" |
| Line 122... | Line 122... | ||
| 122 | /* |
122 | /* |
| 123 | * We need to split loading of the floating-point registers because |
123 | * We need to split loading of the floating-point registers because |
| 124 | * GCC (4.1.1) can't handle more than 30 operands in one asm statement. |
124 | * GCC (4.1.1) can't handle more than 30 operands in one asm statement. |
| 125 | */ |
125 | */ |
| 126 | 126 | ||
| 127 | __asm__ volatile ( |
127 | asm volatile ( |
| 128 | "ldd %0, %%f32\n" |
128 | "ldd %0, %%f32\n" |
| 129 | "ldd %1, %%f34\n" |
129 | "ldd %1, %%f34\n" |
| 130 | "ldd %2, %%f36\n" |
130 | "ldd %2, %%f36\n" |
| 131 | "ldd %3, %%f38\n" |
131 | "ldd %3, %%f38\n" |
| 132 | "ldd %4, %%f40\n" |
132 | "ldd %4, %%f40\n" |
| Line 146... | Line 146... | ||
| 146 | "m" (fctx->d[20]), "m" (fctx->d[21]), "m" (fctx->d[22]), "m" (fctx->d[23]), |
146 | "m" (fctx->d[20]), "m" (fctx->d[21]), "m" (fctx->d[22]), "m" (fctx->d[23]), |
| 147 | "m" (fctx->d[24]), "m" (fctx->d[25]), "m" (fctx->d[26]), "m" (fctx->d[27]), |
147 | "m" (fctx->d[24]), "m" (fctx->d[25]), "m" (fctx->d[26]), "m" (fctx->d[27]), |
| 148 | "m" (fctx->d[28]), "m" (fctx->d[29]), "m" (fctx->d[30]), "m" (fctx->d[31]) |
148 | "m" (fctx->d[28]), "m" (fctx->d[29]), "m" (fctx->d[30]), "m" (fctx->d[31]) |
| 149 | ); |
149 | ); |
| 150 | 150 | ||
| 151 | __asm__ volatile ("ldx %0, %%fsr\n" : : "m" (fctx->fsr)); |
151 | asm volatile ("ldx %0, %%fsr\n" : : "m" (fctx->fsr)); |
| 152 | } |
152 | } |
| 153 | 153 | ||
| 154 | void fpu_enable(void) |
154 | void fpu_enable(void) |
| 155 | { |
155 | { |
| 156 | pstate_reg_t pstate; |
156 | pstate_reg_t pstate; |