diff --git a/arch/x86/include/asm/restorer.h b/arch/x86/include/asm/restorer.h index 6f9bdae2e..2e16dd273 100644 --- a/arch/x86/include/asm/restorer.h +++ b/arch/x86/include/asm/restorer.h @@ -73,4 +73,6 @@ struct rt_sigframe { int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r); +int restore_fpu(struct rt_sigframe *sigframe, struct thread_restore_args *args); + #endif diff --git a/arch/x86/restorer.c b/arch/x86/restorer.c index 599ab8ce9..df42c27c4 100644 --- a/arch/x86/restorer.c +++ b/arch/x86/restorer.c @@ -5,6 +5,8 @@ #include "syscall.h" #include "log.h" +#include "fpu.h" +#include "cpu.h" int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r) { @@ -52,3 +54,19 @@ int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r) return 0; } + +int restore_fpu(struct rt_sigframe *sigframe, struct thread_restore_args *args) +{ + if (args->has_fpu) { + unsigned long addr = (unsigned long)(void *)&args->xsave; + + if ((addr % 64ul) == 0ul) { + sigframe->uc.uc_mcontext.fpstate = &args->xsave; + } else { + pr_err("Unaligned address passed: %lx\n", addr); + return -1; + } + } + + return 0; +} diff --git a/pie/restorer.c b/pie/restorer.c index f3e345c35..6a157d436 100644 --- a/pie/restorer.c +++ b/pie/restorer.c @@ -143,22 +143,6 @@ static void restore_sched_info(struct rst_sched_param *p) sys_sched_setscheduler(0, p->policy, &parm); } -static int restore_fpu(struct rt_sigframe *sigframe, struct thread_restore_args *args) -{ - if (args->has_fpu) { - unsigned long addr = (unsigned long)(void *)&args->xsave; - - if ((addr % 64ul) == 0ul) { - sigframe->uc.uc_mcontext.fpstate = &args->xsave; - } else { - pr_err("Unaligned address passed: %lx\n", addr); - return -1; - } - } - - return 0; -} - static int restore_thread_common(struct rt_sigframe *sigframe, struct thread_restore_args *args) {