Commit abc622b3 authored by Alexander Kartashov's avatar Alexander Kartashov Committed by Pavel Emelyanov

restorer: moved the routine restore_fpu() to the file arch/x86/crtools.c.

Signed-off-by: 's avatarAlexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ea6ab14d
...@@ -73,4 +73,6 @@ struct rt_sigframe { ...@@ -73,4 +73,6 @@ struct rt_sigframe {
int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r); int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r);
int restore_fpu(struct rt_sigframe *sigframe, struct thread_restore_args *args);
#endif #endif
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include "syscall.h" #include "syscall.h"
#include "log.h" #include "log.h"
#include "fpu.h"
#include "cpu.h"
int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r) int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r)
{ {
...@@ -52,3 +54,19 @@ int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r) ...@@ -52,3 +54,19 @@ int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r)
return 0; 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;
}
...@@ -143,22 +143,6 @@ static void restore_sched_info(struct rst_sched_param *p) ...@@ -143,22 +143,6 @@ static void restore_sched_info(struct rst_sched_param *p)
sys_sched_setscheduler(0, p->policy, &parm); 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, static int restore_thread_common(struct rt_sigframe *sigframe,
struct thread_restore_args *args) struct thread_restore_args *args)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment