Skip to content

Commit 423fb0d

Browse files
paulburtonralfbaechle
authored andcommitted
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>
1 parent a2aea69 commit 423fb0d

File tree

2 files changed

+79
-76
lines changed

2 files changed

+79
-76
lines changed

arch/mips/kernel/r2300_fpu.S

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
* Copyright (c) 1998 Harald Koerfgen
1313
*/
1414
#include <asm/asm.h>
15+
#include <asm/asmmacro.h>
1516
#include <asm/errno.h>
17+
#include <asm/export.h>
1618
#include <asm/fpregdef.h>
1719
#include <asm/mipsregs.h>
1820
#include <asm/asm-offsets.h>
@@ -31,9 +33,85 @@
3133
PTR 9b+4,bad_stack; \
3234
.previous
3335

34-
.set noreorder
3536
.set mips1
3637

38+
/*
39+
* Save a thread's fp context.
40+
*/
41+
LEAF(_save_fp)
42+
EXPORT_SYMBOL(_save_fp)
43+
fpu_save_single a0, t1 # clobbers t1
44+
jr ra
45+
END(_save_fp)
46+
47+
/*
48+
* Restore a thread's fp context.
49+
*/
50+
LEAF(_restore_fp)
51+
fpu_restore_single a0, t1 # clobbers t1
52+
jr ra
53+
END(_restore_fp)
54+
55+
/*
56+
* Load the FPU with signalling NANS. This bit pattern we're using has
57+
* the property that no matter whether considered as single or as double
58+
* precision represents signaling NANS.
59+
*
60+
* The value to initialize fcr31 to comes in $a0.
61+
*/
62+
63+
.set push
64+
SET_HARDFLOAT
65+
66+
LEAF(_init_fpu)
67+
mfc0 t0, CP0_STATUS
68+
li t1, ST0_CU1
69+
or t0, t1
70+
mtc0 t0, CP0_STATUS
71+
72+
ctc1 a0, fcr31
73+
74+
li t0, -1
75+
76+
mtc1 t0, $f0
77+
mtc1 t0, $f1
78+
mtc1 t0, $f2
79+
mtc1 t0, $f3
80+
mtc1 t0, $f4
81+
mtc1 t0, $f5
82+
mtc1 t0, $f6
83+
mtc1 t0, $f7
84+
mtc1 t0, $f8
85+
mtc1 t0, $f9
86+
mtc1 t0, $f10
87+
mtc1 t0, $f11
88+
mtc1 t0, $f12
89+
mtc1 t0, $f13
90+
mtc1 t0, $f14
91+
mtc1 t0, $f15
92+
mtc1 t0, $f16
93+
mtc1 t0, $f17
94+
mtc1 t0, $f18
95+
mtc1 t0, $f19
96+
mtc1 t0, $f20
97+
mtc1 t0, $f21
98+
mtc1 t0, $f22
99+
mtc1 t0, $f23
100+
mtc1 t0, $f24
101+
mtc1 t0, $f25
102+
mtc1 t0, $f26
103+
mtc1 t0, $f27
104+
mtc1 t0, $f28
105+
mtc1 t0, $f29
106+
mtc1 t0, $f30
107+
mtc1 t0, $f31
108+
jr ra
109+
END(_init_fpu)
110+
111+
.set pop
112+
113+
.set noreorder
114+
37115
/**
38116
* _save_fp_context() - save FP context from the FPU
39117
* @a0 - pointer to fpregs field of sigcontext

arch/mips/kernel/r2300_switch.S

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -68,78 +68,3 @@ LEAF(resume)
6868
move v0, a0
6969
jr ra
7070
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

0 commit comments

Comments
 (0)