[CRIU] [PATCH 09/44] parasite-syscall.c: introduced the macros REG_RES and REG_IP.
Alexander Kartashov
alekskartashov at parallels.com
Mon Jan 7 10:04:38 EST 2013
The macro REG_RES is to be used to access the syscall return value register
in the struct user_regs_struct_t.
The macro REG_IP is to be used to access the program counter register
in the struct user_regs_struct_t.
Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
---
arch/x86/include/asm/types.h | 3 +++
parasite-syscall.c | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h
index bf33946..a8a6316 100644
--- a/arch/x86/include/asm/types.h
+++ b/arch/x86/include/asm/types.h
@@ -245,4 +245,7 @@ typedef struct {
# define MADV_DONTDUMP 16
#endif
+#define REG_RES(regs) ((regs).ax)
+#define REG_IP(regs) ((regs).ip)
+
#endif /* __CR_ASM_TYPES_H__ */
diff --git a/parasite-syscall.c b/parasite-syscall.c
index d5e8c98..3264bf8 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -210,7 +210,7 @@ static int parasite_execute_by_pid(unsigned int cmd, struct parasite_ctl *ctl, p
ret = __parasite_execute(ctl, pid, ®s);
if (ret == 0)
- ret = (int)regs.ax;
+ ret = (int)REG_RES(regs);
if (ret)
pr_err("Parasite exited with %d\n", ret);
@@ -737,7 +737,7 @@ struct parasite_ctl *parasite_prep_ctl(pid_t pid, struct list_head *vma_area_lis
goto err;
}
- vma_area = get_vma_by_ip(vma_area_list, ctl->regs_orig.ip);
+ vma_area = get_vma_by_ip(vma_area_list, REG_IP(ctl->regs_orig));
if (!vma_area) {
pr_err("No suitable VMA found to run parasite "
"bootstrap code (pid: %d)\n", pid);
--
1.7.10.4
More information about the CRIU
mailing list