--- zzzz-none-000/linux-3.10.107/arch/mips/kernel/signal.c 2017-06-27 09:49:32.000000000 +0000 +++ vr9-7490-729/linux-3.10.107/arch/mips/kernel/signal.c 2021-11-10 11:53:54.000000000 +0000 @@ -68,10 +68,12 @@ static int protected_save_fp_context(struct sigcontext __user *sc) { int err; +#ifndef CONFIG_EVA while (1) { lock_fpu_owner(); - own_fpu_inatomic(1); - err = save_fp_context(sc); /* this might fail */ + err = own_fpu_inatomic(1); + if (!err) + err = save_fp_context(sc); /* this might fail */ unlock_fpu_owner(); if (likely(!err)) break; @@ -82,16 +84,22 @@ if (err) break; /* really bad sigcontext */ } +#else + lose_fpu(1); + err = save_fp_context(sc); /* this might fail */ +#endif /* CONFIG_EVA */ return err; } static int protected_restore_fp_context(struct sigcontext __user *sc) { int err, tmp __maybe_unused; +#ifndef CONFIG_EVA while (1) { lock_fpu_owner(); - own_fpu_inatomic(0); - err = restore_fp_context(sc); /* this might fail */ + err = own_fpu_inatomic(0); + if (!err) + err = restore_fp_context(sc); /* this might fail */ unlock_fpu_owner(); if (likely(!err)) break; @@ -102,6 +110,10 @@ if (err) break; /* really bad sigcontext */ } +#else + lose_fpu(0); + err = restore_fp_context(sc); /* this might fail */ +#endif /* CONFIG_EVA */ return err; } @@ -584,6 +596,7 @@ } #ifdef CONFIG_SMP +#ifndef CONFIG_EVA static int smp_save_fp_context(struct sigcontext __user *sc) { return raw_cpu_has_fpu @@ -598,9 +611,11 @@ : fpu_emulator_restore_context(sc); } #endif +#endif static int signal_setup(void) { +#ifndef CONFIG_EVA #ifdef CONFIG_SMP /* For now just do the cpu_has_fpu check when the functions are invoked */ save_fp_context = smp_save_fp_context; @@ -613,7 +628,11 @@ save_fp_context = fpu_emulator_save_context; restore_fp_context = fpu_emulator_restore_context; } -#endif +#endif /* CONFIG_SMP */ +#else + save_fp_context = fpu_emulator_save_context; + restore_fp_context = fpu_emulator_restore_context; +#endif /* CONFIG_EVA */ return 0; }