forked from checkpoint-restore/criu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sigframe.c
36 lines (27 loc) · 890 Bytes
/
sigframe.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <unistd.h>
#include <string.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));
if (restore_fpu(sigframe, core))
return -1;
if (RT_SIGFRAME_HAS_FPU(sigframe))
if (sigreturn_prep_fpu_frame(sigframe, &RT_SIGFRAME_FPU(rsigframe)))
return -1;
if (restore_gpregs(sigframe, CORE_THREAD_ARCH_INFO(core)->gpregs))
return -1;
setup_sas(sigframe, core->thread_core->sas);
return 0;
}