Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * asmmacro.h: Assembler macros to make things easier to read. |
| 3 | * |
| 4 | * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com) |
| 5 | * Copyright (C) 1998, 1999, 2003 Ralf Baechle |
| 6 | */ |
| 7 | #ifndef _ASM_ASMMACRO_32_H |
| 8 | #define _ASM_ASMMACRO_32_H |
| 9 | |
Sam Ravnborg | 048eb58 | 2005-09-09 22:32:31 +0200 | [diff] [blame^] | 10 | #include <asm/asm-offsets.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #include <asm/regdef.h> |
| 12 | #include <asm/fpregdef.h> |
| 13 | #include <asm/mipsregs.h> |
| 14 | |
| 15 | .macro fpu_save_double thread status tmp1=t0 tmp2 |
| 16 | cfc1 \tmp1, fcr31 |
| 17 | sdc1 $f0, THREAD_FPR0(\thread) |
| 18 | sdc1 $f2, THREAD_FPR2(\thread) |
| 19 | sdc1 $f4, THREAD_FPR4(\thread) |
| 20 | sdc1 $f6, THREAD_FPR6(\thread) |
| 21 | sdc1 $f8, THREAD_FPR8(\thread) |
| 22 | sdc1 $f10, THREAD_FPR10(\thread) |
| 23 | sdc1 $f12, THREAD_FPR12(\thread) |
| 24 | sdc1 $f14, THREAD_FPR14(\thread) |
| 25 | sdc1 $f16, THREAD_FPR16(\thread) |
| 26 | sdc1 $f18, THREAD_FPR18(\thread) |
| 27 | sdc1 $f20, THREAD_FPR20(\thread) |
| 28 | sdc1 $f22, THREAD_FPR22(\thread) |
| 29 | sdc1 $f24, THREAD_FPR24(\thread) |
| 30 | sdc1 $f26, THREAD_FPR26(\thread) |
| 31 | sdc1 $f28, THREAD_FPR28(\thread) |
| 32 | sdc1 $f30, THREAD_FPR30(\thread) |
| 33 | sw \tmp1, THREAD_FCR31(\thread) |
| 34 | .endm |
| 35 | |
| 36 | .macro fpu_save_single thread tmp=t0 |
| 37 | cfc1 \tmp, fcr31 |
| 38 | swc1 $f0, THREAD_FPR0(\thread) |
| 39 | swc1 $f1, THREAD_FPR1(\thread) |
| 40 | swc1 $f2, THREAD_FPR2(\thread) |
| 41 | swc1 $f3, THREAD_FPR3(\thread) |
| 42 | swc1 $f4, THREAD_FPR4(\thread) |
| 43 | swc1 $f5, THREAD_FPR5(\thread) |
| 44 | swc1 $f6, THREAD_FPR6(\thread) |
| 45 | swc1 $f7, THREAD_FPR7(\thread) |
| 46 | swc1 $f8, THREAD_FPR8(\thread) |
| 47 | swc1 $f9, THREAD_FPR9(\thread) |
| 48 | swc1 $f10, THREAD_FPR10(\thread) |
| 49 | swc1 $f11, THREAD_FPR11(\thread) |
| 50 | swc1 $f12, THREAD_FPR12(\thread) |
| 51 | swc1 $f13, THREAD_FPR13(\thread) |
| 52 | swc1 $f14, THREAD_FPR14(\thread) |
| 53 | swc1 $f15, THREAD_FPR15(\thread) |
| 54 | swc1 $f16, THREAD_FPR16(\thread) |
| 55 | swc1 $f17, THREAD_FPR17(\thread) |
| 56 | swc1 $f18, THREAD_FPR18(\thread) |
| 57 | swc1 $f19, THREAD_FPR19(\thread) |
| 58 | swc1 $f20, THREAD_FPR20(\thread) |
| 59 | swc1 $f21, THREAD_FPR21(\thread) |
| 60 | swc1 $f22, THREAD_FPR22(\thread) |
| 61 | swc1 $f23, THREAD_FPR23(\thread) |
| 62 | swc1 $f24, THREAD_FPR24(\thread) |
| 63 | swc1 $f25, THREAD_FPR25(\thread) |
| 64 | swc1 $f26, THREAD_FPR26(\thread) |
| 65 | swc1 $f27, THREAD_FPR27(\thread) |
| 66 | swc1 $f28, THREAD_FPR28(\thread) |
| 67 | swc1 $f29, THREAD_FPR29(\thread) |
| 68 | swc1 $f30, THREAD_FPR30(\thread) |
| 69 | swc1 $f31, THREAD_FPR31(\thread) |
| 70 | sw \tmp, THREAD_FCR31(\thread) |
| 71 | .endm |
| 72 | |
| 73 | .macro fpu_restore_double thread tmp=t0 |
| 74 | lw \tmp, THREAD_FCR31(\thread) |
| 75 | ldc1 $f0, THREAD_FPR0(\thread) |
| 76 | ldc1 $f2, THREAD_FPR2(\thread) |
| 77 | ldc1 $f4, THREAD_FPR4(\thread) |
| 78 | ldc1 $f6, THREAD_FPR6(\thread) |
| 79 | ldc1 $f8, THREAD_FPR8(\thread) |
| 80 | ldc1 $f10, THREAD_FPR10(\thread) |
| 81 | ldc1 $f12, THREAD_FPR12(\thread) |
| 82 | ldc1 $f14, THREAD_FPR14(\thread) |
| 83 | ldc1 $f16, THREAD_FPR16(\thread) |
| 84 | ldc1 $f18, THREAD_FPR18(\thread) |
| 85 | ldc1 $f20, THREAD_FPR20(\thread) |
| 86 | ldc1 $f22, THREAD_FPR22(\thread) |
| 87 | ldc1 $f24, THREAD_FPR24(\thread) |
| 88 | ldc1 $f26, THREAD_FPR26(\thread) |
| 89 | ldc1 $f28, THREAD_FPR28(\thread) |
| 90 | ldc1 $f30, THREAD_FPR30(\thread) |
| 91 | ctc1 \tmp, fcr31 |
| 92 | .endm |
| 93 | |
| 94 | .macro fpu_restore_single thread tmp=t0 |
| 95 | lw \tmp, THREAD_FCR31(\thread) |
| 96 | lwc1 $f0, THREAD_FPR0(\thread) |
| 97 | lwc1 $f1, THREAD_FPR1(\thread) |
| 98 | lwc1 $f2, THREAD_FPR2(\thread) |
| 99 | lwc1 $f3, THREAD_FPR3(\thread) |
| 100 | lwc1 $f4, THREAD_FPR4(\thread) |
| 101 | lwc1 $f5, THREAD_FPR5(\thread) |
| 102 | lwc1 $f6, THREAD_FPR6(\thread) |
| 103 | lwc1 $f7, THREAD_FPR7(\thread) |
| 104 | lwc1 $f8, THREAD_FPR8(\thread) |
| 105 | lwc1 $f9, THREAD_FPR9(\thread) |
| 106 | lwc1 $f10, THREAD_FPR10(\thread) |
| 107 | lwc1 $f11, THREAD_FPR11(\thread) |
| 108 | lwc1 $f12, THREAD_FPR12(\thread) |
| 109 | lwc1 $f13, THREAD_FPR13(\thread) |
| 110 | lwc1 $f14, THREAD_FPR14(\thread) |
| 111 | lwc1 $f15, THREAD_FPR15(\thread) |
| 112 | lwc1 $f16, THREAD_FPR16(\thread) |
| 113 | lwc1 $f17, THREAD_FPR17(\thread) |
| 114 | lwc1 $f18, THREAD_FPR18(\thread) |
| 115 | lwc1 $f19, THREAD_FPR19(\thread) |
| 116 | lwc1 $f20, THREAD_FPR20(\thread) |
| 117 | lwc1 $f21, THREAD_FPR21(\thread) |
| 118 | lwc1 $f22, THREAD_FPR22(\thread) |
| 119 | lwc1 $f23, THREAD_FPR23(\thread) |
| 120 | lwc1 $f24, THREAD_FPR24(\thread) |
| 121 | lwc1 $f25, THREAD_FPR25(\thread) |
| 122 | lwc1 $f26, THREAD_FPR26(\thread) |
| 123 | lwc1 $f27, THREAD_FPR27(\thread) |
| 124 | lwc1 $f28, THREAD_FPR28(\thread) |
| 125 | lwc1 $f29, THREAD_FPR29(\thread) |
| 126 | lwc1 $f30, THREAD_FPR30(\thread) |
| 127 | lwc1 $f31, THREAD_FPR31(\thread) |
| 128 | ctc1 \tmp, fcr31 |
| 129 | .endm |
| 130 | |
| 131 | .macro cpu_save_nonscratch thread |
| 132 | LONG_S s0, THREAD_REG16(\thread) |
| 133 | LONG_S s1, THREAD_REG17(\thread) |
| 134 | LONG_S s2, THREAD_REG18(\thread) |
| 135 | LONG_S s3, THREAD_REG19(\thread) |
| 136 | LONG_S s4, THREAD_REG20(\thread) |
| 137 | LONG_S s5, THREAD_REG21(\thread) |
| 138 | LONG_S s6, THREAD_REG22(\thread) |
| 139 | LONG_S s7, THREAD_REG23(\thread) |
| 140 | LONG_S sp, THREAD_REG29(\thread) |
| 141 | LONG_S fp, THREAD_REG30(\thread) |
| 142 | .endm |
| 143 | |
| 144 | .macro cpu_restore_nonscratch thread |
| 145 | LONG_L s0, THREAD_REG16(\thread) |
| 146 | LONG_L s1, THREAD_REG17(\thread) |
| 147 | LONG_L s2, THREAD_REG18(\thread) |
| 148 | LONG_L s3, THREAD_REG19(\thread) |
| 149 | LONG_L s4, THREAD_REG20(\thread) |
| 150 | LONG_L s5, THREAD_REG21(\thread) |
| 151 | LONG_L s6, THREAD_REG22(\thread) |
| 152 | LONG_L s7, THREAD_REG23(\thread) |
| 153 | LONG_L sp, THREAD_REG29(\thread) |
| 154 | LONG_L fp, THREAD_REG30(\thread) |
| 155 | LONG_L ra, THREAD_REG31(\thread) |
| 156 | .endm |
| 157 | |
| 158 | #endif /* _ASM_ASMMACRO_32_H */ |