[CRIU] [PATCH 10/23] cr-dump.c: introduced the macro TI_SP to access the stack pointer resgister in a machine-independent way

Pavel Emelyanov xemul at parallels.com
Mon Jan 14 05:34:49 EST 2013


On 01/14/2013 11:25 AM, Alexander Kartashov wrote:
> 

Can we better merge patches 9, 10 and 13 into a single CORE_THREAD_ARCH_INFO
access this?

diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h
index 7b74e01..f75b132 100644
--- a/arch/x86/include/asm/types.h
+++ b/arch/x86/include/asm/types.h
@@ -274,4 +274,6 @@ typedef struct {
 # define AT_VECTOR_SIZE 22             /* Not needed at moment */
 #endif
 
+#define CORE_THREAD_ARCH_INFO(core) core->thread_info
+
 #endif /* __CR_ASM_TYPES_H__ */
diff --git a/cr-dump.c b/cr-dump.c
index bbcdbad..f661651 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -818,7 +818,7 @@ static int dump_task_core_all(pid_t pid, const struct proc_pid_stat *stat,
 	if (ret)
 		goto err_free;
 
-	mark_stack_vma(core->thread_info->gpregs->sp, vma_area_list);
+	mark_stack_vma(CORE_THREAD_ARCH_INFO(core)->gpregs->sp, vma_area_list);
 
 	ret = get_task_futex_robust_list(pid, core->thread_core);
 	if (ret)
diff --git a/cr-restore.c b/cr-restore.c
index 1352558..3e34106 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -722,7 +722,7 @@ static int check_core(CoreEntry *core)
 			goto out;
 		}
 
-		if (!core->thread_info) {
+		if (!CORE_THREAD_ARCH_INFO(core)) {
 			pr_err("Core info data missed for non-zombie\n");
 			goto out;
 		}
@@ -1838,8 +1838,8 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
 		}
 
 		thread_args[i].ta		= task_args;
-		thread_args[i].gpregs		= *tcore->thread_info->gpregs;
-		thread_args[i].clear_tid_addr	= tcore->thread_info->clear_tid_addr;
+		thread_args[i].gpregs		= *CORE_THREAD_ARCH_INFO(tcore)->gpregs;
+		thread_args[i].clear_tid_addr	= CORE_THREAD_ARCH_INFO(tcore)->clear_tid_addr;
 		core_get_tls(tcore, &thread_args[i].tls);
 
 		if (tcore->thread_core) {
diff --git a/parasite-syscall.c b/parasite-syscall.c
index c9a39d7..f44f03a 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -361,7 +361,7 @@ int parasite_dump_thread_seized(struct parasite_ctl *ctl, struct pid *tid,
 	ret = parasite_execute_by_pid(PARASITE_CMD_DUMP_THREAD, ctl, tid->real);
 
 	memcpy(&core->thread_core->blk_sigset, &args->blocked, sizeof(args->blocked));
-	core->thread_info->clear_tid_addr = (u64)args->tid_addr;
+	CORE_THREAD_ARCH_INFO(core)->clear_tid_addr = (u64)args->tid_addr;
 	tid->virt = args->tid;
 	core_put_tls(core, args->tls);
 


More information about the CRIU mailing list