criu/sigframe.c
Alexander Kartashov 1982fddb53 cr: generalized the prototype of the routine restore_fpu()
A struct sigframe* instead of fpu_state_t should be passed
to the routine restore_fpu() since FPU registers are stored
in different fields of the sigframe in different architectures.
An architecture-specific implementation of the routine restore_fpu()
should know details of this layout instead of construct_sigframe().

This change makes it possible to move ARM FPU restoration
from sigreturn_prep_fpu_frame() (where it caused a segfault
since the pointer fpu_stat has become invalid in the dumper
address space) to restore_fpu()

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Acked-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-06-01 22:45:49 +04:00

35 lines
874 B
C

#include <unistd.h>
#include "restorer.h"
#include "asm/restore.h"
#include "asm/restorer.h"
#include "protobuf/core.pb-c.h"
int construct_sigframe(struct rt_sigframe *sigframe,
struct rt_sigframe *rsigframe,
CoreEntry *core)
{
k_rtsigset_t *blk_sigset = &RT_SIGFRAME_UC(sigframe).uc_sigmask;
if (core->tc)
memcpy(blk_sigset, &core->tc->blk_sigset, sizeof(k_rtsigset_t));
else if (core->thread_core->has_blk_sigset) {
memcpy(blk_sigset,
&core->thread_core->blk_sigset, sizeof(k_rtsigset_t));
} else
memset(blk_sigset, 0, sizeof(k_rtsigset_t));
sigframe->fpu_state.has_fpu = true;
if (restore_fpu(sigframe, core))
return -1;
if (sigframe->fpu_state.has_fpu)
if (sigreturn_prep_fpu_frame(sigframe, &rsigframe->fpu_state))
return -1;
if (restore_gpregs(sigframe, CORE_THREAD_ARCH_INFO(core)->gpregs))
return -1;
return 0;
}