[CRIU] [PATCH 04/23] parasite-syscall.c: introduced the macros REG_RES and REG_IP

Alexander Kartashov alekskartashov at parallels.com
Mon Jan 14 02:25:46 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 a3f79d8..bbaf3c7 100644
--- a/arch/x86/include/asm/types.h
+++ b/arch/x86/include/asm/types.h
@@ -263,4 +263,7 @@ typedef struct {
 	};
 } fpu_state_t;
 
+#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 c051a53..d35bed8 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -213,7 +213,7 @@ static int parasite_execute_by_pid(unsigned int cmd, struct parasite_ctl *ctl, p
 
 	ret = __parasite_execute(ctl, pid, &regs);
 	if (ret == 0)
-		ret = (int)regs.ax;
+		ret = (int)REG_RES(regs);
 
 	if (ret)
 		pr_err("Parasite exited with %d\n", ret);
@@ -743,7 +743,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