Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Move r2300 FP code from r2300_switch.S to r2300_fpu.S

Move _save_fp(), _restore_fp() & _init_fpu() out of r2300_switch.S &
into r2300_fpu.S. This logically places all FP-related asm code into
r2300_fpu.S & provides consistency with R4K after the preceding commit.

Besides cleaning up this will be useful for later patches which disable
FP support.

[ralf@linux-mips.org: Fixed build issues reported by Arnd Bergmann
<arnd@arndb.de>]

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16238/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Paul Burton and committed by
Ralf Baechle
423fb0d5 a2aea699

+79 -76
+79 -1
arch/mips/kernel/r2300_fpu.S
··· 12 12 * Copyright (c) 1998 Harald Koerfgen 13 13 */ 14 14 #include <asm/asm.h> 15 + #include <asm/asmmacro.h> 15 16 #include <asm/errno.h> 17 + #include <asm/export.h> 16 18 #include <asm/fpregdef.h> 17 19 #include <asm/mipsregs.h> 18 20 #include <asm/asm-offsets.h> ··· 33 31 PTR 9b+4,bad_stack; \ 34 32 .previous 35 33 36 - .set noreorder 37 34 .set mips1 35 + 36 + /* 37 + * Save a thread's fp context. 38 + */ 39 + LEAF(_save_fp) 40 + EXPORT_SYMBOL(_save_fp) 41 + fpu_save_single a0, t1 # clobbers t1 42 + jr ra 43 + END(_save_fp) 44 + 45 + /* 46 + * Restore a thread's fp context. 47 + */ 48 + LEAF(_restore_fp) 49 + fpu_restore_single a0, t1 # clobbers t1 50 + jr ra 51 + END(_restore_fp) 52 + 53 + /* 54 + * Load the FPU with signalling NANS. This bit pattern we're using has 55 + * the property that no matter whether considered as single or as double 56 + * precision represents signaling NANS. 57 + * 58 + * The value to initialize fcr31 to comes in $a0. 59 + */ 60 + 61 + .set push 62 + SET_HARDFLOAT 63 + 64 + LEAF(_init_fpu) 65 + mfc0 t0, CP0_STATUS 66 + li t1, ST0_CU1 67 + or t0, t1 68 + mtc0 t0, CP0_STATUS 69 + 70 + ctc1 a0, fcr31 71 + 72 + li t0, -1 73 + 74 + mtc1 t0, $f0 75 + mtc1 t0, $f1 76 + mtc1 t0, $f2 77 + mtc1 t0, $f3 78 + mtc1 t0, $f4 79 + mtc1 t0, $f5 80 + mtc1 t0, $f6 81 + mtc1 t0, $f7 82 + mtc1 t0, $f8 83 + mtc1 t0, $f9 84 + mtc1 t0, $f10 85 + mtc1 t0, $f11 86 + mtc1 t0, $f12 87 + mtc1 t0, $f13 88 + mtc1 t0, $f14 89 + mtc1 t0, $f15 90 + mtc1 t0, $f16 91 + mtc1 t0, $f17 92 + mtc1 t0, $f18 93 + mtc1 t0, $f19 94 + mtc1 t0, $f20 95 + mtc1 t0, $f21 96 + mtc1 t0, $f22 97 + mtc1 t0, $f23 98 + mtc1 t0, $f24 99 + mtc1 t0, $f25 100 + mtc1 t0, $f26 101 + mtc1 t0, $f27 102 + mtc1 t0, $f28 103 + mtc1 t0, $f29 104 + mtc1 t0, $f30 105 + mtc1 t0, $f31 106 + jr ra 107 + END(_init_fpu) 108 + 109 + .set pop 110 + 111 + .set noreorder 38 112 39 113 /** 40 114 * _save_fp_context() - save FP context from the FPU
-75
arch/mips/kernel/r2300_switch.S
··· 68 68 move v0, a0 69 69 jr ra 70 70 END(resume) 71 - 72 - /* 73 - * Save a thread's fp context. 74 - */ 75 - LEAF(_save_fp) 76 - EXPORT_SYMBOL(_save_fp) 77 - fpu_save_single a0, t1 # clobbers t1 78 - jr ra 79 - END(_save_fp) 80 - 81 - /* 82 - * Restore a thread's fp context. 83 - */ 84 - LEAF(_restore_fp) 85 - fpu_restore_single a0, t1 # clobbers t1 86 - jr ra 87 - END(_restore_fp) 88 - 89 - /* 90 - * Load the FPU with signalling NANS. This bit pattern we're using has 91 - * the property that no matter whether considered as single or as double 92 - * precision represents signaling NANS. 93 - * 94 - * The value to initialize fcr31 to comes in $a0. 95 - */ 96 - 97 - .set push 98 - SET_HARDFLOAT 99 - 100 - LEAF(_init_fpu) 101 - mfc0 t0, CP0_STATUS 102 - li t1, ST0_CU1 103 - or t0, t1 104 - mtc0 t0, CP0_STATUS 105 - 106 - ctc1 a0, fcr31 107 - 108 - li t0, -1 109 - 110 - mtc1 t0, $f0 111 - mtc1 t0, $f1 112 - mtc1 t0, $f2 113 - mtc1 t0, $f3 114 - mtc1 t0, $f4 115 - mtc1 t0, $f5 116 - mtc1 t0, $f6 117 - mtc1 t0, $f7 118 - mtc1 t0, $f8 119 - mtc1 t0, $f9 120 - mtc1 t0, $f10 121 - mtc1 t0, $f11 122 - mtc1 t0, $f12 123 - mtc1 t0, $f13 124 - mtc1 t0, $f14 125 - mtc1 t0, $f15 126 - mtc1 t0, $f16 127 - mtc1 t0, $f17 128 - mtc1 t0, $f18 129 - mtc1 t0, $f19 130 - mtc1 t0, $f20 131 - mtc1 t0, $f21 132 - mtc1 t0, $f22 133 - mtc1 t0, $f23 134 - mtc1 t0, $f24 135 - mtc1 t0, $f25 136 - mtc1 t0, $f26 137 - mtc1 t0, $f27 138 - mtc1 t0, $f28 139 - mtc1 t0, $f29 140 - mtc1 t0, $f30 141 - mtc1 t0, $f31 142 - jr ra 143 - END(_init_fpu) 144 - 145 - .set pop