Commit 8b93676d authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

dump: Move assign_reg/assign_array closer to place where they are used

And don't forget to undef them once they are not needed.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 1256c390
...@@ -536,9 +536,6 @@ static int dump_task_creds(struct parasite_ctl *ctl, const struct cr_fdset *fds) ...@@ -536,9 +536,6 @@ static int dump_task_creds(struct parasite_ctl *ctl, const struct cr_fdset *fds)
return pb_write_one(fdset_fd(fds, CR_FD_CREDS), &ce, PB_CREDS); return pb_write_one(fdset_fd(fds, CR_FD_CREDS), &ce, PB_CREDS);
} }
#define assign_reg(dst, src, e) do { dst->e = (__typeof__(dst->e))src.e; } while (0)
#define assign_array(dst, src, e) memcpy(dst->e, &src.e, sizeof(src.e))
static int get_task_auxv(pid_t pid, MmEntry *mm, size_t *size) static int get_task_auxv(pid_t pid, MmEntry *mm, size_t *size)
{ {
int fd, ret, i; int fd, ret, i;
...@@ -690,6 +687,9 @@ static int get_task_regs(pid_t pid, CoreEntry *core, const struct parasite_ctl * ...@@ -690,6 +687,9 @@ static int get_task_regs(pid_t pid, CoreEntry *core, const struct parasite_ctl *
} }
} }
#define assign_reg(dst, src, e) do { dst->e = (__typeof__(dst->e))src.e; } while (0)
#define assign_array(dst, src, e) memcpy(dst->e, &src.e, sizeof(src.e))
assign_reg(core->thread_info->gpregs, regs, r15); assign_reg(core->thread_info->gpregs, regs, r15);
assign_reg(core->thread_info->gpregs, regs, r14); assign_reg(core->thread_info->gpregs, regs, r14);
assign_reg(core->thread_info->gpregs, regs, r13); assign_reg(core->thread_info->gpregs, regs, r13);
...@@ -734,6 +734,9 @@ static int get_task_regs(pid_t pid, CoreEntry *core, const struct parasite_ctl * ...@@ -734,6 +734,9 @@ static int get_task_regs(pid_t pid, CoreEntry *core, const struct parasite_ctl *
assign_array(core->thread_info->fpregs, fpregs, st_space); assign_array(core->thread_info->fpregs, fpregs, st_space);
assign_array(core->thread_info->fpregs, fpregs, xmm_space); assign_array(core->thread_info->fpregs, fpregs, xmm_space);
#undef assign_reg
#undef assign_array
ret = 0; ret = 0;
err: err:
......
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