aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/processor.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/include/asm/processor.h')
-rw-r--r--arch/mips/include/asm/processor.h45
1 files changed, 38 insertions, 7 deletions
diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h
index 3605b844ad87..ad70cba8daff 100644
--- a/arch/mips/include/asm/processor.h
+++ b/arch/mips/include/asm/processor.h
@@ -97,18 +97,48 @@ extern unsigned int vced_count, vcei_count;
97 97
98#define NUM_FPU_REGS 32 98#define NUM_FPU_REGS 32
99 99
100typedef __u64 fpureg_t; 100#ifdef CONFIG_CPU_HAS_MSA
101# define FPU_REG_WIDTH 128
102#else
103# define FPU_REG_WIDTH 64
104#endif
105
106union fpureg {
107 __u32 val32[FPU_REG_WIDTH / 32];
108 __u64 val64[FPU_REG_WIDTH / 64];
109};
110
111#ifdef CONFIG_CPU_LITTLE_ENDIAN
112# define FPR_IDX(width, idx) (idx)
113#else
114# define FPR_IDX(width, idx) ((FPU_REG_WIDTH / (width)) - 1 - (idx))
115#endif
116
117#define BUILD_FPR_ACCESS(width) \
118static inline u##width get_fpr##width(union fpureg *fpr, unsigned idx) \
119{ \
120 return fpr->val##width[FPR_IDX(width, idx)]; \
121} \
122 \
123static inline void set_fpr##width(union fpureg *fpr, unsigned idx, \
124 u##width val) \
125{ \
126 fpr->val##width[FPR_IDX(width, idx)] = val; \
127}
128
129BUILD_FPR_ACCESS(32)
130BUILD_FPR_ACCESS(64)
101 131
102/* 132/*
103 * It would be nice to add some more fields for emulator statistics, but there 133 * It would be nice to add some more fields for emulator statistics,
104 * are a number of fixed offsets in offset.h and elsewhere that would have to 134 * the additional information is private to the FPU emulator for now.
105 * be recalculated by hand. So the additional information will be private to 135 * See arch/mips/include/asm/fpu_emulator.h.
106 * the FPU emulator for now. See asm-mips/fpu_emulator.h.
107 */ 136 */
108 137
109struct mips_fpu_struct { 138struct mips_fpu_struct {
110 fpureg_t fpr[NUM_FPU_REGS]; 139 union fpureg fpr[NUM_FPU_REGS];
111 unsigned int fcr31; 140 unsigned int fcr31;
141 unsigned int msacsr;
112}; 142};
113 143
114#define NUM_DSP_REGS 6 144#define NUM_DSP_REGS 6
@@ -284,8 +314,9 @@ struct thread_struct {
284 * Saved FPU/FPU emulator stuff \ 314 * Saved FPU/FPU emulator stuff \
285 */ \ 315 */ \
286 .fpu = { \ 316 .fpu = { \
287 .fpr = {0,}, \ 317 .fpr = {{{0,},},}, \
288 .fcr31 = 0, \ 318 .fcr31 = 0, \
319 .msacsr = 0, \
289 }, \ 320 }, \
290 /* \ 321 /* \
291 * FPU affinity state (null if not FPAFF) \ 322 * FPU affinity state (null if not FPAFF) \