David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 1 | /* MN10300 Low level FPU management operations |
| 2 | * |
| 3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public Licence |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the Licence, or (at your option) any later version. |
| 10 | */ |
| 11 | #include <asm/cpu-regs.h> |
| 12 | |
| 13 | ############################################################################### |
| 14 | # |
| 15 | # void fpu_init_state(void) |
| 16 | # - initialise the FPU |
| 17 | # |
| 18 | ############################################################################### |
| 19 | .globl fpu_init_state |
| 20 | .type fpu_init_state,@function |
| 21 | fpu_init_state: |
| 22 | mov epsw,d0 |
| 23 | or EPSW_FE,epsw |
| 24 | |
| 25 | #ifdef CONFIG_MN10300_PROC_MN103E010 |
| 26 | nop |
| 27 | nop |
| 28 | nop |
| 29 | #endif |
| 30 | fmov 0,fs0 |
| 31 | fmov fs0,fs1 |
| 32 | fmov fs0,fs2 |
| 33 | fmov fs0,fs3 |
| 34 | fmov fs0,fs4 |
| 35 | fmov fs0,fs5 |
| 36 | fmov fs0,fs6 |
| 37 | fmov fs0,fs7 |
| 38 | fmov fs0,fs8 |
| 39 | fmov fs0,fs9 |
| 40 | fmov fs0,fs10 |
| 41 | fmov fs0,fs11 |
| 42 | fmov fs0,fs12 |
| 43 | fmov fs0,fs13 |
| 44 | fmov fs0,fs14 |
| 45 | fmov fs0,fs15 |
| 46 | fmov fs0,fs16 |
| 47 | fmov fs0,fs17 |
| 48 | fmov fs0,fs18 |
| 49 | fmov fs0,fs19 |
| 50 | fmov fs0,fs20 |
| 51 | fmov fs0,fs21 |
| 52 | fmov fs0,fs22 |
| 53 | fmov fs0,fs23 |
| 54 | fmov fs0,fs24 |
| 55 | fmov fs0,fs25 |
| 56 | fmov fs0,fs26 |
| 57 | fmov fs0,fs27 |
| 58 | fmov fs0,fs28 |
| 59 | fmov fs0,fs29 |
| 60 | fmov fs0,fs30 |
| 61 | fmov fs0,fs31 |
| 62 | fmov FPCR_INIT,fpcr |
| 63 | |
| 64 | #ifdef CONFIG_MN10300_PROC_MN103E010 |
| 65 | nop |
| 66 | nop |
| 67 | nop |
| 68 | #endif |
| 69 | mov d0,epsw |
| 70 | ret [],0 |
| 71 | |
| 72 | .size fpu_init_state,.-fpu_init_state |
| 73 | |
| 74 | ############################################################################### |
| 75 | # |
| 76 | # void fpu_save(struct fpu_state_struct *) |
| 77 | # - save the fpu state |
| 78 | # - note that an FPU Operational exception might occur during this process |
| 79 | # |
| 80 | ############################################################################### |
| 81 | .globl fpu_save |
| 82 | .type fpu_save,@function |
| 83 | fpu_save: |
| 84 | mov epsw,d1 |
| 85 | or EPSW_FE,epsw /* enable the FPU so we can access it */ |
| 86 | |
| 87 | #ifdef CONFIG_MN10300_PROC_MN103E010 |
| 88 | nop |
| 89 | nop |
| 90 | #endif |
| 91 | mov d0,a0 |
| 92 | fmov fs0,(a0+) |
| 93 | fmov fs1,(a0+) |
| 94 | fmov fs2,(a0+) |
| 95 | fmov fs3,(a0+) |
| 96 | fmov fs4,(a0+) |
| 97 | fmov fs5,(a0+) |
| 98 | fmov fs6,(a0+) |
| 99 | fmov fs7,(a0+) |
| 100 | fmov fs8,(a0+) |
| 101 | fmov fs9,(a0+) |
| 102 | fmov fs10,(a0+) |
| 103 | fmov fs11,(a0+) |
| 104 | fmov fs12,(a0+) |
| 105 | fmov fs13,(a0+) |
| 106 | fmov fs14,(a0+) |
| 107 | fmov fs15,(a0+) |
| 108 | fmov fs16,(a0+) |
| 109 | fmov fs17,(a0+) |
| 110 | fmov fs18,(a0+) |
| 111 | fmov fs19,(a0+) |
| 112 | fmov fs20,(a0+) |
| 113 | fmov fs21,(a0+) |
| 114 | fmov fs22,(a0+) |
| 115 | fmov fs23,(a0+) |
| 116 | fmov fs24,(a0+) |
| 117 | fmov fs25,(a0+) |
| 118 | fmov fs26,(a0+) |
| 119 | fmov fs27,(a0+) |
| 120 | fmov fs28,(a0+) |
| 121 | fmov fs29,(a0+) |
| 122 | fmov fs30,(a0+) |
| 123 | fmov fs31,(a0+) |
| 124 | fmov fpcr,d0 |
| 125 | mov d0,(a0) |
| 126 | #ifdef CONFIG_MN10300_PROC_MN103E010 |
| 127 | nop |
| 128 | nop |
| 129 | #endif |
| 130 | |
| 131 | mov d1,epsw |
| 132 | ret [],0 |
| 133 | |
| 134 | .size fpu_save,.-fpu_save |
| 135 | |
| 136 | ############################################################################### |
| 137 | # |
| 138 | # void fpu_restore(struct fpu_state_struct *) |
| 139 | # - restore the fpu state |
| 140 | # - note that an FPU Operational exception might occur during this process |
| 141 | # |
| 142 | ############################################################################### |
| 143 | .globl fpu_restore |
| 144 | .type fpu_restore,@function |
| 145 | fpu_restore: |
| 146 | mov epsw,d1 |
| 147 | or EPSW_FE,epsw /* enable the FPU so we can access it */ |
| 148 | |
| 149 | #ifdef CONFIG_MN10300_PROC_MN103E010 |
| 150 | nop |
| 151 | nop |
| 152 | #endif |
| 153 | mov d0,a0 |
| 154 | fmov (a0+),fs0 |
| 155 | fmov (a0+),fs1 |
| 156 | fmov (a0+),fs2 |
| 157 | fmov (a0+),fs3 |
| 158 | fmov (a0+),fs4 |
| 159 | fmov (a0+),fs5 |
| 160 | fmov (a0+),fs6 |
| 161 | fmov (a0+),fs7 |
| 162 | fmov (a0+),fs8 |
| 163 | fmov (a0+),fs9 |
| 164 | fmov (a0+),fs10 |
| 165 | fmov (a0+),fs11 |
| 166 | fmov (a0+),fs12 |
| 167 | fmov (a0+),fs13 |
| 168 | fmov (a0+),fs14 |
| 169 | fmov (a0+),fs15 |
| 170 | fmov (a0+),fs16 |
| 171 | fmov (a0+),fs17 |
| 172 | fmov (a0+),fs18 |
| 173 | fmov (a0+),fs19 |
| 174 | fmov (a0+),fs20 |
| 175 | fmov (a0+),fs21 |
| 176 | fmov (a0+),fs22 |
| 177 | fmov (a0+),fs23 |
| 178 | fmov (a0+),fs24 |
| 179 | fmov (a0+),fs25 |
| 180 | fmov (a0+),fs26 |
| 181 | fmov (a0+),fs27 |
| 182 | fmov (a0+),fs28 |
| 183 | fmov (a0+),fs29 |
| 184 | fmov (a0+),fs30 |
| 185 | fmov (a0+),fs31 |
| 186 | mov (a0),d0 |
| 187 | fmov d0,fpcr |
| 188 | #ifdef CONFIG_MN10300_PROC_MN103E010 |
| 189 | nop |
| 190 | nop |
| 191 | nop |
| 192 | #endif |
| 193 | |
| 194 | mov d1,epsw |
| 195 | ret [],0 |
| 196 | |
| 197 | .size fpu_restore,.-fpu_restore |